From 17df46e3345119a1c7ffb2fa201213774c1e4c46 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 13 Jul 2021 21:52:51 -0700 Subject: [PATCH] Add Android.bp-based definitions for host sdk-repos So that these can be built independently from the large sdk zip. The old Make-based implementation created this as part of the large sdk zip, then extracted it from that zip file. This topic only adds the new definitions under a different filename, full replacement will come in a follow-on CL. Once we fully transitions to this mechanism, we'll be able to turn down most modules on Macs, only building these and their dependencies. Bug: 187222815 Change-Id: If6be8dd573a323ef8b343bc86116ffa3d43922a5 --- build/Android.bp | 256 ++++++++++++++++++++++++++++++++++ sdk/Android.bp | 25 ++++ tools/line_endings/Android.bp | 1 + 3 files changed, 282 insertions(+) create mode 100644 build/Android.bp diff --git a/build/Android.bp b/build/Android.bp new file mode 100644 index 000000000..86f9e4a10 --- /dev/null +++ b/build/Android.bp @@ -0,0 +1,256 @@ +android_sdk_repo_host { + name: "build-tools", + product_variables: { + platform_version_name: { + base_dir: "android-%s", + }, + }, + + srcs: [ + ":build_tools_source_properties", + ":build_tools_runtime_properties", + ], + + merge_zips: [ + ":build-tools_renderscript_includes", + ":renderscript-clang-include", + ":renderscript_sdk_prebuilts", + ], + + multilib: { + common: { + deps: [ + "build-tools_core-lambda-stubs", + ], + }, + }, + deps_remap: [ + { + from: "framework/build-tools_core-lambda-stubs.jar", + to: "core-lambda-stubs.jar", + }, + ], + + target: { + linux: { + merge_zips: [":build-tools-lld-linux"], + strip_files: [ + "lib64/*.so", + "lld-bin/lld", + "lib64/libc++.so.1", + ], + }, + darwin: { + merge_zips: [":build-tools-lld-darwin"], + strip_files: [ + "lib64/*.dylib", + "lld-bin/lld", + ], + }, + not_windows: { + deps: [ + "aapt", + "aapt2", + "aidl", + "apksigner", + "bcc_compat", + "d8", + "dexdump", + "libaapt2_jni", + "llvm-rs-cc", + "split-select", + "zipalign", + ], + deps_remap: [ + { + from: "bin/*", + to: "./", + }, + { + from: "framework/*", + to: "./lib/", + }, + ], + strip_files: [ + "aapt", + "aapt2", + "aidl", + "bcc_compat", + "llvm-rs-cc", + "split-select", + "zipalign", + ], + }, + windows: { + enabled: true, + merge_zips: [":build-tools-lld-windows"], + + compile_multilib: "both", + multilib: { + lib32: { + deps: [ + "aapt", + "aapt2", + "aidl", + "apksigner", + "bcc_compat", + "d8", + "dexdump", + "libaapt2_jni", + "libwinpthread-1", + "lld", + "llvm-rs-cc", + "split-select", + "zipalign", + ], + }, + lib64: { + deps: [ + "libaapt2_jni", + "libwinpthread-1", + ], + }, + }, + deps_remap: [ + { + from: "bin/*", + to: "./", + }, + { + from: "lib/*", + to: "./", + }, + { + from: "framework/*", + to: "./lib/", + }, + ], + strip_files: [ + "*.dll", + "aapt.exe", + "aapt2.exe", + "aidl.exe", + "bcc_compat.exe", + "dexdump.exe", + "lib64/*.dll", + "lld-bin/*.dll", + "lld-bin/*.exe", + "lld.exe", + "llvm-rs-cc.exe", + "split-select.exe", + "zipalign.exe", + ], + }, + }, +} + +// Rename rs_script_api files to renderscript/include/... +genrule { + name: "build-tools_renderscript_includes", + visibility: ["//visibility:private"], + tools: ["soong_zip"], + cmd: "echo $(in) >$(genDir)/list && " + + "$(location soong_zip) -o $(out) -P renderscript " + + "-C $$(dirname $$(dirname $$(awk '{ print $$1 }' $(genDir)/list))) -l $(genDir)/list", + srcs: [":rs_script_api"], + out: ["rs_script_api.zip"], +} + +// This is a device library, so it can't be used by android_sdk_repo_host directly. +java_device_for_host { + name: "build-tools_core-lambda-stubs-device", + visibility: ["//visibility:private"], + libs: ["core-lambda-stubs"], + target: { + windows: { + enabled: true, + }, + }, +} + +java_library_host { + name: "build-tools_core-lambda-stubs", + visibility: ["//visibility:private"], + installable: true, + static_libs: ["build-tools_core-lambda-stubs-device"], + target: { + windows: { + enabled: true, + }, + }, +} + +android_sdk_repo_host { + name: "platform-tools", + base_dir: "platform-tools", + + deps: [ + "adb", + "dmtracedump", + "etc1tool", + "fastboot", + "hprof-conv", + "make_f2fs", + "make_f2fs_casefold", + "mke2fs", + "sqlite3", + ], + deps_remap: [ + { + from: "bin/*", + to: "./", + }, + ], + + srcs: [ + ":mke2fs_conf", + ":platform_tools_properties", + ], + + merge_zips: [":systrace-sdk-zip"], + + target: { + linux: { + strip_files: ["lib64/*.so"], + }, + darwin: { + strip_files: ["lib64/*.dylib"], + }, + not_windows: { + deps: [ + "e2fsdroid", + "sload_f2fs", + ], + strip_files: [ + "adb", + "dmtracedump", + "e2fsdroid", + "etc1tool", + "fastboot", + "hprof-conv", + "make_f2fs_casefold", + "make_f2fs", + "mke2fs", + "sload_f2fs", + "sqlite3", + ], + }, + windows: { + enabled: true, + deps: [ + "AdbWinUsbApi", + "AdbWinApi", + "libwinpthread-1", + ], + deps_remap: [ + { + from: "lib/*", + to: "./", + }, + ], + strip_files: [ + "*.exe", + ], + }, + }, +} diff --git a/sdk/Android.bp b/sdk/Android.bp index d2cd3e08a..674cecfc5 100644 --- a/sdk/Android.bp +++ b/sdk/Android.bp @@ -17,3 +17,28 @@ genrule { srcs: ["plat_tools_source.prop_template"], out: ["platform_tools_version.h"], } + +genrule { + name: "platform_tools_properties", + cmd: "cp $(in) $(out)", + srcs: ["plat_tools_source.prop_template"], + out: ["source.properties"], +} + +genrule { + name: "build_tools_runtime_properties", + cmd: "cp $(in) $(out)", + srcs: ["build_tools_runtime.properties"], + out: ["runtime.properties"], +} + +genrule { + name: "build_tools_source_properties", + product_variables: { + platform_sdk_version: { + cmd: "sed 's/$${PLATFORM_SDK_VERSION}/%d/' $(in) >$(out)", + }, + }, + srcs: ["build_tools_source.prop_template"], + out: ["source.properties"], +} \ No newline at end of file diff --git a/tools/line_endings/Android.bp b/tools/line_endings/Android.bp index db0bc80b8..d12018ce8 100644 --- a/tools/line_endings/Android.bp +++ b/tools/line_endings/Android.bp @@ -15,4 +15,5 @@ cc_binary_host { name: "line_endings", srcs: ["line_endings.c"], cflags: ["-Wall", "-Werror"], + stl: "none", }