Merge changes I627f69b1,Ie5d7f259
* changes:
Prework for migrating min_sdk_version from (kind+level) to (level)
Always include host variants in the sdk snapshot
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index 8d4320a..2917931 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -873,6 +873,9 @@
"android.hardware.health-translate-java",
// cc_test related.
+ // b/274164834 "Could not open Configuration file test.cfg"
+ "svcenc", "svcdec",
+
// Failing host cc_tests
"memunreachable_unit_test",
"libprocinfo_test",
@@ -1439,8 +1442,10 @@
// Bazel prod-mode allowlist. Modules in this list are built by Bazel
// in either prod mode or staging mode.
ProdMixedBuildsEnabledList = []string{
+ // M5: tzdata launch
"com.android.tzdata",
"test1_com.android.tzdata",
+ // M7: adbd launch
"com.android.adbd",
"test_com.android.adbd",
"adbd_test",
@@ -1448,6 +1453,8 @@
"adb_pairing_auth_test",
"adb_pairing_connection_test",
"adb_tls_connection_test",
+ // M9: mixed builds for mainline trains launch
+ "api_fingerprint",
}
// Staging-mode allowlist. Modules in this list are only built
@@ -1455,21 +1462,19 @@
// which will soon be added to the prod allowlist.
// It is implicit that all modules in ProdMixedBuildsEnabledList will
// also be built - do not add them to this list.
- StagingMixedBuildsEnabledList = []string{
- "api_fingerprint",
- }
+ StagingMixedBuildsEnabledList = []string{}
// These should be the libs that are included by the apexes in the ProdMixedBuildsEnabledList
- ProdDclaMixedBuildsEnabledList = []string{}
-
- // These should be the libs that are included by the apexes in the StagingMixedBuildsEnabledList
- StagingDclaMixedBuildsEnabledList = []string{
+ ProdDclaMixedBuildsEnabledList = []string{
"libbase",
"libc++",
"libcrypto",
"libcutils",
}
+ // These should be the libs that are included by the apexes in the StagingMixedBuildsEnabledList
+ StagingDclaMixedBuildsEnabledList = []string{}
+
// TODO(b/269342245): Enable the rest of the DCLA libs
// "libssl",
// "libstagefright_flacdec",
diff --git a/android/arch.go b/android/arch.go
index 6acf9cf..4b4691b 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -1694,6 +1694,7 @@
return []archConfig{
{"arm64", "armv8-a-branchprot", "", []string{"arm64-v8a"}},
{"arm", "armv7-a-neon", "", []string{"armeabi-v7a"}},
+ {"riscv64", "", "", []string{"riscv64"}},
{"x86_64", "", "", []string{"x86_64"}},
{"x86", "", "", []string{"x86"}},
}
diff --git a/android/module.go b/android/module.go
index 773d77b..76fe8dc 100644
--- a/android/module.go
+++ b/android/module.go
@@ -37,26 +37,64 @@
DeviceStaticLibrary = "static_library"
)
+// BuildParameters describes the set of potential parameters to build a Ninja rule.
+// In general, these correspond to a Ninja concept.
type BuildParams struct {
- Rule blueprint.Rule
- Deps blueprint.Deps
- Depfile WritablePath
- Description string
- Output WritablePath
- Outputs WritablePaths
- SymlinkOutput WritablePath
- SymlinkOutputs WritablePaths
- ImplicitOutput WritablePath
+ // A Ninja Rule that will be written to the Ninja file. This allows factoring out common code
+ // among multiple modules to reduce repetition in the Ninja file of action requirements. A rule
+ // can contain variables that should be provided in Args.
+ Rule blueprint.Rule
+ // Deps represents the depfile format. When using RuleBuilder, this defaults to GCC when depfiles
+ // are used.
+ Deps blueprint.Deps
+ // Depfile is a writeable path that allows correct incremental builds when the inputs have not
+ // been fully specified by the Ninja rule. Ninja supports a subset of the Makefile depfile syntax.
+ Depfile WritablePath
+ // A description of the build action.
+ Description string
+ // Output is an output file of the action. When using this field, references to $out in the Ninja
+ // command will refer to this file.
+ Output WritablePath
+ // Outputs is a slice of output file of the action. When using this field, references to $out in
+ // the Ninja command will refer to these files.
+ Outputs WritablePaths
+ // SymlinkOutput is an output file specifically that is a symlink.
+ SymlinkOutput WritablePath
+ // SymlinkOutputs is a slice of output files specifically that is a symlink.
+ SymlinkOutputs WritablePaths
+ // ImplicitOutput is an output file generated by the action. Note: references to `$out` in the
+ // Ninja command will NOT include references to this file.
+ ImplicitOutput WritablePath
+ // ImplicitOutputs is a slice of output files generated by the action. Note: references to `$out`
+ // in the Ninja command will NOT include references to these files.
ImplicitOutputs WritablePaths
- Input Path
- Inputs Paths
- Implicit Path
- Implicits Paths
- OrderOnly Paths
- Validation Path
- Validations Paths
- Default bool
- Args map[string]string
+ // Input is an input file to the Ninja action. When using this field, references to $in in the
+ // Ninja command will refer to this file.
+ Input Path
+ // Inputs is a slice of input files to the Ninja action. When using this field, references to $in
+ // in the Ninja command will refer to these files.
+ Inputs Paths
+ // Implicit is an input file to the Ninja action. Note: references to `$in` in the Ninja command
+ // will NOT include references to this file.
+ Implicit Path
+ // Implicits is a slice of input files to the Ninja action. Note: references to `$in` in the Ninja
+ // command will NOT include references to these files.
+ Implicits Paths
+ // OrderOnly are Ninja order-only inputs to the action. When these are out of date, the output is
+ // not rebuilt until they are built, but changes in order-only dependencies alone do not cause the
+ // output to be rebuilt.
+ OrderOnly Paths
+ // Validation is an output path for a validation action. Validation outputs imply lower
+ // non-blocking priority to building non-validation outputs.
+ Validation Path
+ // Validations is a slice of output path for a validation action. Validation outputs imply lower
+ // non-blocking priority to building non-validation outputs.
+ Validations Paths
+ // Whether to skip outputting a default target statement which will be built by Ninja when no
+ // targets are specified on Ninja's command line.
+ Default bool
+ // Args is a key value mapping for replacements of variables within the Rule
+ Args map[string]string
}
type ModuleBuildParams BuildParams
diff --git a/apex/apex.go b/apex/apex.go
index b2ca6c4..4424b22 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -3025,8 +3025,8 @@
if a.UsePlatformApis() {
ctx.PropertyErrorf("updatable", "updatable APEXes can't use platform APIs")
}
- if a.SocSpecific() || a.DeviceSpecific() {
- ctx.PropertyErrorf("updatable", "vendor APEXes are not updatable")
+ if proptools.Bool(a.properties.Use_vndk_as_stable) {
+ ctx.PropertyErrorf("use_vndk_as_stable", "updatable APEXes can't use external VNDK libs")
}
if a.FutureUpdatable() {
ctx.PropertyErrorf("future_updatable", "Already updatable. Remove `future_updatable: true:`")
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 1f33eca..e1e508b 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -1927,13 +1927,13 @@
expectNoLink("libx", "shared_apex10000", "libz", "shared")
}
-func TestApexMinSdkVersion_crtobjectInVendorApex(t *testing.T) {
+func TestApexMinSdkVersion_InVendorApex(t *testing.T) {
ctx := testApex(t, `
apex {
name: "myapex",
key: "myapex.key",
native_shared_libs: ["mylib"],
- updatable: false,
+ updatable: true,
vendor: true,
min_sdk_version: "29",
}
@@ -1946,20 +1946,34 @@
cc_library {
name: "mylib",
+ srcs: ["mylib.cpp"],
vendor_available: true,
- system_shared_libs: [],
- stl: "none",
- apex_available: [ "myapex" ],
min_sdk_version: "29",
+ shared_libs: ["libbar"],
+ }
+
+ cc_library {
+ name: "libbar",
+ stubs: { versions: ["29", "30"] },
+ llndk: { symbol_file: "libbar.map.txt" },
}
`)
vendorVariant := "android_vendor.29_arm64_armv8-a"
- // First check that the correct variant of crtbegin_so is used.
- ldRule := ctx.ModuleForTests("mylib", vendorVariant+"_shared_apex29").Rule("ld")
- crtBegin := names(ldRule.Args["crtBegin"])
- ensureListContains(t, crtBegin, "out/soong/.intermediates/"+cc.DefaultCcCommonTestModulesDir+"crtbegin_so/"+vendorVariant+"_apex29/crtbegin_so.o")
+ mylib := ctx.ModuleForTests("mylib", vendorVariant+"_shared_myapex")
+
+ // Ensure that mylib links with "current" LLNDK
+ libFlags := names(mylib.Rule("ld").Args["libFlags"])
+ ensureListContains(t, libFlags, "out/soong/.intermediates/libbar/"+vendorVariant+"_shared_current/libbar.so")
+
+ // Ensure that mylib is targeting 29
+ ccRule := ctx.ModuleForTests("mylib", vendorVariant+"_static_apex29").Output("obj/mylib.o")
+ ensureContains(t, ccRule.Args["cFlags"], "-target aarch64-linux-android29")
+
+ // Ensure that the correct variant of crtbegin_so is used.
+ crtBegin := mylib.Rule("ld").Args["crtBegin"]
+ ensureContains(t, crtBegin, "out/soong/.intermediates/"+cc.DefaultCcCommonTestModulesDir+"crtbegin_so/"+vendorVariant+"_apex29/crtbegin_so.o")
// Ensure that the crtbegin_so used by the APEX is targeting 29
cflags := ctx.ModuleForTests("crtbegin_so", vendorVariant+"_apex29").Rule("cc").Args["cFlags"]
@@ -7860,12 +7874,14 @@
`)
}
-func TestUpdatable_cannot_be_vendor_apex(t *testing.T) {
- testApexError(t, `"myapex" .*: updatable: vendor APEXes are not updatable`, `
+func Test_use_vndk_as_stable_shouldnt_be_used_for_updatable_vendor_apexes(t *testing.T) {
+ testApexError(t, `"myapex" .*: use_vndk_as_stable: updatable APEXes can't use external VNDK libs`, `
apex {
name: "myapex",
key: "myapex.key",
updatable: true,
+ min_sdk_version: "current",
+ use_vndk_as_stable: true,
soc_specific: true,
}
@@ -7877,6 +7893,23 @@
`)
}
+func Test_use_vndk_as_stable_shouldnt_be_used_for_non_vendor_apexes(t *testing.T) {
+ testApexError(t, `"myapex" .*: use_vndk_as_stable: not supported for system/system_ext APEXes`, `
+ apex {
+ name: "myapex",
+ key: "myapex.key",
+ updatable: false,
+ use_vndk_as_stable: true,
+ }
+
+ apex_key {
+ name: "myapex.key",
+ public_key: "testkey.avbpubkey",
+ private_key: "testkey.pem",
+ }
+ `)
+}
+
func TestUpdatable_should_not_set_generate_classpaths_proto(t *testing.T) {
testApexError(t, `"mysystemserverclasspathfragment" .* it must not set generate_classpaths_proto to false`, `
apex {
diff --git a/cc/binary.go b/cc/binary.go
index 496c610..097f822 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -512,7 +512,7 @@
}
binary.baseInstaller.subDir = "bootstrap"
}
- binary.baseInstaller.install(ctx, file)
+ binary.baseInstaller.installExecutable(ctx, file)
var preferredArchSymlinkPath android.OptionalPath
for _, symlink := range binary.symlinks {
diff --git a/cc/cc.go b/cc/cc.go
index 400814d..a7884e7 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -3870,6 +3870,7 @@
// When a vendor APEX needs a VNDK lib in it (use_vndk_as_stable: false), it should be a unique
// APEX variation. Otherwise, another vendor APEX with use_vndk_as_stable:true may use a wrong
// variation of the VNDK lib because APEX variations are merged/grouped.
+ // TODO(b/274401041) Find a way to merge APEX variations for vendor apexes.
return c.UseVndk() && c.IsVndk()
}
diff --git a/cc/coverage.go b/cc/coverage.go
index a7356f8..c0f6973 100644
--- a/cc/coverage.go
+++ b/cc/coverage.go
@@ -219,10 +219,14 @@
return properties
}
-// Coverage is an interface for non-CC modules to implement to be mutated for coverage
-type Coverage interface {
+type UseCoverage interface {
android.Module
IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool
+}
+
+// Coverage is an interface for non-CC modules to implement to be mutated for coverage
+type Coverage interface {
+ UseCoverage
SetPreventInstall()
HideFromMake()
MarkAsCoverageVariant(bool)
@@ -261,6 +265,11 @@
m[1].(Coverage).MarkAsCoverageVariant(true)
m[1].(Coverage).EnableCoverageIfNeeded()
+ } else if cov, ok := mctx.Module().(UseCoverage); ok && cov.IsNativeCoverageNeeded(mctx) {
+ // Module itself doesn't have to have "cov" variant, but it should use "cov" variants of
+ // deps.
+ mctx.CreateVariations("cov")
+ mctx.AliasVariation("cov")
}
}
diff --git a/cc/installer.go b/cc/installer.go
index e2c0e7b..716a0df 100644
--- a/cc/installer.go
+++ b/cc/installer.go
@@ -100,6 +100,10 @@
installer.path = ctx.InstallFile(installer.installDir(ctx), file.Base(), file)
}
+func (installer *baseInstaller) installExecutable(ctx ModuleContext, file android.Path) {
+ installer.path = ctx.InstallExecutable(installer.installDir(ctx), file.Base(), file)
+}
+
func (installer *baseInstaller) everInstallable() bool {
// Most cc modules are installable.
return true
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 25b8fe8..023c69a 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -22,6 +22,7 @@
"strings"
"android/soong/android"
+ "android/soong/cc"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@@ -498,3 +499,11 @@
}
return fmt.Sprintf("%x", h.Sum(nil))
}
+
+// Base cc.UseCoverage
+
+var _ cc.UseCoverage = (*filesystem)(nil)
+
+func (*filesystem) IsNativeCoverageNeeded(ctx android.BaseModuleContext) bool {
+ return ctx.Device() && ctx.DeviceConfig().NativeCoverageEnabled()
+}
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index a65d9dd..aef4756 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -20,6 +20,9 @@
"android/soong/android"
"android/soong/cc"
+ "android/soong/etc"
+
+ "github.com/google/blueprint/proptools"
)
func TestMain(m *testing.M) {
@@ -28,6 +31,7 @@
var fixture = android.GroupFixturePreparers(
android.PrepareForIntegrationTestWithAndroid,
+ etc.PrepareForTestWithPrebuiltEtc,
cc.PrepareForIntegrationTestWithCc,
PrepareForTestWithFilesystemBuildComponents,
)
@@ -225,3 +229,56 @@
inputs.Strings(),
"out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so")
}
+
+func TestFileSystemWithCoverageVariants(t *testing.T) {
+ context := android.GroupFixturePreparers(
+ fixture,
+ android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
+ variables.GcovCoverage = proptools.BoolPtr(true)
+ variables.Native_coverage = proptools.BoolPtr(true)
+ }),
+ )
+
+ result := context.RunTestWithBp(t, `
+ prebuilt_etc {
+ name: "prebuilt",
+ src: ":myfilesystem",
+ }
+
+ android_system_image {
+ name: "myfilesystem",
+ deps: [
+ "libfoo",
+ ],
+ linker_config_src: "linker.config.json",
+ }
+
+ cc_library {
+ name: "libfoo",
+ shared_libs: [
+ "libbar",
+ ],
+ stl: "none",
+ }
+
+ cc_library {
+ name: "libbar",
+ stl: "none",
+ }
+ `)
+
+ filesystem := result.ModuleForTests("myfilesystem", "android_common_cov")
+ inputs := filesystem.Output("deps.zip").Implicits
+ android.AssertStringListContains(t, "filesystem should have libfoo(cov)",
+ inputs.Strings(),
+ "out/soong/.intermediates/libfoo/android_arm64_armv8-a_shared_cov/libfoo.so")
+ android.AssertStringListContains(t, "filesystem should have libbar(cov)",
+ inputs.Strings(),
+ "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared_cov/libbar.so")
+
+ filesystemOutput := filesystem.Output("myfilesystem.img").Output
+ prebuiltInput := result.ModuleForTests("prebuilt", "android_arm64_armv8-a").Rule("Cp").Input
+ if filesystemOutput != prebuiltInput {
+ t.Error("prebuilt should use cov variant of filesystem")
+ }
+}
diff --git a/java/app.go b/java/app.go
index 1a324bf..8b54bc8 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1522,6 +1522,7 @@
certificate, certificateName := android.BazelStringOrLabelFromProp(ctx, a.overridableAppProperties.Certificate)
manifestValues := &manifestValueAttribute{}
+ // TODO(b/274474008 ): Directly convert deviceProperties.Min_sdk_version in bp2build
// MinSdkVersion(ctx) calls SdkVersion(ctx) if no value for min_sdk_version is set
minSdkSpec := a.MinSdkVersion(ctx)
if !minSdkSpec.ApiLevel.IsPreview() && minSdkSpec.Valid() {
diff --git a/java/config/config.go b/java/config/config.go
index 838d007..13670ee 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -94,10 +94,12 @@
"-JXX:+TieredCompilation",
"-JXX:TieredStopAtLevel=1",
"-JDcom.android.tools.r8.emitRecordAnnotationsInDex",
+ "-JDcom.android.tools.r8.emitPermittedSubclassesAnnotationsInDex",
}, dexerJavaVmFlagsList...))
exportedVars.ExportStringListStaticVariable("R8Flags", append([]string{
"-JXmx2048M",
"-JDcom.android.tools.r8.emitRecordAnnotationsInDex",
+ "-JDcom.android.tools.r8.emitPermittedSubclassesAnnotationsInDex",
}, dexerJavaVmFlagsList...))
exportedVars.ExportStringListStaticVariable("CommonJdkFlags", []string{
diff --git a/scripts/build-ndk-prebuilts.sh b/scripts/build-ndk-prebuilts.sh
index b57963b..0d14019 100755
--- a/scripts/build-ndk-prebuilts.sh
+++ b/scripts/build-ndk-prebuilts.sh
@@ -19,7 +19,12 @@
exit 1
fi
-TARGET_PRODUCT=ndk build/soong/soong_ui.bash --make-mode --soong-only ${OUT_DIR}/soong/ndk.timestamp
+# TODO: remove ALLOW_MISSING_DEPENDENCIES=true when all the riscv64
+# dependencies exist (currently blocked by http://b/273792258).
+# TODO: remove BUILD_BROKEN_DISABLE_BAZEL=1 when bazel supports riscv64 (http://b/262192655).
+ALLOW_MISSING_DEPENDENCIES=true \
+BUILD_BROKEN_DISABLE_BAZEL=1 \
+ TARGET_PRODUCT=ndk build/soong/soong_ui.bash --make-mode --soong-only ${OUT_DIR}/soong/ndk.timestamp
if [ -n "${DIST_DIR}" ]; then
mkdir -p ${DIST_DIR} || true
diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh
index e1aa70c..7fa0dae 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"
+#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/soong.go b/ui/build/soong.go
index 655ae35..871e637 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -168,7 +168,7 @@
commonArgs = append(commonArgs, "-t")
}
- if !pb.config.multitreeBuild {
+ if pb.config.multitreeBuild {
commonArgs = append(commonArgs, "--multitree-build")
}