# Copyright (c) 2020-2023 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/build.gni")
import("//build_overrides/chip.gni")
import("${chip_root}/build/chip/java/config.gni")
import("${chip_root}/build/chip/java/rules.gni")
import("${chip_root}/build/chip/tests.gni")

if (!matter_enable_java_compilation) {
  import("${build_root}/config/android_abi.gni")
}

shared_library("jni") {
  output_name = "libCHIPController"

  if (current_os == "mac") {
    output_extension = "dylib"
  }

  # Temporary while we have circular dependencies between codegen.py and zap
  # generated files
  check_includes = false

  sources = [
    "AndroidCallbacks-JNI.cpp",
    "AndroidCallbacks.cpp",
    "AndroidCallbacks.h",
    "AndroidClusterExceptions.cpp",
    "AndroidClusterExceptions.h",
    "AndroidCommissioningWindowOpener.cpp",
    "AndroidCommissioningWindowOpener.h",
    "AndroidControllerExceptions.cpp",
    "AndroidControllerExceptions.h",
    "AndroidCurrentFabricRemover.cpp",
    "AndroidCurrentFabricRemover.h",
    "AndroidDeviceControllerWrapper.cpp",
    "AndroidDeviceControllerWrapper.h",
    "AndroidOperationalCredentialsIssuer.cpp",
    "AndroidOperationalCredentialsIssuer.h",
    "AttestationTrustStoreBridge.cpp",
    "AttestationTrustStoreBridge.h",
    "BaseCHIPCluster-JNI.cpp",
    "CHIPAttributeTLVValueDecoder.h",
    "CHIPDefaultCallbacks.cpp",
    "CHIPDefaultCallbacks.h",
    "CHIPDeviceController-JNI.cpp",
    "CHIPTLVValueDecoder-JNI.cpp",
    "DeviceAttestationDelegateBridge.cpp",
    "DeviceAttestationDelegateBridge.h",
    "zap-generated/CHIPAttributeTLVValueDecoder.cpp",
    "zap-generated/CHIPClustersWrite-JNI.cpp",
    "zap-generated/CHIPEventTLVValueDecoder.cpp",
    "zap-generated/CHIPInvokeCallbacks.cpp",
    "zap-generated/CHIPInvokeCallbacks.h",
    "zap-generated/CHIPReadCallbacks.cpp",
  ]

  deps = [
    "${chip_root}/src/controller/data_model",
    "${chip_root}/src/controller/data_model:java-jni-sources",
    "${chip_root}/src/credentials:default_attestation_verifier",
    "${chip_root}/src/inet",
    "${chip_root}/src/lib",
    "${chip_root}/src/lib/support/jsontlv",
    "${chip_root}/src/platform",
  ]

  if (matter_enable_java_compilation) {
    defines = [ "JAVA_MATTER_CONTROLLER_TEST" ]

    sources += [
      "${chip_root}/src/controller/ExamplePersistentStorage.cpp",
      "${chip_root}/src/controller/ExamplePersistentStorage.h",
    ]

    include_dirs = java_matter_controller_dependent_paths
    deps += [ "${chip_root}/third_party/inipp" ]

    if (current_os == "mac") {
      deps += [ "${chip_root}/src/platform/Darwin" ]
    } else {
      deps += [ "${chip_root}/src/platform/Linux" ]
    }

    cflags = [ "-Wno-unknown-pragmas" ]

    output_dir = "${root_out_dir}/lib/jni"
  } else {
    deps += [ "${chip_root}/src/platform/android" ]

    output_dir = "${root_out_dir}/lib/jni/${android_abi}"
  }

  if (current_os == "mac") {
    ldflags = [ "-Wl,-dead_strip" ]
  } else {
    ldflags = [ "-Wl,--gc-sections" ]
  }

  public_configs = [ "${chip_root}/src:includes" ]
}

if (chip_link_tests) {
  shared_library("jni_for_test") {
    sources = [ "AndroidCallbacks-ForTestJNI.cpp" ]
    output_name = "libCHIPForTestController"

    public_configs = [ "${chip_root}/src:includes" ]

    deps = [
      ":jni",
      "${chip_root}/src/messaging/tests:helpers",
    ]

    if (matter_enable_java_compilation) {
      defines = [ "JAVA_MATTER_CONTROLLER_TEST" ]
      include_dirs = java_matter_controller_dependent_paths
      if (current_os == "mac") {
        deps += [ "${chip_root}/src/platform/Darwin" ]
      } else {
        deps += [ "${chip_root}/src/platform/Linux" ]
      }

      cflags = [ "-Wno-unknown-pragmas" ]

      output_dir = "${root_out_dir}/lib/jni"
    } else {
      deps += [ "${chip_root}/src/platform/android" ]

      output_dir = "${root_out_dir}/lib/jni/${android_abi}"
    }

    ldflags = [ "-Wl,--gc-sections" ]
  }
}

kotlin_library("tlv") {
  output_name = "libCHIPTlv.jar"

  sources = [
    "src/chip/tlv/Element.kt",
    "src/chip/tlv/TlvReader.kt",
    "src/chip/tlv/TlvWriter.kt",
    "src/chip/tlv/tags.kt",
    "src/chip/tlv/types.kt",
    "src/chip/tlv/utils.kt",
    "src/chip/tlv/values.kt",
  ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("tlv_reader_test") {
  output_name = "TlvReaderTest.jar"

  deps = [
    ":tlv",
    "${chip_root}/third_party/java_deps:junit-4",
    "${chip_root}/third_party/java_deps:truth",
  ]

  sources = [ "tests/chip/tlv/TlvReaderTest.kt" ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("tlv_writer_test") {
  output_name = "TlvWriterTest.jar"

  deps = [
    ":tlv",
    "${chip_root}/third_party/java_deps:junit-4",
    "${chip_root}/third_party/java_deps:truth",
  ]

  sources = [ "tests/chip/tlv/TlvWriterTest.kt" ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("tlv_read_write_test") {
  output_name = "TlvReadWriteTest.jar"

  deps = [
    ":tlv",
    "${chip_root}/third_party/java_deps:junit-4",
    "${chip_root}/third_party/java_deps:kotlin-test",
    "${chip_root}/third_party/java_deps:truth",
  ]

  sources = [ "tests/chip/tlv/TlvReadWriteTest.kt" ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("jsontlv") {
  output_name = "libCHIPJson.jar"

  deps = [
    ":tlv",
    "${chip_root}/third_party/java_deps:gson",
    "${chip_root}/third_party/java_deps:protobuf-java",
  ]

  sources = [
    "src/chip/jsontlv/JsonToTlv.kt",
    "src/chip/jsontlv/TlvToJson.kt",
    "src/chip/jsontlv/types.kt",
  ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("json_to_tlv_to_json_test") {
  output_name = "JsonToTlvToJsonTest.jar"

  deps = [
    ":jsontlv",
    "${chip_root}/third_party/java_deps:gson",
    "${chip_root}/third_party/java_deps:junit-4",
    "${chip_root}/third_party/java_deps:kotlin-test",
    "${chip_root}/third_party/java_deps:truth",
  ]

  sources = [ "tests/chip/jsontlv/JsonToTlvToJsonTest.kt" ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("onboarding_payload") {
  output_name = "OnboardingPayload.jar"

  deps = [ ":tlv" ]

  sources = [
    "src/chip/onboardingpayload/Base38.kt",
    "src/chip/onboardingpayload/CommissioningFlow.kt",
    "src/chip/onboardingpayload/DiscoveryCapability.kt",
    "src/chip/onboardingpayload/ManualOnboardingPayloadGenerator.kt",
    "src/chip/onboardingpayload/ManualOnboardingPayloadParser.kt",
    "src/chip/onboardingpayload/OnboardingPayload.kt",
    "src/chip/onboardingpayload/OnboardingPayloadParser.kt",
    "src/chip/onboardingpayload/OptionalQRCodeInfo.kt",
    "src/chip/onboardingpayload/QRCodeBasicOnboardingPayloadGenerator.kt",
    "src/chip/onboardingpayload/QRCodeOnboardingPayloadGenerator.kt",
    "src/chip/onboardingpayload/QRCodeOnboardingPayloadParser.kt",
    "src/chip/onboardingpayload/VendorId.kt",
    "src/chip/onboardingpayload/Verhoeff.kt",
    "src/chip/onboardingpayload/Verhoeff10.kt",
  ]
}

kotlin_library("onboardingpayload_manual_code_test") {
  output_name = "OnboardingPayloadManualCodeTest.jar"

  deps = [
    ":onboarding_payload",
    "${chip_root}/third_party/java_deps:junit-4",
    "${chip_root}/third_party/java_deps:truth",
  ]

  sources = [ "tests/chip/onboardingpayload/ManualCodeTest.kt" ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

kotlin_library("onboardingpayload_qr_code_test") {
  output_name = "OnboardingPayloadQRCodeTest.jar"

  deps = [
    ":onboarding_payload",
    "${chip_root}/third_party/java_deps:junit-4",
    "${chip_root}/third_party/java_deps:truth",
  ]

  sources = [ "tests/chip/onboardingpayload/QRCodeTest.kt" ]

  kotlinc_flags = [ "-Xlint:deprecation" ]
}

group("unit_tests") {
  deps = [
    ":json_to_tlv_to_json_test",
    ":onboardingpayload_manual_code_test",
    ":onboardingpayload_qr_code_test",
    ":tlv_read_write_test",
    ":tlv_reader_test",
    ":tlv_writer_test",
  ]
}

android_library("java") {
  output_name = "CHIPController.jar"

  deps = [
    ":tlv",
    "${chip_root}/third_party/java_deps:annotation",
  ]

  data_deps = [ ":jni" ]

  sources = [
    "generated/java/chip/devicecontroller/ClusterIDMapping.java",
    "generated/java/chip/devicecontroller/ClusterReadMapping.java",
    "generated/java/chip/devicecontroller/ClusterWriteMapping.java",
    "src/chip/clusterinfo/ClusterCommandCallback.java",
    "src/chip/clusterinfo/ClusterInfo.java",
    "src/chip/clusterinfo/CommandParameterInfo.java",
    "src/chip/clusterinfo/CommandResponseInfo.java",
    "src/chip/clusterinfo/DelegatedClusterCallback.java",
    "src/chip/clusterinfo/InteractionInfo.java",
    "src/chip/devicecontroller/AttestationInfo.java",
    "src/chip/devicecontroller/AttestationTrustStoreDelegate.java",
    "src/chip/devicecontroller/CSRInfo.java",
    "src/chip/devicecontroller/ChipClusterException.java",
    "src/chip/devicecontroller/ChipCommandType.java",
    "src/chip/devicecontroller/ChipDeviceController.java",
    "src/chip/devicecontroller/ChipDeviceControllerException.java",
    "src/chip/devicecontroller/ChipIdLookup.java",
    "src/chip/devicecontroller/ChipTLVValueDecoder.java",
    "src/chip/devicecontroller/ControllerParams.java",
    "src/chip/devicecontroller/DeviceAttestationDelegate.java",
    "src/chip/devicecontroller/DiscoveredDevice.java",
    "src/chip/devicecontroller/GetConnectedDeviceCallbackJni.java",
    "src/chip/devicecontroller/InvokeCallback.java",
    "src/chip/devicecontroller/InvokeCallbackJni.java",
    "src/chip/devicecontroller/KeypairDelegate.java",
    "src/chip/devicecontroller/NetworkCredentials.java",
    "src/chip/devicecontroller/NetworkLocation.java",
    "src/chip/devicecontroller/OpenCommissioningCallback.java",
    "src/chip/devicecontroller/OperationalKeyConfig.java",
    "src/chip/devicecontroller/PaseVerifierParams.java",
    "src/chip/devicecontroller/ReportCallback.java",
    "src/chip/devicecontroller/ReportCallbackJni.java",
    "src/chip/devicecontroller/ReportEventCallback.java",
    "src/chip/devicecontroller/ReportEventCallbackJni.java",
    "src/chip/devicecontroller/ResubscriptionAttemptCallback.java",
    "src/chip/devicecontroller/SubscriptionEstablishedCallback.java",
    "src/chip/devicecontroller/UnpairDeviceCallback.java",
    "src/chip/devicecontroller/WriteAttributesCallback.java",
    "src/chip/devicecontroller/WriteAttributesCallbackJni.java",
    "src/chip/devicecontroller/model/AttributeState.java",
    "src/chip/devicecontroller/model/AttributeWriteRequest.java",
    "src/chip/devicecontroller/model/ChipAttributePath.java",
    "src/chip/devicecontroller/model/ChipEventPath.java",
    "src/chip/devicecontroller/model/ChipPathId.java",
    "src/chip/devicecontroller/model/ClusterState.java",
    "src/chip/devicecontroller/model/EndpointState.java",
    "src/chip/devicecontroller/model/EventState.java",
    "src/chip/devicecontroller/model/InvokeElement.java",
    "src/chip/devicecontroller/model/NodeState.java",
    "zap-generated/chip/devicecontroller/ChipClusters.java",
    "zap-generated/chip/devicecontroller/ChipEventStructs.java",
    "zap-generated/chip/devicecontroller/ChipStructs.java",
    "zap-generated/chip/devicecontroller/ClusterInfoMapping.java",
  ]

  if (matter_enable_java_compilation) {
    deps += [
      "${chip_root}/third_party/java_deps:json",
      "${chip_root}/third_party/java_deps/stub_src",
    ]
  } else {
    deps += [ ":android" ]

    data_deps += [ "${chip_root}/build/chip/java:shared_cpplib" ]
  }

  javac_flags = [
    "-Xlint:deprecation",
    "-parameters",  # Store infomation about method parameters
  ]

  # TODO: add classpath support (we likely need to add something like
  #  ..../platforms/android-26/android.jar to access BLE items)
}

if (chip_link_tests) {
  android_library("java_for_test") {
    output_name = "CHIPControllerForTest.jar"

    deps = [ "${chip_root}/third_party/java_deps:annotation" ]

    data_deps = [
      ":jni",
      ":jni_for_test",
    ]

    sources = [
      "src/chip/devicecontroller/GetConnectedDeviceCallbackForTestJni.java",
    ]

    if (matter_enable_java_compilation) {
      deps += [
        "${chip_root}/third_party/java_deps:json",
        "${chip_root}/third_party/java_deps/stub_src",
      ]
    } else {
      deps += [ ":android" ]

      data_deps += [ "${chip_root}/build/chip/java:shared_cpplib" ]
    }

    javac_flags = [ "-Xlint:deprecation" ]

    # TODO: add classpath support (we likely need to add something like
    #  ..../platforms/android-26/android.jar to access BLE items)
  }

  android_library("tests") {
    output_name = "CHIPControllerTests.jar"

    deps = [
      ":java_for_test",
      "${chip_root}/src/messaging/tests/java",
      "${chip_root}/third_party/java_deps:annotation",
    ]

    data_deps = [
      ":jni",
      ":jni_for_test",
      "${chip_root}/src/messaging/tests/java:jni",
    ]

    sources =
        [ "tests/chip/devicecontroller/GetConnectedDeviceCallbackJniTest.java" ]

    if (matter_enable_java_compilation) {
      deps += [
        "${chip_root}/third_party/java_deps:json",
        "${chip_root}/third_party/java_deps/stub_src",
      ]
    } else {
      deps += [ ":android" ]

      data_deps += [ "${chip_root}/build/chip/java:shared_cpplib" ]
    }

    javac_flags = [ "-Xlint:deprecation" ]

    # TODO: add classpath support (we likely need to add something like
    #  ..../platforms/android-26/android.jar to access BLE items)
  }
}

if (!matter_enable_java_compilation) {
  java_prebuilt("android") {
    jar_path = "${android_sdk_root}/platforms/android-26/android.jar"
  }
}
