summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/androidmk.go188
-rw-r--r--android/androidmk_test.go20
-rw-r--r--android/arch.go24
-rw-r--r--android/config.go20
-rw-r--r--android/module.go43
-rw-r--r--android/neverallow.go44
-rw-r--r--android/paths.go8
-rw-r--r--android/provider.go6
-rw-r--r--apex/apex.go2
-rw-r--r--apex/builder.go1
-rw-r--r--apex/prebuilt.go6
-rw-r--r--cc/androidmk.go5
-rw-r--r--cc/binary.go15
-rw-r--r--cc/cc.go8
-rw-r--r--cc/library.go45
-rw-r--r--cc/ndk_library.go4
-rw-r--r--cc/object.go4
-rwxr-xr-xcmd/symbols_map/symbols_map_proto/regen.sh4
-rw-r--r--cmd/symbols_map/symbols_map_proto/symbols_map.pb.go126
-rw-r--r--cmd/symbols_map/symbols_map_proto/symbols_map.proto4
-rw-r--r--dexpreopt/Android.bp1
-rw-r--r--dexpreopt/system_server_zip.go49
-rw-r--r--etc/prebuilt_etc.go12
-rw-r--r--filesystem/android_device.go56
-rw-r--r--filesystem/system_other.go21
-rw-r--r--fsgen/filesystem_creator.go7
-rw-r--r--java/dexpreopt_bootjars.go133
-rw-r--r--java/sdk_library_test.go4
-rw-r--r--rust/config/OWNERS2
-rw-r--r--rust/library_test.go39
-rw-r--r--scripts/microfactory.bash9
-rw-r--r--sdk/sdk.go10
-rw-r--r--ui/build/androidmk_denylist.go11
-rw-r--r--ui/build/config.go19
-rw-r--r--ui/build/path.go5
35 files changed, 643 insertions, 312 deletions
diff --git a/android/androidmk.go b/android/androidmk.go
index 2eb13ec5b..e4366fad2 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -113,8 +113,6 @@ type AndroidMkEntries struct {
SubName string
// If set, this value overrides the base module name. SubName is still appended.
OverrideName string
- // Dist files to output
- DistFiles TaggedDistFiles
// The output file for Kati to process and/or install. If absent, the module is skipped.
OutputFile OptionalPath
// If true, the module is skipped and does not appear on the final Android-<product name>.mk
@@ -357,36 +355,15 @@ func (d *distCopies) Strings() (ret []string) {
return
}
-// Compute the contributions that the module makes to the dist.
-func (a *AndroidMkEntries) getDistContributions(mod Module) *distContributions {
+// This gets the dist contributuions from the given module that were specified in the Android.bp
+// file using the dist: property. It does not include contribututions that the module's
+// implementation may have defined with ctx.DistForGoals(), for that, see DistProvider.
+func getDistContributions(ctx ConfigAndOtherModuleProviderContext, mod Module) *distContributions {
amod := mod.base()
name := amod.BaseModuleName()
- // Collate the set of associated tag/paths available for copying to the dist.
- // Start with an empty (nil) set.
- var availableTaggedDists TaggedDistFiles
-
- // Then merge in any that are provided explicitly by the module.
- if a.DistFiles != nil {
- // Merge the DistFiles into the set.
- availableTaggedDists = availableTaggedDists.merge(a.DistFiles)
- }
-
- // If no paths have been provided for the DefaultDistTag and the output file is
- // valid then add that as the default dist path.
- if _, ok := availableTaggedDists[DefaultDistTag]; !ok && a.OutputFile.Valid() {
- availableTaggedDists = availableTaggedDists.addPathsForTag(DefaultDistTag, a.OutputFile.Path())
- }
-
- info := OtherModuleProviderOrDefault(a.entryContext, mod, InstallFilesProvider)
- // If the distFiles created by GenerateTaggedDistFiles contains paths for the
- // DefaultDistTag then that takes priority so delete any existing paths.
- if _, ok := info.DistFiles[DefaultDistTag]; ok {
- delete(availableTaggedDists, DefaultDistTag)
- }
-
- // Finally, merge the distFiles created by GenerateTaggedDistFiles.
- availableTaggedDists = availableTaggedDists.merge(info.DistFiles)
+ info := OtherModuleProviderOrDefault(ctx, mod, InstallFilesProvider)
+ availableTaggedDists := info.DistFiles
if len(availableTaggedDists) == 0 {
// Nothing dist-able for this module.
@@ -460,7 +437,7 @@ func (a *AndroidMkEntries) getDistContributions(mod Module) *distContributions {
productString := ""
if dist.Append_artifact_with_product != nil && *dist.Append_artifact_with_product {
- productString = fmt.Sprintf("_%s", a.entryContext.Config().DeviceProduct())
+ productString = fmt.Sprintf("_%s", ctx.Config().DeviceProduct())
}
if suffix != "" || productString != "" {
@@ -508,7 +485,7 @@ func generateDistContributionsForMake(distContributions *distContributions) []st
// Compute the list of Make strings to declare phony goals and dist-for-goals
// calls from the module's dist and dists properties.
func (a *AndroidMkEntries) GetDistForGoals(mod Module) []string {
- distContributions := a.getDistContributions(mod)
+ distContributions := getDistContributions(a.entryContext, mod)
if distContributions == nil {
return nil
}
@@ -917,18 +894,9 @@ func getSoongOnlyDataFromMods(ctx fillInEntriesContext, mods []Module) ([]distCo
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
}
- if contribution := info.PrimaryInfo.getDistContributions(ctx, mod, &commonInfo); contribution != nil {
+ if contribution := getDistContributions(ctx, mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
- for _, ei := range info.ExtraInfo {
- ei.fillInEntries(ctx, mod, &commonInfo)
- if ei.disabled() {
- continue
- }
- if contribution := ei.getDistContributions(ctx, mod, &commonInfo); contribution != nil {
- allDistContributions = append(allDistContributions, *contribution)
- }
- }
} else {
if x, ok := mod.(AndroidMkDataProvider); ok {
data := x.AndroidMk()
@@ -944,7 +912,7 @@ func getSoongOnlyDataFromMods(ctx fillInEntriesContext, mods []Module) ([]distCo
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
}
- if contribution := data.Entries.getDistContributions(mod); contribution != nil {
+ if contribution := getDistContributions(ctx, mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
}
@@ -958,7 +926,7 @@ func getSoongOnlyDataFromMods(ctx fillInEntriesContext, mods []Module) ([]distCo
if moduleInfoJSON, ok := OtherModuleProvider(ctx, mod, ModuleInfoJSONProvider); ok {
moduleInfoJSONs = append(moduleInfoJSONs, moduleInfoJSON...)
}
- if contribution := entries.getDistContributions(mod); contribution != nil {
+ if contribution := getDistContributions(ctx, mod); contribution != nil {
allDistContributions = append(allDistContributions, *contribution)
}
}
@@ -1301,8 +1269,6 @@ type AndroidMkInfo struct {
SubName string
// If set, this value overrides the base module name. SubName is still appended.
OverrideName string
- // Dist files to output
- DistFiles TaggedDistFiles
// The output file for Kati to process and/or install. If absent, the module is skipped.
OutputFile OptionalPath
// If true, the module is skipped and does not appear on the final Android-<product name>.mk
@@ -1669,7 +1635,7 @@ func (a *AndroidMkInfo) write(w io.Writer) {
// TODO(b/397766191): Change the signature to take ModuleProxy
// Please only access the module's internal data through providers.
func (a *AndroidMkInfo) GetDistForGoals(ctx fillInEntriesContext, mod Module, commonInfo *CommonModuleInfo) []string {
- distContributions := a.getDistContributions(ctx, mod, commonInfo)
+ distContributions := getDistContributions(ctx, mod)
if distContributions == nil {
return nil
}
@@ -1677,133 +1643,6 @@ func (a *AndroidMkInfo) GetDistForGoals(ctx fillInEntriesContext, mod Module, co
return generateDistContributionsForMake(distContributions)
}
-// Compute the contributions that the module makes to the dist.
-// TODO(b/397766191): Change the signature to take ModuleProxy
-// Please only access the module's internal data through providers.
-func (a *AndroidMkInfo) getDistContributions(ctx fillInEntriesContext, mod Module,
- commonInfo *CommonModuleInfo) *distContributions {
- name := commonInfo.BaseModuleName
-
- // Collate the set of associated tag/paths available for copying to the dist.
- // Start with an empty (nil) set.
- var availableTaggedDists TaggedDistFiles
-
- // Then merge in any that are provided explicitly by the module.
- if a.DistFiles != nil {
- // Merge the DistFiles into the set.
- availableTaggedDists = availableTaggedDists.merge(a.DistFiles)
- }
-
- // If no paths have been provided for the DefaultDistTag and the output file is
- // valid then add that as the default dist path.
- if _, ok := availableTaggedDists[DefaultDistTag]; !ok && a.OutputFile.Valid() {
- availableTaggedDists = availableTaggedDists.addPathsForTag(DefaultDistTag, a.OutputFile.Path())
- }
-
- info := OtherModuleProviderOrDefault(ctx, mod, InstallFilesProvider)
- // If the distFiles created by GenerateTaggedDistFiles contains paths for the
- // DefaultDistTag then that takes priority so delete any existing paths.
- if _, ok := info.DistFiles[DefaultDistTag]; ok {
- delete(availableTaggedDists, DefaultDistTag)
- }
-
- // Finally, merge the distFiles created by GenerateTaggedDistFiles.
- availableTaggedDists = availableTaggedDists.merge(info.DistFiles)
-
- if len(availableTaggedDists) == 0 {
- // Nothing dist-able for this module.
- return nil
- }
-
- // Collate the contributions this module makes to the dist.
- distContributions := &distContributions{}
-
- if !commonInfo.ExemptFromRequiredApplicableLicensesProperty {
- distContributions.licenseMetadataFile = info.LicenseMetadataFile
- }
-
- // Iterate over this module's dist structs, merged from the dist and dists properties.
- for _, dist := range commonInfo.Dists {
- // Get the list of goals this dist should be enabled for. e.g. sdk, droidcore
- goals := strings.Join(dist.Targets, " ")
-
- // Get the tag representing the output files to be dist'd. e.g. ".jar", ".proguard_map"
- var tag string
- if dist.Tag == nil {
- // If the dist struct does not specify a tag, use the default output files tag.
- tag = DefaultDistTag
- } else {
- tag = *dist.Tag
- }
-
- // Get the paths of the output files to be dist'd, represented by the tag.
- // Can be an empty list.
- tagPaths := availableTaggedDists[tag]
- if len(tagPaths) == 0 {
- // Nothing to dist for this tag, continue to the next dist.
- continue
- }
-
- if len(tagPaths) > 1 && (dist.Dest != nil || dist.Suffix != nil) {
- errorMessage := "%s: Cannot apply dest/suffix for more than one dist " +
- "file for %q goals tag %q in module %s. The list of dist files, " +
- "which should have a single element, is:\n%s"
- panic(fmt.Errorf(errorMessage, mod, goals, tag, name, tagPaths))
- }
-
- copiesForGoals := distContributions.getCopiesForGoals(goals)
-
- // Iterate over each path adding a copy instruction to copiesForGoals
- for _, path := range tagPaths {
- // It's possible that the Path is nil from errant modules. Be defensive here.
- if path == nil {
- tagName := "default" // for error message readability
- if dist.Tag != nil {
- tagName = *dist.Tag
- }
- panic(fmt.Errorf("Dist file should not be nil for the %s tag in %s", tagName, name))
- }
-
- dest := filepath.Base(path.String())
-
- if dist.Dest != nil {
- var err error
- if dest, err = validateSafePath(*dist.Dest); err != nil {
- // This was checked in ModuleBase.GenerateBuildActions
- panic(err)
- }
- }
-
- ext := filepath.Ext(dest)
- suffix := ""
- if dist.Suffix != nil {
- suffix = *dist.Suffix
- }
-
- productString := ""
- if dist.Append_artifact_with_product != nil && *dist.Append_artifact_with_product {
- productString = fmt.Sprintf("_%s", ctx.Config().DeviceProduct())
- }
-
- if suffix != "" || productString != "" {
- dest = strings.TrimSuffix(dest, ext) + suffix + productString + ext
- }
-
- if dist.Dir != nil {
- var err error
- if dest, err = validateSafePath(*dist.Dir, dest); err != nil {
- // This was checked in ModuleBase.GenerateBuildActions
- panic(err)
- }
- }
-
- copiesForGoals.addCopyInstruction(path, dest)
- }
- }
-
- return distContributions
-}
-
func deepCopyAndroidMkProviderInfo(providerInfo *AndroidMkProviderInfo) AndroidMkProviderInfo {
info := AndroidMkProviderInfo{
PrimaryInfo: deepCopyAndroidMkInfo(&providerInfo.PrimaryInfo),
@@ -1821,9 +1660,8 @@ func deepCopyAndroidMkInfo(mkinfo *AndroidMkInfo) AndroidMkInfo {
Class: mkinfo.Class,
SubName: mkinfo.SubName,
OverrideName: mkinfo.OverrideName,
- // There is no modification on DistFiles or OutputFile, so no need to
+ // There is no modification on OutputFile, so no need to
// make their deep copy.
- DistFiles: mkinfo.DistFiles,
OutputFile: mkinfo.OutputFile,
Disabled: mkinfo.Disabled,
Include: mkinfo.Include,
diff --git a/android/androidmk_test.go b/android/androidmk_test.go
index 0a81fb8bf..cd61133ef 100644
--- a/android/androidmk_test.go
+++ b/android/androidmk_test.go
@@ -34,7 +34,6 @@ type customModule struct {
}
data AndroidMkData
- distFiles TaggedDistFiles
outputFile OptionalPath
}
@@ -73,7 +72,6 @@ func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
path := PathForTesting("default-dist.out")
defaultDistPaths = Paths{path}
m.setOutputFiles(ctx, defaultDistPaths)
- m.distFiles = MakeDefaultDistFiles(path)
case defaultDistFiles_Tagged:
// Module types that set AndroidMkEntry.DistFiles to the result of calling
@@ -84,11 +82,6 @@ func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
// will be the same as empty-string-tag output.
defaultDistPaths = PathsForTesting("one.out")
m.setOutputFiles(ctx, defaultDistPaths)
-
- // This must be called after setting defaultDistPaths/outputFile as
- // GenerateTaggedDistFiles calls into outputFiles property which may use
- // those fields.
- m.distFiles = m.GenerateTaggedDistFiles(ctx)
}
}
@@ -113,7 +106,6 @@ func (m *customModule) AndroidMkEntries() []AndroidMkEntries {
return []AndroidMkEntries{
{
Class: "CUSTOM_MODULE",
- DistFiles: m.distFiles,
OutputFile: m.outputFile,
},
}
@@ -354,7 +346,7 @@ func TestGetDistContributions(t *testing.T) {
if len(entries) != 1 {
t.Errorf("Expected a single AndroidMk entry, got %d", len(entries))
}
- distContributions := entries[0].getDistContributions(module)
+ distContributions := getDistContributions(ctx, module)
if err := compareContributions(expectedContributions, distContributions); err != nil {
t.Errorf("%s\nExpected Contributions\n%sActualContributions\n%s",
@@ -656,8 +648,8 @@ func TestGetDistContributions(t *testing.T) {
default_dist_files: "none",
dist_output_file: false,
dists: [
- // The following is silently ignored because there is not default file
- // in either the dist files or the output file.
+ // The following will dist one.out because there's no default dist file provided
+ // (default_dist_files: "none") and one.out is the outputfile for the "" tag.
{
targets: ["my_goal"],
},
@@ -672,6 +664,12 @@ func TestGetDistContributions(t *testing.T) {
{
goals: "my_goal",
copies: []distCopy{
+ distCopyForTest("one.out", "one.out"),
+ },
+ },
+ {
+ goals: "my_goal",
+ copies: []distCopy{
distCopyForTest("two.out", "two.out"),
distCopyForTest("three/four.out", "four.out"),
},
diff --git a/android/arch.go b/android/arch.go
index 3cd6e4b7a..d6b297119 100644
--- a/android/arch.go
+++ b/android/arch.go
@@ -1553,7 +1553,7 @@ func determineBuildOS(config *config) {
config.BuildOS = func() OsType {
switch runtime.GOOS {
case "linux":
- if Bool(config.productVariables.HostMusl) {
+ if Bool(config.productVariables.HostMusl) || runtime.GOARCH == "arm64" {
return LinuxMusl
}
return Linux
@@ -1565,11 +1565,25 @@ func determineBuildOS(config *config) {
}()
config.BuildArch = func() ArchType {
- switch runtime.GOARCH {
- case "amd64":
- return X86_64
+ switch runtime.GOOS {
+ case "linux":
+ switch runtime.GOARCH {
+ case "amd64":
+ return X86_64
+ case "arm64":
+ return Arm64
+ default:
+ panic(fmt.Sprintf("unsupported arch: %s", runtime.GOARCH))
+ }
+ case "darwin":
+ switch runtime.GOARCH {
+ case "amd64":
+ return X86_64
+ default:
+ panic(fmt.Sprintf("unsupported arch: %s", runtime.GOARCH))
+ }
default:
- panic(fmt.Sprintf("unsupported Arch: %s", runtime.GOARCH))
+ panic(fmt.Sprintf("unsupported OS: %s", runtime.GOOS))
}
}()
diff --git a/android/config.go b/android/config.go
index f6d08b841..696e7727f 100644
--- a/android/config.go
+++ b/android/config.go
@@ -814,11 +814,18 @@ func (c *config) HostCcSharedLibPath(ctx PathContext, lib string) Path {
func (c *config) PrebuiltOS() string {
switch runtime.GOOS {
case "linux":
- return "linux-x86"
+ switch runtime.GOARCH {
+ case "amd64":
+ return "linux-x86"
+ case "arm64":
+ return "linux-arm64"
+ default:
+ panic(fmt.Errorf("Unknown GOARCH %s", runtime.GOARCH))
+ }
case "darwin":
return "darwin-x86"
default:
- panic("Unknown GOOS")
+ panic(fmt.Errorf("Unknown GOOS %s", runtime.GOOS))
}
}
@@ -2222,7 +2229,6 @@ var (
"RELEASE_APEX_CONTRIBUTIONS_NFC": "com.android.nfcservices",
"RELEASE_APEX_CONTRIBUTIONS_ONDEVICEPERSONALIZATION": "com.android.ondevicepersonalization",
"RELEASE_APEX_CONTRIBUTIONS_PERMISSION": "com.android.permission",
- "RELEASE_APEX_CONTRIBUTIONS_PRIMARY_LIBS": "",
"RELEASE_APEX_CONTRIBUTIONS_PROFILING": "com.android.profiling",
"RELEASE_APEX_CONTRIBUTIONS_REMOTEKEYPROVISIONING": "com.android.rkpd",
"RELEASE_APEX_CONTRIBUTIONS_RESOLV": "com.android.resolv",
@@ -2275,10 +2281,18 @@ func (c *config) OemProperties() []string {
}
func (c *config) UseDebugArt() bool {
+ // If the ArtTargetIncludeDebugBuild product variable is set then return its value.
if c.productVariables.ArtTargetIncludeDebugBuild != nil {
return Bool(c.productVariables.ArtTargetIncludeDebugBuild)
}
+ // If the RELEASE_APEX_CONTRIBUTIONS_ART build flag is set to use a prebuilt ART apex
+ // then don't use the debug apex.
+ if val, ok := c.GetBuildFlag("RELEASE_APEX_CONTRIBUTIONS_ART"); ok && val != "" {
+ return false
+ }
+
+ // Default to the debug apex for eng builds.
return Bool(c.productVariables.Eng)
}
diff --git a/android/module.go b/android/module.go
index d2da576d5..405573c1b 100644
--- a/android/module.go
+++ b/android/module.go
@@ -15,6 +15,7 @@
package android
import (
+ "errors"
"fmt"
"net/url"
"path/filepath"
@@ -613,17 +614,6 @@ func (t TaggedDistFiles) merge(other TaggedDistFiles) TaggedDistFiles {
return t
}
-func MakeDefaultDistFiles(paths ...Path) TaggedDistFiles {
- for _, p := range paths {
- if p == nil {
- panic("The path to a dist file cannot be nil.")
- }
- }
-
- // The default OutputFile tag is the empty "" string.
- return TaggedDistFiles{DefaultDistTag: paths}
-}
-
type hostAndDeviceProperties struct {
// If set to true, build a variant of the module for the host. Defaults to false.
Host_supported *bool
@@ -1230,6 +1220,13 @@ func (m *ModuleBase) GenerateTaggedDistFiles(ctx BaseModuleContext) TaggedDistFi
tag := proptools.StringDefault(dist.Tag, DefaultDistTag)
distFileForTagFromProvider, err := outputFilesForModuleFromProvider(ctx, m.module, tag)
+
+ // If the module doesn't define output files for the DefaultDistTag, try the files under
+ // the "" tag.
+ if tag == DefaultDistTag && errors.Is(err, ErrUnsupportedOutputTag) {
+ distFileForTagFromProvider, err = outputFilesForModuleFromProvider(ctx, m.module, "")
+ }
+
if err != OutputFilesProviderNotSet {
if err != nil && tag != DefaultDistTag {
ctx.PropertyErrorf("dist.tag", "%s", err.Error())
@@ -2975,14 +2972,12 @@ func outputFilesForModule(ctx PathContext, module Module, tag string) (Paths, er
// If a module doesn't have the OutputFilesProvider, nil is returned.
func outputFilesForModuleFromProvider(ctx PathContext, module Module, tag string) (Paths, error) {
var outputFiles OutputFilesInfo
- fromProperty := false
if mctx, isMctx := ctx.(OutputFilesProviderModuleContext); isMctx {
if !EqualModules(mctx.Module(), module) {
outputFiles, _ = OtherModuleProvider(mctx, module, OutputFilesProvider)
} else {
outputFiles = mctx.GetOutputFiles()
- fromProperty = true
}
} else if cta, isCta := ctx.(*singletonContextAdaptor); isCta {
outputFiles, _ = OtherModuleProvider(cta, module, OutputFilesProvider)
@@ -2999,10 +2994,8 @@ func outputFilesForModuleFromProvider(ctx PathContext, module Module, tag string
} else if taggedOutputFiles, hasTag := outputFiles.TaggedOutputFiles[tag]; hasTag {
return taggedOutputFiles, nil
} else {
- if fromProperty {
- return nil, fmt.Errorf("unsupported tag %q for module getting its own output files", tag)
- } else {
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
+ return nil, UnsupportedOutputTagError{
+ tag: tag,
}
}
}
@@ -3021,8 +3014,24 @@ type OutputFilesInfo struct {
var OutputFilesProvider = blueprint.NewProvider[OutputFilesInfo]()
+type UnsupportedOutputTagError struct {
+ tag string
+}
+
+func (u UnsupportedOutputTagError) Error() string {
+ return fmt.Sprintf("unsupported output tag %q", u.tag)
+}
+
+func (u UnsupportedOutputTagError) Is(e error) bool {
+ _, ok := e.(UnsupportedOutputTagError)
+ return ok
+}
+
+var _ error = UnsupportedOutputTagError{}
+
// This is used to mark the case where OutputFilesProvider is not set on some modules.
var OutputFilesProviderNotSet = fmt.Errorf("No output files from provider")
+var ErrUnsupportedOutputTag = UnsupportedOutputTagError{}
// Modules can implement HostToolProvider and return a valid OptionalPath from HostToolPath() to
// specify that they can be used as a tool by a genrule module.
diff --git a/android/neverallow.go b/android/neverallow.go
index 70af2acc3..14dc6d212 100644
--- a/android/neverallow.go
+++ b/android/neverallow.go
@@ -298,33 +298,29 @@ func createLimitDirgroupRule() []Rule {
WithoutMatcher("visibility", InAllowedList([]string{"//trusty/vendor/google/aosp/scripts", "//trusty/vendor/google/proprietary/scripts"})).Because(reason),
NeverAllow().
ModuleType("genrule").
- // TODO: remove the 4 below targets once new targets are submitted
- Without("name", "trusty-arm64.lk.elf.gen").
- Without("name", "trusty-arm64-virt-test-debug.lk.elf.gen").
- Without("name", "trusty-x86_64.lk.elf.gen").
- Without("name", "trusty-x86_64-test.lk.elf.gen").
- // trusty vm target names moving forward
- Without("name", "trusty-test_vm-arm64.elf.gen").
- Without("name", "trusty-test_vm-x86.elf.gen").
- Without("name", "trusty-security_vm-arm64.elf.gen").
- Without("name", "trusty-security_vm-x86.elf.gen").
- Without("name", "trusty-widevine_vm-arm64.elf.gen").
- Without("name", "trusty-widevine_vm-x86.elf.gen").
+ // Trusty TEE target names
+ Without("name", "trusty_tee_package_goog").
+ Without("name", "trusty_tee_package").
+ // Trusty vm target names
+ Without("name", "trusty_test_vm_arm64.bin").
+ Without("name", "trusty_test_vm_x86_64.elf").
+ Without("name", "trusty_security_vm_arm64.bin").
+ Without("name", "trusty_security_vm_x86_64.elf").
+ Without("name", "trusty_widevine_vm_arm64.bin").
+ Without("name", "trusty_widevine_vm_x86_64.elf").
WithMatcher("dir_srcs", isSetMatcherInstance).Because(reason),
NeverAllow().
ModuleType("genrule").
- // TODO: remove the 4 below targets once new targets are submitted
- Without("name", "trusty-arm64.lk.elf.gen").
- Without("name", "trusty-arm64-virt-test-debug.lk.elf.gen").
- Without("name", "trusty-x86_64.lk.elf.gen").
- Without("name", "trusty-x86_64-test.lk.elf.gen").
- // trusty vm target names moving forward
- Without("name", "trusty-test_vm-arm64.elf.gen").
- Without("name", "trusty-test_vm-x86.elf.gen").
- Without("name", "trusty-security_vm-arm64.elf.gen").
- Without("name", "trusty-security_vm-x86.elf.gen").
- Without("name", "trusty-widevine_vm-arm64.elf.gen").
- Without("name", "trusty-widevine_vm-x86.elf.gen").
+ // Trusty TEE target names
+ Without("name", "trusty_tee_package_goog").
+ Without("name", "trusty_tee_package").
+ // Trusty vm target names
+ Without("name", "trusty_test_vm_arm64.bin").
+ Without("name", "trusty_test_vm_x86_64.elf").
+ Without("name", "trusty_security_vm_arm64.bin").
+ Without("name", "trusty_security_vm_x86_64.elf").
+ Without("name", "trusty_widevine_vm_arm64.bin").
+ Without("name", "trusty_widevine_vm_x86_64.elf").
With("keep_gendir", "true").Because(reason),
}
}
diff --git a/android/paths.go b/android/paths.go
index a944c48db..9c0c9a273 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -209,6 +209,10 @@ type ModuleErrorfContext interface {
var _ ModuleErrorfContext = blueprint.ModuleContext(nil)
+type AddMissingDependenciesContext interface {
+ AddMissingDependencies([]string)
+}
+
// reportPathError will register an error with the attached context. It
// attempts ctx.ModuleErrorf for a better error message first, then falls
// back to ctx.Errorf.
@@ -220,7 +224,9 @@ func reportPathError(ctx PathContext, err error) {
// attempts ctx.ModuleErrorf for a better error message first, then falls
// back to ctx.Errorf.
func ReportPathErrorf(ctx PathContext, format string, args ...interface{}) {
- if mctx, ok := ctx.(ModuleErrorfContext); ok {
+ if mctx, ok := ctx.(AddMissingDependenciesContext); ok && ctx.Config().AllowMissingDependencies() {
+ mctx.AddMissingDependencies([]string{fmt.Sprintf(format, args...)})
+ } else if mctx, ok := ctx.(ModuleErrorfContext); ok {
mctx.ModuleErrorf(format, args...)
} else if ectx, ok := ctx.(errorfContext); ok {
ectx.Errorf(format, args...)
diff --git a/android/provider.go b/android/provider.go
index b48fd9148..d005daf55 100644
--- a/android/provider.go
+++ b/android/provider.go
@@ -16,6 +16,12 @@ var _ OtherModuleProviderContext = BottomUpMutatorContext(nil)
var _ OtherModuleProviderContext = SingletonContext(nil)
var _ OtherModuleProviderContext = (*TestContext)(nil)
+// ConfigAndOtherModuleProviderContext is OtherModuleProviderContext + ConfigContext
+type ConfigAndOtherModuleProviderContext interface {
+ OtherModuleProviderContext
+ ConfigContext
+}
+
// OtherModuleProvider reads the provider for the given module. If the provider has been set the value is
// returned and the boolean is true. If it has not been set the zero value of the provider's type is returned
// and the boolean is false. The value returned may be a deep copy of the value originally passed to SetProvider.
diff --git a/apex/apex.go b/apex/apex.go
index 0e4416b4f..f70076899 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2263,6 +2263,8 @@ func (a *apexBundle) GenerateAndroidBuildActions(ctx android.ModuleContext) {
FlatListPath: a.FlatListPath(),
Updatable: a.Updatable(),
})
+
+ android.SetProvider(ctx, filesystem.ApexKeyPathInfoProvider, filesystem.ApexKeyPathInfo{a.apexKeysPath})
}
// Set prebuiltInfoProvider. This will be used by `apex_prebuiltinfo_singleton` to print out a metadata file
diff --git a/apex/builder.go b/apex/builder.go
index 15737f8c7..2fc4902fb 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -588,6 +588,7 @@ func (a *apexBundle) installApexSystemServerFiles(ctx android.ModuleContext) {
}
a.extraInstalledFiles = append(a.extraInstalledFiles, installedFile)
a.extraInstalledPairs = append(a.extraInstalledPairs, installPair{install.OutputPathOnHost, installedFile})
+ ctx.PackageFile(install.InstallDirOnDevice, install.InstallFileOnDevice, install.OutputPathOnHost)
}
if performInstalls {
for _, dexJar := range fi.systemServerDexJars {
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 3daa4f81a..89b0091be 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -21,6 +21,7 @@ import (
"android/soong/android"
"android/soong/dexpreopt"
+ "android/soong/filesystem"
"android/soong/java"
"android/soong/provenance"
@@ -245,6 +246,7 @@ func (p *prebuiltCommon) installApexSystemServerFiles(ctx android.ModuleContext)
}
p.extraInstalledFiles = append(p.extraInstalledFiles, installedFile)
p.extraInstalledPairs = append(p.extraInstalledPairs, installPair{install.OutputPathOnHost, installedFile})
+ ctx.PackageFile(install.InstallDirOnDevice, install.InstallFileOnDevice, install.OutputPathOnHost)
}
for _, dexJar := range p.systemServerDexJars {
@@ -676,6 +678,8 @@ func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
ctx.SetOutputFiles(android.Paths{p.outputApex}, "")
+
+ android.SetProvider(ctx, filesystem.ApexKeyPathInfoProvider, filesystem.ApexKeyPathInfo{p.apexKeysPath})
}
func (p *Prebuilt) ProvenanceMetaDataFile() android.Path {
@@ -872,4 +876,6 @@ func (a *ApexSet) GenerateAndroidBuildActions(ctx android.ModuleContext) {
}
ctx.SetOutputFiles(android.Paths{a.outputApex}, "")
+
+ android.SetProvider(ctx, filesystem.ApexKeyPathInfoProvider, filesystem.ApexKeyPathInfo{a.apexKeysPath})
}
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 03f229ef4..b016788ee 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -244,10 +244,6 @@ func (library *libraryDecorator) prepareAndroidMKProviderInfo(config android.Con
entries.Class = "HEADER_LIBRARIES"
}
- if library.distFile != nil {
- entries.DistFiles = android.MakeDefaultDistFiles(library.distFile)
- }
-
library.androidMkWriteExportedFlags(entries)
library.androidMkEntriesWriteAdditionalDependenciesForSourceAbiDiff(entries)
@@ -336,7 +332,6 @@ func (binary *binaryDecorator) prepareAndroidMKProviderInfo(config android.Confi
ctx.subAndroidMk(config, entries, binary.baseInstaller)
entries.Class = "EXECUTABLES"
- entries.DistFiles = binary.distFiles
entries.SetString("LOCAL_SOONG_UNSTRIPPED_BINARY", binary.unstrippedOutputFile.String())
if len(binary.symlinks) > 0 {
entries.AddStrings("LOCAL_MODULE_SYMLINKS", binary.symlinks...)
diff --git a/cc/binary.go b/cc/binary.go
index c4791c519..627d5e560 100644
--- a/cc/binary.go
+++ b/cc/binary.go
@@ -104,8 +104,8 @@ type binaryDecorator struct {
// Output archive of gcno coverage information
coverageOutputFile android.OptionalPath
- // Location of the files that should be copied to dist dir when requested
- distFiles android.TaggedDistFiles
+ // Location of the file that should be copied to dist dir when no explicit tag is requested
+ defaultDistFile android.Path
// Action command lines to run directly after the binary is installed. For example,
// may be used to symlink runtime dependencies (such as bionic) alongside installation.
@@ -385,11 +385,11 @@ func (binary *binaryDecorator) link(ctx ModuleContext,
// When dist'ing a library or binary that has use_version_lib set, always
// distribute the stamped version, even for the device.
versionedOutputFile := android.PathForModuleOut(ctx, "versioned", fileName)
- binary.distFiles = android.MakeDefaultDistFiles(versionedOutputFile)
+ binary.defaultDistFile = versionedOutputFile
if binary.stripper.NeedsStrip(ctx) {
out := android.PathForModuleOut(ctx, "versioned-stripped", fileName)
- binary.distFiles = android.MakeDefaultDistFiles(out)
+ binary.defaultDistFile = out
binary.stripper.StripExecutableOrSharedLib(ctx, versionedOutputFile, out, stripFlags)
}
@@ -575,3 +575,10 @@ func (binary *binaryDecorator) verifyHostBionicLinker(ctx ModuleContext, in, lin
},
})
}
+
+func (binary *binaryDecorator) defaultDistFiles() []android.Path {
+ if binary.defaultDistFile == nil {
+ return nil
+ }
+ return []android.Path{binary.defaultDistFile}
+}
diff --git a/cc/cc.go b/cc/cc.go
index 9e373ad8e..4da110307 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -774,6 +774,10 @@ type linker interface {
// Get the deps that have been explicitly specified in the properties.
linkerSpecifiedDeps(ctx android.ConfigurableEvaluatorContext, module *Module, specifiedDeps specifiedDeps) specifiedDeps
+ // Gets a list of files that will be disted when using the dist property without specifying
+ // an output file tag.
+ defaultDistFiles() []android.Path
+
moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON)
}
@@ -2463,6 +2467,10 @@ func (c *Module) setOutputFiles(ctx ModuleContext) {
if c.linker != nil {
ctx.SetOutputFiles(android.PathsIfNonNil(c.linker.unstrippedOutputFilePath()), "unstripped")
ctx.SetOutputFiles(android.PathsIfNonNil(c.linker.strippedAllOutputFilePath()), "stripped_all")
+ defaultDistFiles := c.linker.defaultDistFiles()
+ if len(defaultDistFiles) > 0 {
+ ctx.SetOutputFiles(defaultDistFiles, android.DefaultDistTag)
+ }
}
}
diff --git a/cc/library.go b/cc/library.go
index 532b7e9aa..8a2b6bdbd 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -220,6 +220,7 @@ func init() {
func RegisterLibraryBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("cc_library_static", LibraryStaticFactory)
+ ctx.RegisterModuleType("cc_rustlibs_for_make", LibraryMakeRustlibsFactory)
ctx.RegisterModuleType("cc_library_shared", LibrarySharedFactory)
ctx.RegisterModuleType("cc_library", LibraryFactory)
ctx.RegisterModuleType("cc_library_host_static", LibraryHostStaticFactory)
@@ -249,6 +250,19 @@ func LibraryStaticFactory() android.Module {
return module.Init()
}
+// cc_rustlibs_for_make creates a static library which bundles together rust_ffi_static
+// deps for Make. This should not be depended on in Soong, and is probably not the
+// module you need unless you are sure of what you're doing. These should only
+// be declared as dependencies in Make. To ensure inclusion, rust_ffi_static modules
+// should be declared in the whole_static_libs property.
+func LibraryMakeRustlibsFactory() android.Module {
+ module, library := NewLibrary(android.HostAndDeviceSupported)
+ library.BuildOnlyStatic()
+ library.wideStaticlibForMake = true
+ module.sdkMemberTypes = []android.SdkMemberType{staticLibrarySdkMemberType}
+ return module.Init()
+}
+
// cc_library_shared creates a shared library for a device and/or host.
func LibrarySharedFactory() android.Module {
module, library := NewLibrary(android.HostAndDeviceSupported)
@@ -419,8 +433,8 @@ type libraryDecorator struct {
// Location of the linked, stripped library for shared libraries, strip: "all"
strippedAllOutputFile android.Path
- // Location of the file that should be copied to dist dir when requested
- distFile android.Path
+ // Location of the file that should be copied to dist dir when no explicit tag is requested
+ defaultDistFile android.Path
versionScriptPath android.OptionalPath
@@ -437,6 +451,10 @@ type libraryDecorator struct {
// Path to the file containing the APIs exported by this library
stubsSymbolFilePath android.Path
+
+ // Forces production of the generated Rust staticlib for cc_library_static.
+ // Intended to be used to provide these generated staticlibs for Make.
+ wideStaticlibForMake bool
}
// linkerProps returns the list of properties structs relevant for this library. (For example, if
@@ -1055,6 +1073,16 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
library.objects = library.objects.Append(objs)
library.wholeStaticLibsFromPrebuilts = android.CopyOfPaths(deps.WholeStaticLibsFromPrebuilts)
+ if library.wideStaticlibForMake {
+ if generatedLib := GenerateRustStaticlib(ctx, deps.RustRlibDeps); generatedLib != nil {
+ // WholeStaticLibsFromPrebuilts are .a files that get included whole into the resulting staticlib
+ // so reuse that here for our Rust staticlibs because we don't have individual object files for
+ // these.
+ deps.WholeStaticLibsFromPrebuilts = append(deps.WholeStaticLibsFromPrebuilts, generatedLib)
+ }
+
+ }
+
fileName := ctx.ModuleName() + staticLibraryExtension
outputFile := android.PathForModuleOut(ctx, fileName)
builderFlags := flagsToBuilderFlags(flags)
@@ -1066,7 +1094,7 @@ func (library *libraryDecorator) linkStatic(ctx ModuleContext,
library.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
} else {
versionedOutputFile := android.PathForModuleOut(ctx, "versioned", fileName)
- library.distFile = versionedOutputFile
+ library.defaultDistFile = versionedOutputFile
library.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
}
}
@@ -1206,11 +1234,11 @@ func (library *libraryDecorator) linkShared(ctx ModuleContext,
library.injectVersionSymbol(ctx, outputFile, versionedOutputFile)
} else {
versionedOutputFile := android.PathForModuleOut(ctx, "versioned", fileName)
- library.distFile = versionedOutputFile
+ library.defaultDistFile = versionedOutputFile
if library.stripper.NeedsStrip(ctx) {
out := android.PathForModuleOut(ctx, "versioned-stripped", fileName)
- library.distFile = out
+ library.defaultDistFile = out
library.stripper.StripExecutableOrSharedLib(ctx, versionedOutputFile, out, stripFlags)
}
@@ -2090,6 +2118,13 @@ func (library *libraryDecorator) overriddenModules() []string {
return library.Properties.Overrides
}
+func (library *libraryDecorator) defaultDistFiles() []android.Path {
+ if library.defaultDistFile == nil {
+ return nil
+ }
+ return []android.Path{library.defaultDistFile}
+}
+
var _ overridable = (*libraryDecorator)(nil)
var versioningMacroNamesListKey = android.NewOnceKey("versioningMacroNamesList")
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 1f0fc0764..c21fe564b 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -560,6 +560,10 @@ func (stub *stubDecorator) nativeCoverage() bool {
return false
}
+func (stub *stubDecorator) defaultDistFiles() []android.Path {
+ return nil
+}
+
// Returns the install path for unversioned NDK libraries (currently only static
// libraries).
func getUnversionedLibraryInstallPath(ctx ModuleContext) android.OutputPath {
diff --git a/cc/object.go b/cc/object.go
index bbfca94c5..95a8beb52 100644
--- a/cc/object.go
+++ b/cc/object.go
@@ -242,6 +242,10 @@ func (object *objectLinker) isCrt() bool {
return Bool(object.Properties.Crt)
}
+func (object *objectLinker) defaultDistFiles() []android.Path {
+ return nil
+}
+
func (object *objectLinker) moduleInfoJSON(ctx ModuleContext, moduleInfoJSON *android.ModuleInfoJSON) {
object.baseLinker.moduleInfoJSON(ctx, moduleInfoJSON)
moduleInfoJSON.Class = []string{"STATIC_LIBRARIES"}
diff --git a/cmd/symbols_map/symbols_map_proto/regen.sh b/cmd/symbols_map/symbols_map_proto/regen.sh
new file mode 100755
index 000000000..3c189d163
--- /dev/null
+++ b/cmd/symbols_map/symbols_map_proto/regen.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+aprotoc --go_out=paths=source_relative:. symbols_map.proto
+
diff --git a/cmd/symbols_map/symbols_map_proto/symbols_map.pb.go b/cmd/symbols_map/symbols_map_proto/symbols_map.pb.go
index f9c0ce5a3..07f4b39f3 100644
--- a/cmd/symbols_map/symbols_map_proto/symbols_map.pb.go
+++ b/cmd/symbols_map/symbols_map_proto/symbols_map.pb.go
@@ -14,8 +14,8 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
-// protoc-gen-go v1.27.1
-// protoc v3.9.1
+// protoc-gen-go v1.30.0
+// protoc v3.21.12
// source: symbols_map.proto
package symbols_map_proto
@@ -93,6 +93,68 @@ func (Mapping_Type) EnumDescriptor() ([]byte, []int) {
return file_symbols_map_proto_rawDescGZIP(), []int{0, 0}
}
+// LocationType is the place where to look for the file with the given
+// identifier.
+type Mapping_LocationType int32
+
+const (
+ // ZIP denotes the file with the given identifier is in the distribuited
+ // symbols.zip or proguard_dict.zip files, or the local disc.
+ Mapping_ZIP Mapping_LocationType = 0
+ // AB denotes the file with the given identifier is in the AB artifacts but
+ // not in a symbols.zip or proguard_dict.zip.
+ Mapping_AB Mapping_LocationType = 1
+)
+
+// Enum value maps for Mapping_LocationType.
+var (
+ Mapping_LocationType_name = map[int32]string{
+ 0: "ZIP",
+ 1: "AB",
+ }
+ Mapping_LocationType_value = map[string]int32{
+ "ZIP": 0,
+ "AB": 1,
+ }
+)
+
+func (x Mapping_LocationType) Enum() *Mapping_LocationType {
+ p := new(Mapping_LocationType)
+ *p = x
+ return p
+}
+
+func (x Mapping_LocationType) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (Mapping_LocationType) Descriptor() protoreflect.EnumDescriptor {
+ return file_symbols_map_proto_enumTypes[1].Descriptor()
+}
+
+func (Mapping_LocationType) Type() protoreflect.EnumType {
+ return &file_symbols_map_proto_enumTypes[1]
+}
+
+func (x Mapping_LocationType) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Do not use.
+func (x *Mapping_LocationType) UnmarshalJSON(b []byte) error {
+ num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
+ if err != nil {
+ return err
+ }
+ *x = Mapping_LocationType(num)
+ return nil
+}
+
+// Deprecated: Use Mapping_LocationType.Descriptor instead.
+func (Mapping_LocationType) EnumDescriptor() ([]byte, []int) {
+ return file_symbols_map_proto_rawDescGZIP(), []int{0, 1}
+}
+
type Mapping struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -107,6 +169,9 @@ type Mapping struct {
Location *string `protobuf:"bytes,2,opt,name=location" json:"location,omitempty"`
// type is the type of the mapping, either ELF or R8.
Type *Mapping_Type `protobuf:"varint,3,opt,name=type,enum=symbols_map.Mapping_Type" json:"type,omitempty"`
+ // location_type is the Location Type that dictates where to search for the
+ // file with the given identifier. Defaults to ZIP if not present.
+ LocationType *Mapping_LocationType `protobuf:"varint,4,opt,name=location_type,json=locationType,enum=symbols_map.Mapping_LocationType" json:"location_type,omitempty"`
}
func (x *Mapping) Reset() {
@@ -162,6 +227,13 @@ func (x *Mapping) GetType() Mapping_Type {
return Mapping_ELF
}
+func (x *Mapping) GetLocationType() Mapping_LocationType {
+ if x != nil && x.LocationType != nil {
+ return *x.LocationType
+ }
+ return Mapping_ZIP
+}
+
type Mappings struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -214,23 +286,29 @@ var File_symbols_map_proto protoreflect.FileDescriptor
var file_symbols_map_proto_rawDesc = []byte{
0x0a, 0x11, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x5f, 0x6d, 0x61, 0x70,
- 0x22, 0x8d, 0x01, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a,
+ 0x22, 0xf6, 0x01, 0x0a, 0x07, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x12, 0x1e, 0x0a, 0x0a,
0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x0a, 0x69, 0x64, 0x65, 0x6e, 0x74, 0x69, 0x66, 0x69, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08,
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x19, 0x2e, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73,
0x5f, 0x6d, 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x54, 0x79, 0x70,
- 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x22, 0x17, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12,
- 0x07, 0x0a, 0x03, 0x45, 0x4c, 0x46, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x52, 0x38, 0x10, 0x01,
- 0x22, 0x3c, 0x0a, 0x08, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x30, 0x0a, 0x08,
- 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14,
+ 0x65, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, 0x46, 0x0a, 0x0d, 0x6c, 0x6f, 0x63, 0x61, 0x74,
+ 0x69, 0x6f, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x21,
0x2e, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x70,
- 0x70, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x31,
- 0x5a, 0x2f, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f,
- 0x63, 0x6d, 0x64, 0x2f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x2f,
- 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f,
+ 0x70, 0x69, 0x6e, 0x67, 0x2e, 0x4c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70,
+ 0x65, 0x52, 0x0c, 0x6c, 0x6f, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x22,
+ 0x17, 0x0a, 0x04, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x45, 0x4c, 0x46, 0x10, 0x00,
+ 0x12, 0x06, 0x0a, 0x02, 0x52, 0x38, 0x10, 0x01, 0x22, 0x1f, 0x0a, 0x0c, 0x4c, 0x6f, 0x63, 0x61,
+ 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x07, 0x0a, 0x03, 0x5a, 0x49, 0x50, 0x10,
+ 0x00, 0x12, 0x06, 0x0a, 0x02, 0x41, 0x42, 0x10, 0x01, 0x22, 0x3c, 0x0a, 0x08, 0x4d, 0x61, 0x70,
+ 0x70, 0x69, 0x6e, 0x67, 0x73, 0x12, 0x30, 0x0a, 0x08, 0x6d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67,
+ 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c,
+ 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x52, 0x08, 0x6d,
+ 0x61, 0x70, 0x70, 0x69, 0x6e, 0x67, 0x73, 0x42, 0x31, 0x5a, 0x2f, 0x61, 0x6e, 0x64, 0x72, 0x6f,
+ 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x63, 0x6d, 0x64, 0x2f, 0x73, 0x79, 0x6d,
+ 0x62, 0x6f, 0x6c, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x2f, 0x73, 0x79, 0x6d, 0x62, 0x6f, 0x6c, 0x73,
+ 0x5f, 0x6d, 0x61, 0x70, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
}
var (
@@ -245,21 +323,23 @@ func file_symbols_map_proto_rawDescGZIP() []byte {
return file_symbols_map_proto_rawDescData
}
-var file_symbols_map_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
+var file_symbols_map_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_symbols_map_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_symbols_map_proto_goTypes = []interface{}{
- (Mapping_Type)(0), // 0: symbols_map.Mapping.Type
- (*Mapping)(nil), // 1: symbols_map.Mapping
- (*Mappings)(nil), // 2: symbols_map.Mappings
+ (Mapping_Type)(0), // 0: symbols_map.Mapping.Type
+ (Mapping_LocationType)(0), // 1: symbols_map.Mapping.LocationType
+ (*Mapping)(nil), // 2: symbols_map.Mapping
+ (*Mappings)(nil), // 3: symbols_map.Mappings
}
var file_symbols_map_proto_depIdxs = []int32{
0, // 0: symbols_map.Mapping.type:type_name -> symbols_map.Mapping.Type
- 1, // 1: symbols_map.Mappings.mappings:type_name -> symbols_map.Mapping
- 2, // [2:2] is the sub-list for method output_type
- 2, // [2:2] is the sub-list for method input_type
- 2, // [2:2] is the sub-list for extension type_name
- 2, // [2:2] is the sub-list for extension extendee
- 0, // [0:2] is the sub-list for field type_name
+ 1, // 1: symbols_map.Mapping.location_type:type_name -> symbols_map.Mapping.LocationType
+ 2, // 2: symbols_map.Mappings.mappings:type_name -> symbols_map.Mapping
+ 3, // [3:3] is the sub-list for method output_type
+ 3, // [3:3] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
}
func init() { file_symbols_map_proto_init() }
@@ -298,7 +378,7 @@ func file_symbols_map_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_symbols_map_proto_rawDesc,
- NumEnums: 1,
+ NumEnums: 2,
NumMessages: 2,
NumExtensions: 0,
NumServices: 0,
diff --git a/cmd/symbols_map/symbols_map_proto/symbols_map.proto b/cmd/symbols_map/symbols_map_proto/symbols_map.proto
index a76d17147..a52f75c2e 100644
--- a/cmd/symbols_map/symbols_map_proto/symbols_map.proto
+++ b/cmd/symbols_map/symbols_map_proto/symbols_map.proto
@@ -40,7 +40,7 @@ message Mapping {
// LocationType is the place where to look for the file with the given
// identifier.
- Enum LocationType {
+ enum LocationType {
// ZIP denotes the file with the given identifier is in the distribuited
// symbols.zip or proguard_dict.zip files, or the local disc.
ZIP = 0;
@@ -56,4 +56,4 @@ message Mapping {
message Mappings {
repeated Mapping mappings = 4;
-} \ No newline at end of file
+}
diff --git a/dexpreopt/Android.bp b/dexpreopt/Android.bp
index 679d06627..ea3f52bd2 100644
--- a/dexpreopt/Android.bp
+++ b/dexpreopt/Android.bp
@@ -9,6 +9,7 @@ bootstrap_go_package {
"class_loader_context.go",
"config.go",
"dexpreopt.go",
+ "system_server_zip.go",
"testing.go",
],
testSrcs: [
diff --git a/dexpreopt/system_server_zip.go b/dexpreopt/system_server_zip.go
new file mode 100644
index 000000000..cef847b7d
--- /dev/null
+++ b/dexpreopt/system_server_zip.go
@@ -0,0 +1,49 @@
+package dexpreopt
+
+import "android/soong/android"
+
+func init() {
+ android.InitRegistrationContext.RegisterSingletonType("system_server_zip_singleton", systemServerZipSingletonFactory)
+}
+
+func systemServerZipSingletonFactory() android.Singleton {
+ return &systemServerZipSingleton{}
+}
+
+type systemServerZipSingleton struct{}
+
+func (s *systemServerZipSingleton) GenerateBuildActions(ctx android.SingletonContext) {
+ global := GetGlobalConfig(ctx)
+ if global.DisablePreopt || global.OnlyPreoptArtBootImage {
+ return
+ }
+
+ systemServerDexjarsDir := android.PathForOutput(ctx, SystemServerDexjarsDir)
+
+ out := android.PathForOutput(ctx, "system_server.zip")
+ builder := android.NewRuleBuilder(pctx, ctx)
+ cmd := builder.Command().BuiltTool("soong_zip").
+ FlagWithOutput("-o ", out).
+ FlagWithArg("-C ", systemServerDexjarsDir.String())
+
+ for i := 0; i < global.SystemServerJars.Len(); i++ {
+ jar := global.SystemServerJars.Jar(i) + ".jar"
+ cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar))
+ }
+ for i := 0; i < global.StandaloneSystemServerJars.Len(); i++ {
+ jar := global.StandaloneSystemServerJars.Jar(i) + ".jar"
+ cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar))
+ }
+ for i := 0; i < global.ApexSystemServerJars.Len(); i++ {
+ jar := global.ApexSystemServerJars.Jar(i) + ".jar"
+ cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar))
+ }
+ for i := 0; i < global.ApexStandaloneSystemServerJars.Len(); i++ {
+ jar := global.ApexStandaloneSystemServerJars.Jar(i) + ".jar"
+ cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar))
+ }
+
+ builder.Build("system_server_zip", "building system_server.zip")
+
+ ctx.DistForGoal("droidcore", out)
+}
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index a440c9113..fad8f0779 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -61,6 +61,7 @@ func RegisterPrebuiltEtcBuildComponents(ctx android.RegistrationContext) {
ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory)
ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory)
ctx.RegisterModuleType("prebuilt_usr_srec", PrebuiltUserSrecFactory)
+ ctx.RegisterModuleType("prebuilt_usr_odml", PrebuiltUserOdmlFactory)
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
ctx.RegisterModuleType("prebuilt_overlay", PrebuiltOverlayFactory)
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
@@ -786,6 +787,17 @@ func PrebuiltUserSrecFactory() android.Module {
return module
}
+// prebuilt_usr_odml is for a prebuilt artifact that is installed in
+// <partition>/usr/odml/<sub_dir> directory.
+func PrebuiltUserOdmlFactory() android.Module {
+ module := &PrebuiltEtc{}
+ InitPrebuiltEtcModule(module, "usr/odml")
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
+ return module
+}
+
// prebuilt_font installs a font in <partition>/fonts directory.
func PrebuiltFontFactory() android.Module {
module := &PrebuiltEtc{}
diff --git a/filesystem/android_device.go b/filesystem/android_device.go
index 178c716d4..a2fa0f08a 100644
--- a/filesystem/android_device.go
+++ b/filesystem/android_device.go
@@ -175,7 +175,7 @@ func (a *androidDevice) GenerateAndroidBuildActions(ctx android.ModuleContext) {
allInstalledModules := a.allInstalledModules(ctx)
- a.buildTargetFilesZip(ctx)
+ a.buildTargetFilesZip(ctx, allInstalledModules)
a.buildProguardZips(ctx, allInstalledModules)
var deps []android.Path
@@ -279,7 +279,7 @@ func (a *androidDevice) allInstalledModules(ctx android.ModuleContext) []android
ret := []android.Module{}
ctx.WalkDepsProxy(func(mod, _ android.ModuleProxy) bool {
- if variations, ok := allOwners[mod.Name()]; ok && android.InList(ctx.OtherModuleSubDir(mod), variations) {
+ if variations, ok := allOwners[ctx.OtherModuleName(mod)]; ok && android.InList(ctx.OtherModuleSubDir(mod), variations) {
ret = append(ret, mod)
}
return true
@@ -393,7 +393,7 @@ type targetFilesystemZipCopy struct {
destSubdir string
}
-func (a *androidDevice) buildTargetFilesZip(ctx android.ModuleContext) {
+func (a *androidDevice) buildTargetFilesZip(ctx android.ModuleContext, allInstalledModules []android.Module) {
targetFilesDir := android.PathForModuleOut(ctx, "target_files_dir")
targetFilesZip := android.PathForModuleOut(ctx, "target_files.zip")
@@ -497,7 +497,7 @@ func (a *androidDevice) buildTargetFilesZip(ctx android.ModuleContext) {
}
a.copyImagesToTargetZip(ctx, builder, targetFilesDir)
- a.copyMetadataToTargetZip(ctx, builder, targetFilesDir)
+ a.copyMetadataToTargetZip(ctx, builder, targetFilesDir, allInstalledModules)
builder.Command().
BuiltTool("soong_zip").
@@ -549,7 +549,7 @@ func (a *androidDevice) copyImagesToTargetZip(ctx android.ModuleContext, builder
}
}
-func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir android.WritablePath) {
+func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, builder *android.RuleBuilder, targetFilesDir android.WritablePath, allInstalledModules []android.Module) {
// Create a META/ subdirectory
builder.Command().Textf("mkdir -p %s/META", targetFilesDir.String())
if proptools.Bool(a.deviceProps.Ab_ota_updater) {
@@ -587,7 +587,22 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build
if android.InList(partition, []string{"userdata"}) {
continue
}
- builder.Command().Textf("cp").Input(fsInfos[partition].FilesystemConfig).Textf(" %s/META/%s", targetFilesDir.String(), a.filesystemConfigNameForTargetFiles(partition))
+ if partition != "vendor_ramdisk" {
+ // vendor_ramdisk will be handled separately.
+ builder.Command().Textf("cp").Input(fsInfos[partition].FilesystemConfig).Textf(" %s/META/%s", targetFilesDir.String(), a.filesystemConfigNameForTargetFiles(partition))
+ }
+ if partition == "ramdisk" {
+ // Create an additional copy at boot_filesystem_config.txt
+ builder.Command().Textf("cp").Input(fsInfos[partition].FilesystemConfig).Textf(" %s/META/boot_filesystem_config.txt", targetFilesDir.String())
+ }
+ 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")
+ }
+ 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")
+ }
}
// Copy ramdisk_node_list
if ramdiskNodeList := android.PathForModuleSrc(ctx, proptools.String(a.deviceProps.Ramdisk_node_list)); ramdiskNodeList != nil {
@@ -597,6 +612,35 @@ func (a *androidDevice) copyMetadataToTargetZip(ctx android.ModuleContext, build
if releaseTools := android.PathForModuleSrc(ctx, proptools.String(a.deviceProps.Releasetools_extension)); releaseTools != nil {
builder.Command().Textf("cp").Input(releaseTools).Textf(" %s/META/", targetFilesDir.String())
}
+ // apexkeys.txt
+ var installedApexKeys []android.Path
+ for _, installedModule := range allInstalledModules {
+ if info, ok := android.OtherModuleProvider(ctx, installedModule, ApexKeyPathInfoProvider); ok {
+ installedApexKeys = append(installedApexKeys, info.ApexKeyPath)
+ }
+ }
+ installedApexKeys = android.SortedUniquePaths(installedApexKeys) // Sort by keypath to match make
+ builder.Command().Text("cat").Inputs(installedApexKeys).Textf(" >> %s/META/apexkeys.txt", targetFilesDir.String())
+
+}
+
+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) {
+ fsConfigOut := android.PathForModuleOut(ctx, filename)
+ ctx.Build(pctx, android.BuildParams{
+ Rule: fsConfigRule,
+ Output: fsConfigOut,
+ Args: map[string]string{
+ "rootDir": stagingDir,
+ "prefix": "",
+ },
+ })
+ builder.Command().Textf("cp").Input(fsConfigOut).Textf(" %s/META/", targetFilesDir)
}
// Filenames for the partition specific fs_config files.
diff --git a/filesystem/system_other.go b/filesystem/system_other.go
index 5309e9012..cbfd78b5b 100644
--- a/filesystem/system_other.go
+++ b/filesystem/system_other.go
@@ -172,9 +172,10 @@ func (m *systemOtherImage) GenerateAndroidBuildActions(ctx android.ModuleContext
builder.Build("build_system_other_hermetic", "build system other")
fsInfo := FilesystemInfo{
- Output: output,
- OutputHermetic: outputHermetic,
- RootDir: stagingDir,
+ Output: output,
+ OutputHermetic: outputHermetic,
+ RootDir: stagingDir,
+ FilesystemConfig: m.generateFilesystemConfig(ctx, stagingDir, stagingDirTimestamp),
}
android.SetProvider(ctx, FilesystemProvider, fsInfo)
@@ -183,6 +184,20 @@ func (m *systemOtherImage) GenerateAndroidBuildActions(ctx android.ModuleContext
ctx.CheckbuildFile(output)
}
+func (s *systemOtherImage) generateFilesystemConfig(ctx android.ModuleContext, stagingDir, stagingDirTimestamp android.Path) android.Path {
+ out := android.PathForModuleOut(ctx, "filesystem_config.txt")
+ ctx.Build(pctx, android.BuildParams{
+ Rule: fsConfigRule,
+ Input: stagingDirTimestamp, // assemble the staging directory
+ Output: out,
+ Args: map[string]string{
+ "rootDir": stagingDir.String(),
+ "prefix": "system/",
+ },
+ })
+ return out
+}
+
func (f *systemOtherImage) propFileForHermeticImg(ctx android.ModuleContext, builder *android.RuleBuilder, inputPropFile android.Path) android.Path {
propFilePinnedTimestamp := android.PathForModuleOut(ctx, "for_target_files", "prop")
builder.Command().Textf("cat").Input(inputPropFile).Flag(">").Output(propFilePinnedTimestamp).
diff --git a/fsgen/filesystem_creator.go b/fsgen/filesystem_creator.go
index e2485a1d3..3d83706a3 100644
--- a/fsgen/filesystem_creator.go
+++ b/fsgen/filesystem_creator.go
@@ -347,11 +347,9 @@ func (f *filesystemCreator) createDeviceModule(
superImageSubPartitions []string,
) {
baseProps := &struct {
- Name *string
- Android_info *string
+ Name *string
}{
- Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "device")),
- Android_info: proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "android_info.prop{.txt}")),
+ Name: proptools.StringPtr(generatedModuleName(ctx.Config(), "device")),
}
// Currently, only the system and system_ext partition module is created.
@@ -406,6 +404,7 @@ func (f *filesystemCreator) createDeviceModule(
Ab_ota_partitions: ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.AbOtaPartitions,
Ab_ota_postinstall_config: ctx.Config().ProductVariables().PartitionVarsForSoongMigrationOnlyDoNotUse.AbOtaPostInstallConfig,
Ramdisk_node_list: proptools.StringPtr(":ramdisk_node_list"),
+ Android_info: proptools.StringPtr(":" + generatedModuleName(ctx.Config(), "android_info.prop{.txt}")),
}
if bootloader, ok := f.createBootloaderFilegroup(ctx); ok {
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 313d8c7a4..228704355 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -675,6 +675,139 @@ func (d *dexpreoptBootJars) GenerateAndroidBuildActions(ctx android.ModuleContex
installs: artBootImageHostInstalls,
},
)
+
+ d.buildBootZip(ctx)
+}
+
+// Build the boot.zip which contains the boot jars and their compilation output
+// We can do this only if preopt is enabled and if the product uses libart config (which sets the
+// default properties for preopting).
+// Origionally, this was only for ART Cloud.
+func (d *dexpreoptBootJars) buildBootZip(ctx android.ModuleContext) {
+ image := d.defaultBootImage
+ if image == nil || SkipDexpreoptBootJars(ctx) {
+ return
+ }
+ global := dexpreopt.GetGlobalConfig(ctx)
+ globalSoong := dexpreopt.GetGlobalSoongConfig(ctx)
+ if global.DisablePreopt || global.OnlyPreoptArtBootImage {
+ return
+ }
+
+ bootclasspathDexFiles, bootclassPathLocations := bcpForDexpreopt(ctx, global.PreoptWithUpdatableBcp)
+ if len(bootclasspathDexFiles) == 0 {
+ return
+ }
+
+ systemServerDexjarsDir := android.PathForOutput(ctx, dexpreopt.SystemServerDexjarsDir)
+
+ bootZipMetadataTmp := android.PathForModuleOut(ctx, "boot_zip", "METADATA.txt.tmp")
+ bootZipMetadata := android.PathForModuleOut(ctx, "boot_zip", "METADATA.txt")
+ newlineFile := android.PathForModuleOut(ctx, "boot_zip", "newline.txt")
+ android.WriteFileRule(ctx, newlineFile, "")
+
+ dexPreoptRootDir := filepath.Dir(filepath.Dir(bootclasspathDexFiles[0].String()))
+
+ var sb strings.Builder
+ sb.WriteString("bootclasspath = ")
+ for i, bootclasspathJar := range bootclasspathDexFiles {
+ if i > 0 {
+ sb.WriteString(":")
+ }
+ rel, err := filepath.Rel(dexPreoptRootDir, bootclasspathJar.String())
+ if err != nil {
+ ctx.ModuleErrorf("All dexpreopt jars should be under the same rootdir %q, but %q wasn't.", dexPreoptRootDir, bootclasspathJar)
+ } else {
+ sb.WriteString(rel)
+ }
+ }
+ sb.WriteString("\nbootclasspath-locations = ")
+ for i, bootclasspathLocation := range bootclassPathLocations {
+ if i > 0 {
+ sb.WriteString(":")
+ }
+ sb.WriteString(bootclasspathLocation)
+ }
+ sb.WriteString("\nboot-image = ")
+
+ // Infix can be 'art' (ART image for testing), 'boot' (primary), or 'mainline' (mainline
+ // extension). Soong creates a set of variables for Make, one or each boot image. The only
+ // reason why the ART image is exposed to Make is testing (art gtests) and benchmarking (art
+ // golem benchmarks). Install rules that use those variables are in dex_preopt_libart.mk. Here
+ // for dexpreopt purposes the infix is always 'boot' or 'mainline'.
+ dexpreoptInfix := "boot"
+ if global.PreoptWithUpdatableBcp {
+ dexpreoptInfix = "mainline"
+ }
+
+ var dexPreoptImageZipBoot android.Path
+ var dexPreoptImageZipArt android.Path
+ var dexPreoptImageZipMainline android.Path
+ for _, current := range append(d.otherImages, image) {
+ if current.name == dexpreoptInfix {
+ _, imageLocationsOnDevice := current.getAnyAndroidVariant().imageLocations()
+ for i, location := range imageLocationsOnDevice {
+ imageLocationsOnDevice[i] = strings.TrimPrefix(location, "/")
+ }
+ sb.WriteString(strings.Join(imageLocationsOnDevice, ":"))
+ }
+ switch current.name {
+ case "boot":
+ dexPreoptImageZipBoot = current.zip
+ case "art":
+ dexPreoptImageZipArt = current.zip
+ case "mainline":
+ dexPreoptImageZipMainline = current.zip
+ }
+ }
+ sb.WriteString("\nextra-args = ")
+ android.WriteFileRuleVerbatim(ctx, bootZipMetadataTmp, sb.String())
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cat,
+ Inputs: []android.Path{
+ bootZipMetadataTmp,
+ globalSoong.UffdGcFlag,
+ newlineFile,
+ },
+ Output: bootZipMetadata,
+ })
+
+ bootZipFirstPart := android.PathForModuleOut(ctx, "boot_zip", "boot_first_part.zip")
+ bootZip := android.PathForModuleOut(ctx, "boot_zip", "boot.zip")
+ builder := android.NewRuleBuilder(pctx, ctx)
+ cmd := builder.Command().BuiltTool("soong_zip").
+ FlagWithOutput("-o ", bootZipFirstPart).
+ FlagWithArg("-C ", filepath.Dir(filepath.Dir(bootclasspathDexFiles[0].String())))
+ for _, bootclasspathJar := range bootclasspathDexFiles {
+ cmd.FlagWithInput("-f ", bootclasspathJar)
+ }
+ for i := range global.SystemServerJars.Len() {
+ // Use "/system" path for JARs with "platform:" prefix. These JARs counterintuitively use
+ // "platform" prefix but they will be actually installed to /system partition.
+ // For the remaining system server JARs use the partition signified by the prefix.
+ // For example, prefix "system_ext:" will use "/system_ext" path.
+ dir := global.SystemServerJars.Apex(i)
+ if dir == "platform" {
+ dir = "system"
+ }
+ jar := global.SystemServerJars.Jar(i) + ".jar"
+ cmd.FlagWithArg("-e ", dir+"/framework/"+jar)
+ cmd.FlagWithInput("-f ", systemServerDexjarsDir.Join(ctx, jar))
+ }
+ cmd.Flag("-j")
+ cmd.FlagWithInput("-f ", bootZipMetadata)
+
+ builder.Command().BuiltTool("merge_zips").
+ Output(bootZip).
+ Input(bootZipFirstPart).
+ Input(dexPreoptImageZipBoot).
+ Input(dexPreoptImageZipArt).
+ Input(dexPreoptImageZipMainline)
+
+ builder.Build("boot_zip", "build boot.zip")
+
+ ctx.DistForGoal("droidcore", bootZipMetadata)
+ ctx.DistForGoal("droidcore", bootZip)
}
// GenerateSingletonBuildActions generates build rules for the dexpreopt config for Make.
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 431bbacfd..6d27e54d0 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -494,7 +494,7 @@ func TestJavaSdkLibrary_AccessOutputFiles_NoAnnotations(t *testing.T) {
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("foo"),
).
- ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": unsupported module reference tag ".public.annotations.zip"`)).
+ ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": unsupported output tag ".public.annotations.zip"`)).
RunTestWithBp(t, `
java_sdk_library {
name: "foo",
@@ -520,7 +520,7 @@ func TestJavaSdkLibrary_AccessOutputFiles_MissingScope(t *testing.T) {
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("foo"),
).
- ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": unsupported module reference tag ".system.stubs.source"`)).
+ ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": unsupported output tag ".system.stubs.source"`)).
RunTestWithBp(t, `
java_sdk_library {
name: "foo",
diff --git a/rust/config/OWNERS b/rust/config/OWNERS
index dfff87354..e4bf5e60c 100644
--- a/rust/config/OWNERS
+++ b/rust/config/OWNERS
@@ -1,2 +1,2 @@
-per-file global.go = srhines@google.com, chh@google.com, pirama@google.com, yikong@google.com
+per-file global.go = srhines@google.com, pirama@google.com, yikong@google.com
diff --git a/rust/library_test.go b/rust/library_test.go
index 6db95253f..6cc4f2517 100644
--- a/rust/library_test.go
+++ b/rust/library_test.go
@@ -426,6 +426,45 @@ func TestRustFFIExportedIncludes(t *testing.T) {
android.AssertStringDoesContain(t, "cFlags for lib module", libfooStatic.Args["cFlags"], " -Irust_includes ")
}
+// Make sure cc_rustlibs_for_make has the expected behavior, and that
+// cc_library_static does as well.
+// This is here instead of cc/library_test.go because the test needs to
+// define a rust_ffi module which can't be done in soong-cc to avoid the
+// circular dependency.
+func TestCCRustlibsForMake(t *testing.T) {
+ t.Parallel()
+ result := testRust(t, `
+ rust_ffi_static {
+ name: "libbar",
+ srcs: ["foo.rs"],
+ crate_name: "bar",
+ export_include_dirs: ["rust_includes"],
+ host_supported: true,
+ }
+
+ cc_rustlibs_for_make {
+ name: "libmakerustlibs",
+ whole_static_libs: ["libbar"],
+ }
+
+ cc_library_static {
+ name: "libccstatic",
+ whole_static_libs: ["libbar"],
+ }
+ `)
+
+ libmakerustlibs := result.ModuleForTests(t, "libmakerustlibs", "android_arm64_armv8-a_static").MaybeRule("rustc")
+ libccstatic := result.ModuleForTests(t, "libccstatic", "android_arm64_armv8-a_static").MaybeRule("rustc")
+
+ if libmakerustlibs.Output == nil {
+ t.Errorf("cc_rustlibs_for_make is not generating a Rust staticlib when it should")
+ }
+
+ if libccstatic.Output != nil {
+ t.Errorf("cc_library_static is generating a Rust staticlib when it should not")
+ }
+}
+
func TestRustVersionScript(t *testing.T) {
ctx := testRust(t, `
rust_library {
diff --git a/scripts/microfactory.bash b/scripts/microfactory.bash
index ce4a0e48a..49988fa29 100644
--- a/scripts/microfactory.bash
+++ b/scripts/microfactory.bash
@@ -23,7 +23,14 @@
# Ensure GOROOT is set to the in-tree version.
case $(uname) in
Linux)
- export GOROOT="${TOP}/prebuilts/go/linux-x86/"
+ case $(uname -m) in
+ x86_64)
+ export GOROOT="${TOP}/prebuilts/go/linux-x86/"
+ ;;
+ aarch64)
+ export GOROOT="${TOP}/prebuilts/go/linux-arm64/"
+ ;;
+ esac
;;
Darwin)
export GOROOT="${TOP}/prebuilts/go/darwin-x86/"
diff --git a/sdk/sdk.go b/sdk/sdk.go
index aa82abbb4..ab50659cd 100644
--- a/sdk/sdk.go
+++ b/sdk/sdk.go
@@ -178,22 +178,24 @@ func (s *sdk) GenerateAndroidBuildActions(ctx android.ModuleContext) {
s.buildSnapshot(ctx, sdkVariants)
}
+ if s.snapshotFile.Valid() != s.infoFile.Valid() {
+ panic(fmt.Sprintf("Snapshot (%q) and info file (%q) should both be set or neither should be set.", s.snapshotFile, s.infoFile))
+ }
+
if s.snapshotFile.Valid() {
ctx.SetOutputFiles([]android.Path{s.snapshotFile.Path()}, "")
+ ctx.SetOutputFiles([]android.Path{s.snapshotFile.Path(), s.infoFile.Path()}, android.DefaultDistTag)
}
}
func (s *sdk) AndroidMkEntries() []android.AndroidMkEntries {
- if !s.snapshotFile.Valid() != !s.infoFile.Valid() {
- panic("Snapshot (%q) and info file (%q) should both be set or neither should be set.")
- } else if !s.snapshotFile.Valid() {
+ if !s.snapshotFile.Valid() {
return []android.AndroidMkEntries{}
}
return []android.AndroidMkEntries{android.AndroidMkEntries{
Class: "FAKE",
OutputFile: s.snapshotFile,
- DistFiles: android.MakeDefaultDistFiles(s.snapshotFile.Path(), s.infoFile.Path()),
Include: "$(BUILD_PHONY_PACKAGE)",
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
diff --git a/ui/build/androidmk_denylist.go b/ui/build/androidmk_denylist.go
index 640a82d9a..cd49ec876 100644
--- a/ui/build/androidmk_denylist.go
+++ b/ui/build/androidmk_denylist.go
@@ -70,8 +70,8 @@ func blockAndroidMks(ctx Context, androidMks []string) {
}
}
-// The Android.mk files in these directories are for NDK build system.
-var external_ndk_androidmks []string = []string{
+var external_androidmks []string = []string{
+ // The Android.mk files in these directories are for NDK build system.
"external/fmtlib/",
"external/google-breakpad/",
"external/googletest/",
@@ -83,6 +83,9 @@ var external_ndk_androidmks []string = []string{
"external/vulkan-validation-layers/",
"external/walt/",
"external/webp/",
+ // These directories hold the published Android SDK, used in Unbundled Gradle builds.
+ "prebuilts/fullsdk-darwin",
+ "prebuilts/fullsdk-linux",
}
var art_androidmks = []string{
@@ -90,8 +93,8 @@ var art_androidmks = []string{
}
func ignoreSomeAndroidMks(androidMks []string) (filtered []string) {
- ignore_androidmks := make([]string, 0, len(external_ndk_androidmks)+len(art_androidmks))
- ignore_androidmks = append(ignore_androidmks, external_ndk_androidmks...)
+ ignore_androidmks := make([]string, 0, len(external_androidmks)+len(art_androidmks))
+ ignore_androidmks = append(ignore_androidmks, external_androidmks...)
ignore_androidmks = append(ignore_androidmks, art_androidmks...)
shouldKeep := func(androidmk string) bool {
diff --git a/ui/build/config.go b/ui/build/config.go
index a4f778d74..94b07811d 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -1117,11 +1117,18 @@ func (c *configImpl) ApiSurfacesOutDir() string {
func (c *configImpl) PrebuiltOS() string {
switch runtime.GOOS {
case "linux":
- return "linux-x86"
+ switch runtime.GOARCH {
+ case "amd64":
+ return "linux-x86"
+ case "arm64":
+ return "linux-arm64"
+ default:
+ panic(fmt.Errorf("Unknown GOARCH %s", runtime.GOARCH))
+ }
case "darwin":
return "darwin-x86"
default:
- panic("Unknown GOOS")
+ panic(fmt.Errorf("Unknown GOOS %s", runtime.GOOS))
}
}
@@ -1711,13 +1718,7 @@ func (c *configImpl) hostCrossOut() string {
}
func (c *configImpl) HostPrebuiltTag() string {
- if runtime.GOOS == "linux" {
- return "linux-x86"
- } else if runtime.GOOS == "darwin" {
- return "darwin-x86"
- } else {
- panic("Unsupported OS")
- }
+ return c.PrebuiltOS()
}
func (c *configImpl) KatiBin() string {
diff --git a/ui/build/path.go b/ui/build/path.go
index cc1d7e9c2..b92d79959 100644
--- a/ui/build/path.go
+++ b/ui/build/path.go
@@ -20,7 +20,6 @@ import (
"os"
"os/exec"
"path/filepath"
- "runtime"
"strings"
"github.com/google/blueprint/microfactory"
@@ -122,7 +121,7 @@ func SetupLitePath(ctx Context, config Config, tmpDir string) {
myPath, _ = filepath.Abs(myPath)
// Set up the checked-in prebuilts path directory for the current host OS.
- prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86")
+ prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + config.PrebuiltOS())
myPath = prebuiltsPath + string(os.PathListSeparator) + myPath
// Set $PATH to be the directories containing the host tool symlinks, and
@@ -258,7 +257,7 @@ func SetupPath(ctx Context, config Config) {
// We put some prebuilts in $PATH, since it's infeasible to add dependencies
// for all of them.
- prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + runtime.GOOS + "-x86")
+ prebuiltsPath, _ := filepath.Abs("prebuilts/build-tools/path/" + config.PrebuiltOS())
myPath = prebuiltsPath + string(os.PathListSeparator) + myPath
// Replace the $PATH variable with the path_interposer symlinks, and