From d907dad58050902f8c1f88d8f1fe4f5485fc8d1e Mon Sep 17 00:00:00 2001 From: Joonhaeng Heo Date: Wed, 5 Jul 2023 15:59:07 +0900 Subject: [PATCH] Decouple Java generated API --- build/chip/java/config.gni | 2 ++ src/controller/java/BUILD.gn | 45 ++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/build/chip/java/config.gni b/build/chip/java/config.gni index ca18c9231fef1d..b5299ec5e5dbec 100644 --- a/build/chip/java/config.gni +++ b/build/chip/java/config.gni @@ -15,6 +15,7 @@ java_path = getenv("JAVA_PATH") declare_args() { java_matter_controller_dependent_paths = [] + matter_enable_java_generated_api = true matter_enable_java_compilation = false if (java_path != "" && current_os == "linux") { java_matter_controller_dependent_paths += [ "${java_path}/include/" ] @@ -27,6 +28,7 @@ declare_args() { [ "${java_path}/include/linux/" ] } + matter_enable_java_generated_api = false matter_enable_java_compilation = true } } diff --git a/src/controller/java/BUILD.gn b/src/controller/java/BUILD.gn index 60f3f954343c9d..b34470e7dd9c14 100644 --- a/src/controller/java/BUILD.gn +++ b/src/controller/java/BUILD.gn @@ -53,22 +53,15 @@ shared_library("jni") { "AttestationTrustStoreBridge.h", "BaseCHIPCluster-JNI.cpp", "CHIPAttributeTLVValueDecoder.h", - "CHIPDefaultCallbacks.cpp", - "CHIPDefaultCallbacks.h", "CHIPDeviceController-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", @@ -76,6 +69,19 @@ shared_library("jni") { "${chip_root}/src/platform", ] + if (matter_enable_java_generated_api) { + sources += [ + "CHIPDefaultCallbacks.cpp", + "CHIPDefaultCallbacks.h", + "zap-generated/CHIPClustersWrite-JNI.cpp", + "zap-generated/CHIPInvokeCallbacks.cpp", + "zap-generated/CHIPInvokeCallbacks.h", + "zap-generated/CHIPReadCallbacks.cpp", + ] + + deps += [ "${chip_root}/src/controller/data_model:java-jni-sources" ] + } + if (matter_enable_java_compilation) { defines = [ "JAVA_MATTER_CONTROLLER_TEST" ] @@ -297,14 +303,6 @@ android_library("java") { 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", @@ -344,12 +342,25 @@ android_library("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_generated_api) { + sources += [ + "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", + "zap-generated/chip/devicecontroller/ChipClusters.java", + "zap-generated/chip/devicecontroller/ClusterInfoMapping.java", + ] + } + if (matter_enable_java_compilation) { deps += [ "${chip_root}/third_party/java_deps:json",