Merge "Disable default strip for host variants" into main
diff --git a/Android.bp b/Android.bp
index 337545b..7134591 100644
--- a/Android.bp
+++ b/Android.bp
@@ -176,6 +176,12 @@
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 @@
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 @@
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 @@
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 @@
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/Android.bp b/android/Android.bp
index 1cc7ffe..00dc50a 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -97,6 +97,7 @@
"product_packages_file.go",
"proto.go",
"provider.go",
+ "provider_keys.go",
"raw_files.go",
"recovery_build_prop.go",
"register.go",
diff --git a/android/compliance_metadata.go b/android/compliance_metadata.go
index a6dbb8d..7c0ab85 100644
--- a/android/compliance_metadata.go
+++ b/android/compliance_metadata.go
@@ -127,27 +127,32 @@
// dependencies, built/installed files, etc. It is a wrapper on a map[string]string with some utility
// methods to get/set properties' values.
type ComplianceMetadataInfo struct {
- properties map[string]string
+ properties map[string]string
+ filesContained []string
}
type complianceMetadataInfoGob struct {
- Properties map[string]string
+ Properties map[string]string
+ FilesContained []string
}
func NewComplianceMetadataInfo() *ComplianceMetadataInfo {
return &ComplianceMetadataInfo{
- properties: map[string]string{},
+ properties: map[string]string{},
+ filesContained: make([]string, 0),
}
}
func (m *ComplianceMetadataInfo) ToGob() *complianceMetadataInfoGob {
return &complianceMetadataInfoGob{
- Properties: m.properties,
+ Properties: m.properties,
+ FilesContained: m.filesContained,
}
}
func (m *ComplianceMetadataInfo) FromGob(data *complianceMetadataInfoGob) {
m.properties = data.Properties
+ m.filesContained = data.FilesContained
}
func (c *ComplianceMetadataInfo) GobEncode() ([]byte, error) {
@@ -169,6 +174,14 @@
c.SetStringValue(propertyName, strings.TrimSpace(strings.Join(value, " ")))
}
+func (c *ComplianceMetadataInfo) SetFilesContained(files []string) {
+ c.filesContained = files
+}
+
+func (c *ComplianceMetadataInfo) GetFilesContained() []string {
+ return c.filesContained
+}
+
func (c *ComplianceMetadataInfo) getStringValue(propertyName string) string {
if !slices.Contains(COMPLIANCE_METADATA_PROPS, propertyName) {
panic(fmt.Errorf("Unknown metadata property: %s.", propertyName))
@@ -317,8 +330,25 @@
makeModulesCsv := PathForOutput(ctx, "compliance-metadata", deviceProduct, "make-modules.csv")
if !ctx.Config().KatiEnabled() {
- WriteFileRule(ctx, makeMetadataCsv, "installed_file,module_path,is_soong_module,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,static_libs,whole_static_libs,license_text")
- WriteFileRule(ctx, makeModulesCsv, "name,module_path,module_class,module_type,static_libs,whole_static_libs,built_files,installed_files")
+ // In soong-only build the installed file list is from android_device module
+ ctx.VisitAllModuleProxies(func(module ModuleProxy) {
+ if androidDeviceInfo, ok := OtherModuleProvider(ctx, module, AndroidDeviceInfoProvider); !ok || !androidDeviceInfo.Main_device {
+ return
+ }
+ if metadataInfo, ok := OtherModuleProvider(ctx, module, ComplianceMetadataProvider); ok {
+ if len(metadataInfo.filesContained) > 0 {
+ csvHeaders := "installed_file,module_path,is_soong_module,is_prebuilt_make_module,product_copy_files,kernel_module_copy_files,is_platform_generated,static_libs,whole_static_libs,license_text"
+ csvContent := make([]string, 0, len(metadataInfo.filesContained)+1)
+ csvContent = append(csvContent, csvHeaders)
+ for _, file := range metadataInfo.filesContained {
+ csvContent = append(csvContent, file+",,Y,,,,,,,")
+ }
+ WriteFileRuleVerbatim(ctx, makeMetadataCsv, strings.Join(csvContent, "\n"))
+ WriteFileRuleVerbatim(ctx, makeModulesCsv, "name,module_path,module_class,module_type,static_libs,whole_static_libs,built_files,installed_files")
+ }
+ return
+ }
+ })
}
// Import metadata from Make and Soong to sqlite3 database
diff --git a/android/config.go b/android/config.go
index 696e772..9ccd099 100644
--- a/android/config.go
+++ b/android/config.go
@@ -385,24 +385,28 @@
}
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 @@
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 3d86860..d1b26c1 100644
--- a/android/config_test.go
+++ b/android/config_test.go
@@ -213,13 +213,18 @@
})
}
-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 @@
{"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 5457539..a56fea3 100644
--- a/android/module.go
+++ b/android/module.go
@@ -1915,6 +1915,7 @@
Dists []Dist
ExportedToMake bool
Team string
+ PartitionTag string
}
type ApiLevelOrPlatform struct {
@@ -2282,6 +2283,7 @@
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/provider_keys.go b/android/provider_keys.go
new file mode 100644
index 0000000..60b383f
--- /dev/null
+++ b/android/provider_keys.go
@@ -0,0 +1,24 @@
+// Copyright 2025 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package android
+
+import "github.com/google/blueprint"
+
+// Providers of package filesystem
+type AndroidDeviceInfo struct {
+ Main_device bool
+}
+
+var AndroidDeviceInfoProvider = blueprint.NewProvider[AndroidDeviceInfo]()
diff --git a/android/rule_builder.go b/android/rule_builder.go
index ea6aaa4..01fe6d8 100644
--- a/android/rule_builder.go
+++ b/android/rule_builder.go
@@ -660,12 +660,17 @@
}
for _, c := range r.commands {
for _, tool := range c.packagedTools {
- command.CopyBefore = append(command.CopyBefore, &sbox_proto.Copy{
- From: proto.String(tool.srcPath.String()),
- To: proto.String(sboxPathForPackagedToolRel(tool)),
- Executable: proto.Bool(tool.executable),
- })
- tools = append(tools, tool.srcPath)
+ if tool.srcPath != nil {
+ command.CopyBefore = append(command.CopyBefore, &sbox_proto.Copy{
+ From: proto.String(tool.srcPath.String()),
+ To: proto.String(sboxPathForPackagedToolRel(tool)),
+ Executable: proto.Bool(tool.executable),
+ })
+ tools = append(tools, tool.srcPath)
+ } else if tool.SymlinkTarget() == "" {
+ // We ignore symlinks for now, could be added later if needed
+ panic("Expected tool packagingSpec to either be a file or symlink")
+ }
}
}
}
diff --git a/apex/apex.go b/apex/apex.go
index 196f389..38ab012 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -550,6 +550,9 @@
// 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 @@
}
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 @@
})
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 1233e33..9be3918 100644
--- a/cc/afdo.go
+++ b/cc/afdo.go
@@ -108,6 +108,8 @@
// 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/genrule_test.go b/cc/genrule_test.go
index 438eb98..4e700a2 100644
--- a/cc/genrule_test.go
+++ b/cc/genrule_test.go
@@ -17,6 +17,7 @@
import (
"reflect"
"slices"
+ "strings"
"testing"
"android/soong/android"
@@ -254,3 +255,42 @@
gen_64bit,
)
}
+
+// Test that a genrule can depend on a tool with symlinks. The symlinks are ignored, but
+// at least it doesn't cause errors.
+func TestGenruleToolWithSymlinks(t *testing.T) {
+ bp := `
+ genrule {
+ name: "gen",
+ tools: ["tool_with_symlinks"],
+ cmd: "$(location tool_with_symlinks) $(in) $(out)",
+ out: ["out"],
+ }
+
+ cc_binary_host {
+ name: "tool_with_symlinks",
+ symlinks: ["symlink1", "symlink2"],
+ }
+ `
+ ctx := PrepareForIntegrationTestWithCc.
+ ExtendWithErrorHandler(android.FixtureExpectsNoErrors).
+ RunTestWithBp(t, bp)
+ gen := ctx.ModuleForTests(t, "gen", "").Output("out")
+ toolFound := false
+ symlinkFound := false
+ for _, dep := range gen.RuleParams.CommandDeps {
+ if strings.HasSuffix(dep, "/tool_with_symlinks") {
+ toolFound = true
+ }
+ if strings.HasSuffix(dep, "/symlink1") || strings.HasSuffix(dep, "/symlink2") {
+ symlinkFound = true
+ }
+ }
+ if !toolFound {
+ t.Errorf("Tool not found")
+ }
+ // We may want to change genrules to include symlinks later
+ if symlinkFound {
+ t.Errorf("Symlinks found")
+ }
+}
diff --git a/cc/library.go b/cc/library.go
index 8a2b6bd..b248224 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -606,10 +606,22 @@
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 d2c4b28..8b68c55 100644
--- a/cc/test.go
+++ b/cc/test.go
@@ -455,6 +455,9 @@
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 0db3f9f..451dac4 100644
--- a/ci_tests/ci_test_package_zip.go
+++ b/ci_tests/ci_test_package_zip.go
@@ -149,7 +149,7 @@
// 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 @@
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 3d306e3..a616ee0 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -19,6 +19,7 @@
"fmt"
"path/filepath"
"slices"
+ "sort"
"strings"
"sync/atomic"
@@ -114,6 +115,7 @@
miscInfo android.Path
rootDirForFsConfig string
rootDirForFsConfigTimestamp android.Path
+ apkCertsInfo android.Path
}
func AndroidDeviceFactory() android.Module {
@@ -188,7 +190,8 @@
allInstalledModules := a.allInstalledModules(ctx)
- a.kernelConfig, a.kernelVersion = a.extractKernelVersionAndConfigs(ctx)
+ a.apkCertsInfo = a.buildApkCertsInfo(ctx, allInstalledModules)
+ a.kernelVersion, a.kernelConfig = a.extractKernelVersionAndConfigs(ctx)
a.miscInfo = a.addMiscInfo(ctx)
a.buildTargetFilesZip(ctx, allInstalledModules)
a.buildProguardZips(ctx, allInstalledModules)
@@ -278,6 +281,31 @@
a.setVbmetaPhonyTargets(ctx)
a.distFiles(ctx)
+
+ android.SetProvider(ctx, android.AndroidDeviceInfoProvider, android.AndroidDeviceInfo{
+ Main_device: android.Bool(a.deviceProps.Main_device),
+ })
+
+ if proptools.String(a.partitionProps.Super_partition_name) != "" {
+ buildComplianceMetadata(ctx, superPartitionDepTag, filesystemDepTag)
+ } else {
+ buildComplianceMetadata(ctx, filesystemDepTag)
+ }
+}
+
+func buildComplianceMetadata(ctx android.ModuleContext, tags ...blueprint.DependencyTag) {
+ filesContained := make([]string, 0)
+ for _, tag := range tags {
+ ctx.VisitDirectDepsProxyWithTag(tag, func(m android.ModuleProxy) {
+ if complianceMetadataInfo, ok := android.OtherModuleProvider(ctx, m, android.ComplianceMetadataProvider); ok {
+ filesContained = append(filesContained, complianceMetadataInfo.GetFilesContained()...)
+ }
+ })
+ }
+ sort.Strings(filesContained)
+
+ complianceMetadataInfo := ctx.ComplianceMetadataInfo()
+ complianceMetadataInfo.SetFilesContained(filesContained)
}
// Returns a list of modules that are installed, which are collected from the dependency
@@ -317,18 +345,32 @@
return strings.TrimSuffix(file, ext) + insertion + ext
}
+func (a *androidDevice) distInstalledFiles(ctx android.ModuleContext) {
+ distInstalledFilesJsonAndTxt := func(installedFiles InstalledFilesStruct) {
+ if installedFiles.Json != nil {
+ ctx.DistForGoal("droidcore-unbundled", installedFiles.Json)
+ }
+ if installedFiles.Txt != nil {
+ ctx.DistForGoal("droidcore-unbundled", installedFiles.Txt)
+ }
+ }
+
+ fsInfoMap := a.getFsInfos(ctx)
+ for _, partition := range android.SortedKeys(fsInfoMap) {
+ // installed-files-*{.txt | .json} is not disted for userdata partition
+ if partition == "userdata" {
+ continue
+ }
+ fsInfo := fsInfoMap[partition]
+ for _, installedFiles := range fsInfo.InstalledFilesDepSet.ToList() {
+ distInstalledFilesJsonAndTxt(installedFiles)
+ }
+ }
+}
+
func (a *androidDevice) distFiles(ctx android.ModuleContext) {
if !ctx.Config().KatiEnabled() && proptools.Bool(a.deviceProps.Main_device) {
- fsInfoMap := a.getFsInfos(ctx)
- for _, partition := range android.SortedKeys(fsInfoMap) {
- fsInfo := fsInfoMap[partition]
- if fsInfo.InstalledFiles.Json != nil {
- ctx.DistForGoal("droidcore-unbundled", fsInfo.InstalledFiles.Json)
- }
- if fsInfo.InstalledFiles.Txt != nil {
- ctx.DistForGoal("droidcore-unbundled", fsInfo.InstalledFiles.Txt)
- }
- }
+ a.distInstalledFiles(ctx)
namePrefix := ""
if ctx.Config().HasDeviceProduct() {
@@ -651,6 +693,9 @@
}
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
@@ -836,11 +881,12 @@
Flag("--tools lz4:"+lz4tool.String()).Implicit(lz4tool).
FlagWithInput("--input ", kernel).
FlagWithOutput("--output-release ", extractedVersionFile).
- FlagWithOutput("--output-configs ", extractedConfigsFile)
+ FlagWithOutput("--output-configs ", extractedConfigsFile).
+ Textf(`&& printf "\n" >> %s`, extractedVersionFile)
if specifiedVersion := proptools.String(a.deviceProps.Kernel_version); specifiedVersion != "" {
specifiedVersionFile := android.PathForModuleOut(ctx, "specified_kernel_version.txt")
- android.WriteFileRuleVerbatim(ctx, specifiedVersionFile, specifiedVersion)
+ android.WriteFileRule(ctx, specifiedVersionFile, specifiedVersion)
builder.Command().Text("diff -q").
Input(specifiedVersionFile).
Input(extractedVersionFile).
@@ -864,3 +910,49 @@
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/bootimg.go b/filesystem/bootimg.go
index effbd65..2bf0d59 100644
--- a/filesystem/bootimg.go
+++ b/filesystem/bootimg.go
@@ -263,6 +263,11 @@
PublicKey: extractedPublicKey,
Output: output,
})
+
+ // Dump compliance metadata
+ if ramdisk := proptools.String(b.properties.Ramdisk_module); ramdisk != "" {
+ buildComplianceMetadata(ctx, bootimgRamdiskDep)
+ }
}
var BootimgInfoProvider = blueprint.NewProvider[BootimgInfo]()
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index 35fdd00..065acbd 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -30,6 +30,7 @@
"android/soong/linkerconfig"
"github.com/google/blueprint"
+ "github.com/google/blueprint/depset"
"github.com/google/blueprint/proptools"
)
@@ -424,8 +425,8 @@
FullInstallPaths []FullInstallPathInfo
- // Installed files list
- InstalledFiles InstalledFilesStruct
+ // Installed files dep set of this module and its dependency filesystem modules
+ InstalledFilesDepSet depset.DepSet[InstalledFilesStruct]
// Path to compress hints file for erofs filesystems
// This will be nil for other fileystems like ext4
@@ -438,6 +439,8 @@
Owners []InstalledModuleInfo
UseAvb bool
+
+ HasFsverity bool
}
// FullInstallPathInfo contains information about the "full install" paths of all the files
@@ -541,13 +544,13 @@
}
}
-func buildInstalledFiles(ctx android.ModuleContext, partition string, rootDir android.Path, image android.Path) (txt android.ModuleOutPath, json android.ModuleOutPath) {
+func buildInstalledFiles(ctx android.ModuleContext, partition string, rootDir android.Path, image android.Path) InstalledFilesStruct {
fileName := "installed-files"
if len(partition) > 0 {
fileName += fmt.Sprintf("-%s", partition)
}
- txt = android.PathForModuleOut(ctx, fmt.Sprintf("%s.txt", fileName))
- json = android.PathForModuleOut(ctx, fmt.Sprintf("%s.json", fileName))
+ txt := android.PathForModuleOut(ctx, fmt.Sprintf("%s.txt", fileName))
+ json := android.PathForModuleOut(ctx, fmt.Sprintf("%s.json", fileName))
ctx.Build(pctx, android.BuildParams{
Rule: installedFilesJsonRule,
@@ -566,7 +569,10 @@
Description: "Installed file list txt",
})
- return txt, json
+ return InstalledFilesStruct{
+ Txt: txt,
+ Json: json,
+ }
}
func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -649,11 +655,15 @@
fileListFile := android.PathForModuleOut(ctx, "fileList")
android.WriteFileRule(ctx, fileListFile, f.installedFilesList())
- partitionName := f.partitionName()
- if partitionName == "system" {
- partitionName = ""
+ var partitionNameForInstalledFiles string
+ switch f.partitionName() {
+ case "system":
+ partitionNameForInstalledFiles = ""
+ case "vendor_ramdisk":
+ partitionNameForInstalledFiles = "vendor-ramdisk"
+ default:
+ partitionNameForInstalledFiles = f.partitionName()
}
- installedFileTxt, installedFileJson := buildInstalledFiles(ctx, partitionName, rootDir, f.output)
var erofsCompressHints android.Path
if f.properties.Erofs.Compress_hints != nil {
@@ -674,15 +684,17 @@
BuildImagePropFileDeps: buildImagePropFileDeps,
SpecsForSystemOther: f.systemOtherFiles(ctx),
FullInstallPaths: fullInstallPaths,
- InstalledFiles: InstalledFilesStruct{
- Txt: installedFileTxt,
- Json: installedFileJson,
- },
+ InstalledFilesDepSet: depset.New(
+ depset.POSTORDER,
+ []InstalledFilesStruct{buildInstalledFiles(ctx, partitionNameForInstalledFiles, rootDir, f.output)},
+ includeFilesInstalledFiles(ctx),
+ ),
ErofsCompressHints: erofsCompressHints,
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)
@@ -698,6 +710,14 @@
}
f.setVbmetaPartitionProvider(ctx)
+
+ // Dump metadata that can not be done in android/compliance-metadata.go
+ complianceMetadataInfo := ctx.ComplianceMetadataInfo()
+ filesContained := make([]string, 0, len(fullInstallPaths))
+ for _, file := range fullInstallPaths {
+ filesContained = append(filesContained, file.FullInstallPath.String())
+ }
+ complianceMetadataInfo.SetFilesContained(filesContained)
}
func (f *filesystem) fileystemStagingDirTimestamp(ctx android.ModuleContext) android.WritablePath {
@@ -882,13 +902,24 @@
builder.Command().Text("mkdir -p").Text(filepath.Dir(dst.String()))
builder.Command().Text("ln -sf").Text(proptools.ShellEscape(target)).Text(dst.String())
f.appendToEntry(ctx, dst)
- // Only add the fullInstallPath logic for files in the rebased dir. The root dir
- // is harder to install to.
- if strings.HasPrefix(name, rebasedPrefix) {
+ // Add the fullInstallPath logic for files in the rebased dir, and for non-rebased files in "system" partition
+ // the fullInstallPath is changed to "root" which aligns to the behavior in Make.
+ if f.PartitionType() == "system" {
+ installPath := android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix))
+ if !strings.HasPrefix(name, rebasedPrefix) {
+ installPath = android.PathForModuleInPartitionInstall(ctx, "root", name)
+ }
*fullInstallPaths = append(*fullInstallPaths, FullInstallPathInfo{
- FullInstallPath: android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)),
+ FullInstallPath: installPath,
SymlinkTarget: target,
})
+ } else {
+ if strings.HasPrefix(name, rebasedPrefix) {
+ *fullInstallPaths = append(*fullInstallPaths, FullInstallPathInfo{
+ FullInstallPath: android.PathForModuleInPartitionInstall(ctx, f.PartitionType(), strings.TrimPrefix(name, rebasedPrefix)),
+ SymlinkTarget: target,
+ })
+ }
}
}
@@ -1167,6 +1198,15 @@
return rootDirs, partitions
}
+func includeFilesInstalledFiles(ctx android.ModuleContext) (ret []depset.DepSet[InstalledFilesStruct]) {
+ ctx.VisitDirectDepsWithTag(interPartitionInstallDependencyTag, func(m android.Module) {
+ if fsProvider, ok := android.OtherModuleProvider(ctx, m, FilesystemProvider); ok {
+ ret = append(ret, fsProvider.InstalledFilesDepSet)
+ }
+ })
+ return
+}
+
func (f *filesystem) buildCpioImage(
ctx android.ModuleContext,
builder *android.RuleBuilder,
diff --git a/filesystem/super_image.go b/filesystem/super_image.go
index 5e62fa7..9e4412c 100644
--- a/filesystem/super_image.go
+++ b/filesystem/super_image.go
@@ -183,6 +183,8 @@
})
ctx.SetOutputFiles([]android.Path{output}, "")
ctx.CheckbuildFile(output)
+
+ buildComplianceMetadata(ctx, subImageDepTag)
}
func (s *superImage) installFileName() string {
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index f00e491..b73fb21 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -505,6 +505,7 @@
}
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 @@
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/fsgen/fsgen_mutators.go b/fsgen/fsgen_mutators.go
index 9b25e77..d34ae77 100644
--- a/fsgen/fsgen_mutators.go
+++ b/fsgen/fsgen_mutators.go
@@ -105,12 +105,14 @@
"libgsi": defaultDepCandidateProps(ctx.Config()),
"llndk.libraries.txt": defaultDepCandidateProps(ctx.Config()),
"logpersist.start": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_system": defaultDepCandidateProps(ctx.Config()),
"update_engine_sideload": defaultDepCandidateProps(ctx.Config()),
// keep-sorted end
},
"vendor": {
"fs_config_files_vendor": defaultDepCandidateProps(ctx.Config()),
"fs_config_dirs_vendor": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_vendor": defaultDepCandidateProps(ctx.Config()),
generatedModuleName(ctx.Config(), "vendor-build.prop"): defaultDepCandidateProps(ctx.Config()),
},
"odm": {
@@ -118,34 +120,41 @@
// https://cs.android.com/android/_/android/platform/build/+/e4849e87ab660b59a6501b3928693db065ee873b:tools/fs_config/Android.mk;l=34;drc=8d6481b92c4b4e9b9f31a61545b6862090fcc14b;bpv=1;bpt=0
"fs_config_files_odm": defaultDepCandidateProps(ctx.Config()),
"fs_config_dirs_odm": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_odm": defaultDepCandidateProps(ctx.Config()),
},
- "product": {},
+ "product": {
+ "notice_xml_product": defaultDepCandidateProps(ctx.Config()),
+ },
"system_ext": {
// VNDK apexes are automatically included.
// This hardcoded list will need to be updated if `PRODUCT_EXTRA_VNDK_VERSIONS` is updated.
// https://cs.android.com/android/_/android/platform/build/+/adba533072b00c53ac0f198c550a3cbd7a00e4cd:core/main.mk;l=984;bpv=1;bpt=0;drc=174db7b179592cf07cbfd2adb0119486fda911e7
- "com.android.vndk.v30": defaultDepCandidateProps(ctx.Config()),
- "com.android.vndk.v31": defaultDepCandidateProps(ctx.Config()),
- "com.android.vndk.v32": defaultDepCandidateProps(ctx.Config()),
- "com.android.vndk.v33": defaultDepCandidateProps(ctx.Config()),
- "com.android.vndk.v34": defaultDepCandidateProps(ctx.Config()),
+ "com.android.vndk.v30": defaultDepCandidateProps(ctx.Config()),
+ "com.android.vndk.v31": defaultDepCandidateProps(ctx.Config()),
+ "com.android.vndk.v32": defaultDepCandidateProps(ctx.Config()),
+ "com.android.vndk.v33": defaultDepCandidateProps(ctx.Config()),
+ "com.android.vndk.v34": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_system_ext": defaultDepCandidateProps(ctx.Config()),
},
"userdata": {},
"system_dlkm": {
// these are phony required deps of the phony fs_config_dirs_nonsystem
"fs_config_dirs_system_dlkm": defaultDepCandidateProps(ctx.Config()),
"fs_config_files_system_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_system_dlkm": defaultDepCandidateProps(ctx.Config()),
// build props are automatically added to `ALL_DEFAULT_INSTALLED_MODULES`
"system_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
},
"vendor_dlkm": {
"fs_config_dirs_vendor_dlkm": defaultDepCandidateProps(ctx.Config()),
"fs_config_files_vendor_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_vendor_dlkm": defaultDepCandidateProps(ctx.Config()),
"vendor_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
},
"odm_dlkm": {
"fs_config_dirs_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
"fs_config_files_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
+ "notice_xml_odm_dlkm": defaultDepCandidateProps(ctx.Config()),
"odm_dlkm-build.prop": defaultDepCandidateProps(ctx.Config()),
},
"ramdisk": {},
diff --git a/java/Android.bp b/java/Android.bp
index 911af83..99d9c38 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -78,6 +78,7 @@
"system_modules.go",
"systemserver_classpath_fragment.go",
"testing.go",
+ "tracereferences.go",
"tradefed.go",
],
testSrcs: [
diff --git a/java/app.go b/java/app.go
index fe5eec3..65ccc68 100644
--- a/java/app.go
+++ b/java/app.go
@@ -2209,3 +2209,7 @@
appInfo.Certificate = m.Certificate()
appInfo.PrivAppAllowlist = m.PrivAppAllowlist()
}
+
+type AppInfos []AppInfo
+
+var AppInfosProvider = blueprint.NewProvider[AppInfos]()
diff --git a/java/config/config.go b/java/config/config.go
index 71025de..fdb8d78 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -173,6 +173,7 @@
pctx.HostBinToolVariable("R8Cmd", "r8")
pctx.HostBinToolVariable("ExtractR8RulesCmd", "extract-r8-rules")
pctx.HostBinToolVariable("ResourceShrinkerCmd", "resourceshrinker")
+ pctx.HostBinToolVariable("TraceReferencesCmd", "tracereferences")
pctx.HostBinToolVariable("HiddenAPICmd", "hiddenapi")
pctx.HostBinToolVariable("ExtractApksCmd", "extract_apks")
pctx.VariableFunc("TurbineJar", func(ctx android.PackageVarContext) string {
diff --git a/java/dex.go b/java/dex.go
index ed2df21..b32d5ae 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -103,6 +103,19 @@
// If true, transitive reverse dependencies of this module will have this
// module's proguard spec appended to their optimization action
Export_proguard_flags_files *bool
+
+ // Path to a file containing a list of class names that should not be compiled using R8.
+ // These classes will be compiled by D8 similar to when Optimize.Enabled is false.
+ //
+ // Example:
+ //
+ // r8.exclude:
+ // com.example.Foo
+ // com.example.Bar
+ // com.example.Bar$Baz
+ //
+ // By default all classes are compiled using R8 when Optimize.Enabled is set.
+ Exclude *string `android:"path"`
}
// Keep the data uncompressed. We always need uncompressed dex for execution,
@@ -528,6 +541,11 @@
r8Flags = append(r8Flags, "--store-store-fence-constructor-inlining")
}
+ if opt.Exclude != nil {
+ r8Flags = append(r8Flags, "--exclude", *opt.Exclude)
+ r8Deps = append(r8Deps, android.PathForModuleSrc(ctx, *opt.Exclude))
+ }
+
return r8Flags, r8Deps, artProfileOutput
}
diff --git a/java/dexpreopt_check.go b/java/dexpreopt_check.go
index c971565..9d0f539 100644
--- a/java/dexpreopt_check.go
+++ b/java/dexpreopt_check.go
@@ -100,7 +100,12 @@
if systemServerJar.InstallInSystemExt() && ctx.Config().InstallApexSystemServerDexpreoptSamePartition() {
partition = ctx.DeviceConfig().SystemExtPath() // system_ext
}
- dexLocation := dexpreopt.GetSystemServerDexLocation(ctx, global, systemServerJar.Name())
+ var dexLocation string
+ if m, ok := systemServerJar.(ModuleWithStem); ok {
+ dexLocation = dexpreopt.GetSystemServerDexLocation(ctx, global, m.Stem())
+ } else {
+ ctx.PropertyErrorf("dexpreopt_systemserver_check", "%v is not a ModuleWithStem", systemServerJar.Name())
+ }
odexLocation := dexpreopt.ToOdexPath(dexLocation, targets[0].Arch.ArchType, partition)
odexPath := getInstallPath(ctx, odexLocation)
vdexPath := getInstallPath(ctx, pathtools.ReplaceExtension(odexLocation, "vdex"))
diff --git a/java/droiddoc.go b/java/droiddoc.go
index 225f201..3faf294 100644
--- a/java/droiddoc.go
+++ b/java/droiddoc.go
@@ -195,6 +195,9 @@
"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 b3241cc..c215925 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -1243,7 +1243,7 @@
// 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 c1e4f8c..215fbbd 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2530,6 +2530,7 @@
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 b3d9348..42d42b8 100644
--- a/java/rro.go
+++ b/java/rro.go
@@ -427,6 +427,11 @@
// 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/java/tracereferences.go b/java/tracereferences.go
new file mode 100644
index 0000000..342b6a6
--- /dev/null
+++ b/java/tracereferences.go
@@ -0,0 +1,54 @@
+// Copyright 2025 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package java
+
+import (
+ "android/soong/android"
+
+ "github.com/google/blueprint"
+)
+
+var traceReferences = pctx.AndroidStaticRule("traceReferences",
+ blueprint.RuleParams{
+ Command: `${config.TraceReferencesCmd} ` +
+ // Note that we suppress missing def errors, as we're only interested
+ // in the direct deps between the sources and target.
+ `--map-diagnostics:MissingDefinitionsDiagnostic error none ` +
+ `--keep-rules ` +
+ `--output ${out} ` +
+ `--target ${in} ` +
+ // `--source` and `--lib` are already prepended to each
+ // jar reference in the sources and libs joined string args.
+ `${sources} ` +
+ `${libs}`,
+ CommandDeps: []string{"${config.TraceReferencesCmd}"},
+ }, "sources", "libs")
+
+// Generates keep rules in output corresponding to any references from sources
+// (a list of jars) onto target (the referenced jar) that are not included in
+// libs (a list of external jars).
+func TraceReferences(ctx android.ModuleContext, sources android.Paths, target android.Path, libs android.Paths,
+ output android.WritablePath) {
+ ctx.Build(pctx, android.BuildParams{
+ Rule: traceReferences,
+ Input: target,
+ Output: output,
+ Implicits: append(sources, libs...),
+ Args: map[string]string{
+ "sources": android.JoinWithPrefix(sources.Strings(), "--source "),
+ "libs": android.JoinWithPrefix(libs.Strings(), "--lib "),
+ },
+ })
+}
diff --git a/phony/phony.go b/phony/phony.go
index 4f61c45..e75f4c8 100644
--- a/phony/phony.go
+++ b/phony/phony.go
@@ -104,8 +104,7 @@
android.ModuleBase
android.DefaultableModuleBase
- phonyDepsModuleNames []string
- properties PhonyProperties
+ properties PhonyProperties
}
type PhonyProperties struct {
@@ -126,18 +125,8 @@
}
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))
}
}