summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Android.bp22
-rw-r--r--android/config.go40
-rw-r--r--android/config_test.go32
-rw-r--r--android/module.go11
-rw-r--r--android/rule_builder.go6
-rw-r--r--apex/apex.go6
-rw-r--r--cc/afdo.go5
-rw-r--r--cc/library.go14
-rw-r--r--cc/test.go3
-rw-r--r--ci_tests/ci_test_package_zip.go19
-rw-r--r--filesystem/android_device.go150
-rw-r--r--filesystem/filesystem.go6
-rw-r--r--fsgen/filesystem_creator.go15
-rw-r--r--java/app.go4
-rw-r--r--java/droiddoc.go3
-rw-r--r--java/droidstubs.go2
-rw-r--r--java/java.go1
-rw-r--r--java/rro.go5
-rw-r--r--phony/phony.go17
19 files changed, 305 insertions, 56 deletions
diff --git a/Android.bp b/Android.bp
index 337545bce..713459112 100644
--- a/Android.bp
+++ b/Android.bp
@@ -176,6 +176,12 @@ build_prop {
footer_files: [
":applied_backported_fixes",
],
+ dist: {
+ targets: [
+ "droidcore-unbundled",
+ "sdk",
+ ],
+ },
// Currently, only microdroid, Ravenwood, and cf system image can refer to system-build.prop
visibility: [
"//build/soong/fsgen",
@@ -191,6 +197,10 @@ build_prop {
system_ext_specific: true,
product_config: ":product_config",
relative_install_path: "etc", // system_ext/etc/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-system_ext",
+ },
visibility: [
"//build/make/target/product/gsi",
"//build/soong/fsgen",
@@ -203,6 +213,10 @@ build_prop {
product_specific: true,
product_config: ":product_config",
relative_install_path: "etc", // product/etc/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-product",
+ },
visibility: [
"//build/make/target/product/gsi",
"//build/soong/fsgen",
@@ -215,6 +229,10 @@ build_prop {
device_specific: true,
product_config: ":product_config",
relative_install_path: "etc", // odm/etc/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-odm",
+ },
visibility: ["//build/soong/fsgen"],
}
@@ -251,6 +269,10 @@ build_prop {
ramdisk: true,
product_config: ":product_config",
relative_install_path: "etc/ramdisk", // ramdisk/system/etc/ramdisk/build.prop
+ dist: {
+ targets: ["droidcore-unbundled"],
+ dest: "build.prop-ramdisk",
+ },
visibility: ["//visibility:private"],
}
diff --git a/android/config.go b/android/config.go
index 696e7727f..9ccd09990 100644
--- a/android/config.go
+++ b/android/config.go
@@ -385,24 +385,28 @@ type config struct {
}
type partialCompileFlags struct {
- // Is partial compilation enabled at all?
- Enabled bool
-
// Whether to use d8 instead of r8
Use_d8 bool
+ // Whether to disable stub validation. This is slightly more surgical
+ // than DISABLE_STUB_VALIDATION, in that it only applies to partial
+ // compile builds.
+ Disable_stub_validation bool
+
+ // Whether to disable api lint.
+ Disable_api_lint bool
+
// Add others as needed.
}
// These are the flags when `SOONG_PARTIAL_COMPILE` is empty or not set.
-var defaultPartialCompileFlags = partialCompileFlags{
- Enabled: false,
-}
+var defaultPartialCompileFlags = partialCompileFlags{}
// These are the flags when `SOONG_PARTIAL_COMPILE=true`.
var enabledPartialCompileFlags = partialCompileFlags{
- Enabled: true,
- Use_d8: true,
+ Use_d8: true,
+ Disable_stub_validation: false,
+ Disable_api_lint: false,
}
type deviceConfig struct {
@@ -477,13 +481,29 @@ func (c *config) parsePartialCompileFlags(isEngBuild bool) (partialCompileFlags,
state = "+"
}
switch tok {
+ case "all":
+ // Turn on **all** of the flags.
+ ret = partialCompileFlags{
+ Use_d8: true,
+ Disable_stub_validation: true,
+ Disable_api_lint: true,
+ }
case "true":
ret = enabledPartialCompileFlags
case "false":
// Set everything to false.
ret = partialCompileFlags{}
- case "enabled":
- ret.Enabled = makeVal(state, defaultPartialCompileFlags.Enabled)
+
+ case "api_lint", "enable_api_lint":
+ ret.Disable_api_lint = !makeVal(state, !defaultPartialCompileFlags.Disable_api_lint)
+ case "disable_api_lint":
+ ret.Disable_api_lint = makeVal(state, defaultPartialCompileFlags.Disable_api_lint)
+
+ case "stub_validation", "enable_stub_validation":
+ ret.Disable_stub_validation = !makeVal(state, !defaultPartialCompileFlags.Disable_stub_validation)
+ case "disable_stub_validation":
+ ret.Disable_stub_validation = makeVal(state, defaultPartialCompileFlags.Disable_stub_validation)
+
case "use_d8":
ret.Use_d8 = makeVal(state, defaultPartialCompileFlags.Use_d8)
default:
diff --git a/android/config_test.go b/android/config_test.go
index 3d8686041..d1b26c12a 100644
--- a/android/config_test.go
+++ b/android/config_test.go
@@ -213,13 +213,18 @@ func TestConfiguredJarList(t *testing.T) {
})
}
-func (p partialCompileFlags) updateEnabled(value bool) partialCompileFlags {
- p.Enabled = value
+func (p partialCompileFlags) updateUseD8(value bool) partialCompileFlags {
+ p.Use_d8 = value
return p
}
-func (p partialCompileFlags) updateUseD8(value bool) partialCompileFlags {
- p.Use_d8 = value
+func (p partialCompileFlags) updateDisableApiLint(value bool) partialCompileFlags {
+ p.Disable_api_lint = value
+ return p
+}
+
+func (p partialCompileFlags) updateDisableStubValidation(value bool) partialCompileFlags {
+ p.Disable_stub_validation = value
return p
}
@@ -241,10 +246,29 @@ func TestPartialCompile(t *testing.T) {
{"false", true, partialCompileFlags{}},
{"true", true, enabledPartialCompileFlags},
{"true", false, partialCompileFlags{}},
+ {"all", true, partialCompileFlags{}.updateUseD8(true).updateDisableApiLint(true).updateDisableStubValidation(true)},
+
+ // This verifies both use_d8 and the processing order.
{"true,use_d8", true, enabledPartialCompileFlags.updateUseD8(true)},
{"true,-use_d8", true, enabledPartialCompileFlags.updateUseD8(false)},
{"use_d8,false", true, partialCompileFlags{}},
{"false,+use_d8", true, partialCompileFlags{}.updateUseD8(true)},
+
+ // disable_api_lint can be specified with any of 3 options.
+ {"false,-api_lint", true, partialCompileFlags{}.updateDisableApiLint(true)},
+ {"false,-enable_api_lint", true, partialCompileFlags{}.updateDisableApiLint(true)},
+ {"false,+disable_api_lint", true, partialCompileFlags{}.updateDisableApiLint(true)},
+ {"false,+api_lint", true, partialCompileFlags{}.updateDisableApiLint(false)},
+ {"false,+enable_api_lint", true, partialCompileFlags{}.updateDisableApiLint(false)},
+ {"false,-disable_api_lint", true, partialCompileFlags{}.updateDisableApiLint(false)},
+
+ // disable_stub_validation can be specified with any of 3 options.
+ {"false,-stub_validation", true, partialCompileFlags{}.updateDisableStubValidation(true)},
+ {"false,-enable_stub_validation", true, partialCompileFlags{}.updateDisableStubValidation(true)},
+ {"false,+disable_stub_validation", true, partialCompileFlags{}.updateDisableStubValidation(true)},
+ {"false,+stub_validation", true, partialCompileFlags{}.updateDisableStubValidation(false)},
+ {"false,+enable_stub_validation", true, partialCompileFlags{}.updateDisableStubValidation(false)},
+ {"false,-disable_stub_validation", true, partialCompileFlags{}.updateDisableStubValidation(false)},
}
for _, test := range tests {
diff --git a/android/module.go b/android/module.go
index 713751a71..a56fea322 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1669,9 +1669,10 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
if len(ctx.installFiles) > 0 {
name := namespacePrefix + ctx.ModuleName() + "-install"
- ctx.Phony(name, ctx.installFiles.Paths()...)
+ installFiles := ctx.installFiles.Paths()
+ ctx.Phony(name, installFiles...)
info.InstallTarget = PathForPhony(ctx, name)
- deps = append(deps, info.InstallTarget)
+ deps = append(deps, installFiles...)
}
// A module's -checkbuild phony targets should
@@ -1681,13 +1682,13 @@ func (m *ModuleBase) generateModuleTarget(ctx *moduleContext) {
if (!ctx.Config().KatiEnabled() || !shouldSkipAndroidMkProcessing(ctx, m)) && !ctx.uncheckedModule && ctx.checkbuildTarget != nil {
name := namespacePrefix + ctx.ModuleName() + "-checkbuild"
ctx.Phony(name, ctx.checkbuildTarget)
- deps = append(deps, PathForPhony(ctx, name))
+ deps = append(deps, ctx.checkbuildTarget)
}
if outputFiles, err := outputFilesForModule(ctx, ctx.Module(), ""); err == nil && len(outputFiles) > 0 {
name := namespacePrefix + ctx.ModuleName() + "-outputs"
ctx.Phony(name, outputFiles...)
- deps = append(deps, PathForPhony(ctx, name))
+ deps = append(deps, outputFiles...)
}
if len(deps) > 0 {
@@ -1914,6 +1915,7 @@ type CommonModuleInfo struct {
Dists []Dist
ExportedToMake bool
Team string
+ PartitionTag string
}
type ApiLevelOrPlatform struct {
@@ -2281,6 +2283,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
Dists: m.Dists(),
ExportedToMake: m.ExportedToMake(),
Team: m.Team(),
+ PartitionTag: m.PartitionTag(ctx.DeviceConfig()),
}
if mm, ok := m.module.(interface {
MinSdkVersion(ctx EarlyModuleContext) ApiLevel
diff --git a/android/rule_builder.go b/android/rule_builder.go
index db56c3f29..ea6aaa4c4 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -1187,7 +1187,11 @@ func (c *RuleBuilderCommand) Text(text string) *RuleBuilderCommand {
// Textf adds the specified formatted text to the command line. The text should not contain input or output paths or
// the rule will not have them listed in its dependencies or outputs.
func (c *RuleBuilderCommand) Textf(format string, a ...interface{}) *RuleBuilderCommand {
- return c.Text(fmt.Sprintf(format, a...))
+ if c.buf.Len() > 0 {
+ c.buf.WriteByte(' ')
+ }
+ fmt.Fprintf(&c.buf, format, a...)
+ return c
}
// Flag adds the specified raw text to the command line. The text should not contain input or output paths or the
diff --git a/apex/apex.go b/apex/apex.go
index 196f389d2..38ab012d8 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -550,6 +550,9 @@ type apexBundle struct {
// Required modules, filled out during GenerateAndroidBuildActions and used in AndroidMk
required []string
+
+ // appinfo of the apk-in-apex of this module
+ appInfos java.AppInfos
}
// apexFileClass represents a type of file that can be included in APEX.
@@ -1931,6 +1934,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
}
case androidAppTag:
if appInfo, ok := android.OtherModuleProvider(ctx, child, java.AppInfoProvider); ok {
+ a.appInfos = append(a.appInfos, *appInfo)
if appInfo.AppSet {
appDir := "app"
if appInfo.Privileged {
@@ -2267,6 +2271,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
})
android.SetProvider(ctx, filesystem.ApexKeyPathInfoProvider, filesystem.ApexKeyPathInfo{a.apexKeysPath})
+
+ android.SetProvider(ctx, java.AppInfosProvider, a.appInfos)
}
// Set prebuiltInfoProvider. This will be used by `apex_prebuiltinfo_singleton` to print out a metadata file
diff --git a/cc/afdo.go b/cc/afdo.go
index 8d8341eb4..9be39185c 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -105,6 +105,11 @@ func (afdo *afdo) flags(ctx ModuleContext, flags Flags) Flags {
// The flags are prepended to allow overriding.
profileUseFlag := fmt.Sprintf(afdoFlagsFormat, fdoProfilePath)
flags.Local.CFlags = append([]string{profileUseFlag}, flags.Local.CFlags...)
+ // Salvage stale profile by fuzzy matching and use the remapped location for sample profile query.
+ flags.Local.CFlags = append([]string{"-mllvm", "--salvage-stale-profile=true"}, flags.Local.CFlags...)
+ flags.Local.CFlags = append([]string{"-mllvm", "--salvage-stale-profile-max-callsites=2000"}, flags.Local.CFlags...)
+ // Salvage stale profile by fuzzy matching renamed functions.
+ flags.Local.CFlags = append([]string{"-mllvm", "--salvage-unused-profile=true"}, flags.Local.CFlags...)
flags.Local.LdFlags = append([]string{profileUseFlag, "-Wl,-mllvm,-no-warn-sample-unused=true"}, flags.Local.LdFlags...)
// Update CFlagsDeps and LdFlagsDeps so the module is rebuilt
diff --git a/cc/library.go b/cc/library.go
index 8a2b6bdbd..b248224bd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -606,10 +606,22 @@ func (library *libraryDecorator) compile(ctx ModuleContext, flags Flags, deps Pa
panic(err)
}
+ llndkFlag := "--llndk"
+ if ctx.baseModuleName() == "libbinder_ndk" && ctx.inProduct() {
+ // This is a special case only for the libbinder_ndk. As the product partition is in the
+ // framework side along with system and system_ext partitions in Treble, libbinder_ndk
+ // provides different binder interfaces between product and vendor modules.
+ // In libbinder_ndk, 'llndk' annotation is for the vendor APIs; while 'systemapi'
+ // annotation is for the product APIs.
+ // Use '--systemapi' flag for building the llndk stub of product variant for the
+ // libbinder_ndk.
+ llndkFlag = "--systemapi"
+ }
+
// This is the vendor variant of an LLNDK library, build the LLNDK stubs.
nativeAbiResult := ParseNativeAbiDefinition(ctx,
String(library.Properties.Llndk.Symbol_file),
- nativeClampedApiLevel(ctx, version), "--llndk")
+ nativeClampedApiLevel(ctx, version), llndkFlag)
objs := CompileStubLibrary(ctx, flags, nativeAbiResult.StubSrc, sharedFlags)
if !Bool(library.Properties.Llndk.Unversioned) {
library.versionScriptPath = android.OptionalPathForPath(
diff --git a/cc/test.go b/cc/test.go
index d2c4b28e8..8b68c5563 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -455,6 +455,9 @@ func (test *testBinary) install(ctx ModuleContext, file android.Path) {
if standaloneTestDep.SkipInstall() {
continue
}
+ if standaloneTestDep.Partition() == "data" {
+ continue
+ }
test.binaryDecorator.baseInstaller.installStandaloneTestDep(ctx, standaloneTestDep)
}
}
diff --git a/ci_tests/ci_test_package_zip.go b/ci_tests/ci_test_package_zip.go
index 0db3f9f67..451dac4cc 100644
--- a/ci_tests/ci_test_package_zip.go
+++ b/ci_tests/ci_test_package_zip.go
@@ -149,7 +149,7 @@ func (p *testPackageZip) GenerateAndroidBuildActions(ctx android.ModuleContext)
// dist the test output
if ctx.ModuleName() == "platform_tests" {
- distedName := ctx.Config().Getenv("TARGET_PRODUCT") + "-tests-" + ctx.Config().BuildId() + ".zip"
+ distedName := ctx.Config().Getenv("TARGET_PRODUCT") + "-tests-FILE_NAME_TAG_PLACEHOLDER.zip"
ctx.DistForGoalWithFilename("platform_tests", p.output, distedName)
}
}
@@ -236,20 +236,21 @@ func extendBuilderCommand(ctx android.ModuleContext, m android.Module, builder *
if strings.HasPrefix(f, "out") {
continue
}
- f = strings.ReplaceAll(f, "system/", "DATA/")
+ if strings.HasPrefix(f, "system/") {
+ f = strings.Replace(f, "system/", "DATA/", 1)
+ }
f = strings.ReplaceAll(f, filepath.Join("testcases", name, arch), filepath.Join("DATA", class, name))
f = strings.ReplaceAll(f, filepath.Join("testcases", name, secondArch), filepath.Join("DATA", class, name))
- f = strings.ReplaceAll(f, "testcases", filepath.Join("DATA", class))
- f = strings.ReplaceAll(f, "data/", "DATA/")
+ if strings.HasPrefix(f, "testcases") {
+ f = strings.Replace(f, "testcases", filepath.Join("DATA", class), 1)
+ }
+ if strings.HasPrefix(f, "data/") {
+ f = strings.Replace(f, "data/", "DATA/", 1)
+ }
f = strings.ReplaceAll(f, "DATA_other", "system_other")
f = strings.ReplaceAll(f, "system_other/DATA", "system_other/system")
dir := filepath.Dir(f)
- // ignore the additional installed files from test
- if strings.Contains(dir, "DATA/native_tests") || strings.Count(dir, "DATA") > 1 {
- continue
- }
-
tempOut := android.PathForModuleOut(ctx, "STAGING", f)
builder.Command().Text("mkdir").Flag("-p").Text(filepath.Join(stagingDir.String(), dir))
builder.Command().Text("cp").Flag("-Rf").Input(installedFile).Output(tempOut)
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index c49e53686..04eaf840e 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -107,11 +107,15 @@ type androidDevice struct {
allImagesZip android.Path
- proguardDictZip android.Path
- proguardDictMapping android.Path
- proguardUsageZip android.Path
- kernelConfig android.Path
- kernelVersion android.Path
+ proguardDictZip android.Path
+ proguardDictMapping android.Path
+ proguardUsageZip android.Path
+ kernelConfig android.Path
+ kernelVersion android.Path
+ miscInfo android.Path
+ rootDirForFsConfig string
+ rootDirForFsConfigTimestamp android.Path
+ apkCertsInfo android.Path
}
func AndroidDeviceFactory() android.Module {
@@ -186,7 +190,9 @@ func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) {
allInstalledModules := a.allInstalledModules(ctx)
+ a.apkCertsInfo = a.buildApkCertsInfo(ctx, allInstalledModules)
a.kernelConfig, a.kernelVersion = a.extractKernelVersionAndConfigs(ctx)
+ a.miscInfo = a.addMiscInfo(ctx)
a.buildTargetFilesZip(ctx, allInstalledModules)
a.buildProguardZips(ctx, allInstalledModules)
@@ -359,6 +365,10 @@ func (a *androidDevice) distFiles(ctx android.ModuleContext) {
ctx.DistForGoalWithFilename("droidcore-unbundled", a.proguardDictZip, namePrefix+insertBeforeExtension(a.proguardDictZip.Base(), "-FILE_NAME_TAG_PLACEHOLDER"))
ctx.DistForGoalWithFilename("droidcore-unbundled", a.proguardDictMapping, namePrefix+insertBeforeExtension(a.proguardDictMapping.Base(), "-FILE_NAME_TAG_PLACEHOLDER"))
ctx.DistForGoalWithFilename("droidcore-unbundled", a.proguardUsageZip, namePrefix+insertBeforeExtension(a.proguardUsageZip.Base(), "-FILE_NAME_TAG_PLACEHOLDER"))
+
+ if a.deviceProps.Android_info != nil {
+ ctx.DistForGoal("droidcore-unbundled", android.PathForModuleSrc(ctx, *a.deviceProps.Android_info))
+ }
}
}
@@ -496,6 +506,17 @@ func (a *androidDevice) buildTargetFilesZip(ctx android.ModuleContext, allInstal
if toCopy.destSubdir == "SYSTEM" {
// Create the ROOT partition in target_files.zip
builder.Command().Textf("rsync --links --exclude=system/* %s/ -r %s/ROOT", toCopy.fsInfo.RootDir, targetFilesDir.String())
+ // Add a duplicate rule to assemble the ROOT/ directory in separate intermediates.
+ // The output timestamp will be an input to a separate fs_config call.
+ a.rootDirForFsConfig = android.PathForModuleOut(ctx, "root_dir_for_fs_config").String()
+ rootDirBuilder := android.NewRuleBuilder(pctx, ctx)
+ rootDirForFsConfigTimestamp := android.PathForModuleOut(ctx, "root_dir_for_fs_config.timestamp")
+ rootDirBuilder.Command().Textf("rsync --links --exclude=system/* %s/ -r %s", toCopy.fsInfo.RootDir, a.rootDirForFsConfig).
+ Implicit(toCopy.fsInfo.Output).
+ Text("&& touch").
+ Output(rootDirForFsConfigTimestamp)
+ rootDirBuilder.Build("assemble_root_dir_for_fs_config", "Assemble ROOT/ for fs_config")
+ a.rootDirForFsConfigTimestamp = rootDirForFsConfigTimestamp
}
}
// Copy cmdline, kernel etc. files of boot images
@@ -634,11 +655,11 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build
}
if partition == "system" {
// Create root_filesystem_config from the assembled ROOT/ intermediates directory
- a.generateFilesystemConfigForTargetFiles(ctx, builder, targetFilesDir.String(), targetFilesDir.String()+"/ROOT", "root_filesystem_config.txt")
+ a.generateFilesystemConfigForTargetFiles(ctx, builder, a.rootDirForFsConfigTimestamp, targetFilesDir.String(), a.rootDirForFsConfig, "root_filesystem_config.txt")
}
if partition == "vendor_ramdisk" {
// Create vendor_boot_filesystem_config from the assembled VENDOR_BOOT/RAMDISK intermediates directory
- a.generateFilesystemConfigForTargetFiles(ctx, builder, targetFilesDir.String(), targetFilesDir.String()+"/VENDOR_BOOT/RAMDISK", "vendor_boot_filesystem_config.txt")
+ a.generateFilesystemConfigForTargetFiles(ctx, builder, nil, targetFilesDir.String(), targetFilesDir.String()+"/VENDOR_BOOT/RAMDISK", "vendor_boot_filesystem_config.txt")
}
}
// Copy ramdisk_node_list
@@ -658,6 +679,9 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build
}
installedApexKeys = android.SortedUniquePaths(installedApexKeys) // Sort by keypath to match make
builder.Command().Text("cat").Inputs(installedApexKeys).Textf(" >> %s/META/apexkeys.txt", targetFilesDir.String())
+ // apkcerts.txt
+ builder.Command().Textf("cp").Input(a.apkCertsInfo).Textf(" %s/META/", targetFilesDir.String())
+
// Copy fastboot-info.txt
if fastbootInfo := android.PathForModuleSrc(ctx, proptools.String(a.deviceProps.FastbootInfo)); fastbootInfo != nil {
// TODO (b/399788523): Autogenerate fastboot-info.txt if there is no source fastboot-info.txt
@@ -672,6 +696,12 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build
if a.kernelVersion != nil {
builder.Command().Textf("cp").Input(a.kernelVersion).Textf(" %s/META/", targetFilesDir.String())
}
+ // misc_info.txt
+ if a.miscInfo != nil {
+ builder.Command().Textf("cp").Input(a.miscInfo).Textf(" %s/META/", targetFilesDir.String())
+ }
+ // apex_info.pb, care_map.pb, vbmeta_digest.txt
+ a.addImgToTargetFiles(ctx, builder, targetFilesDir.String())
if a.partitionProps.Super_partition_name != nil {
superPartition := ctx.GetDirectDepProxyWithTag(*a.partitionProps.Super_partition_name, superPartitionDepTag)
@@ -686,17 +716,71 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build
}
+// A partial implementation of make's $PRODUCT_OUT/misc_info.txt
+// https://cs.android.com/android/platform/superproject/main/+/main:build/make/core/Makefile;l=5894?q=misc_info.txt%20f:build%2Fmake%2Fcore%2FMakefile&ss=android%2Fplatform%2Fsuperproject%2Fmain
+// This file is subsequently used by add_img_to_target_files to create additioanl metadata files like apex_info.pb
+// TODO (b/399788119): Complete the migration of misc_info.txt
+func (a *androidDevice) addMiscInfo(ctx android.ModuleContext) android.Path {
+ builder := android.NewRuleBuilder(pctx, ctx)
+ miscInfo := android.PathForModuleOut(ctx, "misc_info.txt")
+ builder.Command().
+ Textf("rm -f %s", miscInfo).
+ Textf("&& echo recovery_api_version=%s >> %s", ctx.Config().VendorConfig("recovery").String("recovery_api_version"), miscInfo).
+ Textf("&& echo fstab_version=%s >> %s", ctx.Config().VendorConfig("recovery").String("recovery_fstab_version"), miscInfo).
+ ImplicitOutput(miscInfo)
+
+ if a.partitionProps.Recovery_partition_name == nil {
+ builder.Command().Textf("echo no_recovery=true >> %s", miscInfo)
+ }
+ fsInfos := a.getFsInfos(ctx)
+ for _, partition := range android.SortedKeys(fsInfos) {
+ if fsInfos[partition].UseAvb {
+ builder.Command().Textf("echo 'avb_%s_hashtree_enable=true' >> %s", partition, miscInfo)
+ }
+ }
+ if len(a.partitionProps.Vbmeta_partitions) > 0 {
+ builder.Command().
+ Textf("echo avb_enable=true >> %s", miscInfo).
+ Textf("&& echo avb_building_vbmeta_image=true >> %s", miscInfo).
+ Textf("&& echo avb_avbtool=avbtool >> %s", miscInfo)
+ }
+ if a.partitionProps.Boot_partition_name != nil {
+ builder.Command().Textf("echo boot_images=boot.img >> %s", miscInfo)
+ }
+
+ builder.Build("misc_info", "Building misc_info")
+
+ return miscInfo
+}
+
+// addImgToTargetFiles invokes `add_img_to_target_files` and creates the following files in META/
+// - apex_info.pb
+// - care_map.pb
+// - vbmeta_digest.txt
+func (a *androidDevice) addImgToTargetFiles(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir string) {
+ mkbootimg := ctx.Config().HostToolPath(ctx, "mkbootimg")
+ builder.Command().
+ Textf("PATH=%s:$PATH", ctx.Config().HostToolDir()).
+ Textf("MKBOOTIMG=%s", mkbootimg).
+ Implicit(mkbootimg).
+ BuiltTool("add_img_to_target_files").
+ Flag("-a -v -p").
+ Flag(ctx.Config().HostToolDir()).
+ Text(targetFilesDir)
+}
+
type ApexKeyPathInfo struct {
ApexKeyPath android.Path
}
var ApexKeyPathInfoProvider = blueprint.NewProvider[ApexKeyPathInfo]()
-func (a *androidDevice) generateFilesystemConfigForTargetFiles(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir, stagingDir, filename string) {
+func (a *androidDevice) generateFilesystemConfigForTargetFiles(ctx android.ModuleContext, builder *android.RuleBuilder, stagingDirTimestamp android.Path, targetFilesDir, stagingDir, filename string) {
fsConfigOut := android.PathForModuleOut(ctx, filename)
ctx.Build(pctx, android.BuildParams{
- Rule: fsConfigRule,
- Output: fsConfigOut,
+ Rule: fsConfigRule,
+ Implicit: stagingDirTimestamp,
+ Output: fsConfigOut,
Args: map[string]string{
"rootDir": stagingDir,
"prefix": "",
@@ -811,3 +895,49 @@ func (a *androidDevice) extractKernelVersionAndConfigs(ctx android.ModuleContext
return extractedVersionFile, extractedConfigsFile
}
+
+func (a *androidDevice) buildApkCertsInfo(ctx android.ModuleContext, allInstalledModules []android.Module) android.Path {
+ // TODO (spandandas): Add compressed
+ formatLine := func(cert java.Certificate, name, partition string) string {
+ pem := cert.AndroidMkString()
+ var key string
+ if cert.Key == nil {
+ key = ""
+ } else {
+ key = cert.Key.String()
+ }
+ return fmt.Sprintf(`name="%s" certificate="%s" private_key="%s" partition="%s"`, name, pem, key, partition)
+ }
+
+ apkCerts := []string{}
+ for _, installedModule := range allInstalledModules {
+ partition := ""
+ if commonInfo, ok := android.OtherModuleProvider(ctx, installedModule, android.CommonModuleInfoKey); ok {
+ partition = commonInfo.PartitionTag
+ } else {
+ ctx.ModuleErrorf("%s does not set CommonModuleInfoKey", installedModule.Name())
+ }
+ if info, ok := android.OtherModuleProvider(ctx, installedModule, java.AppInfoProvider); ok {
+ apkCerts = append(apkCerts, formatLine(info.Certificate, info.InstallApkName+".apk", partition))
+ } else if info, ok := android.OtherModuleProvider(ctx, installedModule, java.AppInfosProvider); ok {
+ for _, certInfo := range info {
+ apkCerts = append(apkCerts, formatLine(certInfo.Certificate, certInfo.InstallApkName+".apk", partition))
+ }
+ } else if info, ok := android.OtherModuleProvider(ctx, installedModule, java.RuntimeResourceOverlayInfoProvider); ok {
+ apkCerts = append(apkCerts, formatLine(info.Certificate, info.OutputFile.Base(), partition))
+ }
+ }
+ slices.Sort(apkCerts) // sort by name
+ fsInfos := a.getFsInfos(ctx)
+ if fsInfos["system"].HasFsverity {
+ defaultPem, defaultKey := ctx.Config().DefaultAppCertificate(ctx)
+ apkCerts = append(apkCerts, formatLine(java.Certificate{Pem: defaultPem, Key: defaultKey}, "BuildManifest.apk", "system"))
+ if info, ok := fsInfos["system_ext"]; ok && info.HasFsverity {
+ apkCerts = append(apkCerts, formatLine(java.Certificate{Pem: defaultPem, Key: defaultKey}, "BuildManifestSystemExt.apk", "system_ext"))
+ }
+ }
+
+ apkCertsInfo := android.PathForModuleOut(ctx, "apkcerts.txt")
+ android.WriteFileRuleVerbatim(ctx, apkCertsInfo, strings.Join(apkCerts, "\n")+"\n")
+ return apkCertsInfo
+}
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 88de21792..79db988a0 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -436,6 +436,10 @@ type FilesystemInfo struct {
FilesystemConfig android.Path
Owners []InstalledModuleInfo
+
+ UseAvb bool
+
+ HasFsverity bool
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -680,6 +684,8 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
SelinuxFc: f.selinuxFc,
FilesystemConfig: f.generateFilesystemConfig(ctx, rootDir, rebasedDir),
Owners: f.gatherOwners(specs),
+ UseAvb: proptools.Bool(f.properties.Use_avb),
+ HasFsverity: f.properties.Fsverity.Inputs.GetOrDefault(ctx, nil) != nil,
}
android.SetProvider(ctx, FilesystemProvider, fsInfo)
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index f00e491cc..b73fb219f 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -505,6 +505,7 @@ func partitionSpecificFsProps(ctx android.EarlyModuleContext, partitions allGene
}
fsProps.Security_patch = proptools.StringPtr(ctx.Config().PlatformSecurityPatch())
fsProps.Stem = proptools.StringPtr("system_ext.img")
+ fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
case "product":
fsProps.Gen_aconfig_flags_pb = proptools.BoolPtr(true)
fsProps.Android_filesystem_deps.System = proptools.StringPtr(partitions.nameForType("system"))
@@ -853,19 +854,29 @@ func (f *filesystemCreator) createVendorBuildProp(ctx android.LoadHookContext) {
Product_config *string
Android_info *string
Licenses []string
+ Dist android.Dist
}{
Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "vendor-build.prop")),
Vendor: proptools.BoolPtr(true),
Stem: proptools.StringPtr("build.prop"),
Product_config: proptools.StringPtr(":product_config"),
Android_info: proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "android_info.prop")),
- Licenses: []string{"Android-Apache-2.0"},
+ Dist: android.Dist{
+ Targets: []string{"droidcore-unbundled"},
+ Dest: proptools.StringPtr("build.prop-vendor"),
+ },
+ Licenses: []string{"Android-Apache-2.0"},
}
vendorBuildProp := ctx.CreateModule(
android.BuildPropFactory,
vendorBuildProps,
)
- vendorBuildProp.HideFromMake()
+ // We don't want this to conflict with the make-built vendor build.prop, but unfortunately
+ // calling HideFromMake() prevents disting files, even in soong-only mode. So only call
+ // HideFromMake() on soong+make builds.
+ if ctx.Config().KatiEnabled() {
+ vendorBuildProp.HideFromMake()
+ }
}
func createRecoveryBuildProp(ctx android.LoadHookContext) string {
diff --git a/java/app.go b/java/app.go
index fe5eec32d..65ccc686c 100644
--- a/java/app.go
+++ b/java/app.go
@@ -2209,3 +2209,7 @@ func setCommonAppInfo(appInfo *AppInfo, m androidApp) {
appInfo.Certificate = m.Certificate()
appInfo.PrivAppAllowlist = m.PrivAppAllowlist()
}
+
+type AppInfos []AppInfo
+
+var AppInfosProvider = blueprint.NewProvider[AppInfos]()
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 225f201a9..3faf294de 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -195,6 +195,9 @@ func apiCheckEnabled(ctx android.ModuleContext, apiToCheck ApiToCheck, apiVersio
"them instead.")
}
return false
+ } else if ctx.Config().PartialCompileFlags().Disable_stub_validation &&
+ !ctx.Config().BuildFromTextStub() {
+ return false
} else if String(apiToCheck.Api_file) != "" && String(apiToCheck.Removed_api_file) != "" {
return true
} else if String(apiToCheck.Api_file) != "" {
diff --git a/java/droidstubs.go b/java/droidstubs.go
index b3241cca9..c21592518 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -1243,7 +1243,7 @@ func (d *Droidstubs) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Add options for the other optional tasks: API-lint and check-released.
// We generate separate timestamp files for them.
- doApiLint := BoolDefault(d.properties.Check_api.Api_lint.Enabled, false)
+ doApiLint := BoolDefault(d.properties.Check_api.Api_lint.Enabled, false) && !ctx.Config().PartialCompileFlags().Disable_api_lint
doCheckReleased := apiCheckEnabled(ctx, d.properties.Check_api.Last_released, "last_released")
writeSdkValues := Bool(d.properties.Write_sdk_values)
diff --git a/java/java.go b/java/java.go
index c1e4f8ca0..215fbbda8 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2530,6 +2530,7 @@ func (al *ApiLibrary) DepsMutator(ctx android.BottomUpMutatorContext) {
apiContributions := al.properties.Api_contributions
addValidations := !ctx.Config().IsEnvTrue("DISABLE_STUB_VALIDATION") &&
!ctx.Config().IsEnvTrue("WITHOUT_CHECK_API") &&
+ !ctx.Config().PartialCompileFlags().Disable_stub_validation &&
proptools.BoolDefault(al.properties.Enable_validation, true)
for _, apiContributionName := range apiContributions {
ctx.AddDependency(ctx.Module(), javaApiContributionTag, apiContributionName)
diff --git a/java/rro.go b/java/rro.go
index b3d934867..42d42b86a 100644
--- a/java/rro.go
+++ b/java/rro.go
@@ -427,6 +427,11 @@ func (a *AutogenRuntimeResourceOverlay) GenerateAndroidBuildActions(ctx android.
// Install the signed apk
installDir := android.PathForModuleInstall(ctx, "overlay")
ctx.InstallFile(installDir, signed.Base(), signed)
+
+ android.SetProvider(ctx, RuntimeResourceOverlayInfoProvider, RuntimeResourceOverlayInfo{
+ OutputFile: signed,
+ Certificate: a.certificate,
+ })
}
func (a *AutogenRuntimeResourceOverlay) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
diff --git a/phony/phony.go b/phony/phony.go
index 4f61c4583..e75f4c809 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -104,8 +104,7 @@ type PhonyRule struct {
android.ModuleBase
android.DefaultableModuleBase
- phonyDepsModuleNames []string
- properties PhonyProperties
+ properties PhonyProperties
}
type PhonyProperties struct {
@@ -126,18 +125,8 @@ func PhonyRuleFactory() android.Module {
}
func (p *PhonyRule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- p.phonyDepsModuleNames = p.properties.Phony_deps.GetOrDefault(ctx, nil)
-}
-
-func (p *PhonyRule) AndroidMk() android.AndroidMkData {
- return android.AndroidMkData{
- Custom: func(w io.Writer, name, prefix, moduleDir string, data android.AndroidMkData) {
- if len(p.phonyDepsModuleNames) > 0 {
- depModulesStr := strings.Join(p.phonyDepsModuleNames, " ")
- fmt.Fprintln(w, ".PHONY:", name)
- fmt.Fprintln(w, name, ":", depModulesStr)
- }
- },
+ for _, dep := range p.properties.Phony_deps.GetOrDefault(ctx, nil) {
+ ctx.Phony(ctx.ModuleName(), android.PathForPhony(ctx, dep))
}
}