aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaewoong Jung <jungjw@google.com>2020-06-01 10:45:49 -0700
committerJaewoong Jung <jungjw@google.com>2020-06-02 14:35:04 -0700
commitfccad6b09888792a0b156f9ff1b2558810006244 (patch)
tree73a558d74a22ead1dffb44e27f22e6a2ced1c69f
parentc344620ed669e8e98979a8ed882d7e1adce59b17 (diff)
downloadbuild_soong-fccad6b09888792a0b156f9ff1b2558810006244.tar.gz
build_soong-fccad6b09888792a0b156f9ff1b2558810006244.tar.bz2
build_soong-fccad6b09888792a0b156f9ff1b2558810006244.zip
Soong package structure refactoring
Give prebuilt_etc and sh_binary their own packages and split the gigantic main Android.bp up to small, per-package ones. (This is a cherry-pick change.) Test: m nothing, TreeHugger Bug: 156980228 Change-Id: I7b00cd344b9f16861f1ff39edf0029f016b853d0 Merged-In: I7b00cd344b9f16861f1ff39edf0029f016b853d0
-rw-r--r--Android.bp546
-rw-r--r--android/Android.bp78
-rw-r--r--android/soongconfig/Android.bp13
-rw-r--r--apex/Android.bp27
-rw-r--r--apex/apex.go20
-rw-r--r--apex/apex_test.go6
-rw-r--r--cc/Android.bp87
-rw-r--r--cc/config/Android.bp32
-rw-r--r--cc/vndk.go3
-rw-r--r--env/Android.bp7
-rw-r--r--etc/Android.bp16
-rw-r--r--etc/prebuilt_etc.go (renamed from android/prebuilt_etc.go)124
-rw-r--r--etc/prebuilt_etc_test.go (renamed from android/prebuilt_etc_test.go)47
-rw-r--r--genrule/Android.bp18
-rw-r--r--java/Android.bp66
-rw-r--r--java/config/Android.bp15
-rw-r--r--phony/Android.bp12
-rw-r--r--python/Android.bp24
-rw-r--r--remoteexec/Android.bp15
-rw-r--r--rust/Android.bp30
-rw-r--r--rust/config/Android.bp19
-rw-r--r--sdk/Android.bp27
-rw-r--r--sh/Android.bp16
-rw-r--r--sh/sh_binary.go (renamed from android/sh_binary.go)114
-rw-r--r--sh/sh_binary_test.go (renamed from android/sh_binary_test.go)45
-rw-r--r--shared/Android.bp7
-rw-r--r--sysprop/Android.bp18
-rw-r--r--tradefed/Android.bp14
-rw-r--r--xml/Android.bp18
-rw-r--r--xml/xml.go5
-rw-r--r--xml/xml_test.go3
31 files changed, 784 insertions, 688 deletions
diff --git a/Android.bp b/Android.bp
index a235906b..2df1afb6 100644
--- a/Android.bp
+++ b/Android.bp
@@ -11,14 +11,6 @@ subdirs = [
]
bootstrap_go_package {
- name: "soong-env",
- pkgPath: "android/soong/env",
- srcs: [
- "env/env.go",
- ],
-}
-
-bootstrap_go_package {
name: "soong",
pkgPath: "android/soong",
deps: [
@@ -29,544 +21,6 @@ bootstrap_go_package {
],
}
-bootstrap_go_package {
- name: "soong-android",
- pkgPath: "android/soong/android",
- deps: [
- "blueprint",
- "blueprint-bootstrap",
- "soong",
- "soong-android-soongconfig",
- "soong-env",
- "soong-shared",
- ],
- srcs: [
- "android/androidmk.go",
- "android/apex.go",
- "android/api_levels.go",
- "android/arch.go",
- "android/config.go",
- "android/csuite_config.go",
- "android/defaults.go",
- "android/defs.go",
- "android/expand.go",
- "android/filegroup.go",
- "android/hooks.go",
- "android/image.go",
- "android/makevars.go",
- "android/module.go",
- "android/mutator.go",
- "android/namespace.go",
- "android/neverallow.go",
- "android/notices.go",
- "android/onceper.go",
- "android/override_module.go",
- "android/package.go",
- "android/package_ctx.go",
- "android/path_properties.go",
- "android/paths.go",
- "android/prebuilt.go",
- "android/prebuilt_etc.go",
- "android/proto.go",
- "android/register.go",
- "android/rule_builder.go",
- "android/sandbox.go",
- "android/sdk.go",
- "android/sh_binary.go",
- "android/singleton.go",
- "android/soong_config_modules.go",
- "android/testing.go",
- "android/util.go",
- "android/variable.go",
- "android/visibility.go",
- "android/vts_config.go",
- "android/writedocs.go",
-
- // Lock down environment access last
- "android/env.go",
- ],
- testSrcs: [
- "android/android_test.go",
- "android/androidmk_test.go",
- "android/arch_test.go",
- "android/config_test.go",
- "android/csuite_config_test.go",
- "android/expand_test.go",
- "android/module_test.go",
- "android/mutator_test.go",
- "android/namespace_test.go",
- "android/neverallow_test.go",
- "android/onceper_test.go",
- "android/package_test.go",
- "android/path_properties_test.go",
- "android/paths_test.go",
- "android/prebuilt_test.go",
- "android/prebuilt_etc_test.go",
- "android/rule_builder_test.go",
- "android/soong_config_modules_test.go",
- "android/util_test.go",
- "android/variable_test.go",
- "android/visibility_test.go",
- "android/vts_config_test.go",
- ],
-}
-
-bootstrap_go_package {
- name: "soong-android-soongconfig",
- pkgPath: "android/soong/android/soongconfig",
- deps: [
- "blueprint",
- "blueprint-parser",
- "blueprint-proptools",
- ],
- srcs: [
- "android/soongconfig/config.go",
- "android/soongconfig/modules.go",
- ],
-}
-
-bootstrap_go_package {
- name: "soong-cc-config",
- pkgPath: "android/soong/cc/config",
- deps: [
- "soong-android",
- "soong-remoteexec",
- ],
- srcs: [
- "cc/config/clang.go",
- "cc/config/global.go",
- "cc/config/tidy.go",
- "cc/config/toolchain.go",
- "cc/config/vndk.go",
-
- "cc/config/arm_device.go",
- "cc/config/arm64_device.go",
- "cc/config/arm64_fuchsia_device.go",
- "cc/config/mips_device.go",
- "cc/config/mips64_device.go",
- "cc/config/x86_device.go",
- "cc/config/x86_64_device.go",
- "cc/config/x86_64_fuchsia_device.go",
-
- "cc/config/x86_darwin_host.go",
- "cc/config/x86_linux_host.go",
- "cc/config/x86_linux_bionic_host.go",
- "cc/config/x86_windows_host.go",
- ],
- testSrcs: [
- "cc/config/tidy_test.go",
- ],
-}
-
-bootstrap_go_package {
- name: "soong-cc",
- pkgPath: "android/soong/cc",
- deps: [
- "blueprint",
- "blueprint-pathtools",
- "soong",
- "soong-android",
- "soong-cc-config",
- "soong-genrule",
- "soong-tradefed",
- ],
- srcs: [
- "cc/androidmk.go",
- "cc/builder.go",
- "cc/cc.go",
- "cc/ccdeps.go",
- "cc/check.go",
- "cc/coverage.go",
- "cc/gen.go",
- "cc/linkable.go",
- "cc/lto.go",
- "cc/makevars.go",
- "cc/pgo.go",
- "cc/prebuilt.go",
- "cc/proto.go",
- "cc/rs.go",
- "cc/sanitize.go",
- "cc/sabi.go",
- "cc/sdk.go",
- "cc/snapshot_utils.go",
- "cc/stl.go",
- "cc/strip.go",
- "cc/sysprop.go",
- "cc/tidy.go",
- "cc/util.go",
- "cc/vendor_snapshot.go",
- "cc/vndk.go",
- "cc/vndk_prebuilt.go",
-
- "cc/cflag_artifacts.go",
- "cc/cmakelists.go",
- "cc/compdb.go",
- "cc/compiler.go",
- "cc/installer.go",
- "cc/linker.go",
-
- "cc/binary.go",
- "cc/binary_sdk_member.go",
- "cc/fuzz.go",
- "cc/library.go",
- "cc/library_headers.go",
- "cc/library_sdk_member.go",
- "cc/object.go",
- "cc/test.go",
- "cc/toolchain_library.go",
-
- "cc/ndk_prebuilt.go",
- "cc/ndk_headers.go",
- "cc/ndk_library.go",
- "cc/ndk_sysroot.go",
-
- "cc/llndk_library.go",
-
- "cc/kernel_headers.go",
-
- "cc/genrule.go",
-
- "cc/vendor_public_library.go",
-
- "cc/testing.go",
- ],
- testSrcs: [
- "cc/cc_test.go",
- "cc/compiler_test.go",
- "cc/gen_test.go",
- "cc/genrule_test.go",
- "cc/library_headers_test.go",
- "cc/library_test.go",
- "cc/object_test.go",
- "cc/prebuilt_test.go",
- "cc/proto_test.go",
- "cc/test_data_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-genrule",
- pkgPath: "android/soong/genrule",
- deps: [
- "blueprint",
- "blueprint-pathtools",
- "soong",
- "soong-android",
- "soong-shared",
- ],
- srcs: [
- "genrule/genrule.go",
- ],
- testSrcs: [
- "genrule/genrule_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-phony",
- pkgPath: "android/soong/phony",
- deps: [
- "blueprint",
- "soong-android",
- ],
- srcs: [
- "phony/phony.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-java",
- pkgPath: "android/soong/java",
- deps: [
- "blueprint",
- "blueprint-pathtools",
- "soong",
- "soong-android",
- "soong-cc",
- "soong-dexpreopt",
- "soong-genrule",
- "soong-java-config",
- "soong-remoteexec",
- "soong-tradefed",
- ],
- srcs: [
- "java/aapt2.go",
- "java/aar.go",
- "java/android_manifest.go",
- "java/android_resources.go",
- "java/androidmk.go",
- "java/app_builder.go",
- "java/app.go",
- "java/builder.go",
- "java/device_host_converter.go",
- "java/dex.go",
- "java/dexpreopt.go",
- "java/dexpreopt_bootjars.go",
- "java/dexpreopt_config.go",
- "java/droiddoc.go",
- "java/gen.go",
- "java/genrule.go",
- "java/hiddenapi.go",
- "java/hiddenapi_singleton.go",
- "java/jacoco.go",
- "java/java.go",
- "java/jdeps.go",
- "java/java_resources.go",
- "java/kotlin.go",
- "java/platform_compat_config.go",
- "java/plugin.go",
- "java/prebuilt_apis.go",
- "java/proto.go",
- "java/robolectric.go",
- "java/sdk.go",
- "java/sdk_library.go",
- "java/support_libraries.go",
- "java/sysprop.go",
- "java/system_modules.go",
- "java/testing.go",
- "java/tradefed.go",
- ],
- testSrcs: [
- "java/androidmk_test.go",
- "java/app_test.go",
- "java/device_host_converter_test.go",
- "java/dexpreopt_test.go",
- "java/dexpreopt_bootjars_test.go",
- "java/java_test.go",
- "java/jdeps_test.go",
- "java/kotlin_test.go",
- "java/plugin_test.go",
- "java/sdk_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-java-config",
- pkgPath: "android/soong/java/config",
- deps: [
- "blueprint-proptools",
- "soong-android",
- "soong-remoteexec",
- ],
- srcs: [
- "java/config/config.go",
- "java/config/error_prone.go",
- "java/config/kotlin.go",
- "java/config/makevars.go",
- ],
-}
-
-bootstrap_go_package {
- name: "soong-rust-config",
- pkgPath: "android/soong/rust/config",
- deps: [
- "soong-android",
- "soong-cc-config",
- ],
- srcs: [
- "rust/config/arm_device.go",
- "rust/config/arm64_device.go",
- "rust/config/global.go",
- "rust/config/toolchain.go",
- "rust/config/whitelist.go",
- "rust/config/x86_darwin_host.go",
- "rust/config/x86_linux_host.go",
- "rust/config/x86_device.go",
- "rust/config/x86_64_device.go",
- ],
-}
-
-bootstrap_go_package {
- name: "soong-rust",
- pkgPath: "android/soong/rust",
- deps: [
- "soong",
- "soong-android",
- "soong-cc",
- "soong-rust-config",
- ],
- srcs: [
- "rust/androidmk.go",
- "rust/compiler.go",
- "rust/binary.go",
- "rust/builder.go",
- "rust/library.go",
- "rust/prebuilt.go",
- "rust/proc_macro.go",
- "rust/rust.go",
- "rust/test.go",
- "rust/testing.go",
- ],
- testSrcs: [
- "rust/binary_test.go",
- "rust/compiler_test.go",
- "rust/library_test.go",
- "rust/rust_test.go",
- "rust/test_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-python",
- pkgPath: "android/soong/python",
- deps: [
- "blueprint",
- "soong-android",
- "soong-tradefed",
- ],
- srcs: [
- "python/androidmk.go",
- "python/binary.go",
- "python/builder.go",
- "python/defaults.go",
- "python/installer.go",
- "python/library.go",
- "python/proto.go",
- "python/python.go",
- "python/test.go",
- ],
- testSrcs: [
- "python/python_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-shared",
- pkgPath: "android/soong/shared",
- srcs: [
- "shared/paths.go",
- ],
-}
-
-bootstrap_go_package {
- name: "soong-tradefed",
- pkgPath: "android/soong/tradefed",
- deps: [
- "blueprint",
- "soong-android",
- ],
- srcs: [
- "tradefed/autogen.go",
- "tradefed/config.go",
- "tradefed/makevars.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-xml",
- pkgPath: "android/soong/xml",
- deps: [
- "blueprint",
- "blueprint-pathtools",
- "soong",
- "soong-android",
- ],
- srcs: [
- "xml/xml.go",
- ],
- testSrcs: [
- "xml/xml_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-apex",
- pkgPath: "android/soong/apex",
- deps: [
- "blueprint",
- "soong",
- "soong-android",
- "soong-cc",
- "soong-java",
- "soong-python",
- ],
- srcs: [
- "apex/androidmk.go",
- "apex/apex.go",
- "apex/apex_singleton.go",
- "apex/builder.go",
- "apex/key.go",
- "apex/prebuilt.go",
- "apex/vndk.go",
- ],
- testSrcs: [
- "apex/apex_test.go",
- "apex/vndk_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-sysprop",
- pkgPath: "android/soong/sysprop",
- deps: [
- "blueprint",
- "soong",
- "soong-android",
- "soong-cc",
- "soong-java",
- ],
- srcs: [
- "sysprop/sysprop_library.go",
- ],
- testSrcs: [
- "sysprop/sysprop_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-sdk",
- pkgPath: "android/soong/sdk",
- deps: [
- "blueprint",
- "soong",
- "soong-android",
- "soong-apex",
- "soong-cc",
- "soong-java",
- ],
- srcs: [
- "sdk/bp.go",
- "sdk/exports.go",
- "sdk/sdk.go",
- "sdk/update.go",
- ],
- testSrcs: [
- "sdk/bp_test.go",
- "sdk/cc_sdk_test.go",
- "sdk/exports_test.go",
- "sdk/java_sdk_test.go",
- "sdk/sdk_test.go",
- "sdk/testing.go",
- ],
- pluginFor: ["soong_build"],
-}
-
-bootstrap_go_package {
- name: "soong-remoteexec",
- pkgPath: "android/soong/remoteexec",
- deps: [
- "blueprint",
- "soong-android",
- ],
- srcs: [
- "remoteexec/remoteexec.go",
- ],
- testSrcs: [
- "remoteexec/remoteexec_test.go",
- ],
- pluginFor: ["soong_build"],
-}
-
//
// Defaults to enable various configurations of host bionic
//
diff --git a/android/Android.bp b/android/Android.bp
new file mode 100644
index 00000000..65411064
--- /dev/null
+++ b/android/Android.bp
@@ -0,0 +1,78 @@
+bootstrap_go_package {
+ name: "soong-android",
+ pkgPath: "android/soong/android",
+ deps: [
+ "blueprint",
+ "blueprint-bootstrap",
+ "soong",
+ "soong-android-soongconfig",
+ "soong-env",
+ "soong-shared",
+ ],
+ srcs: [
+ "androidmk.go",
+ "apex.go",
+ "api_levels.go",
+ "arch.go",
+ "config.go",
+ "csuite_config.go",
+ "defaults.go",
+ "defs.go",
+ "expand.go",
+ "filegroup.go",
+ "hooks.go",
+ "image.go",
+ "makevars.go",
+ "module.go",
+ "mutator.go",
+ "namespace.go",
+ "neverallow.go",
+ "notices.go",
+ "onceper.go",
+ "override_module.go",
+ "package.go",
+ "package_ctx.go",
+ "path_properties.go",
+ "paths.go",
+ "prebuilt.go",
+ "proto.go",
+ "register.go",
+ "rule_builder.go",
+ "sandbox.go",
+ "sdk.go",
+ "singleton.go",
+ "soong_config_modules.go",
+ "testing.go",
+ "util.go",
+ "variable.go",
+ "visibility.go",
+ "vts_config.go",
+ "writedocs.go",
+
+ // Lock down environment access last
+ "env.go",
+ ],
+ testSrcs: [
+ "android_test.go",
+ "androidmk_test.go",
+ "arch_test.go",
+ "config_test.go",
+ "csuite_config_test.go",
+ "expand_test.go",
+ "module_test.go",
+ "mutator_test.go",
+ "namespace_test.go",
+ "neverallow_test.go",
+ "onceper_test.go",
+ "package_test.go",
+ "path_properties_test.go",
+ "paths_test.go",
+ "prebuilt_test.go",
+ "rule_builder_test.go",
+ "soong_config_modules_test.go",
+ "util_test.go",
+ "variable_test.go",
+ "visibility_test.go",
+ "vts_config_test.go",
+ ],
+}
diff --git a/android/soongconfig/Android.bp b/android/soongconfig/Android.bp
new file mode 100644
index 00000000..df912e62
--- /dev/null
+++ b/android/soongconfig/Android.bp
@@ -0,0 +1,13 @@
+bootstrap_go_package {
+ name: "soong-android-soongconfig",
+ pkgPath: "android/soong/android/soongconfig",
+ deps: [
+ "blueprint",
+ "blueprint-parser",
+ "blueprint-proptools",
+ ],
+ srcs: [
+ "config.go",
+ "modules.go",
+ ],
+}
diff --git a/apex/Android.bp b/apex/Android.bp
new file mode 100644
index 00000000..144f4419
--- /dev/null
+++ b/apex/Android.bp
@@ -0,0 +1,27 @@
+bootstrap_go_package {
+ name: "soong-apex",
+ pkgPath: "android/soong/apex",
+ deps: [
+ "blueprint",
+ "soong",
+ "soong-android",
+ "soong-cc",
+ "soong-java",
+ "soong-python",
+ "soong-sh",
+ ],
+ srcs: [
+ "androidmk.go",
+ "apex.go",
+ "apex_singleton.go",
+ "builder.go",
+ "key.go",
+ "prebuilt.go",
+ "vndk.go",
+ ],
+ testSrcs: [
+ "apex_test.go",
+ "vndk_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/apex/apex.go b/apex/apex.go
index ba1c1d27..4c5dbd0e 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -23,14 +23,16 @@ import (
"strings"
"sync"
+ "github.com/google/blueprint"
+ "github.com/google/blueprint/bootstrap"
+ "github.com/google/blueprint/proptools"
+
"android/soong/android"
"android/soong/cc"
+ prebuilt_etc "android/soong/etc"
"android/soong/java"
"android/soong/python"
-
- "github.com/google/blueprint"
- "github.com/google/blueprint/bootstrap"
- "github.com/google/blueprint/proptools"
+ "android/soong/sh"
)
const (
@@ -1661,7 +1663,7 @@ func apexFileForGoBinary(ctx android.BaseModuleContext, depName string, gb boots
return newApexFile(ctx, fileToCopy, depName, dirInApex, goBinary, nil)
}
-func apexFileForShBinary(ctx android.BaseModuleContext, sh *android.ShBinary) apexFile {
+func apexFileForShBinary(ctx android.BaseModuleContext, sh *sh.ShBinary) apexFile {
dirInApex := filepath.Join("bin", sh.SubDir())
fileToCopy := sh.OutputFile()
af := newApexFile(ctx, fileToCopy, sh.Name(), dirInApex, shBinary, sh)
@@ -1683,7 +1685,7 @@ func apexFileForJavaLibrary(ctx android.BaseModuleContext, lib javaDependency, m
return af
}
-func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt android.PrebuiltEtcModule, depName string) apexFile {
+func apexFileForPrebuiltEtc(ctx android.BaseModuleContext, prebuilt prebuilt_etc.PrebuiltEtcModule, depName string) apexFile {
dirInApex := filepath.Join("etc", prebuilt.SubDir())
fileToCopy := prebuilt.OutputFile()
return newApexFile(ctx, fileToCopy, depName, dirInApex, etc, prebuilt)
@@ -1944,7 +1946,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if cc, ok := child.(*cc.Module); ok {
filesInfo = append(filesInfo, apexFileForExecutable(ctx, cc))
return true // track transitive dependencies
- } else if sh, ok := child.(*android.ShBinary); ok {
+ } else if sh, ok := child.(*sh.ShBinary); ok {
filesInfo = append(filesInfo, apexFileForShBinary(ctx, sh))
} else if py, ok := child.(*python.Module); ok && py.HostToolPath().Valid() {
filesInfo = append(filesInfo, apexFileForPyBinary(ctx, py))
@@ -1985,7 +1987,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
ctx.PropertyErrorf("apps", "%q is not an android_app module", depName)
}
case prebuiltTag:
- if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
+ if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
} else if prebuilt, ok := child.(java.PlatformCompatConfigIntf); ok {
filesInfo = append(filesInfo, apexFileForCompatConfig(ctx, prebuilt, depName))
@@ -2082,7 +2084,7 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
return false
} else if java.IsXmlPermissionsFileDepTag(depTag) {
- if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
+ if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
}
} else if am.CanHaveApexVariants() && am.IsInstallableToApex() {
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 89f8c899..3ff47ce8 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -29,7 +29,9 @@ import (
"android/soong/android"
"android/soong/cc"
"android/soong/dexpreopt"
+ prebuilt_etc "android/soong/etc"
"android/soong/java"
+ "android/soong/sh"
)
var buildDir string
@@ -209,9 +211,9 @@ func testApexContext(t *testing.T, bp string, handlers ...testCustomizer) (*andr
ctx.RegisterModuleType("cc_test", cc.TestFactory)
ctx.RegisterModuleType("vndk_prebuilt_shared", cc.VndkPrebuiltSharedFactory)
ctx.RegisterModuleType("vndk_libraries_txt", cc.VndkLibrariesTxtFactory)
- ctx.RegisterModuleType("prebuilt_etc", android.PrebuiltEtcFactory)
+ ctx.RegisterModuleType("prebuilt_etc", prebuilt_etc.PrebuiltEtcFactory)
ctx.RegisterModuleType("platform_compat_config", java.PlatformCompatConfigFactory)
- ctx.RegisterModuleType("sh_binary", android.ShBinaryFactory)
+ ctx.RegisterModuleType("sh_binary", sh.ShBinaryFactory)
ctx.RegisterModuleType("filegroup", android.FileGroupFactory)
java.RegisterJavaBuildComponents(ctx)
java.RegisterSystemModulesBuildComponents(ctx)
diff --git a/cc/Android.bp b/cc/Android.bp
new file mode 100644
index 00000000..9ece05f6
--- /dev/null
+++ b/cc/Android.bp
@@ -0,0 +1,87 @@
+bootstrap_go_package {
+ name: "soong-cc",
+ pkgPath: "android/soong/cc",
+ deps: [
+ "blueprint",
+ "blueprint-pathtools",
+ "soong",
+ "soong-android",
+ "soong-cc-config",
+ "soong-etc",
+ "soong-genrule",
+ "soong-tradefed",
+ ],
+ srcs: [
+ "androidmk.go",
+ "builder.go",
+ "cc.go",
+ "ccdeps.go",
+ "check.go",
+ "coverage.go",
+ "gen.go",
+ "linkable.go",
+ "lto.go",
+ "makevars.go",
+ "pgo.go",
+ "prebuilt.go",
+ "proto.go",
+ "rs.go",
+ "sanitize.go",
+ "sabi.go",
+ "sdk.go",
+ "snapshot_utils.go",
+ "stl.go",
+ "strip.go",
+ "sysprop.go",
+ "tidy.go",
+ "util.go",
+ "vendor_snapshot.go",
+ "vndk.go",
+ "vndk_prebuilt.go",
+
+ "cflag_artifacts.go",
+ "cmakelists.go",
+ "compdb.go",
+ "compiler.go",
+ "installer.go",
+ "linker.go",
+
+ "binary.go",
+ "binary_sdk_member.go",
+ "fuzz.go",
+ "library.go",
+ "library_headers.go",
+ "library_sdk_member.go",
+ "object.go",
+ "test.go",
+ "toolchain_library.go",
+
+ "ndk_prebuilt.go",
+ "ndk_headers.go",
+ "ndk_library.go",
+ "ndk_sysroot.go",
+
+ "llndk_library.go",
+
+ "kernel_headers.go",
+
+ "genrule.go",
+
+ "vendor_public_library.go",
+
+ "testing.go",
+ ],
+ testSrcs: [
+ "cc_test.go",
+ "compiler_test.go",
+ "gen_test.go",
+ "genrule_test.go",
+ "library_headers_test.go",
+ "library_test.go",
+ "object_test.go",
+ "prebuilt_test.go",
+ "proto_test.go",
+ "test_data_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/cc/config/Android.bp b/cc/config/Android.bp
new file mode 100644
index 00000000..7edb0c98
--- /dev/null
+++ b/cc/config/Android.bp
@@ -0,0 +1,32 @@
+bootstrap_go_package {
+ name: "soong-cc-config",
+ pkgPath: "android/soong/cc/config",
+ deps: [
+ "soong-android",
+ "soong-remoteexec",
+ ],
+ srcs: [
+ "clang.go",
+ "global.go",
+ "tidy.go",
+ "toolchain.go",
+ "vndk.go",
+
+ "arm_device.go",
+ "arm64_device.go",
+ "arm64_fuchsia_device.go",
+ "mips_device.go",
+ "mips64_device.go",
+ "x86_device.go",
+ "x86_64_device.go",
+ "x86_64_fuchsia_device.go",
+
+ "x86_darwin_host.go",
+ "x86_linux_host.go",
+ "x86_linux_bionic_host.go",
+ "x86_windows_host.go",
+ ],
+ testSrcs: [
+ "tidy_test.go",
+ ],
+}
diff --git a/cc/vndk.go b/cc/vndk.go
index 8eab8ba7..ef33c1a5 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -25,6 +25,7 @@ import (
"android/soong/android"
"android/soong/cc/config"
+ "android/soong/etc"
)
const (
@@ -410,7 +411,7 @@ type vndkLibrariesTxt struct {
outputFile android.OutputPath
}
-var _ android.PrebuiltEtcModule = &vndkLibrariesTxt{}
+var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
var _ android.OutputFileProducer = &vndkLibrariesTxt{}
// vndk_libraries_txt is a special kind of module type in that it name is one of
diff --git a/env/Android.bp b/env/Android.bp
new file mode 100644
index 00000000..90c60472
--- /dev/null
+++ b/env/Android.bp
@@ -0,0 +1,7 @@
+bootstrap_go_package {
+ name: "soong-env",
+ pkgPath: "android/soong/env",
+ srcs: [
+ "env.go",
+ ],
+}
diff --git a/etc/Android.bp b/etc/Android.bp
new file mode 100644
index 00000000..cfd303ec
--- /dev/null
+++ b/etc/Android.bp
@@ -0,0 +1,16 @@
+bootstrap_go_package {
+ name: "soong-etc",
+ pkgPath: "android/soong/etc",
+ deps: [
+ "blueprint",
+ "soong",
+ "soong-android",
+ ],
+ srcs: [
+ "prebuilt_etc.go",
+ ],
+ testSrcs: [
+ "prebuilt_etc_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/android/prebuilt_etc.go b/etc/prebuilt_etc.go
index 3dea6d8f..842d9eec 100644
--- a/android/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -12,19 +12,29 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package android
+package etc
-import "strconv"
+import (
+ "strconv"
+
+ "github.com/google/blueprint/proptools"
+
+ "android/soong/android"
+)
+
+var pctx = android.NewPackageContext("android/soong/etc")
// TODO(jungw): Now that it handles more than the ones in etc/, consider renaming this file.
func init() {
- RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
- RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
- RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
- RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
- RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
- RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
+ pctx.Import("android/soong/android")
+
+ android.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
+ android.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
+ android.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
+ android.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
+ android.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
+ android.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
}
type prebuiltEtcProperties struct {
@@ -52,24 +62,24 @@ type prebuiltEtcProperties struct {
}
type PrebuiltEtcModule interface {
- Module
+ android.Module
SubDir() string
- OutputFile() OutputPath
+ OutputFile() android.OutputPath
}
type PrebuiltEtc struct {
- ModuleBase
+ android.ModuleBase
properties prebuiltEtcProperties
- sourceFilePath Path
- outputFilePath OutputPath
+ sourceFilePath android.Path
+ outputFilePath android.OutputPath
// The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
installDirBase string
// The base install location when soc_specific property is set to true, e.g. "firmware" for prebuilt_firmware.
socInstallDirBase string
- installDirPath InstallPath
- additionalDependencies *Paths
+ installDirPath android.InstallPath
+ additionalDependencies *android.Paths
}
func (p *PrebuiltEtc) inRamdisk() bool {
@@ -96,65 +106,65 @@ func (p *PrebuiltEtc) InstallInRecovery() bool {
return p.inRecovery()
}
-var _ ImageInterface = (*PrebuiltEtc)(nil)
+var _ android.ImageInterface = (*PrebuiltEtc)(nil)
-func (p *PrebuiltEtc) ImageMutatorBegin(ctx BaseModuleContext) {}
+func (p *PrebuiltEtc) ImageMutatorBegin(ctx android.BaseModuleContext) {}
-func (p *PrebuiltEtc) CoreVariantNeeded(ctx BaseModuleContext) bool {
+func (p *PrebuiltEtc) CoreVariantNeeded(ctx android.BaseModuleContext) bool {
return !p.ModuleBase.InstallInRecovery() && !p.ModuleBase.InstallInRamdisk()
}
-func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx BaseModuleContext) bool {
- return Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
+func (p *PrebuiltEtc) RamdiskVariantNeeded(ctx android.BaseModuleContext) bool {
+ return proptools.Bool(p.properties.Ramdisk_available) || p.ModuleBase.InstallInRamdisk()
}
-func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx BaseModuleContext) bool {
- return Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
+func (p *PrebuiltEtc) RecoveryVariantNeeded(ctx android.BaseModuleContext) bool {
+ return proptools.Bool(p.properties.Recovery_available) || p.ModuleBase.InstallInRecovery()
}
-func (p *PrebuiltEtc) ExtraImageVariations(ctx BaseModuleContext) []string {
+func (p *PrebuiltEtc) ExtraImageVariations(ctx android.BaseModuleContext) []string {
return nil
}
-func (p *PrebuiltEtc) SetImageVariation(ctx BaseModuleContext, variation string, module Module) {
+func (p *PrebuiltEtc) SetImageVariation(ctx android.BaseModuleContext, variation string, module android.Module) {
}
-func (p *PrebuiltEtc) DepsMutator(ctx BottomUpMutatorContext) {
+func (p *PrebuiltEtc) DepsMutator(ctx android.BottomUpMutatorContext) {
if p.properties.Src == nil {
ctx.PropertyErrorf("src", "missing prebuilt source file")
}
}
-func (p *PrebuiltEtc) SourceFilePath(ctx ModuleContext) Path {
- return PathForModuleSrc(ctx, String(p.properties.Src))
+func (p *PrebuiltEtc) SourceFilePath(ctx android.ModuleContext) android.Path {
+ return android.PathForModuleSrc(ctx, android.String(p.properties.Src))
}
-func (p *PrebuiltEtc) InstallDirPath() InstallPath {
+func (p *PrebuiltEtc) InstallDirPath() android.InstallPath {
return p.installDirPath
}
// This allows other derivative modules (e.g. prebuilt_etc_xml) to perform
// additional steps (like validating the src) before the file is installed.
-func (p *PrebuiltEtc) SetAdditionalDependencies(paths Paths) {
+func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
p.additionalDependencies = &paths
}
-func (p *PrebuiltEtc) OutputFile() OutputPath {
+func (p *PrebuiltEtc) OutputFile() android.OutputPath {
return p.outputFilePath
}
func (p *PrebuiltEtc) SubDir() string {
- return String(p.properties.Sub_dir)
+ return android.String(p.properties.Sub_dir)
}
func (p *PrebuiltEtc) Installable() bool {
- return p.properties.Installable == nil || Bool(p.properties.Installable)
+ return p.properties.Installable == nil || android.Bool(p.properties.Installable)
}
-func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx ModuleContext) {
- p.sourceFilePath = PathForModuleSrc(ctx, String(p.properties.Src))
- filename := String(p.properties.Filename)
- filename_from_src := Bool(p.properties.Filename_from_src)
+func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ p.sourceFilePath = android.PathForModuleSrc(ctx, android.String(p.properties.Src))
+ filename := android.String(p.properties.Filename)
+ filename_from_src := android.Bool(p.properties.Filename_from_src)
if filename == "" {
if filename_from_src {
filename = p.sourceFilePath.Base()
@@ -165,7 +175,7 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx ModuleContext) {
ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
return
}
- p.outputFilePath = PathForModuleOut(ctx, filename).OutputPath
+ p.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
// If soc install dir was specified and SOC specific is set, set the installDirPath to the specified
// socInstallDirBase.
@@ -173,18 +183,18 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx ModuleContext) {
if ctx.SocSpecific() && p.socInstallDirBase != "" {
installBaseDir = p.socInstallDirBase
}
- p.installDirPath = PathForModuleInstall(ctx, installBaseDir, String(p.properties.Sub_dir))
+ p.installDirPath = android.PathForModuleInstall(ctx, installBaseDir, proptools.String(p.properties.Sub_dir))
// This ensures that outputFilePath has the correct name for others to
// use, as the source file may have a different name.
- ctx.Build(pctx, BuildParams{
- Rule: Cp,
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
Output: p.outputFilePath,
Input: p.sourceFilePath,
})
}
-func (p *PrebuiltEtc) AndroidMkEntries() []AndroidMkEntries {
+func (p *PrebuiltEtc) AndroidMkEntries() []android.AndroidMkEntries {
nameSuffix := ""
if p.inRamdisk() && !p.onlyInRamdisk() {
nameSuffix = ".ramdisk"
@@ -192,12 +202,12 @@ func (p *PrebuiltEtc) AndroidMkEntries() []AndroidMkEntries {
if p.inRecovery() && !p.onlyInRecovery() {
nameSuffix = ".recovery"
}
- return []AndroidMkEntries{AndroidMkEntries{
+ return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "ETC",
SubName: nameSuffix,
- OutputFile: OptionalPathForPath(p.outputFilePath),
- ExtraEntries: []AndroidMkExtraEntriesFunc{
- func(entries *AndroidMkEntries) {
+ OutputFile: android.OptionalPathForPath(p.outputFilePath),
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_MODULE_TAGS", "optional")
entries.SetString("LOCAL_MODULE_PATH", p.installDirPath.ToMakePath().String())
entries.SetString("LOCAL_INSTALLED_MODULE_STEM", p.outputFilePath.Base())
@@ -219,61 +229,61 @@ func InitPrebuiltEtcModule(p *PrebuiltEtc, dirBase string) {
// prebuilt_etc is for a prebuilt artifact that is installed in
// <partition>/etc/<sub_dir> directory.
-func PrebuiltEtcFactory() Module {
+func PrebuiltEtcFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "etc")
// This module is device-only
- InitAndroidArchModule(module, DeviceSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
}
// prebuilt_etc_host is for a host prebuilt artifact that is installed in
// $(HOST_OUT)/etc/<sub_dir> directory.
-func PrebuiltEtcHostFactory() Module {
+func PrebuiltEtcHostFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "etc")
// This module is host-only
- InitAndroidArchModule(module, HostSupported, MultilibCommon)
+ android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
return module
}
// prebuilt_usr_share is for a prebuilt artifact that is installed in
// <partition>/usr/share/<sub_dir> directory.
-func PrebuiltUserShareFactory() Module {
+func PrebuiltUserShareFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "usr/share")
// This module is device-only
- InitAndroidArchModule(module, DeviceSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
}
// prebuild_usr_share_host is for a host prebuilt artifact that is installed in
// $(HOST_OUT)/usr/share/<sub_dir> directory.
-func PrebuiltUserShareHostFactory() Module {
+func PrebuiltUserShareHostFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "usr/share")
// This module is host-only
- InitAndroidArchModule(module, HostSupported, MultilibCommon)
+ android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon)
return module
}
// prebuilt_font installs a font in <partition>/fonts directory.
-func PrebuiltFontFactory() Module {
+func PrebuiltFontFactory() android.Module {
module := &PrebuiltEtc{}
InitPrebuiltEtcModule(module, "fonts")
// This module is device-only
- InitAndroidArchModule(module, DeviceSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
}
// prebuilt_firmware installs a firmware file to <partition>/etc/firmware directory for system image.
// If soc_specific property is set to true, the firmware file is installed to the vendor <partition>/firmware
// directory for vendor image.
-func PrebuiltFirmwareFactory() Module {
+func PrebuiltFirmwareFactory() android.Module {
module := &PrebuiltEtc{}
module.socInstallDirBase = "firmware"
InitPrebuiltEtcModule(module, "etc/firmware")
// This module is device-only
- InitAndroidArchModule(module, DeviceSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
}
diff --git a/android/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index 6e751e75..e13cb3cb 100644
--- a/android/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -12,24 +12,53 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package android
+package etc
import (
+ "io/ioutil"
+ "os"
"path/filepath"
"reflect"
"testing"
+
+ "android/soong/android"
)
-func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
+var buildDir string
+
+func setUp() {
+ var err error
+ buildDir, err = ioutil.TempDir("", "soong_etc_test")
+ if err != nil {
+ panic(err)
+ }
+}
+
+func tearDown() {
+ os.RemoveAll(buildDir)
+}
+
+func TestMain(m *testing.M) {
+ run := func() int {
+ setUp()
+ defer tearDown()
+
+ return m.Run()
+ }
+
+ os.Exit(run())
+}
+
+func testPrebuiltEtc(t *testing.T, bp string) (*android.TestContext, android.Config) {
fs := map[string][]byte{
"foo.conf": nil,
"bar.conf": nil,
"baz.conf": nil,
}
- config := TestArchConfig(buildDir, nil, bp, fs)
+ config := android.TestArchConfig(buildDir, nil, bp, fs)
- ctx := NewTestArchContext()
+ ctx := android.NewTestArchContext()
ctx.RegisterModuleType("prebuilt_etc", PrebuiltEtcFactory)
ctx.RegisterModuleType("prebuilt_etc_host", PrebuiltEtcHostFactory)
ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
@@ -38,9 +67,9 @@ func testPrebuiltEtc(t *testing.T, bp string) (*TestContext, Config) {
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
- FailIfErrored(t, errs)
+ android.FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)
- FailIfErrored(t, errs)
+ android.FailIfErrored(t, errs)
return ctx, config
}
@@ -142,7 +171,7 @@ func TestPrebuiltEtcAndroidMk(t *testing.T) {
}
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*PrebuiltEtc)
- entries := AndroidMkEntriesForTest(t, config, "", mod)[0]
+ entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
for k, expectedValue := range expected {
if value, ok := entries.EntryMap[k]; ok {
if !reflect.DeepEqual(value, expectedValue) {
@@ -162,7 +191,7 @@ func TestPrebuiltEtcHost(t *testing.T) {
}
`)
- buildOS := BuildOs.String()
+ buildOS := android.BuildOs.String()
p := ctx.ModuleForTests("foo.conf", buildOS+"_common").Module().(*PrebuiltEtc)
if !p.Host() {
t.Errorf("host bit is not set for a prebuilt_etc_host module.")
@@ -194,7 +223,7 @@ func TestPrebuiltUserShareHostInstallDirPath(t *testing.T) {
}
`)
- buildOS := BuildOs.String()
+ buildOS := android.BuildOs.String()
p := ctx.ModuleForTests("foo.conf", buildOS+"_common").Module().(*PrebuiltEtc)
expected := filepath.Join(buildDir, "host", config.PrebuiltOS(), "usr", "share", "bar")
if p.installDirPath.String() != expected {
diff --git a/genrule/Android.bp b/genrule/Android.bp
new file mode 100644
index 00000000..ff543a61
--- /dev/null
+++ b/genrule/Android.bp
@@ -0,0 +1,18 @@
+bootstrap_go_package {
+ name: "soong-genrule",
+ pkgPath: "android/soong/genrule",
+ deps: [
+ "blueprint",
+ "blueprint-pathtools",
+ "soong",
+ "soong-android",
+ "soong-shared",
+ ],
+ srcs: [
+ "genrule.go",
+ ],
+ testSrcs: [
+ "genrule_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/java/Android.bp b/java/Android.bp
new file mode 100644
index 00000000..2de1b8ea
--- /dev/null
+++ b/java/Android.bp
@@ -0,0 +1,66 @@
+bootstrap_go_package {
+ name: "soong-java",
+ pkgPath: "android/soong/java",
+ deps: [
+ "blueprint",
+ "blueprint-pathtools",
+ "soong",
+ "soong-android",
+ "soong-cc",
+ "soong-dexpreopt",
+ "soong-genrule",
+ "soong-java-config",
+ "soong-remoteexec",
+ "soong-tradefed",
+ ],
+ srcs: [
+ "aapt2.go",
+ "aar.go",
+ "android_manifest.go",
+ "android_resources.go",
+ "androidmk.go",
+ "app_builder.go",
+ "app.go",
+ "builder.go",
+ "device_host_converter.go",
+ "dex.go",
+ "dexpreopt.go",
+ "dexpreopt_bootjars.go",
+ "dexpreopt_config.go",
+ "droiddoc.go",
+ "gen.go",
+ "genrule.go",
+ "hiddenapi.go",
+ "hiddenapi_singleton.go",
+ "jacoco.go",
+ "java.go",
+ "jdeps.go",
+ "java_resources.go",
+ "kotlin.go",
+ "platform_compat_config.go",
+ "plugin.go",
+ "prebuilt_apis.go",
+ "proto.go",
+ "robolectric.go",
+ "sdk.go",
+ "sdk_library.go",
+ "support_libraries.go",
+ "sysprop.go",
+ "system_modules.go",
+ "testing.go",
+ "tradefed.go",
+ ],
+ testSrcs: [
+ "androidmk_test.go",
+ "app_test.go",
+ "device_host_converter_test.go",
+ "dexpreopt_test.go",
+ "dexpreopt_bootjars_test.go",
+ "java_test.go",
+ "jdeps_test.go",
+ "kotlin_test.go",
+ "plugin_test.go",
+ "sdk_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/java/config/Android.bp b/java/config/Android.bp
new file mode 100644
index 00000000..19835218
--- /dev/null
+++ b/java/config/Android.bp
@@ -0,0 +1,15 @@
+bootstrap_go_package {
+ name: "soong-java-config",
+ pkgPath: "android/soong/java/config",
+ deps: [
+ "blueprint-proptools",
+ "soong-android",
+ "soong-remoteexec",
+ ],
+ srcs: [
+ "config.go",
+ "error_prone.go",
+ "kotlin.go",
+ "makevars.go",
+ ],
+}
diff --git a/phony/Android.bp b/phony/Android.bp
new file mode 100644
index 00000000..2c423ef7
--- /dev/null
+++ b/phony/Android.bp
@@ -0,0 +1,12 @@
+bootstrap_go_package {
+ name: "soong-phony",
+ pkgPath: "android/soong/phony",
+ deps: [
+ "blueprint",
+ "soong-android",
+ ],
+ srcs: [
+ "phony.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/python/Android.bp b/python/Android.bp
new file mode 100644
index 00000000..ffd03fe8
--- /dev/null
+++ b/python/Android.bp
@@ -0,0 +1,24 @@
+bootstrap_go_package {
+ name: "soong-python",
+ pkgPath: "android/soong/python",
+ deps: [
+ "blueprint",
+ "soong-android",
+ "soong-tradefed",
+ ],
+ srcs: [
+ "androidmk.go",
+ "binary.go",
+ "builder.go",
+ "defaults.go",
+ "installer.go",
+ "library.go",
+ "proto.go",
+ "python.go",
+ "test.go",
+ ],
+ testSrcs: [
+ "python_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/remoteexec/Android.bp b/remoteexec/Android.bp
new file mode 100644
index 00000000..fc2c0e32
--- /dev/null
+++ b/remoteexec/Android.bp
@@ -0,0 +1,15 @@
+bootstrap_go_package {
+ name: "soong-remoteexec",
+ pkgPath: "android/soong/remoteexec",
+ deps: [
+ "blueprint",
+ "soong-android",
+ ],
+ srcs: [
+ "remoteexec.go",
+ ],
+ testSrcs: [
+ "remoteexec_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/rust/Android.bp b/rust/Android.bp
new file mode 100644
index 00000000..24fd8301
--- /dev/null
+++ b/rust/Android.bp
@@ -0,0 +1,30 @@
+bootstrap_go_package {
+ name: "soong-rust",
+ pkgPath: "android/soong/rust",
+ deps: [
+ "soong",
+ "soong-android",
+ "soong-cc",
+ "soong-rust-config",
+ ],
+ srcs: [
+ "androidmk.go",
+ "compiler.go",
+ "binary.go",
+ "builder.go",
+ "library.go",
+ "prebuilt.go",
+ "proc_macro.go",
+ "rust.go",
+ "test.go",
+ "testing.go",
+ ],
+ testSrcs: [
+ "binary_test.go",
+ "compiler_test.go",
+ "library_test.go",
+ "rust_test.go",
+ "test_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/rust/config/Android.bp b/rust/config/Android.bp
new file mode 100644
index 00000000..1a10312e
--- /dev/null
+++ b/rust/config/Android.bp
@@ -0,0 +1,19 @@
+bootstrap_go_package {
+ name: "soong-rust-config",
+ pkgPath: "android/soong/rust/config",
+ deps: [
+ "soong-android",
+ "soong-cc-config",
+ ],
+ srcs: [
+ "arm_device.go",
+ "arm64_device.go",
+ "global.go",
+ "toolchain.go",
+ "whitelist.go",
+ "x86_darwin_host.go",
+ "x86_linux_host.go",
+ "x86_device.go",
+ "x86_64_device.go",
+ ],
+}
diff --git a/sdk/Android.bp b/sdk/Android.bp
new file mode 100644
index 00000000..cb93351d
--- /dev/null
+++ b/sdk/Android.bp
@@ -0,0 +1,27 @@
+bootstrap_go_package {
+ name: "soong-sdk",
+ pkgPath: "android/soong/sdk",
+ deps: [
+ "blueprint",
+ "soong",
+ "soong-android",
+ "soong-apex",
+ "soong-cc",
+ "soong-java",
+ ],
+ srcs: [
+ "bp.go",
+ "exports.go",
+ "sdk.go",
+ "update.go",
+ ],
+ testSrcs: [
+ "bp_test.go",
+ "cc_sdk_test.go",
+ "exports_test.go",
+ "java_sdk_test.go",
+ "sdk_test.go",
+ "testing.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/sh/Android.bp b/sh/Android.bp
new file mode 100644
index 00000000..0b04e7de
--- /dev/null
+++ b/sh/Android.bp
@@ -0,0 +1,16 @@
+bootstrap_go_package {
+ name: "soong-sh",
+ pkgPath: "android/soong/sh",
+ deps: [
+ "blueprint",
+ "soong",
+ "soong-android",
+ ],
+ srcs: [
+ "sh_binary.go",
+ ],
+ testSrcs: [
+ "sh_binary_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/android/sh_binary.go b/sh/sh_binary.go
index 7d9dc67b..2dcd7162 100644
--- a/android/sh_binary.go
+++ b/sh/sh_binary.go
@@ -12,12 +12,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-package android
+package sh
import (
"fmt"
"path/filepath"
"strings"
+
+ "github.com/google/blueprint/proptools"
+
+ "android/soong/android"
)
// sh_binary is for shell scripts (and batch files) that are installed as
@@ -26,11 +30,15 @@ import (
// Do not use them for prebuilt C/C++/etc files. Use cc_prebuilt_binary
// instead.
+var pctx = android.NewPackageContext("android/soong/sh")
+
func init() {
- RegisterModuleType("sh_binary", ShBinaryFactory)
- RegisterModuleType("sh_binary_host", ShBinaryHostFactory)
- RegisterModuleType("sh_test", ShTestFactory)
- RegisterModuleType("sh_test_host", ShTestHostFactory)
+ pctx.Import("android/soong/android")
+
+ android.RegisterModuleType("sh_binary", ShBinaryFactory)
+ android.RegisterModuleType("sh_binary_host", ShBinaryHostFactory)
+ android.RegisterModuleType("sh_test", ShTestFactory)
+ android.RegisterModuleType("sh_test_host", ShTestHostFactory)
}
type shBinaryProperties struct {
@@ -69,55 +77,55 @@ type TestProperties struct {
}
type ShBinary struct {
- ModuleBase
+ android.ModuleBase
properties shBinaryProperties
- sourceFilePath Path
- outputFilePath OutputPath
- installedFile InstallPath
+ sourceFilePath android.Path
+ outputFilePath android.OutputPath
+ installedFile android.InstallPath
}
-var _ HostToolProvider = (*ShBinary)(nil)
+var _ android.HostToolProvider = (*ShBinary)(nil)
type ShTest struct {
ShBinary
testProperties TestProperties
- data Paths
+ data android.Paths
}
-func (s *ShBinary) HostToolPath() OptionalPath {
- return OptionalPathForPath(s.installedFile)
+func (s *ShBinary) HostToolPath() android.OptionalPath {
+ return android.OptionalPathForPath(s.installedFile)
}
-func (s *ShBinary) DepsMutator(ctx BottomUpMutatorContext) {
+func (s *ShBinary) DepsMutator(ctx android.BottomUpMutatorContext) {
if s.properties.Src == nil {
ctx.PropertyErrorf("src", "missing prebuilt source file")
}
}
-func (s *ShBinary) OutputFile() OutputPath {
+func (s *ShBinary) OutputFile() android.OutputPath {
return s.outputFilePath
}
func (s *ShBinary) SubDir() string {
- return String(s.properties.Sub_dir)
+ return proptools.String(s.properties.Sub_dir)
}
func (s *ShBinary) Installable() bool {
- return s.properties.Installable == nil || Bool(s.properties.Installable)
+ return s.properties.Installable == nil || proptools.Bool(s.properties.Installable)
}
func (s *ShBinary) Symlinks() []string {
return s.properties.Symlinks
}
-func (s *ShBinary) generateAndroidBuildActions(ctx ModuleContext) {
- s.sourceFilePath = PathForModuleSrc(ctx, String(s.properties.Src))
- filename := String(s.properties.Filename)
- filename_from_src := Bool(s.properties.Filename_from_src)
+func (s *ShBinary) generateAndroidBuildActions(ctx android.ModuleContext) {
+ s.sourceFilePath = android.PathForModuleSrc(ctx, proptools.String(s.properties.Src))
+ filename := proptools.String(s.properties.Filename)
+ filename_from_src := proptools.Bool(s.properties.Filename_from_src)
if filename == "" {
if filename_from_src {
filename = s.sourceFilePath.Base()
@@ -128,38 +136,38 @@ func (s *ShBinary) generateAndroidBuildActions(ctx ModuleContext) {
ctx.PropertyErrorf("filename_from_src", "filename is set. filename_from_src can't be true")
return
}
- s.outputFilePath = PathForModuleOut(ctx, filename).OutputPath
+ s.outputFilePath = android.PathForModuleOut(ctx, filename).OutputPath
// This ensures that outputFilePath has the correct name for others to
// use, as the source file may have a different name.
- ctx.Build(pctx, BuildParams{
- Rule: CpExecutable,
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.CpExecutable,
Output: s.outputFilePath,
Input: s.sourceFilePath,
})
}
-func (s *ShBinary) GenerateAndroidBuildActions(ctx ModuleContext) {
+func (s *ShBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
s.generateAndroidBuildActions(ctx)
- installDir := PathForModuleInstall(ctx, "bin", String(s.properties.Sub_dir))
+ installDir := android.PathForModuleInstall(ctx, "bin", proptools.String(s.properties.Sub_dir))
s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath)
}
-func (s *ShBinary) AndroidMkEntries() []AndroidMkEntries {
- return []AndroidMkEntries{AndroidMkEntries{
+func (s *ShBinary) AndroidMkEntries() []android.AndroidMkEntries {
+ return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "EXECUTABLES",
- OutputFile: OptionalPathForPath(s.outputFilePath),
+ OutputFile: android.OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
- ExtraEntries: []AndroidMkExtraEntriesFunc{
- func(entries *AndroidMkEntries) {
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries)
},
},
}}
}
-func (s *ShBinary) customAndroidMkEntries(entries *AndroidMkEntries) {
- entries.SetString("LOCAL_MODULE_RELATIVE_PATH", String(s.properties.Sub_dir))
+func (s *ShBinary) customAndroidMkEntries(entries *android.AndroidMkEntries) {
+ entries.SetString("LOCAL_MODULE_RELATIVE_PATH", proptools.String(s.properties.Sub_dir))
entries.SetString("LOCAL_MODULE_SUFFIX", "")
entries.SetString("LOCAL_MODULE_STEM", s.outputFilePath.Rel())
if len(s.properties.Symlinks) > 0 {
@@ -167,38 +175,38 @@ func (s *ShBinary) customAndroidMkEntries(entries *AndroidMkEntries) {
}
}
-func (s *ShTest) GenerateAndroidBuildActions(ctx ModuleContext) {
+func (s *ShTest) GenerateAndroidBuildActions(ctx android.ModuleContext) {
s.ShBinary.generateAndroidBuildActions(ctx)
testDir := "nativetest"
if ctx.Target().Arch.ArchType.Multilib == "lib64" {
testDir = "nativetest64"
}
- if ctx.Target().NativeBridge == NativeBridgeEnabled {
+ if ctx.Target().NativeBridge == android.NativeBridgeEnabled {
testDir = filepath.Join(testDir, ctx.Target().NativeBridgeRelativePath)
} else if !ctx.Host() && ctx.Config().HasMultilibConflict(ctx.Arch().ArchType) {
testDir = filepath.Join(testDir, ctx.Arch().ArchType.String())
}
- installDir := PathForModuleInstall(ctx, testDir, String(s.properties.Sub_dir))
+ installDir := android.PathForModuleInstall(ctx, testDir, proptools.String(s.properties.Sub_dir))
s.installedFile = ctx.InstallExecutable(installDir, s.outputFilePath.Base(), s.outputFilePath)
- s.data = PathsForModuleSrc(ctx, s.testProperties.Data)
+ s.data = android.PathsForModuleSrc(ctx, s.testProperties.Data)
}
func (s *ShTest) InstallInData() bool {
return true
}
-func (s *ShTest) AndroidMkEntries() []AndroidMkEntries {
- return []AndroidMkEntries{AndroidMkEntries{
+func (s *ShTest) AndroidMkEntries() []android.AndroidMkEntries {
+ return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "NATIVE_TESTS",
- OutputFile: OptionalPathForPath(s.outputFilePath),
+ OutputFile: android.OptionalPathForPath(s.outputFilePath),
Include: "$(BUILD_SYSTEM)/soong_cc_prebuilt.mk",
- ExtraEntries: []AndroidMkExtraEntriesFunc{
- func(entries *AndroidMkEntries) {
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(entries *android.AndroidMkEntries) {
s.customAndroidMkEntries(entries)
entries.AddStrings("LOCAL_COMPATIBILITY_SUITE", s.testProperties.Test_suites...)
- entries.SetString("LOCAL_TEST_CONFIG", String(s.testProperties.Test_config))
+ entries.SetString("LOCAL_TEST_CONFIG", proptools.String(s.testProperties.Test_config))
for _, d := range s.data {
rel := d.Rel()
path := d.String()
@@ -219,41 +227,41 @@ func InitShBinaryModule(s *ShBinary) {
// sh_binary is for a shell script or batch file to be installed as an
// executable binary to <partition>/bin.
-func ShBinaryFactory() Module {
+func ShBinaryFactory() android.Module {
module := &ShBinary{}
- module.Prefer32(func(ctx BaseModuleContext, base *ModuleBase, class OsClass) bool {
- return class == Device && ctx.Config().DevicePrefer32BitExecutables()
+ module.Prefer32(func(ctx android.BaseModuleContext, base *android.ModuleBase, class android.OsClass) bool {
+ return class == android.Device && ctx.Config().DevicePrefer32BitExecutables()
})
InitShBinaryModule(module)
- InitAndroidArchModule(module, HostAndDeviceSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
return module
}
// sh_binary_host is for a shell script to be installed as an executable binary
// to $(HOST_OUT)/bin.
-func ShBinaryHostFactory() Module {
+func ShBinaryHostFactory() android.Module {
module := &ShBinary{}
InitShBinaryModule(module)
- InitAndroidArchModule(module, HostSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst)
return module
}
// sh_test defines a shell script based test module.
-func ShTestFactory() Module {
+func ShTestFactory() android.Module {
module := &ShTest{}
InitShBinaryModule(&module.ShBinary)
module.AddProperties(&module.testProperties)
- InitAndroidArchModule(module, HostAndDeviceSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibFirst)
return module
}
// sh_test_host defines a shell script based test module that runs on a host.
-func ShTestHostFactory() Module {
+func ShTestHostFactory() android.Module {
module := &ShTest{}
InitShBinaryModule(&module.ShBinary)
module.AddProperties(&module.testProperties)
- InitAndroidArchModule(module, HostSupported, MultilibFirst)
+ android.InitAndroidArchModule(module, android.HostSupported, android.MultilibFirst)
return module
}
diff --git a/android/sh_binary_test.go b/sh/sh_binary_test.go
index 137e7734..6c0d96ab 100644
--- a/android/sh_binary_test.go
+++ b/sh/sh_binary_test.go
@@ -1,27 +1,56 @@
-package android
+package sh
import (
+ "io/ioutil"
+ "os"
"reflect"
"testing"
+
+ "android/soong/android"
)
-func testShBinary(t *testing.T, bp string) (*TestContext, Config) {
+var buildDir string
+
+func setUp() {
+ var err error
+ buildDir, err = ioutil.TempDir("", "soong_sh_test")
+ if err != nil {
+ panic(err)
+ }
+}
+
+func tearDown() {
+ os.RemoveAll(buildDir)
+}
+
+func TestMain(m *testing.M) {
+ run := func() int {
+ setUp()
+ defer tearDown()
+
+ return m.Run()
+ }
+
+ os.Exit(run())
+}
+
+func testShBinary(t *testing.T, bp string) (*android.TestContext, android.Config) {
fs := map[string][]byte{
"test.sh": nil,
"testdata/data1": nil,
"testdata/sub/data2": nil,
}
- config := TestArchConfig(buildDir, nil, bp, fs)
+ config := android.TestArchConfig(buildDir, nil, bp, fs)
- ctx := NewTestArchContext()
+ ctx := android.NewTestArchContext()
ctx.RegisterModuleType("sh_test", ShTestFactory)
ctx.RegisterModuleType("sh_test_host", ShTestHostFactory)
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})
- FailIfErrored(t, errs)
+ android.FailIfErrored(t, errs)
_, errs = ctx.PrepareBuildActions(config)
- FailIfErrored(t, errs)
+ android.FailIfErrored(t, errs)
return ctx, config
}
@@ -41,7 +70,7 @@ func TestShTestTestData(t *testing.T) {
mod := ctx.ModuleForTests("foo", "android_arm64_armv8-a").Module().(*ShTest)
- entries := AndroidMkEntriesForTest(t, config, "", mod)[0]
+ entries := android.AndroidMkEntriesForTest(t, config, "", mod)[0]
expected := []string{":testdata/data1", ":testdata/sub/data2"}
actual := entries.EntryMap["LOCAL_TEST_DATA"]
if !reflect.DeepEqual(expected, actual) {
@@ -62,7 +91,7 @@ func TestShTestHost(t *testing.T) {
}
`)
- buildOS := BuildOs.String()
+ buildOS := android.BuildOs.String()
mod := ctx.ModuleForTests("foo", buildOS+"_x86_64").Module().(*ShTest)
if !mod.Host() {
t.Errorf("host bit is not set for a sh_test_host module.")
diff --git a/shared/Android.bp b/shared/Android.bp
new file mode 100644
index 00000000..07dfe11d
--- /dev/null
+++ b/shared/Android.bp
@@ -0,0 +1,7 @@
+bootstrap_go_package {
+ name: "soong-shared",
+ pkgPath: "android/soong/shared",
+ srcs: [
+ "paths.go",
+ ],
+}
diff --git a/sysprop/Android.bp b/sysprop/Android.bp
new file mode 100644
index 00000000..48094f1e
--- /dev/null
+++ b/sysprop/Android.bp
@@ -0,0 +1,18 @@
+bootstrap_go_package {
+ name: "soong-sysprop",
+ pkgPath: "android/soong/sysprop",
+ deps: [
+ "blueprint",
+ "soong",
+ "soong-android",
+ "soong-cc",
+ "soong-java",
+ ],
+ srcs: [
+ "sysprop_library.go",
+ ],
+ testSrcs: [
+ "sysprop_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/tradefed/Android.bp b/tradefed/Android.bp
new file mode 100644
index 00000000..6e5e5330
--- /dev/null
+++ b/tradefed/Android.bp
@@ -0,0 +1,14 @@
+bootstrap_go_package {
+ name: "soong-tradefed",
+ pkgPath: "android/soong/tradefed",
+ deps: [
+ "blueprint",
+ "soong-android",
+ ],
+ srcs: [
+ "autogen.go",
+ "config.go",
+ "makevars.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/xml/Android.bp b/xml/Android.bp
new file mode 100644
index 00000000..cd25cff7
--- /dev/null
+++ b/xml/Android.bp
@@ -0,0 +1,18 @@
+bootstrap_go_package {
+ name: "soong-xml",
+ pkgPath: "android/soong/xml",
+ deps: [
+ "blueprint",
+ "blueprint-pathtools",
+ "soong",
+ "soong-android",
+ "soong-etc",
+ ],
+ srcs: [
+ "xml.go",
+ ],
+ testSrcs: [
+ "xml_test.go",
+ ],
+ pluginFor: ["soong_build"],
+}
diff --git a/xml/xml.go b/xml/xml.go
index 3a680eca..8810ae4d 100644
--- a/xml/xml.go
+++ b/xml/xml.go
@@ -16,6 +16,7 @@ package xml
import (
"android/soong/android"
+ "android/soong/etc"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -62,7 +63,7 @@ type prebuiltEtcXmlProperties struct {
}
type prebuiltEtcXml struct {
- android.PrebuiltEtc
+ etc.PrebuiltEtc
properties prebuiltEtcXmlProperties
}
@@ -121,7 +122,7 @@ func (p *prebuiltEtcXml) GenerateAndroidBuildActions(ctx android.ModuleContext)
func PrebuiltEtcXmlFactory() android.Module {
module := &prebuiltEtcXml{}
module.AddProperties(&module.properties)
- android.InitPrebuiltEtcModule(&module.PrebuiltEtc, "etc")
+ etc.InitPrebuiltEtcModule(&module.PrebuiltEtc, "etc")
// This module is device-only
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
return module
diff --git a/xml/xml_test.go b/xml/xml_test.go
index f8ec8235..abcb1085 100644
--- a/xml/xml_test.go
+++ b/xml/xml_test.go
@@ -20,6 +20,7 @@ import (
"testing"
"android/soong/android"
+ "android/soong/etc"
)
var buildDir string
@@ -57,7 +58,7 @@ func testXml(t *testing.T, bp string) *android.TestContext {
}
config := android.TestArchConfig(buildDir, nil, bp, fs)
ctx := android.NewTestArchContext()
- ctx.RegisterModuleType("prebuilt_etc", android.PrebuiltEtcFactory)
+ ctx.RegisterModuleType("prebuilt_etc", etc.PrebuiltEtcFactory)
ctx.RegisterModuleType("prebuilt_etc_xml", PrebuiltEtcXmlFactory)
ctx.Register(config)
_, errs := ctx.ParseFileList(".", []string{"Android.bp"})