Merge "Enable host cross python test builds"
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 9700f8b..e22eec5 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -1565,10 +1565,10 @@
// also be built - do not add them to this list.
StagingMixedBuildsEnabledList = []string{
// M13: media.swcodec launch
- // TODO(b/282042844): reenable
- // "com.android.media.swcodec",
- // "test_com.android.media.swcodec",
- // "libstagefright_foundation",
+ "com.android.media.swcodec",
+ "test_com.android.media.swcodec",
+ "libstagefright_foundation",
+ "libcodec2_hidl@1.0",
}
// These should be the libs that are included by the apexes in the ProdMixedBuildsEnabledList
diff --git a/cc/config/global.go b/cc/config/global.go
index d4106eb..d63e324 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -438,6 +438,8 @@
pctx.StaticVariableWithEnvOverride("ClangShortVersion", "LLVM_RELEASE_VERSION", ClangDefaultShortVersion)
pctx.StaticVariable("ClangAsanLibDir", "${ClangBase}/linux-x86/${ClangVersion}/lib/clang/${ClangShortVersion}/lib/linux")
+ exportedVars.ExportStringListStaticVariable("WarningAllowedProjects", WarningAllowedProjects)
+
// These are tied to the version of LLVM directly in external/llvm, so they might trail the host prebuilts
// being used for the rest of the build process.
pctx.SourcePathVariable("RSClangBase", "prebuilts/clang/host")
diff --git a/cc/lto.go b/cc/lto.go
index 1afa1dd..581856b 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -91,11 +91,6 @@
return flags
}
- // TODO(b/254713216): LTO doesn't work on riscv64 yet.
- if ctx.Arch().ArchType == android.Riscv64 {
- return flags
- }
-
if lto.LTO(ctx) {
var ltoCFlag string
var ltoLdFlag string
diff --git a/java/app.go b/java/app.go
index 3344647..e095092 100755
--- a/java/app.go
+++ b/java/app.go
@@ -585,19 +585,6 @@
certificates = append([]Certificate{mainCert}, certificates...)
}
- if !m.Platform() {
- certPath := certificates[0].Pem.String()
- systemCertPath := ctx.Config().DefaultAppCertificateDir(ctx).String()
- if strings.HasPrefix(certPath, systemCertPath) {
- enforceSystemCert := ctx.Config().EnforceSystemCertificate()
- allowed := ctx.Config().EnforceSystemCertificateAllowList()
-
- if enforceSystemCert && !inList(m.Name(), allowed) {
- ctx.PropertyErrorf("certificate", "The module in product partition cannot be signed with certificate in system.")
- }
- }
- }
-
if len(certificates) > 0 {
mainCertificate = certificates[0]
} else {
@@ -613,6 +600,20 @@
}
}
+ if !m.Platform() {
+ certPath := mainCertificate.Pem.String()
+ systemCertPath := ctx.Config().DefaultAppCertificateDir(ctx).String()
+ if strings.HasPrefix(certPath, systemCertPath) {
+ enforceSystemCert := ctx.Config().EnforceSystemCertificate()
+ allowed := ctx.Config().EnforceSystemCertificateAllowList()
+
+ if enforceSystemCert && !inList(m.Name(), allowed) {
+ ctx.PropertyErrorf("certificate", "The module in product partition cannot be signed with certificate in system.")
+ }
+ }
+ }
+
+
return mainCertificate, certificates
}
diff --git a/java/app_test.go b/java/app_test.go
index 8a69a03..c485478 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -3382,6 +3382,14 @@
srcs: ["a.java"],
certificate: ":missing_certificate",
sdk_version: "current",
+ }
+
+ android_app {
+ name: "bar",
+ srcs: ["a.java"],
+ certificate: ":missing_certificate",
+ product_specific: true,
+ sdk_version: "current",
}`)
foo := result.ModuleForTests("foo", "android_common")
diff --git a/java/java.go b/java/java.go
index 65bfce0..bb8fe62 100644
--- a/java/java.go
+++ b/java/java.go
@@ -1650,7 +1650,7 @@
// list of api.txt files relative to this directory that contribute to the
// API surface.
// This is a list of relative paths
- Api_files []string
+ Api_files []string `android:"path"`
// List of flags to be passed to the javac compiler to generate jar file
Javacflags []string
@@ -1832,9 +1832,7 @@
// Add the api_files inputs
for _, api := range al.properties.Api_files {
- // Use MaybeExistentPathForSource since the api file might not exist during analysis.
- // This will be provided by the orchestrator in the combined execution.
- srcFiles = append(srcFiles, android.MaybeExistentPathForSource(ctx, ctx.ModuleDir(), api))
+ srcFiles = append(srcFiles, android.PathForModuleSrc(ctx, api))
}
if srcFiles == nil {
diff --git a/java/java_test.go b/java/java_test.go
index 2a4913e..ea89e6e 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2252,6 +2252,29 @@
android.AssertStringDoesContain(t, "Command expected to contain output files list text file flag", manifestCommand, "--out __SBOX_SANDBOX_DIR__/out/sources.txt")
}
+func TestJavaApiLibraryFilegroupInput(t *testing.T) {
+ ctx, _ := testJavaWithFS(t, `
+ filegroup {
+ name: "default_current.txt",
+ srcs: ["current.txt"],
+ }
+
+ java_api_library {
+ name: "foo",
+ api_files: [":default_current.txt"],
+ }
+ `,
+ map[string][]byte{
+ "current.txt": nil,
+ })
+
+ m := ctx.ModuleForTests("foo", "android_common")
+ outputs := fmt.Sprint(m.AllOutputs())
+ if !strings.Contains(outputs, "foo/foo.jar") {
+ t.Errorf("Module output does not contain expected jar %s", "foo/foo.jar")
+ }
+}
+
func TestTradefedOptions(t *testing.T) {
result := PrepareForTestWithJavaBuildComponents.RunTestWithBp(t, `
java_test_host {
diff --git a/java/testing.go b/java/testing.go
index 6671bf0..ffc3a08 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -71,7 +71,12 @@
// Needed for framework
defaultJavaDir + "/framework/aidl": nil,
// Needed for various deps defined in GatherRequiredDepsForTest()
- defaultJavaDir + "/a.java": nil,
+ defaultJavaDir + "/a.java": nil,
+ defaultJavaDir + "/api/current.txt": nil,
+ defaultJavaDir + "/api/system-current.txt": nil,
+ defaultJavaDir + "/api/test-current.txt": nil,
+ defaultJavaDir + "/api/module-lib-current.txt": nil,
+ defaultJavaDir + "/api/system-server-current.txt": nil,
// Needed for R8 rules on apps
"build/make/core/proguard.flags": nil,
diff --git a/tests/dcla_apex_comparison_test.sh b/tests/dcla_apex_comparison_test.sh
index 97ae97e..667dde0 100755
--- a/tests/dcla_apex_comparison_test.sh
+++ b/tests/dcla_apex_comparison_test.sh
@@ -45,6 +45,11 @@
com.android.tethering
)
+BAZEL_TARGETS=(
+ //packages/modules/adb/apex:com.android.adbd
+ //frameworks/av/apex:com.android.media.swcodec
+)
+
DCLA_LIBS=(
libbase.so
libc++.so
@@ -76,6 +81,10 @@
############
OUTPUT_DIR="$(mktemp -d tmp.XXXXXX)"
+function call_bazel() {
+ build/bazel/bin/bazel $@
+}
+
function cleanup {
rm -rf "${OUTPUT_DIR}"
}
@@ -87,7 +96,9 @@
function extract_dcla_libs() {
local product=$1; shift
- for module in "${MODULES[@]}"; do
+ local modules=("$@"); shift
+
+ for module in "${modules[@]}"; do
local apex="${OUTPUT_DIR}/${product}/${module}.apex"
local extract_dir="${OUTPUT_DIR}/${product}/${module}/extract"
@@ -97,11 +108,12 @@
function compare_dcla_libs() {
local product=$1; shift
+ local modules=("$@"); shift
for lib in "${DCLA_LIBS[@]}"; do
for arch in lib lib64; do
local prev_sha=""
- for module in "${MODULES[@]}"; do
+ for module in "${modules[@]}"; do
local file="${OUTPUT_DIR}/${product}/${module}/extract/${arch}/${lib}"
if [[ ! -f "${file}" ]]; then
# not all libs are present in a module
@@ -112,7 +124,7 @@
sha="${sha% *}"
if [ "${prev_sha}" == "" ]; then
prev_sha="${sha}"
- elif [ "${sha}" != "${prev_sha}" ] && { [ "${lib}" != "libcrypto.so" ] || [ "${module}" != "com.android.tethering" ]; }; then
+ elif [ "${sha}" != "${prev_sha}" ] && { [ "${lib}" != "libcrypto.so" ] || [[ "${module}" != *"com.android.tethering" ]]; }; then
echo "Test failed, ${lib} has different hash value"
exit 1
fi
@@ -131,8 +143,22 @@
--product "${product}" \
--dist_dir "${OUTPUT_DIR}/${product}"
- extract_dcla_libs "${product}"
- compare_dcla_libs "${product}"
+ bazel_apexes=()
+ if [[ -n ${TEST_BAZEL+x} ]] && [ "${TEST_BAZEL}" = true ]; then
+ export TARGET_PRODUCT="${product/module/aosp}"
+ call_bazel build --config=bp2build --config=ci --config=android "${BAZEL_TARGETS[@]}"
+ for target in "${BAZEL_TARGETS[@]}"; do
+ apex_path="$(realpath $(call_bazel cquery --config=bp2build --config=android --config=ci --output=files $target))"
+ mkdir -p ${OUTPUT_DIR}/${product}
+ bazel_apex="bazel_$(basename $apex_path)"
+ mv $apex_path ${OUTPUT_DIR}/${product}/${bazel_apex}
+ bazel_apexes+=(${bazel_apex%".apex"})
+ done
+ fi
+
+ all_modeuls=(${MODULES[@]} ${bazel_apexes[@]})
+ extract_dcla_libs "${product}" "${all_modeuls[@]}"
+ compare_dcla_libs "${product}" "${all_modeuls[@]}"
done
echo "Test passed"
diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh
index e1aa70c..db14bd4 100755
--- a/tests/run_integration_tests.sh
+++ b/tests/run_integration_tests.sh
@@ -15,8 +15,8 @@
# mock client.
"$TOP/build/soong/tests/apex_comparison_tests.sh"
"$TOP/build/soong/tests/apex_comparison_tests.sh" "module_arm64only"
-extra_build_params=--bazel-mode-staging "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
-BUILD_BROKEN_DISABLE_BAZEL=true "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
+TEST_BAZEL=true extra_build_params=--bazel-mode-staging "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
+#BUILD_BROKEN_DISABLE_BAZEL=true "$TOP/build/soong/tests/dcla_apex_comparison_test.sh"
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh"
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh" "aosp_arm" "armv7-a"
"$TOP/build/soong/tests/apex_cc_module_arch_variant_tests.sh" "aosp_cf_arm64_phone" "armv8-a" "cortex-a53"
diff --git a/ui/build/config.go b/ui/build/config.go
index 6b6ce71..8ec9680 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -316,9 +316,8 @@
func NewConfig(ctx Context, args ...string) Config {
ret := &configImpl{
- environ: OsEnvironment(),
- sandboxConfig: &SandboxConfig{},
- ninjaWeightListSource: HINT_FROM_SOONG,
+ environ: OsEnvironment(),
+ sandboxConfig: &SandboxConfig{},
}
// Default matching ninja