Merge "Use named options for verify_overlaps"
diff --git a/android/bazel.go b/android/bazel.go
index af5de12..edf67d4 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -435,146 +435,103 @@
// Per-module denylist to always opt modules out of both bp2build and mixed builds.
bp2buildModuleDoNotConvertList = []string{
- "libnativehelper_compat_libc", // Broken compile: implicit declaration of function 'strerror_r' is invalid in C99
+ // cc bugs
+ "libsepol", // TODO(b/207408632): Unsupported case of .l sources in cc library rules
+ "libactivitymanager_aidl", // TODO(b/207426160): Unsupported use of aidl sources (via Dactivity_manager_procstate_aidl) in a cc_library
+ "gen-kotlin-build-file.py", // TODO(b/198619163) module has same name as source
+ "libgtest_ndk_c++", "libgtest_main_ndk_c++", // TODO(b/201816222): Requires sdk_version support.
+ "linkerconfig", "mdnsd", // TODO(b/202876379): has arch-variant static_executable
+ "linker", // TODO(b/228316882): cc_binary uses link_crt
+ "libdebuggerd", // TODO(b/228314770): support product variable-specific header_libs
+ "versioner", // TODO(b/228313961): depends on prebuilt shared library libclang-cpp_host as a shared library, which does not supply expected providers for a shared library
- "libart", // depends on unconverted modules: art_operator_srcs, libodrstatslog, libelffile, art_cmdlineparser_headers, cpp-define-generator-definitions, libcpu_features, libdexfile, libartpalette, libbacktrace, libnativebridge, libnativeloader, libsigchain, libunwindstack, libartbase, libprofile, cpp-define-generator-asm-support, apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, libstatssocket, heapprofd_client_api
- "libart-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libart-compiler, libdexfile, libprofile, libartbase, libbacktrace, libartbase-art-gtest
- "libart_headers", // depends on unconverted modules: art_libartbase_headers
- "libartd", // depends on unconverted modules: apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, libstatssocket, heapprofd_client_api, art_operator_srcs, libodrstatslog, libelffiled, art_cmdlineparser_headers, cpp-define-generator-definitions, libcpu_features, libdexfiled, libartpalette, libbacktrace, libnativebridge, libnativeloader, libsigchain, libunwindstack, libartbased, libprofiled, cpp-define-generator-asm-support
- "libartd-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libartd-compiler, libdexfiled, libprofiled, libartbased, libbacktrace, libartbased-art-gtest
- "libstatslog_art", // depends on unconverted modules: statslog_art.cpp, statslog_art.h
- "statslog_art.h", "statslog_art.cpp", // depends on unconverted modules: stats-log-api-gen
-
- "libandroid_runtime_lazy", // depends on unconverted modules: libbinder_headers
- "libcmd", // depends on unconverted modules: libbinder
-
- "libdexfile_support_static", // Depends on unconverted module: libdexfile_external_headers
- "libunwindstack_local", "libunwindstack_utils", "libc_malloc_debug", "libfdtrack", // Depends on unconverted module: libunwindstack
-
- "libdexfile_support", // TODO(b/210546943): Enabled based on product variables.
- "libdexfile_external_headers", // TODO(b/210546943): Enabled based on product variables.
-
- "libunwindstack", // Depends on unconverted module libdexfile_support.
- "libnativehelper_compat_libc++", // Broken compile: implicit declaration of function 'strerror_r' is invalid in C99
-
- "chkcon", "sefcontext_compile", // depends on unconverted modules: libsepol
-
- "libsepol", // TODO(b/207408632): Unsupported case of .l sources in cc library rules
-
- "gen-kotlin-build-file.py", // module has same name as source
-
- "libactivitymanager_aidl", // TODO(b/207426160): Depends on activity_manager_procstate_aidl, which is an aidl filegroup.
-
- "libnativehelper_lazy_mts_jni", "libnativehelper_mts_jni", // depends on unconverted modules: libgmock_ndk
- "libnativetesthelper_jni", "libgmock_main_ndk", "libgmock_ndk", // depends on unconverted module: libgtest_ndk_c++
-
- "statslog-framework-java-gen", "statslog.cpp", "statslog.h", "statslog.rs", "statslog_header.rs", // depends on unconverted modules: stats-log-api-gen
-
- "stats-log-api-gen", // depends on unconverted modules: libstats_proto_host, libprotobuf-cpp-full
-
- "libstatslog", // depends on unconverted modules: statslog.cpp, statslog.h, ...
-
- "cmd", // depends on unconverted module packagemanager_aidl-cpp, of unsupported type aidl_interface
- "servicedispatcher", // depends on unconverted module android.debug_aidl, of unsupported type aidl_interface
- "libutilscallstack", // depends on unconverted module libbacktrace
- "libbacktrace", // depends on unconverted module libunwindstack
- "libdebuggerd_handler", // depends on unconverted module libdebuggerd_handler_core
- "libdebuggerd_handler_core", "libdebuggerd_handler_fallback", // depends on unconverted module libdebuggerd
- "unwind_for_offline", // depends on unconverted module libunwindstack_utils
- "libdebuggerd", // depends on unconverted modules libdexfile_support, libunwindstack, gwp_asan_crash_handler, libtombstone_proto, libprotobuf-cpp-lite
- "libdexfile_static", // depends on libartpalette, libartbase, libdexfile, which are of unsupported type: art_cc_library.
-
- "static_crasher", // depends on unconverted modules: libdebuggerd_handler
-
- "pbtombstone", "crash_dump", // depends on libdebuggerd, libunwindstack
-
- "libbase_ndk", // http://b/186826477, fails to link libctscamera2_jni for device (required for CtsCameraTestCases)
-
- "libprotobuf-internal-protos", // b/210751803, we don't handle path property for filegroups
- "libprotobuf-internal-python-srcs", // b/210751803, we don't handle path property for filegroups
- "libprotobuf-java-full", // b/210751803, we don't handle path property for filegroups
- "host-libprotobuf-java-full", // b/210751803, we don't handle path property for filegroups
- "libprotobuf-java-util-full", // b/210751803, we don't handle path property for filegroups
- "apex_manifest_proto_java", // b/210751803, depends on libprotobuf-java-full
- "conscrypt", // b/210751803, we don't handle path property for filegroups
- "conscrypt-for-host", // b/210751803, we don't handle path property for filegroups
-
- "libprotobuf-java-nano", // b/220869005, depends on non-public_current SDK
- "host-libprotobuf-java-nano", // b/220869005, depends on libprotobuf-java-nano
-
- "libc_musl_sysroot_bionic_arch_headers", // b/218405924, depends on soong_zip
- "libc_musl_sysroot_bionic_headers", // b/218405924, depends on soong_zip and generates duplicate srcs
+ // java bugs
+ "libbase_ndk", // TODO(b/186826477): fails to link libctscamera2_jni for device (required for CtsCameraTestCases)
// python protos
- "libprotobuf-python", // contains .proto sources
- "conv_linker_config", // depends on linker_config_proto, a python lib with proto sources
- "apex_build_info_proto", "apex_manifest_proto", // a python lib with proto sources
- "linker_config_proto", // contains .proto sources
+ "libprotobuf-python", // TODO(b/196084681): contains .proto sources
+ "apex_build_info_proto", "apex_manifest_proto", // TODO(b/196084681): a python lib with proto sources
+ "linker_config_proto", // TODO(b/196084681): contains .proto sources
- "brotli-fuzzer-corpus", // b/202015218: outputs are in location incompatible with bazel genrule handling.
+ // genrule incompatibilities
+ "brotli-fuzzer-corpus", // TODO(b/202015218): outputs are in location incompatible with bazel genrule handling.
+ "platform_tools_properties", "build_tools_source_properties", // TODO(b/203369847): multiple genrules in the same package creating the same file
- // python modules
- "analyze_bcpf", // depends on bpmodify a blueprint_go_binary.
+ // aar support
+ "prebuilt_car-ui-androidx-core-common", // TODO(b/224773339), genrule dependency creates an .aar, not a .jar
+ "prebuilt_platform-robolectric-4.4-prebuilt", // aosp/1999250, needs .aar support in Jars
+ "prebuilt_platform-robolectric-4.5.1-prebuilt", // aosp/1999250, needs .aar support in Jars
- // b/203369847: multiple genrules in the same package creating the same file
- // //development/sdk/...
- "platform_tools_properties",
- "build_tools_source_properties",
-
- // APEX support
- "com.android.runtime", // depends on unconverted modules: bionic-linker-config, linkerconfig
-
- "libgtest_ndk_c++", // b/201816222: Requires sdk_version support.
- "libgtest_main_ndk_c++", // b/201816222: Requires sdk_version support.
-
- "abb", // depends on unconverted modules: libcmd, libbinder
- "adb", // depends on unconverted modules: AdbWinApi, libadb_host, libandroidfw, libapp_processes_protos_full, libfastdeploy_host, libopenscreen-discovery, libopenscreen-platform-impl, libusb, bin2c_fastdeployagent, AdbWinUsbApi
- "libadb_host", // depends on unconverted modules: libopenscreen-discovery, libopenscreen-platform-impl, libusb, AdbWinApi
- "libfastdeploy_host", // depends on unconverted modules: libandroidfw, libusb, AdbWinApi
- "linker", // depends on unconverted modules: libdebuggerd_handler_fallback
- "linker_reloc_bench_main", // depends on unconverted modules: liblinker_reloc_bench_*
- "versioner", // depends on unconverted modules: libclang_cxx_host, libLLVM_host, of unsupported type llvm_host_prebuilt_library_shared
-
- "linkerconfig", // http://b/202876379 has arch-variant static_executable
- "mdnsd", // http://b/202876379 has arch-variant static_executable
-
- "CarHTMLViewer", // depends on unconverted modules android.car-stubs, car-ui-lib
-
- "libdexfile", // depends on unconverted modules: dexfile_operator_srcs, libartbase, libartpalette,
- "libdexfiled", // depends on unconverted modules: dexfile_operator_srcs, libartbased, libartpalette
+ // path property for filegroups
+ "conscrypt", // TODO(b/210751803), we don't handle path property for filegroups
+ "conscrypt-for-host", // TODO(b/210751803), we don't handle path property for filegroups
+ "host-libprotobuf-java-full", // TODO(b/210751803), we don't handle path property for filegroups
+ "libprotobuf-internal-protos", // TODO(b/210751803), we don't handle path property for filegroups
+ "libprotobuf-internal-python-srcs", // TODO(b/210751803), we don't handle path property for filegroups
+ "libprotobuf-java-full", // TODO(b/210751803), we don't handle path property for filegroups
+ "libprotobuf-java-util-full", // TODO(b/210751803), we don't handle path property for filegroups
// go deps:
+ "analyze_bcpf", // depends on bpmodify a blueprint_go_binary.
"apex-protos", // depends on soong_zip, a go binary
"generated_android_icu4j_src_files", "generated_android_icu4j_test_files", "icu4c_test_data", // depends on unconverted modules: soong_zip
"host_bionic_linker_asm", // depends on extract_linker, a go binary.
"host_bionic_linker_script", // depends on extract_linker, a go binary.
- "robolectric-sqlite4java-native", // depends on soong_zip, a go binary
- "robolectric_tzdata", // depends on soong_zip, a go binary
+ "libc_musl_sysroot_bionic_arch_headers", // depends on soong_zip
+ "libc_musl_sysroot_bionic_headers", // 218405924, depends on soong_zip and generates duplicate srcs
"libc_musl_sysroot_libc++_headers", "libc_musl_sysroot_libc++abi_headers", // depends on soong_zip, zip2zip
+ "robolectric-sqlite4java-native", // depends on soong_zip, a go binary
+ "robolectric_tzdata", // depends on soong_zip, a go binary
- "android_icu4j_srcgen_binary", // Bazel build error: deps not allowed without srcs; move to runtime_deps
- "core-icu4j-for-host", // Bazel build error: deps not allowed without srcs; move to runtime_deps
-
- // java deps
- "android_icu4j_srcgen", // depends on unconverted modules: currysrc
- "bin2c_fastdeployagent", // depends on deployagent, a java binary
- "currysrc", // depends on unconverted modules: currysrc_org.eclipse, guavalib, jopt-simple-4.9
- "robolectric-sqlite4java-0.282", // depends on unconverted modules: robolectric-sqlite4java-import, robolectric-sqlite4java-native
- "timezone-host", // depends on unconverted modules: art.module.api.annotations
- "truth-host-prebuilt", // depends on unconverted modules: truth-prebuilt
- "truth-prebuilt", // depends on unconverted modules: asm-7.0, guava
-
- "generated_android_icu4j_resources", // depends on unconverted modules: android_icu4j_srcgen_binary, soong_zip
- "generated_android_icu4j_test_resources", // depends on unconverted modules: android_icu4j_srcgen_binary, soong_zip
-
- "art-script", // depends on unconverted modules: dalvikvm, dex2oat
- "dex2oat-script", // depends on unconverted modules: dex2oat
-
- "prebuilt_car-ui-androidx-core-common", // b/224773339, genrule dependency creates an .aar, not a .jar
- "prebuilt_platform-robolectric-4.4-prebuilt", // aosp/1999250, needs .aar support in Jars
- "prebuilt_platform-robolectric-4.5.1-prebuilt", // aosp/1999250, needs .aar support in Jars
-
+ // rust support
"libtombstoned_client_rust_bridge_code", "libtombstoned_client_wrapper", // rust conversions are not supported
+
+ // unconverted deps
+ "CarHTMLViewer", // depends on unconverted modules android.car-stubs, car-ui-lib
+ "abb", // depends on unconverted modules: libcmd, libbinder
+ "adb", // depends on unconverted modules: AdbWinApi, libandroidfw, libopenscreen-discovery, libopenscreen-platform-impl, libusb, bin2c_fastdeployagent, AdbWinUsbApi
+ "android_icu4j_srcgen", // depends on unconverted modules: currysrc
+ "android_icu4j_srcgen_binary", // depends on unconverted modules: android_icu4j_srcgen, currysrc
+ "apex_manifest_proto_java", // b/210751803, depends on libprotobuf-java-full
+ "art-script", // depends on unconverted modules: dalvikvm, dex2oat
+ "bin2c_fastdeployagent", // depends on unconverted modules: deployagent
+ "chkcon", "sefcontext_compile", // depends on unconverted modules: libsepol
+ "com.android.runtime", // depends on unconverted modules: bionic-linker-config, linkerconfig
+ "conv_linker_config", // depends on unconverted modules: linker_config_proto
+ "currysrc", // depends on unconverted modules: currysrc_org.eclipse, guavalib, jopt-simple-4.9
+ "dex2oat-script", // depends on unconverted modules: dex2oat
+ "generated_android_icu4j_resources", // depends on unconverted modules: android_icu4j_srcgen_binary, soong_zip
+ "generated_android_icu4j_test_resources", // depends on unconverted modules: android_icu4j_srcgen_binary, soong_zip
+ "host-libprotobuf-java-nano", // b/220869005, depends on libprotobuf-java-nano
+ "libadb_host", // depends on unconverted modules: AdbWinApi, libopenscreen-discovery, libopenscreen-platform-impl, libusb
+ "libart", // depends on unconverted modules: apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api, art_operator_srcs, libcpu_features, libodrstatslog, libelffile, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfile, libnativebridge, libnativeloader, libsigchain, libartbase, libprofile, cpp-define-generator-asm-support
+ "libart-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libart-compiler, libdexfile, libprofile, libartbase, libartbase-art-gtest
+ "libart_headers", // depends on unconverted modules: art_libartbase_headers
+ "libartd", // depends on unconverted modules: art_operator_srcs, libcpu_features, libodrstatslog, libelffiled, art_cmdlineparser_headers, cpp-define-generator-definitions, libdexfiled, libnativebridge, libnativeloader, libsigchain, libartbased, libprofiled, cpp-define-generator-asm-support, apex-info-list-tinyxml, libtinyxml2, libnativeloader-headers, heapprofd_client_api
+ "libartd-runtime-gtest", // depends on unconverted modules: libgtest_isolated, libartd-compiler, libdexfiled, libprofiled, libartbased, libartbased-art-gtest
+ "libdebuggerd_handler", // depends on unconverted module libdebuggerd_handler_core
+ "libdebuggerd_handler_core", "libdebuggerd_handler_fallback", // depends on unconverted module libdebuggerd
+ "libdexfile", // depends on unconverted modules: dexfile_operator_srcs, libartbase, libartpalette,
+ "libdexfile_static", // depends on unconverted modules: libartbase, libdexfile
+ "libdexfiled", // depends on unconverted modules: dexfile_operator_srcs, libartbased, libartpalette
+ "libfastdeploy_host", // depends on unconverted modules: libandroidfw, libusb, AdbWinApi
+ "libgmock_main_ndk", // depends on unconverted modules: libgtest_ndk_c++
+ "libgmock_ndk", // depends on unconverted modules: libgtest_ndk_c++
+ "libnativehelper_lazy_mts_jni", "libnativehelper_mts_jni", // depends on unconverted modules: libnativetesthelper_jni, libgmock_ndk
+ "libnativetesthelper_jni", // depends on unconverted modules: libgtest_ndk_c++
+ "libprotobuf-java-nano", // b/220869005, depends on non-public_current SDK
+ "libstatslog", // depends on unconverted modules: libstatspull, statsd-aidl-ndk, libbinder_ndk
+ "libstatslog_art", // depends on unconverted modules: statslog_art.cpp, statslog_art.h
+ "linker_reloc_bench_main", // depends on unconverted modules: liblinker_reloc_bench_*
+ "pbtombstone", "crash_dump", // depends on libdebuggerd, libunwindstack
+ "robolectric-sqlite4java-0.282", // depends on unconverted modules: robolectric-sqlite4java-import, robolectric-sqlite4java-native
+ "static_crasher", // depends on unconverted modules: libdebuggerd_handler
+ "stats-log-api-gen", // depends on unconverted modules: libstats_proto_host
+ "statslog.cpp", "statslog.h", "statslog.rs", // depends on unconverted modules: stats-log-api-gen
+ "statslog_art.cpp", "statslog_art.h", "statslog_header.rs", // depends on unconverted modules: stats-log-api-gen
+ "timezone-host", // depends on unconverted modules: art.module.api.annotations
+ "truth-host-prebuilt", // depends on unconverted modules: truth-prebuilt
+ "truth-prebuilt", // depends on unconverted modules: asm-7.0, guava
}
// Per-module denylist of cc_library modules to only generate the static
diff --git a/androidmk/androidmk/androidmk_test.go b/androidmk/androidmk/androidmk_test.go
index 2176361..afde68b 100644
--- a/androidmk/androidmk/androidmk_test.go
+++ b/androidmk/androidmk/androidmk_test.go
@@ -1690,6 +1690,21 @@
}
`,
},
+ {
+ desc: "convert android_app to android_test when having test_suites",
+ in: `
+include $(CLEAR_VARS)
+LOCAL_MODULE := foo
+LOCAL_COMPATIBILITY_SUITE := bar
+include $(BUILD_PACKAGE)
+ `,
+ expected: `
+android_test {
+ name: "foo",
+ test_suites: ["bar"],
+}
+`,
+ },
}
func TestEndToEnd(t *testing.T) {
diff --git a/bpfix/bpfix/bpfix.go b/bpfix/bpfix/bpfix.go
index 4f7d88c..94b28dc 100644
--- a/bpfix/bpfix/bpfix.go
+++ b/bpfix/bpfix/bpfix.go
@@ -449,6 +449,7 @@
}
hasInstrumentationFor := hasNonEmptyLiteralStringProperty(mod, "instrumentation_for")
+ hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites")
tags, _ := getLiteralListPropertyValue(mod, "tags")
var hasTestsTag bool
@@ -458,7 +459,7 @@
}
}
- isTest := hasInstrumentationFor || hasTestsTag
+ isTest := hasInstrumentationFor || hasTestsTag || hasTestSuites
if isTest {
switch mod.Type {
@@ -470,13 +471,7 @@
mod.Type = "java_test"
case "java_library_host":
mod.Type = "java_test_host"
- }
- }
-
- // when a cc_binary module has a nonempty test_suites field, modify the type to cc_test
- if mod.Type == "cc_binary" {
- hasTestSuites := hasNonEmptyLiteralListProperty(mod, "test_suites")
- if hasTestSuites {
+ case "cc_binary":
mod.Type = "cc_test"
}
}
diff --git a/bpfix/bpfix/bpfix_test.go b/bpfix/bpfix/bpfix_test.go
index 17b3c24..672e852 100644
--- a/bpfix/bpfix/bpfix_test.go
+++ b/bpfix/bpfix/bpfix_test.go
@@ -1436,6 +1436,38 @@
}
`,
},
+ {
+ name: "android_app with android_test",
+ in: `
+ android_app {
+ name: "foo",
+ srcs: ["srcs"],
+ test_suites: ["test_suite1"],
+ }
+ `,
+ out: `
+ android_test {
+ name: "foo",
+ srcs: ["srcs"],
+ test_suites: ["test_suite1"],
+ }
+ `,
+ },
+ {
+ name: "android_app without test_suites",
+ in: `
+ android_app {
+ name: "foo",
+ srcs: ["srcs"],
+ }
+ `,
+ out: `
+ android_app {
+ name: "foo",
+ srcs: ["srcs"],
+ }
+ `,
+ },
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
diff --git a/cc/config/global.go b/cc/config/global.go
index a4627b2..dfb9a66 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -222,7 +222,6 @@
"-Wno-misleading-indentation", // http://b/153746954
"-Wno-zero-as-null-pointer-constant", // http://b/68236239
"-Wno-deprecated-anon-enum-enum-conversion", // http://b/153746485
- "-Wno-deprecated-enum-enum-conversion", // http://b/153746563
"-Wno-string-compare", // http://b/153764102
"-Wno-pessimizing-move", // http://b/154270751
// New warnings to be fixed after clang-r399163
diff --git a/cc/pgo.go b/cc/pgo.go
index aa0feae..0632c15 100644
--- a/cc/pgo.go
+++ b/cc/pgo.go
@@ -32,8 +32,8 @@
}
globalPgoProfileProjects = []string{
- "toolchain/pgo-profiles",
- "vendor/google_data/pgo_profile",
+ "toolchain/pgo-profiles/pgo",
+ "vendor/google_data/pgo_profile/pgo",
}
)
diff --git a/mk2rbc/mk2rbc.go b/mk2rbc/mk2rbc.go
index 8807437..0942c28 100644
--- a/mk2rbc/mk2rbc.go
+++ b/mk2rbc/mk2rbc.go
@@ -32,6 +32,7 @@
"os"
"path/filepath"
"regexp"
+ "sort"
"strconv"
"strings"
"text/scanner"
@@ -110,6 +111,7 @@
"require-artifacts-in-path-relaxed": &simpleCallParser{name: baseName + ".require_artifacts_in_path_relaxed", returnType: starlarkTypeVoid},
// TODO(asmundak): remove it once all calls are removed from configuration makefiles. see b/183161002
"shell": &shellCallParser{},
+ "sort": &simpleCallParser{name: baseName + ".mksort", returnType: starlarkTypeList},
"strip": &simpleCallParser{name: baseName + ".mkstrip", returnType: starlarkTypeString},
"subst": &substCallParser{fname: "subst"},
"warning": &makeControlFuncParser{name: baseName + ".mkwarning"},
@@ -758,6 +760,16 @@
func (ctx *parseContext) handleSubConfig(
v mkparser.Node, pathExpr starlarkExpr, loadAlways bool, processModule func(inheritedModule) starlarkNode) []starlarkNode {
+ // Allow seeing $(sort $(wildcard realPathExpr)) or $(wildcard realPathExpr)
+ // because those are functionally the same as not having the sort/wildcard calls.
+ if ce, ok := pathExpr.(*callExpr); ok && ce.name == "rblf.mksort" && len(ce.args) == 1 {
+ if ce2, ok2 := ce.args[0].(*callExpr); ok2 && ce2.name == "rblf.expand_wildcard" && len(ce2.args) == 1 {
+ pathExpr = ce2.args[0]
+ }
+ } else if ce2, ok2 := pathExpr.(*callExpr); ok2 && ce2.name == "rblf.expand_wildcard" && len(ce2.args) == 1 {
+ pathExpr = ce2.args[0]
+ }
+
// In a simple case, the name of a module to inherit/include is known statically.
if path, ok := maybeString(pathExpr); ok {
// Note that even if this directive loads a module unconditionally, a module may be
@@ -765,6 +777,7 @@
moduleShouldExist := loadAlways && ctx.ifNestLevel == 0
if strings.Contains(path, "*") {
if paths, err := fs.Glob(ctx.script.sourceFS, path); err == nil {
+ sort.Strings(paths)
result := make([]starlarkNode, 0)
for _, p := range paths {
mi := ctx.newDependentModule(p, !moduleShouldExist)
diff --git a/mk2rbc/mk2rbc_test.go b/mk2rbc/mk2rbc_test.go
index 3698813..9c2b392 100644
--- a/mk2rbc/mk2rbc_test.go
+++ b/mk2rbc/mk2rbc_test.go
@@ -197,15 +197,31 @@
mkname: "path/product.mk",
in: `
$(call inherit-product, */font.mk)
+$(call inherit-product, $(sort $(wildcard */font.mk)))
+$(call inherit-product, $(wildcard */font.mk))
+
+include */font.mk
+include $(sort $(wildcard */font.mk))
+include $(wildcard */font.mk)
`,
expected: `load("//build/make/core:product_config.rbc", "rblf")
-load("//foo:font.star", _font_init = "init")
-load("//bar:font.star", _font1_init = "init")
+load("//bar:font.star", _font_init = "init")
+load("//foo:font.star", _font1_init = "init")
def init(g, handle):
cfg = rblf.cfg(handle)
- rblf.inherit(handle, "foo/font", _font_init)
- rblf.inherit(handle, "bar/font", _font1_init)
+ rblf.inherit(handle, "bar/font", _font_init)
+ rblf.inherit(handle, "foo/font", _font1_init)
+ rblf.inherit(handle, "bar/font", _font_init)
+ rblf.inherit(handle, "foo/font", _font1_init)
+ rblf.inherit(handle, "bar/font", _font_init)
+ rblf.inherit(handle, "foo/font", _font1_init)
+ _font_init(g, handle)
+ _font1_init(g, handle)
+ _font_init(g, handle)
+ _font1_init(g, handle)
+ _font_init(g, handle)
+ _font1_init(g, handle)
`,
},
{
@@ -1022,12 +1038,13 @@
`,
},
{
- desc: "strip function",
+ desc: "strip/sort functions",
mkname: "product.mk",
in: `
ifeq ($(filter hwaddress,$(PRODUCT_PACKAGES)),)
PRODUCT_PACKAGES := $(strip $(PRODUCT_PACKAGES) hwaddress)
endif
+MY_VAR := $(sort b a c)
`,
expected: `load("//build/make/core:product_config.rbc", "rblf")
@@ -1036,6 +1053,7 @@
if "hwaddress" not in cfg.get("PRODUCT_PACKAGES", []):
rblf.setdefault(handle, "PRODUCT_PACKAGES")
cfg["PRODUCT_PACKAGES"] = (rblf.mkstrip("%s hwaddress" % " ".join(cfg.get("PRODUCT_PACKAGES", [])))).split()
+ g["MY_VAR"] = rblf.mksort("b a c")
`,
},
{
diff --git a/provenance/tools/Android.bp b/provenance/tools/Android.bp
index 1f959bb..0eddd76 100644
--- a/provenance/tools/Android.bp
+++ b/provenance/tools/Android.bp
@@ -14,6 +14,10 @@
* limitations under the License.
*/
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
python_binary_host {
name: "gen_provenance_metadata",
srcs: [
diff --git a/sdk/testing.go b/sdk/testing.go
index 294f1a5..062f200 100644
--- a/sdk/testing.go
+++ b/sdk/testing.go
@@ -25,6 +25,8 @@
"android/soong/cc"
"android/soong/genrule"
"android/soong/java"
+
+ "github.com/google/blueprint/proptools"
)
// Prepare for running an sdk test with an apex.
@@ -81,6 +83,11 @@
}
}),
+ // Add a build number file.
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.BuildNumberFile = proptools.StringPtr(BUILD_NUMBER_FILE)
+ }),
+
// Make sure that every test provides all the source files.
android.PrepareForTestDisallowNonExistentPaths,
android.MockFS{
@@ -143,6 +150,8 @@
copyRules := &strings.Builder{}
otherCopyRules := &strings.Builder{}
snapshotDirPrefix := sdk.builderForTests.snapshotDir.String() + "/"
+
+ seenBuildNumberFile := false
for _, bp := range buildParams {
switch bp.Rule.String() {
case android.Cp.String():
@@ -152,8 +161,14 @@
src := android.NormalizePathForTesting(bp.Input)
// We differentiate between copy rules for the snapshot, and copy rules for the install file.
if strings.HasPrefix(output.String(), snapshotDirPrefix) {
- // Get source relative to build directory.
- _, _ = fmt.Fprintf(copyRules, "%s -> %s\n", src, dest)
+ // Don't include the build-number.txt file in the copy rules as that would break lots of
+ // tests, just verify that it is copied here as it should appear in every snapshot.
+ if output.Base() == BUILD_NUMBER_FILE {
+ seenBuildNumberFile = true
+ } else {
+ // Get source relative to build directory.
+ _, _ = fmt.Fprintf(copyRules, "%s -> %s\n", src, dest)
+ }
info.snapshotContents = append(info.snapshotContents, dest)
} else {
_, _ = fmt.Fprintf(otherCopyRules, "%s -> %s\n", src, dest)
@@ -189,6 +204,10 @@
}
}
+ if !seenBuildNumberFile {
+ panic(fmt.Sprintf("Every snapshot must include the %s file", BUILD_NUMBER_FILE))
+ }
+
info.copyRules = copyRules.String()
info.otherCopyRules = otherCopyRules.String()
diff --git a/sdk/update.go b/sdk/update.go
index 389e845..5db604b 100644
--- a/sdk/update.go
+++ b/sdk/update.go
@@ -281,6 +281,10 @@
return append(variants, newVariant)
}
+// BUILD_NUMBER_FILE is the name of the file in the snapshot zip that will contain the number of
+// the build from which the snapshot was produced.
+const BUILD_NUMBER_FILE = "snapshot-creation-build-number.txt"
+
// SDK directory structure
// <sdk_root>/
// Android.bp : definition of a 'sdk' module is here. This is a hand-made one.
@@ -479,6 +483,9 @@
bp.build(pctx, ctx, nil)
+ // Copy the build number file into the snapshot.
+ builder.CopyToSnapshot(ctx.Config().BuildNumberFile(ctx), BUILD_NUMBER_FILE)
+
filesToZip := builder.filesToZip
// zip them all