# Copyright (c) 2020 Project CHIP Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")

import("//build/config/android/config.gni")

javac_runner = "${chip_root}/build/chip/java/javac_runner.py"
jar_runner = "${chip_root}/build/chip/java/jar_runner.py"

assert(android_sdk_root != "", "android_sdk_root must be specified")

# Declare a java library target
#
#   sources: List of .java files included in this library.
#
#   output_name: File name for the output .jar (not including extension).
#     Defaults to the input .jar file name.
#
#   javac_flags: additional flags to pass to the javac compiler
#
template("java_library") {
  # Figure out the output name
  _jar_name = target_name
  if (defined(invoker.output_name)) {
    _jar_name = invoker.output_name
  } else {
    _jar_name += ".jar"
  }

  # Additional flags
  _javac_flags = [
    "-Werror",
    "-Xlint:all",
  ]
  if (defined(invoker.javac_flags)) {
    _javac_flags += invoker.javac_flags
  }

  _deps = []
  if (defined(invoker.deps)) {
    _deps = invoker.deps
  }

  _data_deps = []
  if (defined(invoker.data_deps)) {
    _data_deps = invoker.data_deps
  }

  # What files will be compiled
  _java_files = invoker.sources

  # Generates a .java file containing all sources to be compiled
  _java_sources_file = "$target_gen_dir/$target_name.sources"
  if (defined(invoker.java_sources_file)) {
    _java_sources_file = invoker.java_sources_file
  }
  write_file(_java_sources_file, rebase_path(_java_files, root_build_dir))

  # Compiles the given files into a directory and generates a 'class list'
  _javac_target_name = target_name + "__javac"
  _class_dir = rebase_path(target_out_dir, root_build_dir) + "/classes"
  _class_list_file = "$target_gen_dir/$target_name.classlist"
  action(_javac_target_name) {
    sources = _java_files

    outputs = [ _class_list_file ]

    script = javac_runner

    args = [
             "--classdir",
             _class_dir,
             "--outfile",
             rebase_path(_class_list_file, root_build_dir),
             "--",
             "-d",
             _class_dir,
             "@" + rebase_path(_java_sources_file, root_build_dir),
           ] + _javac_flags
  }

  # Bundles all files within the 'class directory' into a jar file
  _jar_output = "$root_out_dir/lib/$_jar_name"
  action(target_name) {
    deps = [ ":$_javac_target_name" ] + _deps

    data_deps = _data_deps

    outputs = [ _jar_output ]

    script = jar_runner

    args = [
      "cf",
      rebase_path(_jar_output, root_build_dir),
      "-C",
      _class_dir,
      ".",
    ]
  }
}

template("android_library") {
  java_library(target_name) {
    forward_variables_from(invoker, "*")

    if (!defined(javac_flags)) {
      javac_flags = []
    }

    javac_flags += [
      "-classpath",
      "${android_sdk_root}/platforms/android-${android_sdk_version}/android.jar",
      "-Xlint:-options",
      "-source",
      "8",
      "-target",
      "8",
    ]
  }
}
