# Copyright 2015 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# A tool that removes all non-interface-specific parts from a .jar file.

if (is_linux || is_chromeos || target_os == "android") {
  config("ijar_compiler_flags") {
    if (is_clang) {
      cflags = [
        "-Wno-shadow",
        "-Wno-unused-but-set-variable",
      ]
    }
  }

  executable("ijar") {
    sources = [
      "classfile.cc",
      "common.h",
      "ijar.cc",
      "mapped_file.h",
      "mapped_file_unix.cc",
      "platform_utils.cc",
      "platform_utils.h",
      "zip.cc",
      "zip.h",
      "zlib_client.cc",
      "zlib_client.h",
    ]

    deps = [ "//third_party/zlib" ]

    configs += [ ":ijar_compiler_flags" ]

    # Always build release since this is a build tool.
    if (is_debug) {
      configs -= [ "//build/config:debug" ]
      configs += [ "//build/config:release" ]
    }

    # TODO(crbug.com/40031409): Fix code that adds exit-time destructors and
    # enable the diagnostic by removing this line.
    configs += [ "//build/config/compiler:no_exit_time_destructors" ]
  }
}
