• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1LOCAL_PATH := $(call my-dir)
2
3#LINT.IfChange
4LOCAL_bluetooth_project_dir := $(LOCAL_PATH)
5
6LOCAL_cert_test_sources := \
7	$(call all-named-files-under,*.py,blueberry) \
8	$(call all-named-files-under,*.yaml,blueberry) \
9	setup.py
10LOCAL_cert_test_sources := \
11	$(filter-out gd_cert_venv% venv%, $(LOCAL_cert_test_sources))
12LOCAL_cert_test_sources := \
13	$(addprefix $(LOCAL_PATH)/, $(LOCAL_cert_test_sources))
14
15LOCAL_host_executables := \
16	$(HOST_OUT_EXECUTABLES)/bluetooth_stack_with_facade \
17	$(HOST_OUT_EXECUTABLES)/bluetooth_with_facades \
18	$(HOST_OUT_EXECUTABLES)/bt_topshim_facade \
19	$(HOST_OUT_EXECUTABLES)/root-canal
20
21LOCAL_host_python_hci_packets_library := \
22	$(SOONG_OUT_DIR)/.intermediates/packages/modules/Bluetooth/system/gd/gd_hci_packets_python3_gen/gen/hci_packets.py
23
24LOCAL_host_python_extension_libraries := \
25	$(HOST_OUT_SHARED_LIBRARIES)/bluetooth_packets_python3.so
26
27LOCAL_host_libraries := \
28	$(HOST_OUT_SHARED_LIBRARIES)/libbase.so \
29	$(HOST_OUT_SHARED_LIBRARIES)/libbluetooth.so \
30	$(HOST_OUT_SHARED_LIBRARIES)/libbluetooth_gd.so \
31	$(HOST_OUT_SHARED_LIBRARIES)/libc++.so \
32	$(HOST_OUT_SHARED_LIBRARIES)/libchrome.so \
33	$(HOST_OUT_SHARED_LIBRARIES)/libcrypto-host.so \
34	$(HOST_OUT_SHARED_LIBRARIES)/libcutils.so \
35	$(HOST_OUT_SHARED_LIBRARIES)/libevent-host.so \
36	$(HOST_OUT_SHARED_LIBRARIES)/libflatbuffers-cpp.so \
37	$(HOST_OUT_SHARED_LIBRARIES)/libgrpc++_unsecure.so \
38	$(HOST_OUT_SHARED_LIBRARIES)/libgrpc++.so \
39	$(HOST_OUT_SHARED_LIBRARIES)/libgrpc_wrap.so \
40	$(HOST_OUT_SHARED_LIBRARIES)/liblog.so \
41	$(HOST_OUT_SHARED_LIBRARIES)/libssl-host.so \
42	$(HOST_OUT_SHARED_LIBRARIES)/libz-host.so \
43	$(HOST_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-full.so \
44	$(HOST_OUT_SHARED_LIBRARIES)/libunwindstack.so \
45	$(HOST_OUT_SHARED_LIBRARIES)/liblzma.so
46
47LOCAL_target_executables := \
48	$(TARGET_OUT_EXECUTABLES)/bluetooth_stack_with_facade
49
50LOCAL_target_libraries := \
51	$(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.bluetooth@1.0.so \
52	$(TARGET_OUT_SHARED_LIBRARIES)/android.hardware.bluetooth@1.1.so \
53	$(TARGET_OUT_SHARED_LIBRARIES)/libandroid_runtime_lazy.so \
54	$(TARGET_OUT_SHARED_LIBRARIES)/libbase.so \
55	$(TARGET_OUT_SHARED_LIBRARIES)/libbinder_ndk.so \
56	$(TARGET_OUT_SHARED_LIBRARIES)/libbinder.so \
57	$(TARGET_OUT_SHARED_LIBRARIES)/libc++.so \
58	$(TARGET_OUT_SHARED_LIBRARIES)/libcrypto.so \
59	$(TARGET_OUT_SHARED_LIBRARIES)/libcutils.so \
60	$(TARGET_OUT_SHARED_LIBRARIES)/libgrpc_wrap.so \
61	$(TARGET_OUT_SHARED_LIBRARIES)/libgrpc++_unsecure.so \
62	$(TARGET_OUT_SHARED_LIBRARIES)/libgrpc++.so \
63	$(TARGET_OUT_SHARED_LIBRARIES)/libhidlbase.so \
64	$(TARGET_OUT_SHARED_LIBRARIES)/liblog.so \
65	$(TARGET_OUT_SHARED_LIBRARIES)/liblzma.so \
66	$(TARGET_OUT_SHARED_LIBRARIES)/libprotobuf-cpp-full.so \
67	$(TARGET_OUT_SHARED_LIBRARIES)/libssl.so \
68	$(TARGET_OUT_SHARED_LIBRARIES)/libstatslog_bt.so \
69	$(TARGET_OUT_SHARED_LIBRARIES)/libunwindstack.so \
70	$(TARGET_OUT_SHARED_LIBRARIES)/libutils.so \
71	$(TARGET_OUT_SHARED_LIBRARIES)/libz.so
72	# libclang_rt.asan-aarch64-android.so is only generated for ASAN build and included automatically
73	# on devices
74	# $(TARGET_OUT_SHARED_LIBRARIES)/libclang_rt.asan-aarch64-android.so \
75	# libc.so, libdl_android.so, libdl.so, and libm.so are provided by com.android.runtime APEX
76	# Hence we cannot manually add them here
77	# $(TARGET_OUT_SHARED_LIBRARIES)/libc.so \
78	# $(TARGET_OUT_SHARED_LIBRARIES)/libdl_android.so \
79	# $(TARGET_OUT_SHARED_LIBRARIES)/libdl.so \
80	# $(TARGET_OUT_SHARED_LIBRARIES)/libm.so \
81	# libstatssocket.so is provided by co.android.os.statsd APEX
82	# $(TARGET_OUT_SHARED_LIBRARIES)/libstatssocket.so
83	# linux-vdso.so.1 is always provided by OS
84	# $(TARGET_OUT_SHARED_LIBRARIES)/linux-vdso.so.1
85#LINT.ThenChange(blueberry/tests/gd/cert/gd_device.py)
86
87bluetooth_cert_src_and_bin_zip := \
88	$(call intermediates-dir-for,PACKAGING,bluetooth_cert_src_and_bin,HOST)/bluetooth_cert_src_and_bin.zip
89
90# Assume 64-bit OS
91$(bluetooth_cert_src_and_bin_zip): PRIVATE_bluetooth_project_dir := $(LOCAL_bluetooth_project_dir)
92$(bluetooth_cert_src_and_bin_zip): PRIVATE_cert_test_sources := $(LOCAL_cert_test_sources)
93$(bluetooth_cert_src_and_bin_zip): PRIVATE_host_executables := $(LOCAL_host_executables)
94$(bluetooth_cert_src_and_bin_zip): PRIVATE_host_libraries := $(LOCAL_host_libraries)
95$(bluetooth_cert_src_and_bin_zip): PRIVATE_host_python_extension_libraries := $(LOCAL_host_python_extension_libraries)
96$(bluetooth_cert_src_and_bin_zip): PRIVATE_host_python_hci_packets_library := $(LOCAL_host_python_hci_packets_library)
97$(bluetooth_cert_src_and_bin_zip): PRIVATE_target_executables := $(LOCAL_target_executables)
98$(bluetooth_cert_src_and_bin_zip): PRIVATE_target_libraries := $(LOCAL_target_libraries)
99$(bluetooth_cert_src_and_bin_zip): $(SOONG_ZIP) $(LOCAL_cert_test_sources) \
100		$(LOCAL_host_executables) $(LOCAL_host_libraries) $(LOCAL_host_python_libraries) \
101		$(LOCAL_host_python_extension_libraries) \
102		$(LOCAL_host_python_hci_packets_library) \
103		$(LOCAL_target_executables) $(LOCAL_target_libraries)
104	$(hide) $(SOONG_ZIP) -d -o $@ \
105		-C $(PRIVATE_bluetooth_project_dir) $(addprefix -f ,$(PRIVATE_cert_test_sources)) \
106		-C $(dir $(PRIVATE_host_python_hci_packets_library)) -f $(PRIVATE_host_python_hci_packets_library) \
107		-C $(HOST_OUT_EXECUTABLES) $(addprefix -f ,$(PRIVATE_host_executables)) \
108		-C $(HOST_OUT_SHARED_LIBRARIES) $(addprefix -f ,$(PRIVATE_host_python_extension_libraries)) \
109		-P lib64 \
110		-C $(HOST_OUT_SHARED_LIBRARIES) $(addprefix -f ,$(PRIVATE_host_libraries)) \
111		-P target \
112		-C $(TARGET_OUT_EXECUTABLES) $(addprefix -f ,$(PRIVATE_target_executables)) \
113		-C $(TARGET_OUT_SHARED_LIBRARIES) $(addprefix -f ,$(PRIVATE_target_libraries))
114
115$(call declare-container-license-metadata,$(bluetooth_cert_src_and_bin_zip),\
116    SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT legacy_unencumbered,\
117    notice, $(LOCAL_PATH)/../NOTICE,,packages/modules/Bluetooth)
118$(call declare-container-license-deps,$(bluetooth_cert_src_and_bin_zip),\
119    $(LOCAL_host_python_extension_libraries) $(LOCAL_target_executables) $(LOCAL_target_libraries),$(bluetooth_cert_src_and_bin_zip):)
120
121# TODO: Find a better way to locate output from SOONG genrule()
122LOCAL_facade_generated_py_zip := \
123	$(SOONG_OUT_DIR)/.intermediates/packages/modules/Bluetooth/system/BlueberryFacadeAndCertGeneratedStub_py/gen/blueberry_facade_generated_py.zip
124
125bluetooth_cert_tests_py_package_zip := \
126	$(call intermediates-dir-for,PACKAGING,bluetooth_cert_tests_py_package,HOST)/bluetooth_cert_tests.zip
127
128$(bluetooth_cert_tests_py_package_zip): PRIVATE_bluetooth_project_dir := $(LOCAL_bluetooth_project_dir)
129$(bluetooth_cert_tests_py_package_zip): PRIVATE_cert_src_and_bin_zip := $(bluetooth_cert_src_and_bin_zip)
130$(bluetooth_cert_tests_py_package_zip): PRIVATE_facade_generated_py_zip := $(LOCAL_facade_generated_py_zip)
131$(bluetooth_cert_tests_py_package_zip): $(SOONG_ZIP) \
132		$(bluetooth_cert_src_and_bin_zip) $(bluetooth_cert_generated_py_zip)
133	@echo "Packaging Bluetooth Cert Tests into $@"
134	@rm -rf $(dir $@)bluetooth_cert_tests
135	@mkdir -p $(dir $@)bluetooth_cert_tests
136	$(hide) unzip -o -q $(PRIVATE_cert_src_and_bin_zip) -d $(dir $@)bluetooth_cert_tests
137	$(hide) unzip -o -q $(PRIVATE_facade_generated_py_zip) -d $(dir $@)bluetooth_cert_tests
138	# Make all subdirectory Python packages except lib64 and target
139	$(hide) for f in `find $(dir $@)bluetooth_cert_tests -type d -name "*" \
140					-not -path "$(dir $@)bluetooth_cert_tests/target*" \
141					-not -path "$(dir $@)bluetooth_cert_tests/lib64*"` \
142			; do (touch -a $$f/__init__.py) ; done
143	$(hide) $(SOONG_ZIP) -d -o $@ -C $(dir $@)bluetooth_cert_tests -D $(dir $@)bluetooth_cert_tests \
144		-P llvm_binutils -C $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION) \
145		-f $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/bin/llvm-cov \
146		-f $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/bin/llvm-profdata \
147		-f $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/bin/llvm-symbolizer \
148		-f $(LLVM_PREBUILTS_BASE)/linux-x86/$(LLVM_PREBUILTS_VERSION)/lib/x86_64-unknown-linux-gnu/libc++.so.1
149
150$(call declare-container-license-metadata,$(bluetooth_cert_tests_py_package_zip),\
151    SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT legacy_unencumbered,\
152    notice, $(LOCAL_PATH)/../NOTICE,,packages/modules/Bluetooth)
153$(call declare-container-license-deps,$(bluetooth_cert_tests_py_package_zip),\
154    $(bluetooth_cert_src_and_bin_zip) $(bluetooth_cert_generated_py_zip),$(bluetooth_cert_tests_py_package_zip):)
155
156$(call dist-for-goals,bluetooth_stack_with_facade,$(bluetooth_cert_tests_py_package_zip):bluetooth_cert_tests.zip)
157