Merge changes from topic "build_go_source_mixed_builds" into main
* changes:
Delete aliases to prebuilts
Add functionality to sandbox mixed build actions
diff --git a/android/Android.bp b/android/Android.bp
index fc5198f..f5bb785 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -107,6 +107,7 @@
"bazel_test.go",
"config_test.go",
"config_bp2build_test.go",
+ "configured_jars_test.go",
"csuite_config_test.go",
"defaults_test.go",
"depset_test.go",
diff --git a/android/allowlists/allowlists.go b/android/allowlists/allowlists.go
index d320599..974245e 100644
--- a/android/allowlists/allowlists.go
+++ b/android/allowlists/allowlists.go
@@ -931,9 +931,6 @@
"test_fips", // depends on unconverted modules: adb
"timezone-host", // depends on unconverted modules: art.module.api.annotations
- // '//bionic/libc:libc_bp2build_cc_library_static' is duplicated in the 'deps' attribute of rule
- "toybox-static",
-
// aidl files not created
"overlayable_policy_aidl_interface",
diff --git a/android/bazel.go b/android/bazel.go
index 1bfbdec..0d2c777 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -255,7 +255,7 @@
if b.ShouldConvertWithBp2build(ctx) {
return bp2buildModuleLabel(ctx, module)
}
- panic(fmt.Errorf("requested non-existent label for module ", module.Name()))
+ panic(fmt.Errorf("requested non-existent label for module %s", module.Name()))
}
type Bp2BuildConversionAllowlist struct {
diff --git a/android/bazel_handler.go b/android/bazel_handler.go
index 94bc88b..4d91cc8 100644
--- a/android/bazel_handler.go
+++ b/android/bazel_handler.go
@@ -1389,6 +1389,9 @@
cmd.ImplicitOutput(PathForBazelOut(ctx, outputPath))
}
}
+ for _, inputPath := range buildStatement.OrderOnlyInputs {
+ cmd.OrderOnly(PathForBazelOut(ctx, inputPath))
+ }
for _, inputPath := range buildStatement.InputPaths {
cmd.Implicit(PathForBazelOut(ctx, inputPath))
}
diff --git a/android/config.go b/android/config.go
index fa43962..9cfbc9e 100644
--- a/android/config.go
+++ b/android/config.go
@@ -202,10 +202,10 @@
// product configuration values are read from Kati-generated soong.variables.
type config struct {
// Options configurable with soong.variables
- productVariables productVariables
+ productVariables ProductVariables
// Only available on configs created by TestConfig
- TestProductVariables *productVariables
+ TestProductVariables *ProductVariables
// A specialized context object for Bazel/Soong mixed builds and migration
// purposes.
@@ -321,7 +321,7 @@
// loadFromConfigFile loads and decodes configuration options from a JSON file
// in the current working directory.
-func loadFromConfigFile(configurable *productVariables, filename string) error {
+func loadFromConfigFile(configurable *ProductVariables, filename string) error {
// Try to open the file
configFileReader, err := os.Open(filename)
defer configFileReader.Close()
@@ -373,7 +373,7 @@
// atomically writes the config file in case two copies of soong_build are running simultaneously
// (for example, docs generation and ninja manifest generation)
-func saveToConfigFile(config *productVariables, filename string) error {
+func saveToConfigFile(config *ProductVariables, filename string) error {
data, err := json.MarshalIndent(&config, "", " ")
if err != nil {
return fmt.Errorf("cannot marshal config data: %s", err.Error())
@@ -402,7 +402,7 @@
return nil
}
-func saveToBazelConfigFile(config *productVariables, outDir string) error {
+func saveToBazelConfigFile(config *ProductVariables, outDir string) error {
dir := filepath.Join(outDir, bazel.SoongInjectionDirName, "product_config")
err := createDirIfNonexistent(dir, os.ModePerm)
if err != nil {
@@ -1355,6 +1355,10 @@
return c.bazelForceEnabledModules
}
+func (c *config) IsVndkDeprecated() bool {
+ return !Bool(c.productVariables.KeepVndk)
+}
+
func (c *deviceConfig) Arches() []Arch {
var arches []Arch
for _, target := range c.config.Targets[Android] {
diff --git a/android/config_test.go b/android/config_test.go
index 9df5288..7d327a2 100644
--- a/android/config_test.go
+++ b/android/config_test.go
@@ -75,7 +75,7 @@
// run validateConfigAnnotations against each type that might have json annotations
func TestProductConfigAnnotations(t *testing.T) {
- err := validateConfigAnnotations(&productVariables{})
+ err := validateConfigAnnotations(&ProductVariables{})
if err != nil {
t.Errorf(err.Error())
}
@@ -88,7 +88,7 @@
}
}
-func verifyProductVariableMarshaling(t *testing.T, v productVariables) {
+func verifyProductVariableMarshaling(t *testing.T, v ProductVariables) {
dir := t.TempDir()
path := filepath.Join(dir, "test.variables")
err := saveToConfigFile(&v, path)
@@ -96,20 +96,20 @@
t.Errorf("Couldn't save default product config: %q", err)
}
- var v2 productVariables
+ var v2 ProductVariables
err = loadFromConfigFile(&v2, path)
if err != nil {
t.Errorf("Couldn't load default product config: %q", err)
}
}
func TestDefaultProductVariableMarshaling(t *testing.T) {
- v := productVariables{}
+ v := ProductVariables{}
v.SetDefaultConfig()
verifyProductVariableMarshaling(t, v)
}
func TestBootJarsMarshaling(t *testing.T) {
- v := productVariables{}
+ v := ProductVariables{}
v.SetDefaultConfig()
v.BootJars = ConfiguredJarList{
apexes: []string{"apex"},
diff --git a/android/configured_jars.go b/android/configured_jars.go
index 1281bae..c7b808f 100644
--- a/android/configured_jars.go
+++ b/android/configured_jars.go
@@ -178,7 +178,7 @@
func (l *ConfiguredJarList) BuildPaths(ctx PathContext, dir OutputPath) WritablePaths {
paths := make(WritablePaths, l.Len())
for i, jar := range l.jars {
- paths[i] = dir.Join(ctx, ModuleStem(jar)+".jar")
+ paths[i] = dir.Join(ctx, ModuleStem(ctx.Config(), l.Apex(i), jar)+".jar")
}
return paths
}
@@ -187,8 +187,8 @@
// prefix.
func (l *ConfiguredJarList) BuildPathsByModule(ctx PathContext, dir OutputPath) map[string]WritablePath {
paths := map[string]WritablePath{}
- for _, jar := range l.jars {
- paths[jar] = dir.Join(ctx, ModuleStem(jar)+".jar")
+ for i, jar := range l.jars {
+ paths[jar] = dir.Join(ctx, ModuleStem(ctx.Config(), l.Apex(i), jar)+".jar")
}
return paths
}
@@ -228,24 +228,32 @@
return json.Marshal(list)
}
-// ModuleStem hardcodes the stem of framework-minus-apex to return "framework".
-//
-// TODO(b/139391334): hard coded until we find a good way to query the stem of a
-// module before any other mutators are run.
-func ModuleStem(module string) string {
- if module == "framework-minus-apex" {
- return "framework"
+func OverrideConfiguredJarLocationFor(cfg Config, apex string, jar string) (newApex string, newJar string) {
+ for _, entry := range cfg.productVariables.ConfiguredJarLocationOverrides {
+ tuple := strings.Split(entry, ":")
+ if len(tuple) != 4 {
+ panic("malformed configured jar location override '%s', expected format: <old_apex>:<old_jar>:<new_apex>:<new_jar>")
+ }
+ if apex == tuple[0] && jar == tuple[1] {
+ return tuple[2], tuple[3]
+ }
}
- return module
+ return apex, jar
+}
+
+// ModuleStem returns the overridden jar name.
+func ModuleStem(cfg Config, apex string, jar string) string {
+ _, newJar := OverrideConfiguredJarLocationFor(cfg, apex, jar)
+ return newJar
}
// DevicePaths computes the on-device paths for the list of (apex, jar) pairs,
// based on the operating system.
func (l *ConfiguredJarList) DevicePaths(cfg Config, ostype OsType) []string {
paths := make([]string, l.Len())
- for i, jar := range l.jars {
- apex := l.apexes[i]
- name := ModuleStem(jar) + ".jar"
+ for i := 0; i < l.Len(); i++ {
+ apex, jar := OverrideConfiguredJarLocationFor(cfg, l.Apex(i), l.Jar(i))
+ name := jar + ".jar"
var subdir string
if apex == "platform" {
diff --git a/android/configured_jars_test.go b/android/configured_jars_test.go
new file mode 100644
index 0000000..4b586e4
--- /dev/null
+++ b/android/configured_jars_test.go
@@ -0,0 +1,46 @@
+// Copyright 2023 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 (
+ "testing"
+)
+
+func TestOverrideConfiguredJarLocationFor(t *testing.T) {
+ cfg := NullConfig("", "")
+
+ cfg.productVariables = ProductVariables{
+ ConfiguredJarLocationOverrides: []string{
+ "platform:libfoo-old:com.android.foo:libfoo-new",
+ "com.android.bar:libbar-old:platform:libbar-new",
+ },
+ }
+
+ apex, jar := OverrideConfiguredJarLocationFor(cfg, "platform", "libfoo-old")
+ AssertStringEquals(t, "", "com.android.foo", apex)
+ AssertStringEquals(t, "", "libfoo-new", jar)
+
+ apex, jar = OverrideConfiguredJarLocationFor(cfg, "platform", "libbar-old")
+ AssertStringEquals(t, "", "platform", apex)
+ AssertStringEquals(t, "", "libbar-old", jar)
+
+ apex, jar = OverrideConfiguredJarLocationFor(cfg, "com.android.bar", "libbar-old")
+ AssertStringEquals(t, "", "platform", apex)
+ AssertStringEquals(t, "", "libbar-new", jar)
+
+ apex, jar = OverrideConfiguredJarLocationFor(cfg, "platform", "libbar-old")
+ AssertStringEquals(t, "", "platform", apex)
+ AssertStringEquals(t, "", "libbar-old", jar)
+}
diff --git a/android/fixture.go b/android/fixture.go
index dbc3bc5..6660afd 100644
--- a/android/fixture.go
+++ b/android/fixture.go
@@ -369,7 +369,7 @@
// Allow access to the product variables when preparing the fixture.
type FixtureProductVariables struct {
- *productVariables
+ *ProductVariables
}
// Modify product variables.
diff --git a/android/sdk_version_test.go b/android/sdk_version_test.go
index ea99c4d..30bd002 100644
--- a/android/sdk_version_test.go
+++ b/android/sdk_version_test.go
@@ -75,7 +75,7 @@
config := NullConfig("", "")
- config.productVariables = productVariables{
+ config.productVariables = ProductVariables{
Platform_sdk_version: intPtr(31),
Platform_sdk_codename: stringPtr("Tiramisu"),
Platform_version_active_codenames: []string{"Tiramisu"},
diff --git a/android/test_config.go b/android/test_config.go
index 28d9ec4..2a59d92 100644
--- a/android/test_config.go
+++ b/android/test_config.go
@@ -35,7 +35,7 @@
envCopy["PATH"] = os.Getenv("PATH")
config := &config{
- productVariables: productVariables{
+ productVariables: ProductVariables{
DeviceName: stringPtr("test_device"),
DeviceProduct: stringPtr("test_product"),
Platform_sdk_version: intPtr(30),
diff --git a/android/util.go b/android/util.go
index e17d7b2..5375373 100644
--- a/android/util.go
+++ b/android/util.go
@@ -137,19 +137,17 @@
}
// IndexList returns the index of the first occurrence of the given string in the list or -1
-func IndexList(s string, list []string) int {
+func IndexList[T comparable](t T, list []T) int {
for i, l := range list {
- if l == s {
+ if l == t {
return i
}
}
-
return -1
}
-// InList checks if the string belongs to the list
-func InList(s string, list []string) bool {
- return IndexList(s, list) != -1
+func InList[T comparable](t T, list []T) bool {
+ return IndexList(t, list) != -1
}
func setFromList[T comparable](l []T) map[T]bool {
diff --git a/android/variable.go b/android/variable.go
index 3bec854..1c81f3c 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -185,7 +185,7 @@
var defaultProductVariables interface{} = variableProperties{}
-type productVariables struct {
+type ProductVariables struct {
// Suffix to add to generated Makefiles
Make_suffix *string `json:",omitempty"`
@@ -401,9 +401,10 @@
WithDexpreopt bool `json:",omitempty"`
- ManifestPackageNameOverrides []string `json:",omitempty"`
- CertificateOverrides []string `json:",omitempty"`
- PackageNameOverrides []string `json:",omitempty"`
+ ManifestPackageNameOverrides []string `json:",omitempty"`
+ CertificateOverrides []string `json:",omitempty"`
+ PackageNameOverrides []string `json:",omitempty"`
+ ConfiguredJarLocationOverrides []string `json:",omitempty"`
ApexGlobalMinSdkVersionOverride *string `json:",omitempty"`
@@ -474,6 +475,8 @@
ReleaseVersion string `json:",omitempty"`
ReleaseAconfigValueSets []string `json:",omitempty"`
+
+ KeepVndk *bool `json:",omitempty"`
}
func boolPtr(v bool) *bool {
@@ -488,8 +491,8 @@
return &v
}
-func (v *productVariables) SetDefaultConfig() {
- *v = productVariables{
+func (v *ProductVariables) SetDefaultConfig() {
+ *v = ProductVariables{
BuildNumberFile: stringPtr("build_number.txt"),
Platform_version_name: stringPtr("S"),
diff --git a/apex/apex_test.go b/apex/apex_test.go
index f7a4dea..df138e0 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -10553,6 +10553,7 @@
src: "libc.so",
min_sdk_version: "29",
recovery_available: true,
+ vendor_available: true,
}
api_imports {
name: "api_imports",
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 7be8477..f30f7f6 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -297,6 +297,7 @@
// Configure some libraries in the art bootclasspath_fragment that match the source
// bootclasspath_fragment's contents property.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
+ dexpreopt.FixtureSetTestOnlyArtBootImageJars("com.android.art:foo", "com.android.art:bar"),
addSource("foo", "bar"),
java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
).RunTest(t)
@@ -315,7 +316,7 @@
// Make sure that the source bootclasspath_fragment copies its dex files to the predefined
// locations for the art image.
- module := result.ModuleForTests("art-bootclasspath-fragment", "android_common_apex10000")
+ module := result.ModuleForTests("dex_bootjars", "android_common")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
@@ -364,6 +365,7 @@
// Configure some libraries in the art bootclasspath_fragment that match the source
// bootclasspath_fragment's contents property.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
+ dexpreopt.FixtureSetTestOnlyArtBootImageJars("com.android.art:foo", "com.android.art:bar"),
addSource("foo", "bar"),
// Make sure that a preferred prebuilt with consistent contents doesn't affect the apex.
@@ -386,7 +388,7 @@
// Make sure that the prebuilt bootclasspath_fragment copies its dex files to the predefined
// locations for the art image.
- module := result.ModuleForTests("prebuilt_art-bootclasspath-fragment", "android_common_com.android.art")
+ module := result.ModuleForTests("dex_bootjars", "android_common")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
@@ -462,6 +464,7 @@
// Configure some libraries in the art bootclasspath_fragment.
java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
+ dexpreopt.FixtureSetTestOnlyArtBootImageJars("com.android.art:foo", "com.android.art:bar"),
java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
)
@@ -537,7 +540,7 @@
`prebuilt_foo`,
})
- module := result.ModuleForTests("art-bootclasspath-fragment", "android_common_com.android.art")
+ module := result.ModuleForTests("dex_bootjars", "android_common")
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
diff --git a/apex/dexpreopt_bootjars_test.go b/apex/dexpreopt_bootjars_test.go
index ff8f912..2e828ca 100644
--- a/apex/dexpreopt_bootjars_test.go
+++ b/apex/dexpreopt_bootjars_test.go
@@ -138,8 +138,8 @@
prepareForTestWithArtApex,
).RunTestWithBp(t, fmt.Sprintf(bp, preferPrebuilt))
- platformBootclasspath := result.ModuleForTests("platform-bootclasspath", "android_common")
- rule := platformBootclasspath.Output(ruleFile)
+ dexBootJars := result.ModuleForTests("dex_bootjars", "android_common")
+ rule := dexBootJars.Output(ruleFile)
inputs := rule.Implicits.Strings()
sort.Strings(inputs)
@@ -162,8 +162,8 @@
"out/soong/dexpreopt_arm64/dex_bootjars_input/foo.jar",
"out/soong/dexpreopt_arm64/dex_bootjars_input/bar.jar",
"out/soong/dexpreopt_arm64/dex_bootjars_input/baz.jar",
- "out/soong/.intermediates/art-bootclasspath-fragment/android_common_apex10000/art/boot.prof",
- "out/soong/.intermediates/platform-bootclasspath/android_common/boot/boot.prof",
+ "out/soong/.intermediates/art-bootclasspath-fragment/android_common_apex10000/art-bootclasspath-fragment/boot.prof",
+ "out/soong/.intermediates/default/java/dex_bootjars/android_common/boot/boot.prof",
}
expectedOutputs := []string{
@@ -200,7 +200,7 @@
"out/soong/dexpreopt_arm64/dex_bootjars_input/bar.jar",
"out/soong/dexpreopt_arm64/dex_bootjars_input/baz.jar",
"out/soong/.intermediates/com.android.art.deapexer/android_common/deapexer/etc/boot-image.prof",
- "out/soong/.intermediates/platform-bootclasspath/android_common/boot/boot.prof",
+ "out/soong/.intermediates/default/java/dex_bootjars/android_common/boot/boot.prof",
}
expectedOutputs := []string{
diff --git a/bazel/aquery.go b/bazel/aquery.go
index 3428328..186a494 100644
--- a/bazel/aquery.go
+++ b/bazel/aquery.go
@@ -115,6 +115,7 @@
// input path string, but not both.
InputDepsetHashes []string
InputPaths []string
+ OrderOnlyInputs []string
FileContents string
// If ShouldRunInSbox is true, Soong will use sbox to created an isolated environment
// and run the mixed build action there
@@ -137,6 +138,8 @@
depsetHashToArtifactPathsCache sync.Map
// Maps artifact ids to fully expanded paths.
artifactIdToPath map[artifactId]string
+
+ extraBuildStatements []*BuildStatement
}
// The tokens should be substituted with the value specified here, instead of the
@@ -166,13 +169,29 @@
return pathFragmentId(pf.Id)
})
+ var extraBuildStatements []*BuildStatement
artifactIdToPath := make(map[artifactId]string, len(aqueryResult.Artifacts))
for _, artifact := range aqueryResult.Artifacts {
artifactPath, err := expandPathFragment(pathFragmentId(artifact.PathFragmentId), pathFragments)
if err != nil {
return nil, err
}
- artifactIdToPath[artifactId(artifact.Id)] = artifactPath
+ if strings.HasSuffix(artifactPath, "DumpPlatformClassPath.java") {
+ // TODO(b/291828210): This is a workaround for the fact that DumpPlatformClassPath.java
+ // has a timestamp in 2033. We'll copy it to a new file using a order-only dep, so that
+ // the file is not recopied every build. Technically the order-only dep would produce
+ // incremental build issues if this was a regular file produced as part of the build,
+ // but this file is actually created by bazel during analysis, so it's not an issue.
+ outputPath := "hack_for_b291828210/DumpPlatformClassPath.java"
+ extraBuildStatements = append(extraBuildStatements, &BuildStatement{
+ Command: fmt.Sprintf("cp %s %s", artifactPath, outputPath),
+ OutputPaths: []string{outputPath},
+ OrderOnlyInputs: []string{artifactPath},
+ })
+ artifactIdToPath[artifactId(artifact.Id)] = outputPath
+ } else {
+ artifactIdToPath[artifactId(artifact.Id)] = artifactPath
+ }
}
// Map middleman artifact ContentHash to input artifact depset ID.
@@ -199,6 +218,7 @@
depsetHashToArtifactPathsCache: sync.Map{},
emptyDepsetIds: make(map[depsetId]struct{}, 0),
artifactIdToPath: artifactIdToPath,
+ extraBuildStatements: extraBuildStatements,
}
// Validate and adjust aqueryResult.DepSetOfFiles values.
@@ -372,6 +392,7 @@
if err != nil {
return nil, nil, err
}
+ buildStatements = append(buildStatements, aqueryHandler.extraBuildStatements...)
depsetsByHash := map[string]AqueryDepset{}
depsets := make([]AqueryDepset, 0, len(aqueryHandler.depsetIdToAqueryDepset))
diff --git a/bazel/configurability.go b/bazel/configurability.go
index 8f63ec4..d962a1d 100644
--- a/bazel/configurability.go
+++ b/bazel/configurability.go
@@ -74,6 +74,8 @@
InApex = "in_apex"
NonApex = "non_apex"
+
+ ErrorproneDisabled = "errorprone_disabled"
)
func PowerSetWithoutEmptySet[T any](items []T) [][]T {
@@ -216,6 +218,11 @@
NonApex: "//build/bazel/rules/apex:non_apex",
ConditionsDefaultConfigKey: ConditionsDefaultSelectKey,
}
+
+ errorProneMap = map[string]string{
+ ErrorproneDisabled: "//build/bazel/rules/java/errorprone:errorprone_globally_disabled",
+ ConditionsDefaultConfigKey: ConditionsDefaultSelectKey,
+ }
)
// basic configuration types
@@ -229,6 +236,7 @@
productVariables
osAndInApex
inApex
+ errorProneDisabled
)
func osArchString(os string, arch string) string {
@@ -237,13 +245,14 @@
func (ct configurationType) String() string {
return map[configurationType]string{
- noConfig: "no_config",
- arch: "arch",
- os: "os",
- osArch: "arch_os",
- productVariables: "product_variables",
- osAndInApex: "os_in_apex",
- inApex: "in_apex",
+ noConfig: "no_config",
+ arch: "arch",
+ os: "os",
+ osArch: "arch_os",
+ productVariables: "product_variables",
+ osAndInApex: "os_in_apex",
+ inApex: "in_apex",
+ errorProneDisabled: "errorprone_disabled",
}[ct]
}
@@ -274,6 +283,10 @@
if _, ok := inApexMap[config]; !ok {
panic(fmt.Errorf("Unknown in_apex config: %s", config))
}
+ case errorProneDisabled:
+ if _, ok := errorProneMap[config]; !ok {
+ panic(fmt.Errorf("Unknown errorprone config: %s", config))
+ }
default:
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ct))
}
@@ -303,6 +316,8 @@
return config
case inApex:
return inApexMap[config]
+ case errorProneDisabled:
+ return errorProneMap[config]
default:
panic(fmt.Errorf("Unrecognized ConfigurationType %d", ca.configurationType))
}
@@ -321,6 +336,8 @@
OsAndInApexAxis = ConfigurationAxis{configurationType: osAndInApex}
// An axis for in_apex-specific configurations
InApexAxis = ConfigurationAxis{configurationType: inApex}
+
+ ErrorProneAxis = ConfigurationAxis{configurationType: errorProneDisabled}
)
// ProductVariableConfigurationAxis returns an axis for the given product variable
diff --git a/bazel/properties.go b/bazel/properties.go
index e22f4db..15af09b 100644
--- a/bazel/properties.go
+++ b/bazel/properties.go
@@ -766,7 +766,7 @@
switch axis.configurationType {
case noConfig:
lla.Value = list
- case arch, os, osArch, productVariables, osAndInApex, inApex:
+ case arch, os, osArch, productVariables, osAndInApex, inApex, errorProneDisabled:
if lla.ConfigurableValues == nil {
lla.ConfigurableValues = make(configurableLabelLists)
}
@@ -782,7 +782,7 @@
switch axis.configurationType {
case noConfig:
return lla.Value
- case arch, os, osArch, productVariables, osAndInApex, inApex:
+ case arch, os, osArch, productVariables, osAndInApex, inApex, errorProneDisabled:
return lla.ConfigurableValues[axis][config]
default:
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
@@ -1346,7 +1346,7 @@
switch axis.configurationType {
case noConfig:
sla.Value = list
- case arch, os, osArch, productVariables, osAndInApex:
+ case arch, os, osArch, productVariables, osAndInApex, errorProneDisabled:
if sla.ConfigurableValues == nil {
sla.ConfigurableValues = make(configurableStringLists)
}
@@ -1362,7 +1362,7 @@
switch axis.configurationType {
case noConfig:
return sla.Value
- case arch, os, osArch, productVariables, osAndInApex:
+ case arch, os, osArch, productVariables, osAndInApex, errorProneDisabled:
return sla.ConfigurableValues[axis][config]
default:
panic(fmt.Errorf("Unrecognized ConfigurationAxis %s", axis))
diff --git a/bp2build/bp2build.go b/bp2build/bp2build.go
index b22cb28..cfe52db 100644
--- a/bp2build/bp2build.go
+++ b/bp2build/bp2build.go
@@ -80,6 +80,12 @@
os.Exit(1)
}
bp2buildFiles := CreateBazelFiles(ctx.Config(), nil, res.buildFileToTargets, ctx.mode)
+ injectionFiles, additionalBp2buildFiles, err := CreateSoongInjectionDirFiles(ctx, res.metrics)
+ if err != nil {
+ fmt.Printf("%s\n", err.Error())
+ os.Exit(1)
+ }
+ bp2buildFiles = append(bp2buildFiles, additionalBp2buildFiles...)
writeFiles(ctx, bp2buildDir, bp2buildFiles)
// Delete files under the bp2build root which weren't just written. An
// alternative would have been to delete the whole directory and write these
@@ -88,11 +94,6 @@
// performance implications.
deleteFilesExcept(ctx, bp2buildDir, bp2buildFiles)
- injectionFiles, err := CreateSoongInjectionDirFiles(ctx, res.metrics)
- if err != nil {
- fmt.Printf("%s\n", err.Error())
- os.Exit(1)
- }
writeFiles(ctx, android.PathForOutput(ctx, bazel.SoongInjectionDirName), injectionFiles)
starlarkDeps, err := starlark_import.GetNinjaDeps()
if err != nil {
@@ -107,20 +108,20 @@
// This includes
// 1. config value(s) that are hardcoded in Soong
// 2. product_config variables
-func CreateSoongInjectionDirFiles(ctx *CodegenContext, metrics CodegenMetrics) ([]BazelFile, error) {
+func CreateSoongInjectionDirFiles(ctx *CodegenContext, metrics CodegenMetrics) ([]BazelFile, []BazelFile, error) {
var ret []BazelFile
- productConfigFiles, err := CreateProductConfigFiles(ctx)
+ productConfigInjectionFiles, productConfigBp2BuildDirFiles, err := CreateProductConfigFiles(ctx)
if err != nil {
- return nil, err
+ return nil, nil, err
}
- ret = append(ret, productConfigFiles...)
+ ret = append(ret, productConfigInjectionFiles...)
injectionFiles, err := soongInjectionFiles(ctx.Config(), metrics)
if err != nil {
- return nil, err
+ return nil, nil, err
}
- ret = append(ret, injectionFiles...)
- return ret, nil
+ ret = append(injectionFiles, ret...)
+ return ret, productConfigBp2BuildDirFiles, nil
}
// Get the output directory and create it if it doesn't exist.
diff --git a/bp2build/bp2build_product_config.go b/bp2build/bp2build_product_config.go
index 7224496..8d5c99c 100644
--- a/bp2build/bp2build_product_config.go
+++ b/bp2build/bp2build_product_config.go
@@ -1,14 +1,20 @@
package bp2build
import (
+ "android/soong/android"
+ "android/soong/starlark_import"
+ "encoding/json"
"fmt"
"os"
"path/filepath"
"strings"
+
+ "github.com/google/blueprint/proptools"
+ "go.starlark.net/starlark"
)
func CreateProductConfigFiles(
- ctx *CodegenContext) ([]BazelFile, error) {
+ ctx *CodegenContext) ([]BazelFile, []BazelFile, error) {
cfg := &ctx.config
targetProduct := "unknown"
if cfg.HasDeviceProduct() {
@@ -25,9 +31,14 @@
if !strings.HasPrefix(productVariablesFileName, "/") {
productVariablesFileName = filepath.Join(ctx.topDir, productVariablesFileName)
}
- bytes, err := os.ReadFile(productVariablesFileName)
+ productVariablesBytes, err := os.ReadFile(productVariablesFileName)
if err != nil {
- return nil, err
+ return nil, nil, err
+ }
+ productVariables := android.ProductVariables{}
+ err = json.Unmarshal(productVariablesBytes, &productVariables)
+ if err != nil {
+ return nil, nil, err
}
// TODO(b/249685973): the name is product_config_platforms because product_config
@@ -39,11 +50,16 @@
"{VARIANT}", targetBuildVariant,
"{PRODUCT_FOLDER}", currentProductFolder)
- result := []BazelFile{
+ platformMappingContent, err := platformMappingContent(productReplacer.Replace("@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}"), &productVariables)
+ if err != nil {
+ return nil, nil, err
+ }
+
+ injectionDirFiles := []BazelFile{
newFile(
currentProductFolder,
"soong.variables.bzl",
- `variables = json.decode("""`+strings.ReplaceAll(string(bytes), "\\", "\\\\")+`""")`),
+ `variables = json.decode("""`+strings.ReplaceAll(string(productVariablesBytes), "\\", "\\\\")+`""")`),
newFile(
currentProductFolder,
"BUILD",
@@ -99,6 +115,7 @@
"product_config_platforms",
"common.bazelrc",
productReplacer.Replace(`
+build --platform_mappings=platform_mappings
build --platforms @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_linux_x86_64
build:android --platforms=@soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}
@@ -120,6 +137,48 @@
build --host_platform @soong_injection//{PRODUCT_FOLDER}:{PRODUCT}-{VARIANT}_darwin_x86_64
`)),
}
+ bp2buildDirFiles := []BazelFile{
+ newFile(
+ "",
+ "platform_mappings",
+ platformMappingContent),
+ }
+ return injectionDirFiles, bp2buildDirFiles, nil
+}
+func platformMappingContent(mainProductLabel string, mainProductVariables *android.ProductVariables) (string, error) {
+ productsForTesting, err := starlark_import.GetStarlarkValue[map[string]map[string]starlark.Value]("products_for_testing")
+ if err != nil {
+ return "", err
+ }
+ result := "platforms:\n"
+ result += platformMappingSingleProduct(mainProductLabel, mainProductVariables)
+ for product, productVariablesStarlark := range productsForTesting {
+ productVariables, err := starlarkMapToProductVariables(productVariablesStarlark)
+ if err != nil {
+ return "", err
+ }
+ result += platformMappingSingleProduct("@//build/bazel/tests/products:"+product, &productVariables)
+ }
+ return result, nil
+}
+
+func platformMappingSingleProduct(label string, productVariables *android.ProductVariables) string {
+ buildSettings := ""
+ buildSettings += fmt.Sprintf(" --//build/bazel/product_config:apex_global_min_sdk_version_override=%s\n", proptools.String(productVariables.ApexGlobalMinSdkVersionOverride))
+ result := ""
+ for _, extension := range []string{"", "_linux_x86_64", "_linux_bionic_x86_64", "_linux_musl_x86", "_linux_musl_x86_64"} {
+ result += " " + label + extension + "\n" + buildSettings
+ }
+ return result
+}
+
+func starlarkMapToProductVariables(in map[string]starlark.Value) (android.ProductVariables, error) {
+ var err error
+ result := android.ProductVariables{}
+ result.ApexGlobalMinSdkVersionOverride, err = starlark_import.NoneableString(in["ApexGlobalMinSdkVersionOverride"])
+ if err != nil {
+ return result, err
+ }
return result, nil
}
diff --git a/bp2build/cc_binary_conversion_test.go b/bp2build/cc_binary_conversion_test.go
index 18cb9e1..d9a7860 100644
--- a/bp2build/cc_binary_conversion_test.go
+++ b/bp2build/cc_binary_conversion_test.go
@@ -881,7 +881,7 @@
targets: []testBazelTarget{
{"cc_binary", "foo", AttrNameToString{
"local_includes": `["."]`,
- "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "features": `["sanitizer_blocklist_foo_blocklist_txt"]`,
}},
},
})
@@ -1214,3 +1214,82 @@
},
})
}
+
+func TestCcBinaryStatic_SystemSharedLibUsedAsDep(t *testing.T) {
+ runCcBinaryTestCase(t, ccBinaryBp2buildTestCase{
+ description: "cc_library_static system_shared_lib empty for linux_bionic variant",
+ blueprint: soongCcLibraryStaticPreamble +
+ simpleModuleDoNotConvertBp2build("cc_library", "libc") + `
+
+cc_library {
+ name: "libm",
+ bazel_module: { bp2build_available: false },
+}
+
+cc_binary {
+ name: "used_in_bionic_oses",
+ target: {
+ android: {
+ static_libs: ["libc"],
+ },
+ linux_bionic: {
+ static_libs: ["libc"],
+ },
+ },
+ include_build_directory: false,
+ static_executable: true,
+}
+
+cc_binary {
+ name: "all",
+ static_libs: ["libc"],
+ include_build_directory: false,
+ static_executable: true,
+}
+
+cc_binary {
+ name: "keep_for_empty_system_shared_libs",
+ static_libs: ["libc"],
+ system_shared_libs: [],
+ include_build_directory: false,
+ static_executable: true,
+}
+
+cc_binary {
+ name: "used_with_stubs",
+ static_libs: ["libm"],
+ include_build_directory: false,
+ static_executable: true,
+}
+
+cc_binary {
+ name: "keep_with_stubs",
+ static_libs: ["libm"],
+ system_shared_libs: [],
+ include_build_directory: false,
+ static_executable: true,
+}
+`,
+ targets: []testBazelTarget{
+ {"cc_binary", "all", AttrNameToString{
+ "linkshared": "False",
+ }},
+ {"cc_binary", "keep_for_empty_system_shared_libs", AttrNameToString{
+ "deps": `[":libc_bp2build_cc_library_static"]`,
+ "system_deps": `[]`,
+ "linkshared": "False",
+ }},
+ {"cc_binary", "keep_with_stubs", AttrNameToString{
+ "linkshared": "False",
+ "deps": `[":libm_bp2build_cc_library_static"]`,
+ "system_deps": `[]`,
+ }},
+ {"cc_binary", "used_in_bionic_oses", AttrNameToString{
+ "linkshared": "False",
+ }},
+ {"cc_binary", "used_with_stubs", AttrNameToString{
+ "linkshared": "False",
+ }},
+ },
+ })
+}
diff --git a/bp2build/cc_library_conversion_test.go b/bp2build/cc_library_conversion_test.go
index 1e3d72e..490cd91 100644
--- a/bp2build/cc_library_conversion_test.go
+++ b/bp2build/cc_library_conversion_test.go
@@ -4194,11 +4194,11 @@
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_static", "foo_bp2build_cc_library_static", AttrNameToString{
- "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "features": `["sanitizer_blocklist_foo_blocklist_txt"]`,
"local_includes": `["."]`,
}),
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "features": `["sanitizer_blocklist_foo_blocklist_txt"]`,
"local_includes": `["."]`,
}),
},
diff --git a/bp2build/cc_library_shared_conversion_test.go b/bp2build/cc_library_shared_conversion_test.go
index 2d61d53..ccb426f 100644
--- a/bp2build/cc_library_shared_conversion_test.go
+++ b/bp2build/cc_library_shared_conversion_test.go
@@ -1225,7 +1225,7 @@
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_shared", "foo", AttrNameToString{
- "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "features": `["sanitizer_blocklist_foo_blocklist_txt"]`,
"local_includes": `["."]`,
}),
},
diff --git a/bp2build/cc_library_static_conversion_test.go b/bp2build/cc_library_static_conversion_test.go
index 18225df..8084a5d 100644
--- a/bp2build/cc_library_static_conversion_test.go
+++ b/bp2build/cc_library_static_conversion_test.go
@@ -1918,7 +1918,7 @@
`,
ExpectedBazelTargets: []string{
MakeBazelTarget("cc_library_static", "foo", AttrNameToString{
- "features": `["ubsan_blocklist_foo_blocklist_txt"]`,
+ "features": `["sanitizer_blocklist_foo_blocklist_txt"]`,
"local_includes": `["."]`,
}),
},
diff --git a/bp2build/java_library_conversion_test.go b/bp2build/java_library_conversion_test.go
index fd92e95..c501a7b 100644
--- a/bp2build/java_library_conversion_test.go
+++ b/bp2build/java_library_conversion_test.go
@@ -183,8 +183,8 @@
})
}
-func TestJavaLibraryErrorproneJavacflagsEnabledManually(t *testing.T) {
- runJavaLibraryTestCase(t, Bp2buildTestCase{
+func TestJavaLibraryErrorproneEnabledManually(t *testing.T) {
+ runJavaLibraryTestCaseWithRegistrationCtxFunc(t, Bp2buildTestCase{
Blueprint: `java_library {
name: "java-lib-1",
srcs: ["a.java"],
@@ -192,7 +192,13 @@
errorprone: {
enabled: true,
javacflags: ["-Xep:SpeedLimit:OFF"],
+ extra_check_modules: ["plugin2"],
},
+}
+java_plugin {
+ name: "plugin2",
+ srcs: ["a.java"],
+ bazel_module: { bp2build_available: false },
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
@@ -200,10 +206,14 @@
"-Xsuper-fast",
"-Xep:SpeedLimit:OFF",
]`,
- "srcs": `["a.java"]`,
+ "plugins": `[":plugin2"]`,
+ "srcs": `["a.java"]`,
+ "errorprone_force_enable": `True`,
}),
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
},
+ }, func(ctx android.RegistrationContext) {
+ ctx.RegisterModuleType("java_plugin", java.PluginFactory)
})
}
@@ -227,21 +237,23 @@
})
}
-func TestJavaLibraryErrorproneJavacflagsErrorproneDisabledManually(t *testing.T) {
+func TestJavaLibraryErrorproneDisabledManually(t *testing.T) {
runJavaLibraryTestCase(t, Bp2buildTestCase{
Blueprint: `java_library {
name: "java-lib-1",
srcs: ["a.java"],
javacflags: ["-Xsuper-fast"],
errorprone: {
- enabled: false,
- javacflags: ["-Xep:SpeedLimit:OFF"],
+ enabled: false,
},
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_library", "java-lib-1", AttrNameToString{
- "javacopts": `["-Xsuper-fast"]`,
- "srcs": `["a.java"]`,
+ "javacopts": `[
+ "-Xsuper-fast",
+ "-XepDisableAllChecks",
+ ]`,
+ "srcs": `["a.java"]`,
}),
MakeNeverlinkDuplicateTarget("java_library", "java-lib-1"),
},
diff --git a/cc/bp2build.go b/cc/bp2build.go
index 5459595..6e00aa8 100644
--- a/cc/bp2build.go
+++ b/cc/bp2build.go
@@ -1139,6 +1139,7 @@
wholeArchiveDeps bazel.LabelListAttribute
implementationWholeArchiveDeps bazel.LabelListAttribute
systemDynamicDeps bazel.LabelListAttribute
+ usedSystemDynamicDepAsStaticDep map[string]bool
usedSystemDynamicDepAsDynamicDep map[string]bool
useVersionLib bazel.BoolAttribute
@@ -1201,6 +1202,18 @@
// https://cs.android.com/android/platform/superproject/+/master:build/soong/cc/linker.go;l=247-249;drc=088b53577dde6e40085ffd737a1ae96ad82fc4b0
la.wholeArchiveDeps.SetSelectValue(axis, config, bazelLabelForWholeDepsExcludes(ctx, wholeStaticLibs, props.Exclude_static_libs))
+ if isBinary && module.StaticExecutable() {
+ usedSystemStatic := android.FilterListPred(staticLibs, func(s string) bool {
+ return android.InList(s, soongSystemSharedLibs) && !android.InList(s, props.Exclude_static_libs)
+ })
+
+ for _, el := range usedSystemStatic {
+ if la.usedSystemDynamicDepAsStaticDep == nil {
+ la.usedSystemDynamicDepAsStaticDep = map[string]bool{}
+ }
+ la.usedSystemDynamicDepAsStaticDep[el] = true
+ }
+ }
staticDeps := maybePartitionExportedAndImplementationsDepsExcludes(
ctx,
!isBinary,
@@ -1233,6 +1246,7 @@
usedSystem := android.FilterListPred(sharedLibs, func(s string) bool {
return android.InList(s, soongSystemSharedLibs) && !android.InList(s, excludeSharedLibs)
})
+
for _, el := range usedSystem {
if la.usedSystemDynamicDepAsDynamicDep == nil {
la.usedSystemDynamicDepAsDynamicDep = map[string]bool{}
@@ -1625,6 +1639,15 @@
}
la.implementationDynamicDeps.Exclude(bazel.OsAndInApexAxis, bazel.AndroidPlatform, bazel.MakeLabelList(stubsToRemove))
}
+ if la.systemDynamicDeps.IsNil() && len(la.usedSystemDynamicDepAsStaticDep) > 0 {
+ toRemove := bazelLabelForStaticDeps(ctx, android.SortedKeys(la.usedSystemDynamicDepAsStaticDep))
+ la.deps.Exclude(bazel.NoConfigAxis, "", toRemove)
+ la.deps.Exclude(bazel.OsConfigurationAxis, "android", toRemove)
+ la.deps.Exclude(bazel.OsConfigurationAxis, "linux_bionic", toRemove)
+ la.implementationDeps.Exclude(bazel.NoConfigAxis, "", toRemove)
+ la.implementationDeps.Exclude(bazel.OsConfigurationAxis, "android", toRemove)
+ la.implementationDeps.Exclude(bazel.OsConfigurationAxis, "linux_bionic", toRemove)
+ }
la.deps.ResolveExcludes()
la.implementationDeps.ResolveExcludes()
@@ -1819,7 +1842,7 @@
if blocklist != nil {
// Format the blocklist name to be used in a feature name
blocklistFeatureSuffix := strings.Replace(strings.ToLower(*blocklist), ".", "_", -1)
- features = append(features, "ubsan_blocklist_"+blocklistFeatureSuffix)
+ features = append(features, "sanitizer_blocklist_"+blocklistFeatureSuffix)
}
if sanitizerProps.Sanitize.Cfi != nil && !proptools.Bool(sanitizerProps.Sanitize.Cfi) {
features = append(features, "-android_cfi")
diff --git a/cc/cc.go b/cc/cc.go
index 6087970..187f2d6 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -42,6 +42,7 @@
func init() {
RegisterCCBuildComponents(android.InitRegistrationContext)
+ pctx.Import("android/soong/android")
pctx.Import("android/soong/cc/config")
}
@@ -1079,6 +1080,10 @@
return false
}
+func (c *Module) RlibStd() bool {
+ panic(fmt.Errorf("RlibStd called on non-Rust module: %q", c.BaseModuleName()))
+}
+
func (c *Module) RustLibraryInterface() bool {
return false
}
@@ -1367,7 +1372,7 @@
func (c *Module) isCfi() bool {
if sanitize := c.sanitize; sanitize != nil {
- return Bool(sanitize.Properties.Sanitize.Cfi)
+ return Bool(sanitize.Properties.SanitizeMutated.Cfi)
}
return false
}
diff --git a/cc/cc_test.go b/cc/cc_test.go
index fe54463..7534db2 100644
--- a/cc/cc_test.go
+++ b/cc/cc_test.go
@@ -4979,7 +4979,6 @@
conly := []string{"-fPIC", "${config.CommonGlobalConlyflags}"}
cppOnly := []string{"-fPIC", "${config.CommonGlobalCppflags}", "${config.DeviceGlobalCppflags}", "${config.ArmCppflags}"}
- ltoFlags := []string{"-flto=thin", "-fsplit-lto-unit"}
cflags := []string{"-Werror", "-std=candcpp"}
cstd := []string{"-std=gnu17", "-std=conly"}
@@ -5006,17 +5005,17 @@
{
name: "c",
src: "foo.c",
- expected: combineSlices(baseExpectedFlags, conly, expectedIncludes, cflags, ltoFlags, cstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"}),
+ expected: combineSlices(baseExpectedFlags, conly, expectedIncludes, cflags, cstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"}),
},
{
name: "cc",
src: "foo.cc",
- expected: combineSlices(baseExpectedFlags, cppOnly, expectedIncludes, cflags, ltoFlags, cppstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"}),
+ expected: combineSlices(baseExpectedFlags, cppOnly, expectedIncludes, cflags, cppstd, lastIncludes, []string{"${config.NoOverrideGlobalCflags}", "${config.NoOverrideExternalGlobalCflags}"}),
},
{
name: "assemble",
src: "foo.s",
- expected: combineSlices(baseExpectedFlags, []string{"${config.CommonGlobalAsflags}"}, expectedIncludes, ltoFlags, lastIncludes),
+ expected: combineSlices(baseExpectedFlags, []string{"${config.CommonGlobalAsflags}"}, expectedIncludes, lastIncludes),
},
}
diff --git a/cc/config/riscv64_device.go b/cc/config/riscv64_device.go
index 3bc1e69..40919c0 100644
--- a/cc/config/riscv64_device.go
+++ b/cc/config/riscv64_device.go
@@ -26,9 +26,6 @@
// Help catch common 32/64-bit errors.
"-Werror=implicit-function-declaration",
"-fno-emulated-tls",
- // A temporary fix for SExtWRemoval miscompilation bug.
- "-mllvm",
- "-riscv-disable-sextw-removal=true",
"-march=rv64gc_zba_zbb_zbs",
}
diff --git a/cc/config/toolchain.go b/cc/config/toolchain.go
index a0ef575..62f75d1 100644
--- a/cc/config/toolchain.go
+++ b/cc/config/toolchain.go
@@ -261,5 +261,3 @@
func LibFuzzerRuntimeInterceptors(t Toolchain) string {
return LibclangRuntimeLibrary(t, "fuzzer_interceptors")
}
-
-var inList = android.InList
diff --git a/cc/fuzz.go b/cc/fuzz.go
index 636ad85..7f0a502 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -258,25 +258,29 @@
func PackageFuzzModule(ctx android.ModuleContext, fuzzPackagedModule fuzz.FuzzPackagedModule, pctx android.PackageContext) fuzz.FuzzPackagedModule {
fuzzPackagedModule.Corpus = android.PathsForModuleSrc(ctx, fuzzPackagedModule.FuzzProperties.Corpus)
- builder := android.NewRuleBuilder(pctx, ctx)
intermediateDir := android.PathForModuleOut(ctx, "corpus")
+
+ // Create one rule per file to avoid MAX_ARG_STRLEN hardlimit.
for _, entry := range fuzzPackagedModule.Corpus {
- builder.Command().Text("cp").
- Input(entry).
- Output(intermediateDir.Join(ctx, entry.Base()))
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Output: intermediateDir.Join(ctx, entry.Base()),
+ Input: entry,
+ })
}
- builder.Build("copy_corpus", "copy corpus")
fuzzPackagedModule.CorpusIntermediateDir = intermediateDir
fuzzPackagedModule.Data = android.PathsForModuleSrc(ctx, fuzzPackagedModule.FuzzProperties.Data)
- builder = android.NewRuleBuilder(pctx, ctx)
intermediateDir = android.PathForModuleOut(ctx, "data")
+
+ // Create one rule per file to avoid MAX_ARG_STRLEN hardlimit.
for _, entry := range fuzzPackagedModule.Data {
- builder.Command().Text("cp").
- Input(entry).
- Output(intermediateDir.Join(ctx, entry.Rel()))
+ ctx.Build(pctx, android.BuildParams{
+ Rule: android.Cp,
+ Output: intermediateDir.Join(ctx, entry.Rel()),
+ Input: entry,
+ })
}
- builder.Build("copy_data", "copy data")
fuzzPackagedModule.DataIntermediateDir = intermediateDir
if fuzzPackagedModule.FuzzProperties.Dictionary != nil {
diff --git a/cc/library.go b/cc/library.go
index aec6433..266fa75 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1963,6 +1963,10 @@
libName := strings.TrimSuffix(baseName, filepath.Ext(baseName))
errorMessage := "error: Please update ABI references with: $$ANDROID_BUILD_TOP/development/vndk/tools/header-checker/utils/create_reference_dumps.py -l " + libName + " -ref-dump-dir $$ANDROID_BUILD_TOP/" + refDumpDir
+ // Most opt-in libraries do not have dumps for all default architectures.
+ if ctx.Config().HasDeviceProduct() {
+ errorMessage += " -products " + ctx.Config().DeviceProduct()
+ }
library.sourceAbiDiff(ctx, referenceDump, baseName, nameExt,
isLlndkOrNdk, false /* allowExtensions */, "current", errorMessage)
@@ -2271,7 +2275,7 @@
// do not install vndk libs
// vndk libs are packaged into VNDK APEX
- if ctx.isVndk() && !ctx.IsVndkExt() {
+ if ctx.isVndk() && !ctx.IsVndkExt() && !ctx.Config().IsVndkDeprecated() {
return
}
} else if library.hasStubsVariants() && !ctx.Host() && ctx.directlyInAnyApex() {
diff --git a/cc/linkable.go b/cc/linkable.go
index 19e6501..2099399 100644
--- a/cc/linkable.go
+++ b/cc/linkable.go
@@ -87,6 +87,12 @@
// SnapshotStaticLibs returns the list of static library dependencies for this module.
SnapshotStaticLibs() []string
+ // SnapshotDylibs returns the list of dylib library dependencies for this module.
+ SnapshotDylibs() []string
+
+ // SnapshotRlibs returns the list of rlib library dependencies for this module.
+ SnapshotRlibs() []string
+
// IsSnapshotPrebuilt returns true if this module is a snapshot prebuilt.
IsSnapshotPrebuilt() bool
}
@@ -239,6 +245,9 @@
// Dylib returns true if this is an dylib module.
Dylib() bool
+ // RlibStd returns true if this is an rlib which links against an rlib libstd.
+ RlibStd() bool
+
// Static returns true if this is a static library module.
Static() bool
diff --git a/cc/lto.go b/cc/lto.go
index ff2bf5a..44361db 100644
--- a/cc/lto.go
+++ b/cc/lto.go
@@ -74,6 +74,9 @@
} else if ctx.Host() {
// Performance and binary size are less important for host binaries.
ltoDefault = false
+ } else if ctx.Arch().ArchType.Multilib == "lib32" {
+ // LP32 has many subtle issues and less test coverage.
+ ltoDefault = false
}
// Then, determine the actual LTO mode to use. If different from `ltoDefault`, a variant needs
@@ -108,7 +111,7 @@
var ltoLdFlags []string
// The module did not explicitly turn on LTO. Only leverage LTO's
- // better dead code elinmination and CFG simplification, but do
+ // better dead code elimination and CFG simplification, but do
// not perform costly optimizations for a balance between compile
// time, binary size and performance.
if !lto.ThinLTO() {
diff --git a/cc/ndk_sysroot.go b/cc/ndk_sysroot.go
index 0cf21b6..feb3880 100644
--- a/cc/ndk_sysroot.go
+++ b/cc/ndk_sysroot.go
@@ -58,7 +58,6 @@
func init() {
RegisterNdkModuleTypes(android.InitRegistrationContext)
- pctx.Import("android/soong/android")
}
func RegisterNdkModuleTypes(ctx android.RegistrationContext) {
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 62e31d1..626005b 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -646,10 +646,6 @@
if (ctx.Arch().ArchType != android.Arm64 && ctx.Arch().ArchType != android.Riscv64) || !ctx.toolchain().Bionic() {
s.Scs = nil
}
- // ...but temporarily globally disabled on riscv64 (http://b/277909695).
- if ctx.Arch().ArchType == android.Riscv64 {
- s.Scs = nil
- }
// Memtag_heap is only implemented on AArch64.
// Memtag ABI is Android specific for now, so disable for host.
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index a5729df..bb13310 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -100,6 +100,7 @@
snapshotBinarySuffix = "_binary."
snapshotObjectSuffix = "_object."
SnapshotRlibSuffix = "_rlib."
+ SnapshotDylibSuffix = "_dylib."
)
type SnapshotProperties struct {
@@ -107,6 +108,7 @@
Static_libs []string `android:"arch_variant"`
Shared_libs []string `android:"arch_variant"`
Rlibs []string `android:"arch_variant"`
+ Dylibs []string `android:"arch_variant"`
Vndk_libs []string `android:"arch_variant"`
Binaries []string `android:"arch_variant"`
Objects []string `android:"arch_variant"`
@@ -186,6 +188,7 @@
staticLibs := collectSnapshotMap(s.properties.Static_libs, snapshotSuffix, SnapshotStaticSuffix)
sharedLibs := collectSnapshotMap(s.properties.Shared_libs, snapshotSuffix, SnapshotSharedSuffix)
rlibs := collectSnapshotMap(s.properties.Rlibs, snapshotSuffix, SnapshotRlibSuffix)
+ dylibs := collectSnapshotMap(s.properties.Dylibs, snapshotSuffix, SnapshotDylibSuffix)
vndkLibs := collectSnapshotMap(s.properties.Vndk_libs, "", vndkSuffix)
for k, v := range vndkLibs {
sharedLibs[k] = v
@@ -198,11 +201,12 @@
StaticLibs: staticLibs,
SharedLibs: sharedLibs,
Rlibs: rlibs,
+ Dylibs: dylibs,
})
}
type SnapshotInfo struct {
- HeaderLibs, Binaries, Objects, StaticLibs, SharedLibs, Rlibs map[string]string
+ HeaderLibs, Binaries, Objects, StaticLibs, SharedLibs, Rlibs, Dylibs map[string]string
}
var SnapshotInfoProvider = blueprint.NewMutatorProvider(SnapshotInfo{}, "deps")
diff --git a/cc/snapshot_utils.go b/cc/snapshot_utils.go
index cf4617d..1ee120e 100644
--- a/cc/snapshot_utils.go
+++ b/cc/snapshot_utils.go
@@ -57,6 +57,14 @@
return m.Properties.SnapshotStaticLibs
}
+func (m *Module) SnapshotRlibs() []string {
+ return []string{}
+}
+
+func (m *Module) SnapshotDylibs() []string {
+ return []string{}
+}
+
// snapshotLibraryInterface is an interface for libraries captured to VNDK / vendor snapshots.
type snapshotLibraryInterface interface {
libraryInterface
diff --git a/cc/util.go b/cc/util.go
index 6d8ac43..c93646b 100644
--- a/cc/util.go
+++ b/cc/util.go
@@ -28,8 +28,8 @@
return android.JoinWithPrefix(dirs.Strings(), "-I")
}
-var indexList = android.IndexList
-var inList = android.InList
+var indexList = android.IndexList[string]
+var inList = android.InList[string]
var filterList = android.FilterList
var removeListFromList = android.RemoveListFromList
var removeFromList = android.RemoveFromList
diff --git a/cc/vendor_snapshot.go b/cc/vendor_snapshot.go
index d2531c0..9ea337b 100644
--- a/cc/vendor_snapshot.go
+++ b/cc/vendor_snapshot.go
@@ -108,10 +108,10 @@
return false
}
}
- if sanitizable.Static() {
+ if sanitizable.Static() || sanitizable.Rlib() {
return sanitizable.OutputFile().Valid() && !isPrivate(image, m)
}
- if sanitizable.Shared() || sanitizable.Rlib() {
+ if sanitizable.Shared() || sanitizable.Dylib() {
if !sanitizable.OutputFile().Valid() {
return false
}
@@ -153,6 +153,8 @@
SharedLibs []string `json:",omitempty"`
StaticLibs []string `json:",omitempty"`
RuntimeLibs []string `json:",omitempty"`
+ Dylibs []string `json:",omitempty"`
+ Rlibs []string `json:",omitempty"`
// extra config files
InitRc []string `json:",omitempty"`
@@ -283,8 +285,17 @@
if m.Shared() {
prop.SharedLibs = m.SnapshotSharedLibs()
}
- // static libs dependencies are required to collect the NOTICE files.
+
+ // dylibs collect both shared and dylib dependencies.
+ if m.Dylib() {
+ prop.SharedLibs = m.SnapshotSharedLibs()
+ prop.Dylibs = m.SnapshotDylibs()
+ }
+
+ // static and rlib libs dependencies are required to collect the NOTICE files.
prop.StaticLibs = m.SnapshotStaticLibs()
+ prop.Rlibs = m.SnapshotRlibs()
+
if sanitizable, ok := m.(PlatformSanitizeable); ok {
if sanitizable.Static() && sanitizable.SanitizePropDefined() {
prop.SanitizeMinimalDep = sanitizable.MinimalRuntimeDep() || sanitizable.MinimalRuntimeNeeded()
@@ -299,13 +310,15 @@
libType = "shared"
} else if m.Rlib() {
libType = "rlib"
+ } else if m.Dylib() {
+ libType = "dylib"
} else {
libType = "header"
}
var stem string
- // install .a or .so
+ // install .a, .rlib, .dylib.so, or .so
if libType != "header" {
libPath := m.OutputFile().Path()
stem = libPath.Base()
@@ -328,6 +341,12 @@
}
}
}
+ if m.Rlib() && m.RlibStd() {
+ // rlibs produce both rlib-std and dylib-std variants
+ ext := filepath.Ext(stem)
+ stem = strings.TrimSuffix(stem, ext) + ".rlib-std" + ext
+ prop.ModuleName += ".rlib-std"
+ }
snapshotLibOut := filepath.Join(snapshotArchDir, targetArch, libType, m.RelativeInstallPath(), stem)
ret = append(ret, copyFile(ctx, libPath, snapshotLibOut, fake))
} else {
@@ -341,8 +360,12 @@
prop.StaticExecutable = m.StaticExecutable()
prop.InstallInRoot = m.InstallInRoot()
prop.SharedLibs = m.SnapshotSharedLibs()
- // static libs dependencies are required to collect the NOTICE files.
+ prop.Dylibs = m.SnapshotDylibs()
+
+ // static and rlib dependencies are required to collect the NOTICE files.
prop.StaticLibs = m.SnapshotStaticLibs()
+ prop.Rlibs = m.SnapshotRlibs()
+
// install bin
binPath := m.OutputFile().Path()
snapshotBinOut := filepath.Join(snapshotArchDir, targetArch, "binary", binPath.Base())
diff --git a/cmd/pom2bp/pom2bp.go b/cmd/pom2bp/pom2bp.go
index ba0648d..3fb4454 100644
--- a/cmd/pom2bp/pom2bp.go
+++ b/cmd/pom2bp/pom2bp.go
@@ -556,7 +556,8 @@
{{- end}}
{{- end}}
{{- if .IsApk}}
- presigned: true
+ preprocessed: true,
+ presigned: true,
{{- end}}
}
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 22d64a2..5ea84bc 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -225,7 +225,7 @@
ninjaDeps = append(ninjaDeps, codegenContext.AdditionalNinjaDeps()...)
// Create soong_injection repository
- soongInjectionFiles, err := bp2build.CreateSoongInjectionDirFiles(codegenContext, bp2build.CreateCodegenMetrics())
+ soongInjectionFiles, workspaceFiles, err := bp2build.CreateSoongInjectionDirFiles(codegenContext, bp2build.CreateCodegenMetrics())
maybeQuit(err, "")
absoluteSoongInjectionDir := shared.JoinPath(topDir, ctx.Config().SoongOutDir(), bazel.SoongInjectionDirName)
for _, file := range soongInjectionFiles {
@@ -236,6 +236,9 @@
// to allow users to edit/experiment in the synthetic workspace.
writeReadWriteFile(absoluteSoongInjectionDir, file)
}
+ for _, file := range workspaceFiles {
+ writeReadWriteFile(absoluteApiBp2buildDir, file)
+ }
workspace := shared.JoinPath(ctx.Config().SoongOutDir(), "api_bp2build")
// Create the symlink forest
diff --git a/cmd/soong_ui/main.go b/cmd/soong_ui/main.go
index 682fb75..4097e8a 100644
--- a/cmd/soong_ui/main.go
+++ b/cmd/soong_ui/main.go
@@ -218,6 +218,11 @@
trace.SetOutput(filepath.Join(logsDir, c.logsPrefix+"build.trace"))
+ log.Verbose("Command Line: ")
+ for i, arg := range os.Args {
+ log.Verbosef(" [%d] %s", i, arg)
+ }
+
defer func() {
stat.Finish()
criticalPath.WriteToMetrics(met)
diff --git a/dexpreopt/config.go b/dexpreopt/config.go
index bb83dc8..ba41f4a 100644
--- a/dexpreopt/config.go
+++ b/dexpreopt/config.go
@@ -45,7 +45,8 @@
BootJars android.ConfiguredJarList // modules for jars that form the boot class path
ApexBootJars android.ConfiguredJarList // jars within apex that form the boot class path
- ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX
+ ArtApexJars android.ConfiguredJarList // modules for jars that are in the ART APEX
+ TestOnlyArtBootImageJars android.ConfiguredJarList // modules for jars to be included in the ART boot image for testing
SystemServerJars android.ConfiguredJarList // system_server classpath jars on the platform
SystemServerApps []string // apps that are loaded into system server
@@ -700,6 +701,7 @@
BootJars: android.EmptyConfiguredJarList(),
ApexBootJars: android.EmptyConfiguredJarList(),
ArtApexJars: android.EmptyConfiguredJarList(),
+ TestOnlyArtBootImageJars: android.EmptyConfiguredJarList(),
SystemServerJars: android.EmptyConfiguredJarList(),
SystemServerApps: nil,
ApexSystemServerJars: android.EmptyConfiguredJarList(),
diff --git a/dexpreopt/testing.go b/dexpreopt/testing.go
index 6ed0736..147a562 100644
--- a/dexpreopt/testing.go
+++ b/dexpreopt/testing.go
@@ -111,6 +111,13 @@
})
}
+// FixtureSetTestOnlyArtBootImageJars enables dexpreopt and sets the TestOnlyArtBootImageJars property.
+func FixtureSetTestOnlyArtBootImageJars(bootJars ...string) android.FixturePreparer {
+ return FixtureModifyGlobalConfig(func(_ android.PathContext, dexpreoptConfig *GlobalConfig) {
+ dexpreoptConfig.TestOnlyArtBootImageJars = android.CreateTestConfiguredJarList(bootJars)
+ })
+}
+
// FixtureSetBootJars enables dexpreopt and sets the BootJars property.
func FixtureSetBootJars(bootJars ...string) android.FixturePreparer {
return FixtureModifyGlobalConfig(func(_ android.PathContext, dexpreoptConfig *GlobalConfig) {
diff --git a/fuzz/fuzz_common.go b/fuzz/fuzz_common.go
index ada4712..94b795f 100644
--- a/fuzz/fuzz_common.go
+++ b/fuzz/fuzz_common.go
@@ -371,6 +371,8 @@
// Specifies whether fuzz target should check presubmitted code changes for crashes.
// Defaults to false.
Use_for_presubmit *bool `json:"use_for_presubmit,omitempty"`
+ // Specify which paths to exclude from fuzzing coverage reports
+ Exclude_paths_from_reports []string `json:"exclude_paths_from_reports,omitempty"`
}
type FuzzFrameworks struct {
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 99c9166..a470c5e 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -151,6 +151,9 @@
// input files to exclude
Exclude_srcs []string `android:"path,arch_variant"`
+
+ // Enable restat to update the output only if the output is changed
+ Write_if_changed *bool
}
type Module struct {
@@ -467,6 +470,9 @@
// Use a RuleBuilder to create a rule that runs the command inside an sbox sandbox.
rule := getSandboxedRuleBuilder(ctx, android.NewRuleBuilder(pctx, ctx).Sbox(task.genDir, manifestPath))
+ if Bool(g.properties.Write_if_changed) {
+ rule.Restat()
+ }
cmd := rule.Command()
for _, out := range task.out {
diff --git a/java/Android.bp b/java/Android.bp
index e079869..4450c42 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -80,6 +80,7 @@
],
testSrcs: [
"aar_test.go",
+ "android_manifest_test.go",
"androidmk_test.go",
"app_import_test.go",
"app_set_test.go",
diff --git a/java/aar.go b/java/aar.go
index ed3c652..c9e08e2 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -31,7 +31,7 @@
type AndroidLibraryDependency interface {
LibraryDependency
ExportPackage() android.Path
- ResourcesNodeDepSet() *android.DepSet[resourcesNode]
+ ResourcesNodeDepSet() *android.DepSet[*resourcesNode]
RRODirsDepSet() *android.DepSet[rroDir]
ManifestsDepSet() *android.DepSet[android.Path]
SetRROEnforcedForDependent(enforce bool)
@@ -116,7 +116,7 @@
aaptProperties aaptProperties
- resourcesNodesDepSet *android.DepSet[resourcesNode]
+ resourcesNodesDepSet *android.DepSet[*resourcesNode]
rroDirsDepSet *android.DepSet[rroDir]
manifestsDepSet *android.DepSet[android.Path]
}
@@ -142,7 +142,7 @@
func (a *aapt) ExportPackage() android.Path {
return a.exportPackage
}
-func (a *aapt) ResourcesNodeDepSet() *android.DepSet[resourcesNode] {
+func (a *aapt) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] {
return a.resourcesNodesDepSet
}
@@ -444,11 +444,12 @@
a.extraAaptPackagesFile = extraPackages
a.rTxt = rTxt
a.splits = splits
- a.resourcesNodesDepSet = android.NewDepSetBuilder[resourcesNode](android.TOPOLOGICAL).
- Direct(resourcesNode{
- resPackage: a.exportPackage,
- manifest: a.manifestPath,
- assets: a.assetPackage,
+ a.resourcesNodesDepSet = android.NewDepSetBuilder[*resourcesNode](android.TOPOLOGICAL).
+ Direct(&resourcesNode{
+ resPackage: a.exportPackage,
+ manifest: a.manifestPath,
+ additionalManifests: additionalManifests,
+ assets: a.assetPackage,
}).
Transitive(staticResourcesNodesDepSet).Build()
a.rroDirsDepSet = android.NewDepSetBuilder[rroDir](android.TOPOLOGICAL).
@@ -456,16 +457,18 @@
Transitive(staticRRODirsDepSet).Build()
a.manifestsDepSet = android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL).
Direct(a.manifestPath).
+ DirectSlice(additionalManifests).
Transitive(staticManifestsDepSet).Build()
}
type resourcesNode struct {
- resPackage android.Path
- manifest android.Path
- assets android.OptionalPath
+ resPackage android.Path
+ manifest android.Path
+ additionalManifests android.Paths
+ assets android.OptionalPath
}
-type transitiveAarDeps []resourcesNode
+type transitiveAarDeps []*resourcesNode
func (t transitiveAarDeps) resPackages() android.Paths {
var paths android.Paths
@@ -479,6 +482,7 @@
var paths android.Paths
for _, dep := range t {
paths = append(paths, dep.manifest)
+ paths = append(paths, dep.additionalManifests...)
}
return android.FirstUniquePaths(paths)
}
@@ -495,7 +499,7 @@
// aaptLibs collects libraries from dependencies and sdk_version and converts them into paths
func aaptLibs(ctx android.ModuleContext, sdkContext android.SdkContext, classLoaderContexts dexpreopt.ClassLoaderContextMap) (
- staticResourcesNodes *android.DepSet[resourcesNode], staticRRODirs *android.DepSet[rroDir],
+ staticResourcesNodes *android.DepSet[*resourcesNode], staticRRODirs *android.DepSet[rroDir],
staticManifests *android.DepSet[android.Path], sharedLibs android.Paths, flags []string) {
if classLoaderContexts == nil {
@@ -509,7 +513,7 @@
sharedLibs = append(sharedLibs, sdkDep.jars...)
}
- var resourcesNodeDepSets []*android.DepSet[resourcesNode]
+ var resourcesNodeDepSets []*android.DepSet[*resourcesNode]
rroDirsDepSetBuilder := android.NewDepSetBuilder[rroDir](android.TOPOLOGICAL)
manifestsDepSetBuilder := android.NewDepSetBuilder[android.Path](android.TOPOLOGICAL)
@@ -607,6 +611,8 @@
a.hideApexVariantFromMake = !ctx.Provider(android.ApexInfoProvider).(android.ApexInfo).IsForPlatform()
+ a.stem = proptools.StringDefault(a.overridableDeviceProperties.Stem, ctx.ModuleName())
+
ctx.CheckbuildFile(a.proguardOptionsFile)
ctx.CheckbuildFile(a.exportPackage)
ctx.CheckbuildFile(a.aaptSrcJar)
@@ -730,7 +736,7 @@
manifest android.WritablePath
assetsPackage android.WritablePath
- resourcesNodesDepSet *android.DepSet[resourcesNode]
+ resourcesNodesDepSet *android.DepSet[*resourcesNode]
manifestsDepSet *android.DepSet[android.Path]
hideApexVariantFromMake bool
@@ -792,7 +798,7 @@
return android.Paths{a.proguardFlags}
}
-func (a *AARImport) ResourcesNodeDepSet() *android.DepSet[resourcesNode] {
+func (a *AARImport) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] {
return a.resourcesNodesDepSet
}
@@ -956,8 +962,8 @@
aapt2Link(ctx, a.exportPackage, srcJar, proguardOptionsFile, rTxt, a.extraAaptPackagesFile,
linkFlags, linkDeps, nil, overlayRes, transitiveAssets, nil)
- resourcesNodesDepSetBuilder := android.NewDepSetBuilder[resourcesNode](android.TOPOLOGICAL)
- resourcesNodesDepSetBuilder.Direct(resourcesNode{
+ resourcesNodesDepSetBuilder := android.NewDepSetBuilder[*resourcesNode](android.TOPOLOGICAL)
+ resourcesNodesDepSetBuilder.Direct(&resourcesNode{
resPackage: a.exportPackage,
manifest: a.manifest,
assets: android.OptionalPathForPath(a.assetsPackage),
diff --git a/java/android_manifest_test.go b/java/android_manifest_test.go
new file mode 100644
index 0000000..b12d778
--- /dev/null
+++ b/java/android_manifest_test.go
@@ -0,0 +1,103 @@
+// Copyright 2023 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"
+ "testing"
+)
+
+func TestManifestMerger(t *testing.T) {
+ bp := `
+ android_app {
+ name: "app",
+ sdk_version: "current",
+ srcs: ["app/app.java"],
+ resource_dirs: ["app/res"],
+ manifest: "app/AndroidManifest.xml",
+ additional_manifests: ["app/AndroidManifest2.xml"],
+ static_libs: ["direct", "direct_import"],
+ }
+
+ android_library {
+ name: "direct",
+ sdk_version: "current",
+ srcs: ["direct/direct.java"],
+ resource_dirs: ["direct/res"],
+ manifest: "direct/AndroidManifest.xml",
+ additional_manifests: ["direct/AndroidManifest2.xml"],
+ static_libs: ["transitive", "transitive_import"],
+ }
+
+ android_library {
+ name: "transitive",
+ sdk_version: "current",
+ srcs: ["transitive/transitive.java"],
+ resource_dirs: ["transitive/res"],
+ manifest: "transitive/AndroidManifest.xml",
+ additional_manifests: ["transitive/AndroidManifest2.xml"],
+ }
+
+ android_library_import {
+ name: "direct_import",
+ sdk_version: "current",
+ aars: ["direct_import.aar"],
+ static_libs: ["direct_import_dep"],
+ }
+
+ android_library_import {
+ name: "direct_import_dep",
+ sdk_version: "current",
+ aars: ["direct_import_dep.aar"],
+ }
+
+ android_library_import {
+ name: "transitive_import",
+ sdk_version: "current",
+ aars: ["transitive_import.aar"],
+ static_libs: ["transitive_import_dep"],
+ }
+
+ android_library_import {
+ name: "transitive_import_dep",
+ sdk_version: "current",
+ aars: ["transitive_import_dep.aar"],
+ }
+ `
+
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithJavaDefaultModules,
+ PrepareForTestWithOverlayBuildComponents,
+ ).RunTestWithBp(t, bp)
+
+ manifestMergerRule := result.ModuleForTests("app", "android_common").Rule("manifestMerger")
+ android.AssertPathRelativeToTopEquals(t, "main manifest",
+ "out/soong/.intermediates/app/android_common/manifest_fixer/AndroidManifest.xml",
+ manifestMergerRule.Input)
+ android.AssertPathsRelativeToTopEquals(t, "lib manifests",
+ []string{
+ "app/AndroidManifest2.xml",
+ "out/soong/.intermediates/direct/android_common/manifest_fixer/AndroidManifest.xml",
+ "direct/AndroidManifest2.xml",
+ "out/soong/.intermediates/transitive/android_common/manifest_fixer/AndroidManifest.xml",
+ "transitive/AndroidManifest2.xml",
+ "out/soong/.intermediates/transitive_import/android_common/aar/AndroidManifest.xml",
+ "out/soong/.intermediates/direct_import/android_common/aar/AndroidManifest.xml",
+ // TODO(b/288358614): Soong has historically not merged manifests from dependencies of
+ // android_library_import modules.
+
+ },
+ manifestMergerRule.Implicits)
+}
diff --git a/java/androidmk.go b/java/androidmk.go
index 13cc96a..784fa29 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -455,11 +455,6 @@
if len(a.overridableAppProperties.Overrides) > 0 {
overridden = append(overridden, a.overridableAppProperties.Overrides...)
}
- // When APK name is overridden via PRODUCT_PACKAGE_NAME_OVERRIDES
- // ensure that the original name is overridden.
- if a.Stem() != a.installApkName {
- overridden = append(overridden, a.Stem())
- }
return overridden
}
diff --git a/java/app.go b/java/app.go
index 10010e4..8e4efd2 100755
--- a/java/app.go
+++ b/java/app.go
@@ -204,7 +204,7 @@
return nil
}
-func (a *AndroidApp) ResourcesNodeDepSet() *android.DepSet[resourcesNode] {
+func (a *AndroidApp) ResourcesNodeDepSet() *android.DepSet[*resourcesNode] {
return a.aapt.resourcesNodesDepSet
}
@@ -666,8 +666,17 @@
a.aapt.useEmbeddedNativeLibs = a.useEmbeddedNativeLibs(ctx)
a.aapt.useEmbeddedDex = Bool(a.appProperties.Use_embedded_dex)
+ // Unlike installApkName, a.stem should respect base module name for override_android_app.
+ // Therefore, use ctx.ModuleName() instead of a.Name().
+ a.stem = proptools.StringDefault(a.overridableDeviceProperties.Stem, ctx.ModuleName())
+
// Check if the install APK name needs to be overridden.
- a.installApkName = ctx.DeviceConfig().OverridePackageNameFor(a.Stem())
+ // Both android_app and override_android_app module are expected to possess
+ // its module bound apk path. However, override_android_app inherits ctx.ModuleName()
+ // from the base module. Therefore, use a.Name() which represents
+ // the module name for both android_app and override_android_app.
+ a.installApkName = ctx.DeviceConfig().OverridePackageNameFor(
+ proptools.StringDefault(a.overridableDeviceProperties.Stem, a.Name()))
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
diff --git a/java/base.go b/java/base.go
index cb08ef3..8db7162 100644
--- a/java/base.go
+++ b/java/base.go
@@ -21,6 +21,7 @@
"strings"
"android/soong/ui/metrics/bp2build_metrics_proto"
+
"github.com/google/blueprint/pathtools"
"github.com/google/blueprint/proptools"
@@ -502,6 +503,11 @@
sourceExtensions []string
annoSrcJars android.Paths
+
+ // output file name based on Stem property.
+ // This should be set in every ModuleWithStem's GenerateAndroidBuildActions
+ // or the module should override Stem().
+ stem string
}
func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
@@ -1099,7 +1105,7 @@
j.expandJarjarRules = android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
}
- jarName := ctx.ModuleName() + ".jar"
+ jarName := j.Stem() + ".jar"
var uniqueJavaFiles android.Paths
set := make(map[string]bool)
@@ -1897,7 +1903,10 @@
}
func (j *Module) Stem() string {
- return proptools.StringDefault(j.overridableDeviceProperties.Stem, j.Name())
+ if j.stem == "" {
+ panic("Stem() called before stem property was set")
+ }
+ return j.stem
}
func (j *Module) JacocoReportClassesFile() android.Path {
diff --git a/java/bootclasspath.go b/java/bootclasspath.go
index 29eed79..c7dc3af 100644
--- a/java/bootclasspath.go
+++ b/java/bootclasspath.go
@@ -185,6 +185,9 @@
// The tag used for dependencies onto bootclasspath_fragments.
var bootclasspathFragmentDepTag = bootclasspathDependencyTag{name: "fragment"}
+// The tag used for dependencies onto platform_bootclasspath.
+var platformBootclasspathDepTag = bootclasspathDependencyTag{name: "platform"}
+
// BootclasspathNestedAPIProperties defines properties related to the API provided by parts of the
// bootclasspath that are nested within the main BootclasspathAPIProperties.
type BootclasspathNestedAPIProperties struct {
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index ac45ce1..dcc2dec 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -242,7 +242,7 @@
modulePaths []string
// Path to the boot image profile.
- profilePath android.Path
+ profilePath android.WritablePath
}
// commonBootclasspathFragment defines the methods that are implemented by both source and prebuilt
@@ -256,16 +256,6 @@
// versioned sdk.
produceHiddenAPIOutput(ctx android.ModuleContext, contents []android.Module, fragments []android.Module, input HiddenAPIFlagInput) *HiddenAPIOutput
- // produceBootImageFiles will attempt to produce rules to create the boot image files at the paths
- // predefined in the bootImageConfig.
- //
- // If it could not create the files then it will return nil. Otherwise, it will return a map from
- // android.ArchType to the predefined paths of the boot image files.
- produceBootImageFiles(ctx android.ModuleContext, imageConfig *bootImageConfig) bootImageOutputs
-
- // getImageName returns the `image_name` property of this fragment.
- getImageName() *string
-
// getProfilePath returns the path to the boot image profile.
getProfilePath() android.Path
}
@@ -295,9 +285,6 @@
return
}
}
-
- // Initialize the contents property from the image_name.
- bootclasspathFragmentInitContentsFromImage(ctx, m)
})
return m
}
@@ -308,9 +295,7 @@
return m
}
-// bootclasspathFragmentInitContentsFromImage will initialize the contents property from the image_name if
-// necessary.
-func bootclasspathFragmentInitContentsFromImage(ctx android.EarlyModuleContext, m *BootclasspathFragmentModule) {
+func (m *BootclasspathFragmentModule) bootclasspathFragmentPropertyCheck(ctx android.EarlyModuleContext) {
contents := m.properties.Contents
if len(contents) == 0 {
ctx.PropertyErrorf("contents", "required property is missing")
@@ -332,6 +317,18 @@
// too early in the Soong processing for that to work.
global := dexpreopt.GetGlobalConfig(ctx)
modules := global.ArtApexJars
+ configuredJars := modules.CopyOfJars()
+
+ // Skip the check if the configured jars list is empty as that is a common configuration when
+ // building targets that do not result in a system image.
+ if len(configuredJars) == 0 {
+ return
+ }
+
+ if !reflect.DeepEqual(configuredJars, contents) {
+ ctx.ModuleErrorf("inconsistency in specification of contents. ArtApexJars configuration specifies %#v, contents property specifies %#v",
+ configuredJars, contents)
+ }
// Make sure that the apex specified in the configuration is consistent and is one for which
// this boot image is available.
@@ -357,33 +354,6 @@
}
}
-// bootclasspathImageNameContentsConsistencyCheck checks that the configuration that applies to this
-// module (if any) matches the contents.
-//
-// This should be a noop as if image_name="art" then the contents will be set from the ArtApexJars
-// config by bootclasspathFragmentInitContentsFromImage so it will be guaranteed to match. However,
-// in future this will not be the case.
-func (b *BootclasspathFragmentModule) bootclasspathImageNameContentsConsistencyCheck(ctx android.BaseModuleContext) {
- imageName := proptools.String(b.properties.Image_name)
- if imageName == "art" {
- // Get the configuration for the art apex jars.
- modules := b.getImageConfig(ctx).modules
- configuredJars := modules.CopyOfJars()
-
- // Skip the check if the configured jars list is empty as that is a common configuration when
- // building targets that do not result in a system image.
- if len(configuredJars) == 0 {
- return
- }
-
- contents := b.properties.Contents
- if !reflect.DeepEqual(configuredJars, contents) {
- ctx.ModuleErrorf("inconsistency in specification of contents. ArtApexJars configuration specifies %#v, contents property specifies %#v",
- configuredJars, contents)
- }
- }
-}
-
var BootclasspathFragmentApexContentInfoProvider = blueprint.NewProvider(BootclasspathFragmentApexContentInfo{})
// BootclasspathFragmentApexContentInfo contains the bootclasspath_fragments contributions to the
@@ -495,7 +465,7 @@
// unused prebuilt that was created without instrumentation from breaking an instrumentation
// build.
if isActiveModule(ctx.Module()) {
- b.bootclasspathImageNameContentsConsistencyCheck(ctx)
+ b.bootclasspathFragmentPropertyCheck(ctx)
}
// Generate classpaths.proto config
@@ -515,34 +485,15 @@
fragments := gatherApexModulePairDepsWithTag(ctx, bootclasspathFragmentDepTag)
- // Verify that the image_name specified on a bootclasspath_fragment is valid even if this is a
- // prebuilt which will not use the image config.
- imageConfig := b.getImageConfig(ctx)
-
// Perform hidden API processing.
hiddenAPIOutput := b.generateHiddenAPIBuildActions(ctx, contents, fragments)
- var bootImageFiles bootImageOutputs
- if imageConfig != nil {
- // Delegate the production of the boot image files to a module type specific method.
- common := ctx.Module().(commonBootclasspathFragment)
- bootImageFiles = common.produceBootImageFiles(ctx, imageConfig)
- b.profilePath = bootImageFiles.profile
-
- if shouldCopyBootFilesToPredefinedLocations(ctx, imageConfig) {
- // Zip the boot image files up, if available. This will generate the zip file in a
- // predefined location.
- buildBootImageZipInPredefinedLocation(ctx, imageConfig, bootImageFiles.byArch)
-
- // Copy the dex jars of this fragment's content modules to their predefined locations.
- copyBootJarsToPredefinedLocations(ctx, hiddenAPIOutput.EncodedBootDexFilesByModule, imageConfig.dexPathsByModule)
- }
- }
-
- // A prebuilt fragment cannot contribute to an apex.
- if !android.IsModulePrebuilt(ctx.Module()) {
- // Provide the apex content info.
- b.provideApexContentInfo(ctx, imageConfig, hiddenAPIOutput, bootImageFiles)
+ if android.IsModulePrebuilt(ctx.Module()) {
+ b.profilePath = ctx.Module().(*PrebuiltBootclasspathFragmentModule).produceBootImageProfile(ctx)
+ } else {
+ b.profilePath = b.produceBootImageProfileFromSource(ctx, contents, hiddenAPIOutput.EncodedBootDexFilesByModule)
+ // Provide the apex content info. A prebuilt fragment cannot contribute to an apex.
+ b.provideApexContentInfo(ctx, hiddenAPIOutput, b.profilePath)
}
// In order for information about bootclasspath_fragment modules to be added to module-info.json
@@ -556,44 +507,37 @@
}
}
-// shouldCopyBootFilesToPredefinedLocations determines whether the current module should copy boot
-// files, e.g. boot dex jars or boot image files, to the predefined location expected by the rest
-// of the build.
-//
-// This ensures that only a single module will copy its files to the image configuration.
-func shouldCopyBootFilesToPredefinedLocations(ctx android.ModuleContext, imageConfig *bootImageConfig) bool {
+// getProfileProviderApex returns the name of the apex that provides a boot image profile, or an
+// empty string if this module should not provide a boot image profile.
+func (b *BootclasspathFragmentModule) getProfileProviderApex(ctx android.BaseModuleContext) string {
+ // Only use the profile from the module that is preferred.
+ if !isActiveModule(ctx.Module()) {
+ return ""
+ }
+
// Bootclasspath fragment modules that are for the platform do not produce boot related files.
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
- if apexInfo.IsForPlatform() {
- return false
+ for _, apex := range apexInfo.InApexVariants {
+ if isProfileProviderApex(ctx, apex) {
+ return apex
+ }
}
- // If the image configuration has no modules specified then it means that the build has been
- // configured to build something other than a boot image, e.g. an sdk, so do not try and copy the
- // files.
- if imageConfig.modules.Len() == 0 {
- return false
- }
-
- // Only copy files from the module that is preferred.
- return isActiveModule(ctx.Module())
+ return ""
}
// provideApexContentInfo creates, initializes and stores the apex content info for use by other
// modules.
-func (b *BootclasspathFragmentModule) provideApexContentInfo(ctx android.ModuleContext, imageConfig *bootImageConfig, hiddenAPIOutput *HiddenAPIOutput, bootImageFiles bootImageOutputs) {
+func (b *BootclasspathFragmentModule) provideApexContentInfo(ctx android.ModuleContext, hiddenAPIOutput *HiddenAPIOutput, profile android.WritablePath) {
// Construct the apex content info from the config.
info := BootclasspathFragmentApexContentInfo{
// Populate the apex content info with paths to the dex jars.
contentModuleDexJarPaths: hiddenAPIOutput.EncodedBootDexFilesByModule,
}
- if imageConfig != nil {
- global := dexpreopt.GetGlobalConfig(ctx)
- if !global.DisableGenerateProfile {
- info.profilePathOnHost = bootImageFiles.profile
- info.profileInstallPathInApex = imageConfig.profileInstallPathInApex
- }
+ if profile != nil {
+ info.profilePathOnHost = profile
+ info.profileInstallPathInApex = profileInstallPathInApex
}
// Make the apex content info available for other modules.
@@ -614,12 +558,12 @@
}
func (b *BootclasspathFragmentModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList {
- if "art" == proptools.String(b.properties.Image_name) {
- return b.getImageConfig(ctx).modules
- }
-
global := dexpreopt.GetGlobalConfig(ctx)
+ if "art" == proptools.String(b.properties.Image_name) {
+ return global.ArtApexJars
+ }
+
possibleUpdatableModules := gatherPossibleApexModuleNamesAndStems(ctx, b.properties.Contents, bootclasspathFragmentContentDepTag)
jars, unknown := global.ApexBootJars.Filter(possibleUpdatableModules)
@@ -645,25 +589,6 @@
return jars
}
-func (b *BootclasspathFragmentModule) getImageConfig(ctx android.EarlyModuleContext) *bootImageConfig {
- // Get a map of the image configs that are supported.
- imageConfigs := genBootImageConfigs(ctx)
-
- // Retrieve the config for this image.
- imageNamePtr := b.properties.Image_name
- if imageNamePtr == nil {
- return nil
- }
-
- imageName := *imageNamePtr
- imageConfig := imageConfigs[imageName]
- if imageConfig == nil {
- ctx.PropertyErrorf("image_name", "Unknown image name %q, expected one of %s", imageName, strings.Join(android.SortedKeys(imageConfigs), ", "))
- return nil
- }
- return imageConfig
-}
-
// generateHiddenAPIBuildActions generates all the hidden API related build rules.
func (b *BootclasspathFragmentModule) generateHiddenAPIBuildActions(ctx android.ModuleContext, contents []android.Module, fragments []android.Module) *HiddenAPIOutput {
@@ -846,48 +771,22 @@
return output
}
-// produceBootImageFiles builds the boot image files from the source if it is required.
-func (b *BootclasspathFragmentModule) produceBootImageFiles(ctx android.ModuleContext, imageConfig *bootImageConfig) bootImageOutputs {
- // Only generate the boot image if the configuration does not skip it.
- return b.generateBootImageBuildActions(ctx, imageConfig)
-}
-
-// generateBootImageBuildActions generates ninja rules to create the boot image if required for this
-// module.
-//
-// If it could not create the files then it will return nil. Otherwise, it will return a map from
-// android.ArchType to the predefined paths of the boot image files.
-func (b *BootclasspathFragmentModule) generateBootImageBuildActions(ctx android.ModuleContext, imageConfig *bootImageConfig) bootImageOutputs {
- global := dexpreopt.GetGlobalConfig(ctx)
- if !shouldBuildBootImages(ctx.Config(), global) {
- return bootImageOutputs{}
+// produceBootImageProfileFromSource builds the boot image profile from the source if it is required.
+func (b *BootclasspathFragmentModule) produceBootImageProfileFromSource(ctx android.ModuleContext, contents []android.Module, modules bootDexJarByModule) android.WritablePath {
+ apex := b.getProfileProviderApex(ctx)
+ if apex == "" {
+ return nil
}
- // Bootclasspath fragment modules that are for the platform do not produce a boot image.
- apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
- if apexInfo.IsForPlatform() {
- return bootImageOutputs{}
+ dexPaths := make(android.Paths, 0, len(contents))
+ dexLocations := make([]string, 0, len(contents))
+ for _, module := range contents {
+ dexPaths = append(dexPaths, modules[module.Name()])
+ dexLocations = append(dexLocations, filepath.Join("/", "apex", apex, "javalib", module.Name() + ".jar"))
}
- // Build a profile for the image config and then use that to build the boot image.
- profile := bootImageProfileRule(ctx, imageConfig)
-
- // If dexpreopt of boot image jars should be skipped, generate only a profile.
- if SkipDexpreoptBootJars(ctx) {
- return bootImageOutputs{
- profile: profile,
- }
- }
-
- // Build boot image files for the host variants.
- buildBootImageVariantsForBuildOs(ctx, imageConfig, profile)
-
- // Build boot image files for the android variants.
- bootImageFiles := buildBootImageVariantsForAndroidOs(ctx, imageConfig, profile)
-
- // Return the boot image files for the android variants for inclusion in an APEX and to be zipped
- // up for the dist.
- return bootImageFiles
+ // Build a profile for the modules in this fragment.
+ return bootImageProfileRuleCommon(ctx, b.Name(), dexPaths, dexLocations)
}
func (b *BootclasspathFragmentModule) AndroidMkEntries() []android.AndroidMkEntries {
@@ -910,10 +809,6 @@
return entriesList
}
-func (b *BootclasspathFragmentModule) getImageName() *string {
- return b.properties.Image_name
-}
-
func (b *BootclasspathFragmentModule) getProfilePath() android.Path {
return b.profilePath
}
@@ -1183,39 +1078,19 @@
return &output
}
-// produceBootImageFiles extracts the boot image files from the APEX if available.
-func (module *PrebuiltBootclasspathFragmentModule) produceBootImageFiles(ctx android.ModuleContext, imageConfig *bootImageConfig) bootImageOutputs {
- if !shouldCopyBootFilesToPredefinedLocations(ctx, imageConfig) {
- return bootImageOutputs{}
+// produceBootImageProfile extracts the boot image profile from the APEX if available.
+func (module *PrebuiltBootclasspathFragmentModule) produceBootImageProfile(ctx android.ModuleContext) android.WritablePath {
+ // This module does not provide a boot image profile.
+ if module.getProfileProviderApex(ctx) == "" {
+ return nil
}
di := android.FindDeapexerProviderForModule(ctx)
if di == nil {
- return bootImageOutputs{} // An error has been reported by FindDeapexerProviderForModule.
+ return nil // An error has been reported by FindDeapexerProviderForModule.
}
- profile := (android.WritablePath)(nil)
- if imageConfig.profileInstallPathInApex != "" {
- profile = di.PrebuiltExportPath(imageConfig.profileInstallPathInApex)
- }
-
- // Build the boot image files for the host variants. These are always built from the dex files
- // provided by the contents of this module as prebuilt versions of the host boot image files are
- // not available, i.e. there is no host specific prebuilt apex containing them. This has to be
- // built without a profile as the prebuilt modules do not provide a profile.
- buildBootImageVariantsForBuildOs(ctx, imageConfig, profile)
-
- if profile == nil && imageConfig.isProfileGuided() {
- ctx.ModuleErrorf("Unable to produce boot image files: profiles not found in the prebuilt apex")
- return bootImageOutputs{}
- }
- // Build boot image files for the android variants from the dex files provided by the contents
- // of this module.
- return buildBootImageVariantsForAndroidOs(ctx, imageConfig, profile)
-}
-
-func (b *PrebuiltBootclasspathFragmentModule) getImageName() *string {
- return b.properties.Image_name
+ return di.PrebuiltExportPath(profileInstallPathInApex)
}
func (b *PrebuiltBootclasspathFragmentModule) getProfilePath() android.Path {
@@ -1230,14 +1105,10 @@
// If there is no image config associated with this fragment then it returns nil. Otherwise, it
// returns the files that are listed in the image config.
func (module *PrebuiltBootclasspathFragmentModule) RequiredFilesFromPrebuiltApex(ctx android.BaseModuleContext) []string {
- imageConfig := module.getImageConfig(ctx)
- if imageConfig != nil {
- files := []string{}
- if imageConfig.profileInstallPathInApex != "" {
- // Add the boot image profile.
- files = append(files, imageConfig.profileInstallPathInApex)
+ for _, apex := range module.ApexProperties.Apex_available {
+ if isProfileProviderApex(ctx, apex) {
+ return []string{profileInstallPathInApex}
}
- return files
}
return nil
}
@@ -1253,9 +1124,5 @@
android.InitApexModule(m)
android.InitAndroidArchModule(m, android.HostAndDeviceSupported, android.MultilibCommon)
- // Initialize the contents property from the image_name.
- android.AddLoadHook(m, func(ctx android.LoadHookContext) {
- bootclasspathFragmentInitContentsFromImage(ctx, &m.BootclasspathFragmentModule)
- })
return m
}
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 7b56a19..003f2de 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -16,7 +16,6 @@
import (
"path/filepath"
- "sort"
"strings"
"android/soong/android"
@@ -224,6 +223,11 @@
"com.google.android.art.testing",
}
+var (
+ dexpreoptBootJarDepTag = bootclasspathDependencyTag{name: "dexpreopt-boot-jar"}
+ dexBootJarsFragmentsKey = android.NewOnceKey("dexBootJarsFragments")
+)
+
func init() {
RegisterDexpreoptBootJarsComponents(android.InitRegistrationContext)
}
@@ -241,6 +245,9 @@
// Image name (used in directory names and ninja rule names).
name string
+ // If the module with the given name exists, this config is enabled.
+ enabledIfExists string
+
// Basename of the image: the resulting filenames are <stem>[-<jar>].{art,oat,vdex}.
stem string
@@ -257,10 +264,6 @@
// the location is relative to "/".
installDir string
- // Install path of the boot image profile if it needs to be installed in the APEX, or empty if not
- // needed.
- profileInstallPathInApex string
-
// A list of (location, jar) pairs for the Java modules in this image.
modules android.ConfiguredJarList
@@ -296,10 +299,9 @@
// The "--single-image" argument.
singleImage bool
- // Profiles imported from other boot image configs. Each element must represent a
- // `bootclasspath_fragment` of an APEX (i.e., the `name` field of each element must refer to the
- // `image_name` property of a `bootclasspath_fragment`).
- profileImports []*bootImageConfig
+ // Profiles imported from APEXes, in addition to the profile at the default path. Each entry must
+ // be the name of an APEX module.
+ profileImports []string
}
// Target-dependent description of a boot image.
@@ -384,7 +386,7 @@
m := image.modules.Jar(idx)
name := image.stem
if idx != 0 || image.extends != nil {
- name += "-" + android.ModuleStem(m)
+ name += "-" + android.ModuleStem(ctx.Config(), image.modules.Apex(idx), m)
}
return name
}
@@ -458,18 +460,26 @@
return image.compilerFilter == "speed-profile"
}
+func (image *bootImageConfig) isEnabled(ctx android.BaseModuleContext) bool {
+ return ctx.OtherModuleExists(image.enabledIfExists)
+}
+
func dexpreoptBootJarsFactory() android.SingletonModule {
m := &dexpreoptBootJars{}
- android.InitAndroidModule(m)
+ android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
return m
}
func RegisterDexpreoptBootJarsComponents(ctx android.RegistrationContext) {
ctx.RegisterParallelSingletonModuleType("dex_bootjars", dexpreoptBootJarsFactory)
+ ctx.FinalDepsMutators(func(ctx android.RegisterMutatorsContext) {
+ ctx.BottomUp("dex_bootjars_deps", DexpreoptBootJarsMutator).Parallel()
+ })
}
func SkipDexpreoptBootJars(ctx android.PathContext) bool {
- return dexpreopt.GetGlobalConfig(ctx).DisablePreoptBootImages
+ global := dexpreopt.GetGlobalConfig(ctx)
+ return global.DisablePreoptBootImages || !shouldBuildBootImages(ctx.Config(), global)
}
// Singleton module for generating boot image build rules.
@@ -492,38 +502,90 @@
dexpreoptConfigForMake android.WritablePath
}
-// Provide paths to boot images for use by modules that depend upon them.
-//
-// The build rules are created in GenerateSingletonBuildActions().
-func (d *dexpreoptBootJars) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- // Placeholder for now.
+func DexpreoptBootJarsMutator(ctx android.BottomUpMutatorContext) {
+ if _, ok := ctx.Module().(*dexpreoptBootJars); !ok {
+ return
+ }
+
+ if dexpreopt.IsDex2oatNeeded(ctx) {
+ // Add a dependency onto the dex2oat tool which is needed for creating the boot image. The
+ // path is retrieved from the dependency by GetGlobalSoongConfig(ctx).
+ dexpreopt.RegisterToolDeps(ctx)
+ }
+
+ imageConfigs := genBootImageConfigs(ctx)
+ for _, config := range imageConfigs {
+ if !config.isEnabled(ctx) {
+ continue
+ }
+ // For accessing the boot jars.
+ addDependenciesOntoBootImageModules(ctx, config.modules, dexpreoptBootJarDepTag)
+ }
+
+ if ctx.OtherModuleExists("platform-bootclasspath") {
+ // For accessing all bootclasspath fragments.
+ addDependencyOntoApexModulePair(ctx, "platform", "platform-bootclasspath", platformBootclasspathDepTag)
+ } else if ctx.OtherModuleExists("art-bootclasspath-fragment") {
+ // For accessing the ART bootclasspath fragment on a thin manifest (e.g., master-art) where
+ // platform-bootclasspath doesn't exist.
+ addDependencyOntoApexModulePair(ctx, "com.android.art", "art-bootclasspath-fragment", bootclasspathFragmentDepTag)
+ }
}
-// Generate build rules for boot images.
-func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonContext) {
- if dexpreopt.GetCachedGlobalSoongConfig(ctx) == nil {
- // No module has enabled dexpreopting, so we assume there will be no boot image to make.
- return
- }
- d.dexpreoptConfigForMake = android.PathForOutput(ctx, getDexpreoptDirName(ctx), "dexpreopt.config")
- writeGlobalConfigForMake(ctx, d.dexpreoptConfigForMake)
+func gatherBootclasspathFragments(ctx android.ModuleContext) map[string]android.Module {
+ return ctx.Config().Once(dexBootJarsFragmentsKey, func() interface{} {
+ fragments := make(map[string]android.Module)
+ ctx.WalkDeps(func(child, parent android.Module) bool {
+ if !isActiveModule(child) {
+ return false
+ }
+ tag := ctx.OtherModuleDependencyTag(child)
+ if tag == platformBootclasspathDepTag {
+ return true
+ }
+ if tag == bootclasspathFragmentDepTag {
+ apexInfo := ctx.OtherModuleProvider(child, android.ApexInfoProvider).(android.ApexInfo)
+ for _, apex := range apexInfo.InApexVariants {
+ fragments[apex] = child
+ }
+ return false
+ }
+ return false
+ })
+ return fragments
+ }).(map[string]android.Module)
+}
- global := dexpreopt.GetGlobalConfig(ctx)
- if !shouldBuildBootImages(ctx.Config(), global) {
- return
- }
+func getBootclasspathFragmentByApex(ctx android.ModuleContext, apexName string) android.Module {
+ return gatherBootclasspathFragments(ctx)[apexName]
+}
- defaultImageConfig := defaultBootImageConfig(ctx)
- d.defaultBootImage = defaultImageConfig
+// GenerateAndroidBuildActions generates the build rules for boot images.
+func (d *dexpreoptBootJars) GenerateAndroidBuildActions(ctx android.ModuleContext) {
imageConfigs := genBootImageConfigs(ctx)
+ d.defaultBootImage = defaultBootImageConfig(ctx)
d.otherImages = make([]*bootImageConfig, 0, len(imageConfigs)-1)
- for _, config := range imageConfigs {
- if config != defaultImageConfig {
+ for _, name := range getImageNames() {
+ config := imageConfigs[name]
+ if config != d.defaultBootImage {
d.otherImages = append(d.otherImages, config)
}
+ if !config.isEnabled(ctx) {
+ continue
+ }
+ generateBootImage(ctx, config)
+ if config == d.defaultBootImage {
+ bootFrameworkProfileRule(ctx, config)
+ }
}
}
+// GenerateSingletonBuildActions generates build rules for the dexpreopt config for Make.
+func (d *dexpreoptBootJars) GenerateSingletonBuildActions(ctx android.SingletonContext) {
+ d.dexpreoptConfigForMake = android.PathForOutput(ctx, getDexpreoptDirName(ctx), "dexpreopt.config")
+ writeGlobalConfigForMake(ctx, d.dexpreoptConfigForMake)
+}
+
// shouldBuildBootImages determines whether boot images should be built.
func shouldBuildBootImages(config android.Config, global *dexpreopt.GlobalConfig) bool {
// Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
@@ -536,6 +598,101 @@
return true
}
+func generateBootImage(ctx android.ModuleContext, imageConfig *bootImageConfig) {
+ apexJarModulePairs := getModulesForImage(ctx, imageConfig)
+
+ // Copy module dex jars to their predefined locations.
+ bootDexJarsByModule := extractEncodedDexJarsFromModulesOrBootclasspathFragments(ctx, apexJarModulePairs)
+ copyBootJarsToPredefinedLocations(ctx, bootDexJarsByModule, imageConfig.dexPathsByModule)
+
+ // Build a profile for the image config from the profile at the default path. The profile will
+ // then be used along with profiles imported from APEXes to build the boot image.
+ profile := bootImageProfileRule(ctx, imageConfig)
+
+ // If dexpreopt of boot image jars should be skipped, stop after generating a profile.
+ if SkipDexpreoptBootJars(ctx) {
+ return
+ }
+
+ // Build boot image files for the android variants.
+ androidBootImageFiles := buildBootImageVariantsForAndroidOs(ctx, imageConfig, profile)
+
+ // Zip the android variant boot image files up.
+ buildBootImageZipInPredefinedLocation(ctx, imageConfig, androidBootImageFiles.byArch)
+
+ // Build boot image files for the host variants. There are use directly by ART host side tests.
+ buildBootImageVariantsForBuildOs(ctx, imageConfig, profile)
+
+ // Create a `dump-oat-<image-name>` rule that runs `oatdump` for debugging purposes.
+ dumpOatRules(ctx, imageConfig)
+}
+
+type apexJarModulePair struct {
+ apex string
+ jarModule android.Module
+}
+
+func getModulesForImage(ctx android.ModuleContext, imageConfig *bootImageConfig) []apexJarModulePair {
+ modules := make([]apexJarModulePair, 0, imageConfig.modules.Len())
+ for i := 0; i < imageConfig.modules.Len(); i++ {
+ found := false
+ for _, module := range gatherApexModulePairDepsWithTag(ctx, dexpreoptBootJarDepTag) {
+ name := android.RemoveOptionalPrebuiltPrefix(module.Name())
+ if name == imageConfig.modules.Jar(i) {
+ modules = append(modules, apexJarModulePair{
+ apex: imageConfig.modules.Apex(i),
+ jarModule: module,
+ })
+ found = true
+ break
+ }
+ }
+ if !found && !ctx.Config().AllowMissingDependencies() {
+ ctx.ModuleErrorf(
+ "Boot image '%s' module '%s' not added as a dependency of dex_bootjars",
+ imageConfig.name,
+ imageConfig.modules.Jar(i))
+ return []apexJarModulePair{}
+ }
+ }
+ return modules
+}
+
+// extractEncodedDexJarsFromModulesOrBootclasspathFragments gets the hidden API encoded dex jars for
+// the given modules.
+func extractEncodedDexJarsFromModulesOrBootclasspathFragments(ctx android.ModuleContext, apexJarModulePairs []apexJarModulePair) bootDexJarByModule {
+ encodedDexJarsByModuleName := bootDexJarByModule{}
+ for _, pair := range apexJarModulePairs {
+ var path android.Path
+ if android.IsConfiguredJarForPlatform(pair.apex) || android.IsModulePrebuilt(pair.jarModule) {
+ // This gives us the dex jar with the hidden API flags encoded from the monolithic hidden API
+ // files or the dex jar extracted from a prebuilt APEX. We can't use this for a boot jar for
+ // a source APEX because there is no guarantee that it is the same as the jar packed into the
+ // APEX. In practice, they are the same when we are building from a full source tree, but they
+ // are different when we are building from a thin manifest (e.g., master-art), where there is
+ // no monolithic hidden API files at all.
+ path = retrieveEncodedBootDexJarFromModule(ctx, pair.jarModule)
+ } else {
+ // Use exactly the same jar that is packed into the APEX.
+ fragment := getBootclasspathFragmentByApex(ctx, pair.apex)
+ if fragment == nil {
+ ctx.ModuleErrorf("Boot jar '%[1]s' is from APEX '%[2]s', but a bootclasspath_fragment for "+
+ "APEX '%[2]s' doesn't exist or is not added as a dependency of dex_bootjars",
+ pair.jarModule.Name(),
+ pair.apex)
+ }
+ bootclasspathFragmentInfo := ctx.OtherModuleProvider(fragment, BootclasspathFragmentApexContentInfoProvider).(BootclasspathFragmentApexContentInfo)
+ jar, err := bootclasspathFragmentInfo.DexBootJarPathForContentModule(pair.jarModule)
+ if err != nil {
+ ctx.ModuleErrorf("%s", err)
+ }
+ path = jar
+ }
+ encodedDexJarsByModuleName.addPath(pair.jarModule, path)
+ }
+ return encodedDexJarsByModuleName
+}
+
// copyBootJarsToPredefinedLocations generates commands that will copy boot jars to predefined
// paths in the global config.
func copyBootJarsToPredefinedLocations(ctx android.ModuleContext, srcBootDexJarsByModule bootDexJarByModule, dstBootJarsByModule map[string]android.WritablePath) {
@@ -686,10 +843,12 @@
rule.Command().Text("rm").Flag("-f").
Flag(symbolsDir.Join(ctx, "*.art").String()).
Flag(symbolsDir.Join(ctx, "*.oat").String()).
+ Flag(symbolsDir.Join(ctx, "*.vdex").String()).
Flag(symbolsDir.Join(ctx, "*.invocation").String())
rule.Command().Text("rm").Flag("-f").
Flag(outputDir.Join(ctx, "*.art").String()).
Flag(outputDir.Join(ctx, "*.oat").String()).
+ Flag(outputDir.Join(ctx, "*.vdex").String()).
Flag(outputDir.Join(ctx, "*.invocation").String())
cmd := rule.Command()
@@ -711,36 +870,31 @@
Flag("--runtime-arg").FlagWithArg("-Xms", global.Dex2oatImageXms).
Flag("--runtime-arg").FlagWithArg("-Xmx", global.Dex2oatImageXmx)
- if profile != nil {
- cmd.FlagWithInput("--profile-file=", profile)
- }
+ if image.isProfileGuided() && !global.DisableGenerateProfile {
+ if profile != nil {
+ cmd.FlagWithInput("--profile-file=", profile)
+ }
- fragments := make(map[string]commonBootclasspathFragment)
- ctx.VisitDirectDepsWithTag(bootclasspathFragmentDepTag, func(child android.Module) {
- fragment := child.(commonBootclasspathFragment)
- if fragment.getImageName() != nil && android.IsModulePreferred(child) {
- fragments[*fragment.getImageName()] = fragment
+ for _, apex := range image.profileImports {
+ fragment := getBootclasspathFragmentByApex(ctx, apex)
+ if fragment == nil {
+ ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but a "+
+ "bootclasspath_fragment for APEX '%[2]s' doesn't exist or is not added as a "+
+ "dependency of dex_bootjars",
+ image.name,
+ apex)
+ return bootImageVariantOutputs{}
+ }
+ importedProfile := fragment.(commonBootclasspathFragment).getProfilePath()
+ if importedProfile == nil {
+ ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but '%[2]s' "+
+ "doesn't provide a profile",
+ image.name,
+ apex)
+ return bootImageVariantOutputs{}
+ }
+ cmd.FlagWithInput("--profile-file=", importedProfile)
}
- })
-
- for _, profileImport := range image.profileImports {
- fragment := fragments[profileImport.name]
- if fragment == nil {
- ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but a "+
- "bootclasspath_fragment with image name '%[2]s' doesn't exist or is not added as a "+
- "dependency of '%[1]s'",
- image.name,
- profileImport.name)
- return bootImageVariantOutputs{}
- }
- if fragment.getProfilePath() == nil {
- ctx.ModuleErrorf("Boot image config '%[1]s' imports profile from '%[2]s', but '%[2]s' "+
- "doesn't provide a profile",
- image.name,
- profileImport.name)
- return bootImageVariantOutputs{}
- }
- cmd.FlagWithInput("--profile-file=", fragment.getProfilePath())
}
dirtyImageFile := "frameworks/base/config/dirty-image-objects"
@@ -1059,11 +1213,9 @@
ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_FILES", strings.Join(dexPaths.Strings(), " "))
ctx.Strict("DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS", strings.Join(dexLocations, " "))
- var imageNames []string
// The primary ART boot image is exposed to Make for testing (gtests) and benchmarking
// (golem) purposes.
for _, current := range append(d.otherImages, image) {
- imageNames = append(imageNames, current.name)
for _, variant := range current.variants {
suffix := ""
if variant.target.Os.Class == android.Host {
@@ -1084,8 +1236,6 @@
ctx.Strict("DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICE"+current.name, strings.Join(imageLocationsOnDevice, ":"))
ctx.Strict("DEXPREOPT_IMAGE_ZIP_"+current.name, current.zip.String())
}
- // Ensure determinism.
- sort.Strings(imageNames)
- ctx.Strict("DEXPREOPT_IMAGE_NAMES", strings.Join(imageNames, " "))
+ ctx.Strict("DEXPREOPT_IMAGE_NAMES", strings.Join(getImageNames(), " "))
}
}
diff --git a/java/dexpreopt_config.go b/java/dexpreopt_config.go
index abbb96a..0f4bd9b 100644
--- a/java/dexpreopt_config.go
+++ b/java/dexpreopt_config.go
@@ -40,57 +40,67 @@
}
var (
- bootImageConfigKey = android.NewOnceKey("bootImageConfig")
- bootImageConfigRawKey = android.NewOnceKey("bootImageConfigRaw")
- artBootImageName = "art"
- frameworkBootImageName = "boot"
- mainlineBootImageName = "mainline"
- bootImageStem = "boot"
+ bootImageConfigKey = android.NewOnceKey("bootImageConfig")
+ bootImageConfigRawKey = android.NewOnceKey("bootImageConfigRaw")
+ frameworkBootImageName = "boot"
+ mainlineBootImageName = "mainline"
+ bootImageStem = "boot"
+ profileInstallPathInApex = "etc/boot-image.prof"
)
+// getImageNames returns an ordered list of image names. The order doesn't matter but needs to be
+// deterministic. The names listed here must match the map keys returned by genBootImageConfigs.
+func getImageNames() []string {
+ return []string{"art", "boot", "mainline"}
+}
+
func genBootImageConfigRaw(ctx android.PathContext) map[string]*bootImageConfig {
return ctx.Config().Once(bootImageConfigRawKey, func() interface{} {
global := dexpreopt.GetGlobalConfig(ctx)
- artModules := global.ArtApexJars
- frameworkModules := global.BootJars // This includes `artModules`.
+ artBootImageName := "art" // Keep this local to avoid accidental references.
+ frameworkModules := global.BootJars // This includes `global.ArtApexJars`.
mainlineBcpModules := global.ApexBootJars
frameworkSubdir := "system/framework"
- // ART config for the primary boot image in the ART apex.
- // It includes the Core Libraries.
+ profileImports := []string{"com.android.art"}
+
+ // ART boot image for testing only. Do not rely on it to make any build-time decision.
artCfg := bootImageConfig{
- name: artBootImageName,
- stem: bootImageStem,
- installDir: "apex/art_boot_images/javalib",
- profileInstallPathInApex: "etc/boot-image.prof",
- modules: artModules,
- preloadedClassesFile: "art/build/boot/preloaded-classes",
- compilerFilter: "speed-profile",
- singleImage: false,
+ name: artBootImageName,
+ enabledIfExists: "art-bootclasspath-fragment",
+ stem: bootImageStem,
+ installDir: "apex/art_boot_images/javalib",
+ modules: global.TestOnlyArtBootImageJars,
+ preloadedClassesFile: "art/build/boot/preloaded-classes",
+ compilerFilter: "speed-profile",
+ singleImage: false,
+ profileImports: profileImports,
}
// Framework config for the boot image extension.
// It includes framework libraries and depends on the ART config.
frameworkCfg := bootImageConfig{
name: frameworkBootImageName,
+ enabledIfExists: "platform-bootclasspath",
stem: bootImageStem,
installDir: frameworkSubdir,
modules: frameworkModules,
preloadedClassesFile: "frameworks/base/config/preloaded-classes",
compilerFilter: "speed-profile",
singleImage: false,
- profileImports: []*bootImageConfig{&artCfg},
+ profileImports: profileImports,
}
mainlineCfg := bootImageConfig{
- extends: &frameworkCfg,
- name: mainlineBootImageName,
- stem: bootImageStem,
- installDir: frameworkSubdir,
- modules: mainlineBcpModules,
- compilerFilter: "verify",
- singleImage: true,
+ extends: &frameworkCfg,
+ name: mainlineBootImageName,
+ enabledIfExists: "platform-bootclasspath",
+ stem: bootImageStem,
+ installDir: frameworkSubdir,
+ modules: mainlineBcpModules,
+ compilerFilter: "verify",
+ singleImage: true,
}
return map[string]*bootImageConfig{
@@ -180,10 +190,6 @@
}
}
-func artBootImageConfig(ctx android.PathContext) *bootImageConfig {
- return genBootImageConfigs(ctx)[artBootImageName]
-}
-
func defaultBootImageConfig(ctx android.PathContext) *bootImageConfig {
return genBootImageConfigs(ctx)[frameworkBootImageName]
}
@@ -192,6 +198,18 @@
return genBootImageConfigs(ctx)[mainlineBootImageName]
}
+// isProfileProviderApex returns true if this apex provides a boot image profile.
+func isProfileProviderApex(ctx android.PathContext, apexName string) bool {
+ for _, config := range genBootImageConfigs(ctx) {
+ for _, profileImport := range config.profileImports {
+ if profileImport == apexName {
+ return true
+ }
+ }
+ }
+ return false
+}
+
// Apex boot config allows to access build/install paths of apex boot jars without going
// through the usual trouble of registering dependencies on those modules and extracting build paths
// from those dependencies.
diff --git a/java/dexpreopt_config_test.go b/java/dexpreopt_config_test.go
index cd7f295..44d2127 100644
--- a/java/dexpreopt_config_test.go
+++ b/java/dexpreopt_config_test.go
@@ -16,6 +16,7 @@
import (
"runtime"
+ "sort"
"testing"
"android/soong/android"
@@ -35,3 +36,22 @@
CheckFrameworkBootImageConfig(t, result)
CheckMainlineBootImageConfig(t, result)
}
+
+func TestImageNames(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForBootImageConfigTest,
+ ).RunTest(t)
+
+ names := getImageNames()
+ sort.Strings(names)
+
+ ctx := &android.TestPathContext{TestResult: result}
+ configs := genBootImageConfigs(ctx)
+ namesFromConfigs := make([]string, 0, len(configs))
+ for name, _ := range configs {
+ namesFromConfigs = append(namesFromConfigs, name)
+ }
+ sort.Strings(namesFromConfigs)
+
+ android.AssertArrayString(t, "getImageNames vs genBootImageConfigs", names, namesFromConfigs)
+}
diff --git a/java/dexpreopt_config_testing.go b/java/dexpreopt_config_testing.go
index 56f16e0..176c251 100644
--- a/java/dexpreopt_config_testing.go
+++ b/java/dexpreopt_config_testing.go
@@ -29,6 +29,7 @@
"testing"
"android/soong/android"
+ "android/soong/dexpreopt"
)
// PrepareForBootImageConfigTest is the minimal set of preparers that are needed to be able to use
@@ -36,7 +37,17 @@
var PrepareForBootImageConfigTest = android.GroupFixturePreparers(
android.PrepareForTestWithArchMutator,
android.PrepareForTestAccessingMakeVars,
+ PrepareForTestWithDexpreopt,
FixtureConfigureBootJars("com.android.art:core1", "com.android.art:core2", "platform:framework"),
+ dexpreopt.FixtureSetTestOnlyArtBootImageJars("com.android.art:core1", "com.android.art:core2", "platform:extra1"),
+ android.FixtureAddTextFile("extra1/Android.bp", `
+ java_library {
+ name: "extra1",
+ srcs: ["extra1.java"],
+ installable: true,
+ }
+ `),
+ android.FixtureAddFile("extra1/extra1.java", nil),
)
var PrepareApexBootJarConfigs = FixtureConfigureApexBootJars(
@@ -218,15 +229,15 @@
symbolsDir: "out/soong/dexpreopt_arm64/dex_artjars_unstripped",
installDir: "apex/art_boot_images/javalib",
profileInstallPathInApex: "etc/boot-image.prof",
- modules: android.CreateTestConfiguredJarList([]string{"com.android.art:core1", "com.android.art:core2"}),
- dexPaths: []string{"out/soong/dexpreopt_arm64/dex_artjars_input/core1.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/core2.jar"},
- dexPathsDeps: []string{"out/soong/dexpreopt_arm64/dex_artjars_input/core1.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/core2.jar"},
+ modules: android.CreateTestConfiguredJarList([]string{"com.android.art:core1", "com.android.art:core2", "platform:extra1"}),
+ dexPaths: []string{"out/soong/dexpreopt_arm64/dex_artjars_input/core1.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/core2.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/extra1.jar"},
+ dexPathsDeps: []string{"out/soong/dexpreopt_arm64/dex_artjars_input/core1.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/core2.jar", "out/soong/dexpreopt_arm64/dex_artjars_input/extra1.jar"},
zip: "out/soong/dexpreopt_arm64/dex_artjars/art.zip",
variants: []*expectedVariant{
{
archType: android.Arm64,
- dexLocations: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
- dexLocationsDeps: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
+ dexLocations: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar", "/system/framework/extra1.jar"},
+ dexLocationsDeps: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar", "/system/framework/extra1.jar"},
imagePathOnHost: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art",
imagePathOnDevice: "/apex/art_boot_images/javalib/arm64/boot.art",
imagesDeps: []string{
@@ -236,6 +247,9 @@
"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.art",
"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.oat",
"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.vdex",
+ "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.art",
+ "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.oat",
+ "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.vdex",
},
installs: []normalizedInstall{
{
@@ -254,6 +268,14 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.oat",
to: "/apex/art_boot_images/javalib/arm64/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.art",
+ to: "/apex/art_boot_images/javalib/arm64/boot-extra1.art",
+ },
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/arm64/boot-extra1.oat",
+ },
},
vdexInstalls: []normalizedInstall{
{
@@ -264,6 +286,10 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.vdex",
to: "/apex/art_boot_images/javalib/arm64/boot-core2.vdex",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.vdex",
+ to: "/apex/art_boot_images/javalib/arm64/boot-extra1.vdex",
+ },
},
unstrippedInstalls: []normalizedInstall{
{
@@ -274,13 +300,17 @@
from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot-core2.oat",
to: "/apex/art_boot_images/javalib/arm64/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/arm64/boot-extra1.oat",
+ },
},
licenseMetadataFile: expectedLicenseMetadataFile,
},
{
archType: android.Arm,
- dexLocations: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
- dexLocationsDeps: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar"},
+ dexLocations: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar", "/system/framework/extra1.jar"},
+ dexLocationsDeps: []string{"/apex/com.android.art/javalib/core1.jar", "/apex/com.android.art/javalib/core2.jar", "/system/framework/extra1.jar"},
imagePathOnHost: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art",
imagePathOnDevice: "/apex/art_boot_images/javalib/arm/boot.art",
imagesDeps: []string{
@@ -290,6 +320,9 @@
"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.art",
"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.oat",
"out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.vdex",
+ "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.art",
+ "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.oat",
+ "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.vdex",
},
installs: []normalizedInstall{
{
@@ -308,6 +341,14 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.oat",
to: "/apex/art_boot_images/javalib/arm/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.art",
+ to: "/apex/art_boot_images/javalib/arm/boot-extra1.art",
+ },
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/arm/boot-extra1.oat",
+ },
},
vdexInstalls: []normalizedInstall{
{
@@ -318,6 +359,10 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.vdex",
to: "/apex/art_boot_images/javalib/arm/boot-core2.vdex",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.vdex",
+ to: "/apex/art_boot_images/javalib/arm/boot-extra1.vdex",
+ },
},
unstrippedInstalls: []normalizedInstall{
{
@@ -328,13 +373,17 @@
from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot-core2.oat",
to: "/apex/art_boot_images/javalib/arm/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/arm/boot-extra1.oat",
+ },
},
licenseMetadataFile: expectedLicenseMetadataFile,
},
{
archType: android.X86_64,
- dexLocations: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
- dexLocationsDeps: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
+ dexLocations: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar", "host/linux-x86/system/framework/extra1.jar"},
+ dexLocationsDeps: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar", "host/linux-x86/system/framework/extra1.jar"},
imagePathOnHost: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art",
imagePathOnDevice: "/apex/art_boot_images/javalib/x86_64/boot.art",
imagesDeps: []string{
@@ -344,6 +393,9 @@
"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.art",
"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat",
"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.vdex",
+ "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.art",
+ "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.oat",
+ "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.vdex",
},
installs: []normalizedInstall{
{
@@ -360,6 +412,13 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat",
to: "/apex/art_boot_images/javalib/x86_64/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.art",
+ to: "/apex/art_boot_images/javalib/x86_64/boot-extra1.art",
+ }, {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/x86_64/boot-extra1.oat",
+ },
},
vdexInstalls: []normalizedInstall{
{
@@ -370,6 +429,10 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.vdex",
to: "/apex/art_boot_images/javalib/x86_64/boot-core2.vdex",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.vdex",
+ to: "/apex/art_boot_images/javalib/x86_64/boot-extra1.vdex",
+ },
},
unstrippedInstalls: []normalizedInstall{
{
@@ -380,13 +443,17 @@
from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat",
to: "/apex/art_boot_images/javalib/x86_64/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/x86_64/boot-extra1.oat",
+ },
},
licenseMetadataFile: expectedLicenseMetadataFile,
},
{
archType: android.X86,
- dexLocations: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
- dexLocationsDeps: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar"},
+ dexLocations: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar", "host/linux-x86/system/framework/extra1.jar"},
+ dexLocationsDeps: []string{"host/linux-x86/apex/com.android.art/javalib/core1.jar", "host/linux-x86/apex/com.android.art/javalib/core2.jar", "host/linux-x86/system/framework/extra1.jar"},
imagePathOnHost: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art",
imagePathOnDevice: "/apex/art_boot_images/javalib/x86/boot.art",
imagesDeps: []string{
@@ -396,6 +463,9 @@
"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.art",
"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat",
"out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.vdex",
+ "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.art",
+ "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.oat",
+ "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.vdex",
},
installs: []normalizedInstall{
{
@@ -412,6 +482,13 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat",
to: "/apex/art_boot_images/javalib/x86/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.art",
+ to: "/apex/art_boot_images/javalib/x86/boot-extra1.art",
+ }, {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/x86/boot-extra1.oat",
+ },
},
vdexInstalls: []normalizedInstall{
{
@@ -422,6 +499,10 @@
from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.vdex",
to: "/apex/art_boot_images/javalib/x86/boot-core2.vdex",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.vdex",
+ to: "/apex/art_boot_images/javalib/x86/boot-extra1.vdex",
+ },
},
unstrippedInstalls: []normalizedInstall{
{
@@ -432,6 +513,10 @@
from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat",
to: "/apex/art_boot_images/javalib/x86/boot-core2.oat",
},
+ {
+ from: "out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.oat",
+ to: "/apex/art_boot_images/javalib/x86/boot-extra1.oat",
+ },
},
licenseMetadataFile: expectedLicenseMetadataFile,
},
@@ -813,8 +898,8 @@
},
},
profileInstalls: []normalizedInstall{
+ {from: "out/soong/.intermediates/default/java/dex_bootjars/android_common/boot/boot.prof", to: "/system/etc/boot-image.prof"},
{from: "out/soong/dexpreopt_arm64/dex_bootjars/boot.bprof", to: "/system/etc/boot-image.bprof"},
- {from: "out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/boot/boot.prof", to: "/system/etc/boot-image.prof"},
},
profileLicenseMetadataFile: expectedLicenseMetadataFile,
}
@@ -1202,10 +1287,10 @@
DEXPREOPT_BOOTCLASSPATH_DEX_LOCATIONS=/apex/com.android.art/javalib/core1.jar /apex/com.android.art/javalib/core2.jar /system/framework/framework.jar
DEXPREOPT_BOOT_JARS_MODULES=com.android.art:core1:com.android.art:core2:platform:framework
DEXPREOPT_GEN=out/host/linux-x86/bin/dexpreopt_gen
-DEXPREOPT_IMAGE_BUILT_INSTALLED_art_arm=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art:/apex/art_boot_images/javalib/arm/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat:/apex/art_boot_images/javalib/arm/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.art:/apex/art_boot_images/javalib/arm/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.oat:/apex/art_boot_images/javalib/arm/boot-core2.oat
-DEXPREOPT_IMAGE_BUILT_INSTALLED_art_arm64=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art:/apex/art_boot_images/javalib/arm64/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat:/apex/art_boot_images/javalib/arm64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.art:/apex/art_boot_images/javalib/arm64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.oat:/apex/art_boot_images/javalib/arm64/boot-core2.oat
-DEXPREOPT_IMAGE_BUILT_INSTALLED_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art:/apex/art_boot_images/javalib/x86/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat:/apex/art_boot_images/javalib/x86/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.art:/apex/art_boot_images/javalib/x86/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat:/apex/art_boot_images/javalib/x86/boot-core2.oat
-DEXPREOPT_IMAGE_BUILT_INSTALLED_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art:/apex/art_boot_images/javalib/x86_64/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat:/apex/art_boot_images/javalib/x86_64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.art:/apex/art_boot_images/javalib/x86_64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat:/apex/art_boot_images/javalib/x86_64/boot-core2.oat
+DEXPREOPT_IMAGE_BUILT_INSTALLED_art_arm=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art:/apex/art_boot_images/javalib/arm/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat:/apex/art_boot_images/javalib/arm/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.art:/apex/art_boot_images/javalib/arm/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.oat:/apex/art_boot_images/javalib/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.art:/apex/art_boot_images/javalib/arm/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.oat:/apex/art_boot_images/javalib/arm/boot-extra1.oat
+DEXPREOPT_IMAGE_BUILT_INSTALLED_art_arm64=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art:/apex/art_boot_images/javalib/arm64/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat:/apex/art_boot_images/javalib/arm64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.art:/apex/art_boot_images/javalib/arm64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.oat:/apex/art_boot_images/javalib/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.art:/apex/art_boot_images/javalib/arm64/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.oat:/apex/art_boot_images/javalib/arm64/boot-extra1.oat
+DEXPREOPT_IMAGE_BUILT_INSTALLED_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art:/apex/art_boot_images/javalib/x86/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat:/apex/art_boot_images/javalib/x86/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.art:/apex/art_boot_images/javalib/x86/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat:/apex/art_boot_images/javalib/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.art:/apex/art_boot_images/javalib/x86/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.oat:/apex/art_boot_images/javalib/x86/boot-extra1.oat
+DEXPREOPT_IMAGE_BUILT_INSTALLED_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art:/apex/art_boot_images/javalib/x86_64/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat:/apex/art_boot_images/javalib/x86_64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.art:/apex/art_boot_images/javalib/x86_64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat:/apex/art_boot_images/javalib/x86_64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.art:/apex/art_boot_images/javalib/x86_64/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.oat:/apex/art_boot_images/javalib/x86_64/boot-extra1.oat
DEXPREOPT_IMAGE_BUILT_INSTALLED_boot_arm=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot.art:/system/framework/arm/boot.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot.oat:/system/framework/arm/boot.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-core2.art:/system/framework/arm/boot-core2.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-core2.oat:/system/framework/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-framework.art:/system/framework/arm/boot-framework.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-framework.oat:/system/framework/arm/boot-framework.oat
DEXPREOPT_IMAGE_BUILT_INSTALLED_boot_arm64=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.art:/system/framework/arm64/boot.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.oat:/system/framework/arm64/boot.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-core2.art:/system/framework/arm64/boot-core2.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-core2.oat:/system/framework/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.art:/system/framework/arm64/boot-framework.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.oat:/system/framework/arm64/boot-framework.oat
DEXPREOPT_IMAGE_BUILT_INSTALLED_boot_host_x86=out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot.art:/system/framework/x86/boot.art out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot.oat:/system/framework/x86/boot.oat out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-core2.art:/system/framework/x86/boot-core2.art out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-core2.oat:/system/framework/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-framework.art:/system/framework/x86/boot-framework.art out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-framework.oat:/system/framework/x86/boot-framework.oat
@@ -1214,10 +1299,10 @@
DEXPREOPT_IMAGE_BUILT_INSTALLED_mainline_arm64=out/soong/dexpreopt_arm64/dex_mainlinejars/android/system/framework/arm64/boot-framework-foo.art:/system/framework/arm64/boot-framework-foo.art out/soong/dexpreopt_arm64/dex_mainlinejars/android/system/framework/arm64/boot-framework-foo.oat:/system/framework/arm64/boot-framework-foo.oat
DEXPREOPT_IMAGE_BUILT_INSTALLED_mainline_host_x86=out/soong/dexpreopt_arm64/dex_mainlinejars/linux_glibc/system/framework/x86/boot-framework-foo.art:/system/framework/x86/boot-framework-foo.art out/soong/dexpreopt_arm64/dex_mainlinejars/linux_glibc/system/framework/x86/boot-framework-foo.oat:/system/framework/x86/boot-framework-foo.oat
DEXPREOPT_IMAGE_BUILT_INSTALLED_mainline_host_x86_64=out/soong/dexpreopt_arm64/dex_mainlinejars/linux_glibc/system/framework/x86_64/boot-framework-foo.art:/system/framework/x86_64/boot-framework-foo.art out/soong/dexpreopt_arm64/dex_mainlinejars/linux_glibc/system/framework/x86_64/boot-framework-foo.oat:/system/framework/x86_64/boot-framework-foo.oat
-DEXPREOPT_IMAGE_DEPS_art_arm=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.vdex
-DEXPREOPT_IMAGE_DEPS_art_arm64=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.vdex
-DEXPREOPT_IMAGE_DEPS_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.vdex
-DEXPREOPT_IMAGE_DEPS_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.vdex
+DEXPREOPT_IMAGE_DEPS_art_arm=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.vdex
+DEXPREOPT_IMAGE_DEPS_art_arm64=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.oat out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.vdex
+DEXPREOPT_IMAGE_DEPS_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.vdex
+DEXPREOPT_IMAGE_DEPS_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.art out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.oat out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.vdex
DEXPREOPT_IMAGE_DEPS_boot_arm=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-core2.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-core2.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-framework.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-framework.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-framework.vdex
DEXPREOPT_IMAGE_DEPS_boot_arm64=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-core2.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-core2.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.art out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.oat out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.vdex
DEXPREOPT_IMAGE_DEPS_boot_host_x86=out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot.art out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot.oat out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot.vdex out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-core2.art out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-core2.vdex out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-framework.art out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-framework.oat out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-framework.vdex
@@ -1230,14 +1315,14 @@
DEXPREOPT_IMAGE_LICENSE_METADATA_art_arm64=%[1]s
DEXPREOPT_IMAGE_LICENSE_METADATA_art_host_x86=%[1]s
DEXPREOPT_IMAGE_LICENSE_METADATA_art_host_x86_64=%[1]s
-DEXPREOPT_IMAGE_LICENSE_METADATA_boot_arm=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_boot_arm64=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_boot_host_x86=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_boot_host_x86_64=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_arm=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_arm64=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_host_x86=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_host_x86_64=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_boot_arm=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_boot_arm64=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_boot_host_x86=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_boot_host_x86_64=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_arm=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_arm64=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_host_x86=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_LICENSE_METADATA_mainline_host_x86_64=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEart=/apex/art_boot_images/javalib/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEboot=/system/framework/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_DEVICEmainline=/system/framework/boot.art:/system/framework/boot-framework-foo.art
@@ -1245,12 +1330,12 @@
DEXPREOPT_IMAGE_LOCATIONS_ON_HOSTboot=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/boot.art
DEXPREOPT_IMAGE_LOCATIONS_ON_HOSTmainline=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/boot.art:out/soong/dexpreopt_arm64/dex_mainlinejars/android/system/framework/boot-framework-foo.art
DEXPREOPT_IMAGE_NAMES=art boot mainline
-DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED=out/soong/dexpreopt_arm64/dex_bootjars/boot.bprof:/system/etc/boot-image.bprof out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/boot/boot.prof:/system/etc/boot-image.prof
-DEXPREOPT_IMAGE_PROFILE_LICENSE_METADATA=out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic
-DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_arm=out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot.oat:/apex/art_boot_images/javalib/arm/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot-core2.oat:/apex/art_boot_images/javalib/arm/boot-core2.oat
-DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_arm64=out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot.oat:/apex/art_boot_images/javalib/arm64/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot-core2.oat:/apex/art_boot_images/javalib/arm64/boot-core2.oat
-DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat:/apex/art_boot_images/javalib/x86/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat:/apex/art_boot_images/javalib/x86/boot-core2.oat
-DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat:/apex/art_boot_images/javalib/x86_64/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat:/apex/art_boot_images/javalib/x86_64/boot-core2.oat
+DEXPREOPT_IMAGE_PROFILE_BUILT_INSTALLED=out/soong/.intermediates/default/java/dex_bootjars/android_common/boot/boot.prof:/system/etc/boot-image.prof out/soong/dexpreopt_arm64/dex_bootjars/boot.bprof:/system/etc/boot-image.bprof
+DEXPREOPT_IMAGE_PROFILE_LICENSE_METADATA=out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic
+DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_arm=out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot.oat:/apex/art_boot_images/javalib/arm/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot-core2.oat:/apex/art_boot_images/javalib/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm/boot-extra1.oat:/apex/art_boot_images/javalib/arm/boot-extra1.oat
+DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_arm64=out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot.oat:/apex/art_boot_images/javalib/arm64/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot-core2.oat:/apex/art_boot_images/javalib/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/android/apex/art_boot_images/javalib/arm64/boot-extra1.oat:/apex/art_boot_images/javalib/arm64/boot-extra1.oat
+DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot.oat:/apex/art_boot_images/javalib/x86/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.oat:/apex/art_boot_images/javalib/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.oat:/apex/art_boot_images/javalib/x86/boot-extra1.oat
+DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.oat:/apex/art_boot_images/javalib/x86_64/boot.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.oat:/apex/art_boot_images/javalib/x86_64/boot-core2.oat out/soong/dexpreopt_arm64/dex_artjars_unstripped/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.oat:/apex/art_boot_images/javalib/x86_64/boot-extra1.oat
DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_boot_arm=out/soong/dexpreopt_arm64/dex_bootjars_unstripped/android/system/framework/arm/boot.oat:/system/framework/arm/boot.oat out/soong/dexpreopt_arm64/dex_bootjars_unstripped/android/system/framework/arm/boot-core2.oat:/system/framework/arm/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars_unstripped/android/system/framework/arm/boot-framework.oat:/system/framework/arm/boot-framework.oat
DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_boot_arm64=out/soong/dexpreopt_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot.oat:/system/framework/arm64/boot.oat out/soong/dexpreopt_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-core2.oat:/system/framework/arm64/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars_unstripped/android/system/framework/arm64/boot-framework.oat:/system/framework/arm64/boot-framework.oat
DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_boot_host_x86=out/soong/dexpreopt_arm64/dex_bootjars_unstripped/linux_glibc/system/framework/x86/boot.oat:/system/framework/x86/boot.oat out/soong/dexpreopt_arm64/dex_bootjars_unstripped/linux_glibc/system/framework/x86/boot-core2.oat:/system/framework/x86/boot-core2.oat out/soong/dexpreopt_arm64/dex_bootjars_unstripped/linux_glibc/system/framework/x86/boot-framework.oat:/system/framework/x86/boot-framework.oat
@@ -1259,10 +1344,10 @@
DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_mainline_arm64=out/soong/dexpreopt_arm64/dex_mainlinejars_unstripped/android/system/framework/arm64/boot-framework-foo.oat:/system/framework/arm64/boot-framework-foo.oat
DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_mainline_host_x86=out/soong/dexpreopt_arm64/dex_mainlinejars_unstripped/linux_glibc/system/framework/x86/boot-framework-foo.oat:/system/framework/x86/boot-framework-foo.oat
DEXPREOPT_IMAGE_UNSTRIPPED_BUILT_INSTALLED_mainline_host_x86_64=out/soong/dexpreopt_arm64/dex_mainlinejars_unstripped/linux_glibc/system/framework/x86_64/boot-framework-foo.oat:/system/framework/x86_64/boot-framework-foo.oat
-DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_arm=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex:/apex/art_boot_images/javalib/arm/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.vdex:/apex/art_boot_images/javalib/arm/boot-core2.vdex
-DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_arm64=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.vdex:/apex/art_boot_images/javalib/arm64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.vdex:/apex/art_boot_images/javalib/arm64/boot-core2.vdex
-DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.vdex:/apex/art_boot_images/javalib/x86/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.vdex:/apex/art_boot_images/javalib/x86/boot-core2.vdex
-DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.vdex:/apex/art_boot_images/javalib/x86_64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.vdex:/apex/art_boot_images/javalib/x86_64/boot-core2.vdex
+DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_arm=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot.vdex:/apex/art_boot_images/javalib/arm/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-core2.vdex:/apex/art_boot_images/javalib/arm/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm/boot-extra1.vdex:/apex/art_boot_images/javalib/arm/boot-extra1.vdex
+DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_arm64=out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot.vdex:/apex/art_boot_images/javalib/arm64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-core2.vdex:/apex/art_boot_images/javalib/arm64/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/android/apex/art_boot_images/javalib/arm64/boot-extra1.vdex:/apex/art_boot_images/javalib/arm64/boot-extra1.vdex
+DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_host_x86=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot.vdex:/apex/art_boot_images/javalib/x86/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-core2.vdex:/apex/art_boot_images/javalib/x86/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86/boot-extra1.vdex:/apex/art_boot_images/javalib/x86/boot-extra1.vdex
+DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_art_host_x86_64=out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot.vdex:/apex/art_boot_images/javalib/x86_64/boot.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-core2.vdex:/apex/art_boot_images/javalib/x86_64/boot-core2.vdex out/soong/dexpreopt_arm64/dex_artjars/linux_glibc/apex/art_boot_images/javalib/x86_64/boot-extra1.vdex:/apex/art_boot_images/javalib/x86_64/boot-extra1.vdex
DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_boot_arm=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot.vdex:/system/framework/arm/boot.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-core2.vdex:/system/framework/arm/boot-core2.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm/boot-framework.vdex:/system/framework/arm/boot-framework.vdex
DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_boot_arm64=out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot.vdex:/system/framework/arm64/boot.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-core2.vdex:/system/framework/arm64/boot-core2.vdex out/soong/dexpreopt_arm64/dex_bootjars/android/system/framework/arm64/boot-framework.vdex:/system/framework/arm64/boot-framework.vdex
DEXPREOPT_IMAGE_VDEX_BUILT_INSTALLED_boot_host_x86=out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot.vdex:/system/framework/x86/boot.vdex out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-core2.vdex:/system/framework/x86/boot-core2.vdex out/soong/dexpreopt_arm64/dex_bootjars/linux_glibc/system/framework/x86/boot-framework.vdex:/system/framework/x86/boot-framework.vdex
diff --git a/java/java.go b/java/java.go
index d3762f6..6388d13 100644
--- a/java/java.go
+++ b/java/java.go
@@ -676,6 +676,8 @@
j.minSdkVersion = j.MinSdkVersion(ctx)
j.maxSdkVersion = j.MaxSdkVersion(ctx)
+ j.stem = proptools.StringDefault(j.overridableDeviceProperties.Stem, ctx.ModuleName())
+
apexInfo := ctx.Provider(android.ApexInfoProvider).(android.ApexInfo)
if !apexInfo.IsForPlatform() {
j.hideApexVariantFromMake = true
@@ -1468,6 +1470,8 @@
}
func (j *Binary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ j.stem = proptools.StringDefault(j.overridableDeviceProperties.Stem, ctx.ModuleName())
+
if ctx.Arch().ArchType == android.Common {
// Compile the jar
if j.binaryProperties.Main_class != nil {
@@ -2653,7 +2657,7 @@
var Bool = proptools.Bool
var BoolDefault = proptools.BoolDefault
var String = proptools.String
-var inList = android.InList
+var inList = android.InList[string]
// Add class loader context (CLC) of a given dependency to the current CLC.
func addCLCFromDep(ctx android.ModuleContext, depModule android.Module,
@@ -2767,11 +2771,12 @@
type javaCommonAttributes struct {
*javaResourcesAttributes
*kotlinAttributes
- Srcs bazel.LabelListAttribute
- Plugins bazel.LabelListAttribute
- Javacopts bazel.StringListAttribute
- Sdk_version bazel.StringAttribute
- Java_version bazel.StringAttribute
+ Srcs bazel.LabelListAttribute
+ Plugins bazel.LabelListAttribute
+ Javacopts bazel.StringListAttribute
+ Sdk_version bazel.StringAttribute
+ Java_version bazel.StringAttribute
+ Errorprone_force_enable bazel.BoolAttribute
}
type javaDependencyLabels struct {
@@ -2913,26 +2918,35 @@
staticDeps.Add(&bazel.Label{Label: ":" + javaAidlLibName})
}
- var javacopts []string
+ var javacopts bazel.StringListAttribute //[]string
+ plugins := bazel.MakeLabelListAttribute(
+ android.BazelLabelForModuleDeps(ctx, m.properties.Plugins),
+ )
if m.properties.Javacflags != nil {
- javacopts = append(javacopts, m.properties.Javacflags...)
+ javacopts = bazel.MakeStringListAttribute(m.properties.Javacflags)
}
epEnabled := m.properties.Errorprone.Enabled
- //TODO(b/227504307) add configuration that depends on RUN_ERROR_PRONE environment variable
- if Bool(epEnabled) {
- javacopts = append(javacopts, m.properties.Errorprone.Javacflags...)
+ epJavacflags := m.properties.Errorprone.Javacflags
+ var errorproneForceEnable bazel.BoolAttribute
+ if epEnabled == nil {
+ //TODO(b/227504307) add configuration that depends on RUN_ERROR_PRONE environment variable
+ } else if *epEnabled {
+ plugins.Append(bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, m.properties.Errorprone.Extra_check_modules)))
+ javacopts.Append(bazel.MakeStringListAttribute(epJavacflags))
+ errorproneForceEnable.Value = epEnabled
+ } else {
+ javacopts.Append(bazel.MakeStringListAttribute([]string{"-XepDisableAllChecks"}))
}
commonAttrs := &javaCommonAttributes{
Srcs: javaSrcs,
javaResourcesAttributes: m.convertJavaResourcesAttributes(ctx),
- Plugins: bazel.MakeLabelListAttribute(
- android.BazelLabelForModuleDeps(ctx, m.properties.Plugins),
- ),
- Javacopts: bazel.MakeStringListAttribute(javacopts),
- Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
- Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
+ Plugins: plugins,
+ Javacopts: javacopts,
+ Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
+ Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
+ Errorprone_force_enable: errorproneForceEnable,
}
for axis, configToProps := range archVariantProps {
diff --git a/java/java_test.go b/java/java_test.go
index 4738304..dd98677 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2351,3 +2351,22 @@
`stable.core.platform.api.stubs`,
})
}
+
+func TestJavaLibraryWithResourcesStem(t *testing.T) {
+ ctx, _ := testJavaWithFS(t, `
+ java_library {
+ name: "foo",
+ java_resource_dirs: ["test-jar"],
+ stem: "test",
+ }
+ `,
+ map[string][]byte{
+ "test-jar/test/resource.txt": nil,
+ })
+
+ m := ctx.ModuleForTests("foo", "android_common")
+ outputs := fmt.Sprint(m.AllOutputs())
+ if !strings.Contains(outputs, "test.jar") {
+ t.Errorf("Module output does not contain expected jar %s", "test.jar")
+ }
+}
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 0d4db7c..a4bba48 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -123,15 +123,15 @@
}
func (b *platformBootclasspathModule) BootclasspathDepsMutator(ctx android.BottomUpMutatorContext) {
- // Add dependencies on all the modules configured in the "art" boot image.
- artImageConfig := genBootImageConfigs(ctx)[artBootImageName]
- addDependenciesOntoBootImageModules(ctx, artImageConfig.modules, platformBootclasspathArtBootJarDepTag)
+ // Add dependencies on all the ART jars.
+ global := dexpreopt.GetGlobalConfig(ctx)
+ addDependenciesOntoBootImageModules(ctx, global.ArtApexJars, platformBootclasspathArtBootJarDepTag)
- // Add dependencies on all the non-updatable module configured in the "boot" boot image. That does
- // not include modules configured in the "art" boot image.
+ // Add dependencies on all the non-updatable jars, which are on the platform or in non-updatable
+ // APEXes.
addDependenciesOntoBootImageModules(ctx, b.platformJars(ctx), platformBootclasspathBootJarDepTag)
- // Add dependencies on all the apex jars.
+ // Add dependencies on all the updatable jars, except the ART jars.
apexJars := dexpreopt.GetGlobalConfig(ctx).ApexBootJars
addDependenciesOntoBootImageModules(ctx, apexJars, platformBootclasspathApexBootJarDepTag)
@@ -186,7 +186,6 @@
bootDexJarByModule := b.generateHiddenAPIBuildActions(ctx, b.configuredModules, b.fragments)
buildRuleForBootJarsPackageCheck(ctx, bootDexJarByModule)
- b.generateBootImageBuildActions(ctx)
b.copyApexBootJarsForAppsDexpreopt(ctx, apexModules)
}
@@ -218,7 +217,8 @@
}
func (b *platformBootclasspathModule) platformJars(ctx android.PathContext) android.ConfiguredJarList {
- return defaultBootImageConfig(ctx).modules.RemoveList(artBootImageConfig(ctx).modules)
+ global := dexpreopt.GetGlobalConfig(ctx)
+ return global.BootJars.RemoveList(global.ArtApexJars)
}
// checkPlatformModules ensures that the non-updatable modules supplied are not part of an
@@ -399,78 +399,9 @@
ctx.Strict("INTERNAL_PLATFORM_HIDDENAPI_FLAGS", b.hiddenAPIFlagsCSV.String())
}
-// generateBootImageBuildActions generates ninja rules related to the boot image creation.
-func (b *platformBootclasspathModule) generateBootImageBuildActions(ctx android.ModuleContext) {
- // Force the GlobalSoongConfig to be created and cached for use by the dex_bootjars
- // GenerateSingletonBuildActions method as it cannot create it for itself.
- dexpreopt.GetGlobalSoongConfig(ctx)
-
- global := dexpreopt.GetGlobalConfig(ctx)
- if !shouldBuildBootImages(ctx.Config(), global) {
- return
- }
-
- frameworkBootImageConfig := defaultBootImageConfig(ctx)
- bootFrameworkProfileRule(ctx, frameworkBootImageConfig)
- b.generateBootImage(ctx, frameworkBootImageName)
- b.generateBootImage(ctx, mainlineBootImageName)
- dumpOatRules(ctx, frameworkBootImageConfig)
-}
-
-func (b *platformBootclasspathModule) generateBootImage(ctx android.ModuleContext, imageName string) {
- imageConfig := genBootImageConfigs(ctx)[imageName]
-
- modules := b.getModulesForImage(ctx, imageConfig)
-
- // Copy module dex jars to their predefined locations.
- bootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, modules)
- copyBootJarsToPredefinedLocations(ctx, bootDexJarsByModule, imageConfig.dexPathsByModule)
-
- // Build a profile for the image config and then use that to build the boot image.
- profile := bootImageProfileRule(ctx, imageConfig)
-
- // If dexpreopt of boot image jars should be skipped, generate only a profile.
- global := dexpreopt.GetGlobalConfig(ctx)
- if global.DisablePreoptBootImages {
- return
- }
-
- // Build boot image files for the android variants.
- androidBootImageFiles := buildBootImageVariantsForAndroidOs(ctx, imageConfig, profile)
-
- // Zip the android variant boot image files up.
- buildBootImageZipInPredefinedLocation(ctx, imageConfig, androidBootImageFiles.byArch)
-
- // Build boot image files for the host variants. There are use directly by ART host side tests.
- buildBootImageVariantsForBuildOs(ctx, imageConfig, profile)
-}
-
// Copy apex module dex jars to their predefined locations. They will be used for dexpreopt for apps.
func (b *platformBootclasspathModule) copyApexBootJarsForAppsDexpreopt(ctx android.ModuleContext, apexModules []android.Module) {
config := GetApexBootConfig(ctx)
apexBootDexJarsByModule := extractEncodedDexJarsFromModules(ctx, apexModules)
copyBootJarsToPredefinedLocations(ctx, apexBootDexJarsByModule, config.dexPathsByModule)
}
-
-func (b *platformBootclasspathModule) getModulesForImage(ctx android.ModuleContext, imageConfig *bootImageConfig) []android.Module {
- modules := make([]android.Module, 0, imageConfig.modules.Len())
- for i := 0; i < imageConfig.modules.Len(); i++ {
- found := false
- for _, module := range b.configuredModules {
- name := android.RemoveOptionalPrebuiltPrefix(module.Name())
- if name == imageConfig.modules.Jar(i) {
- modules = append(modules, module)
- found = true
- break
- }
- }
- if !found && !ctx.Config().AllowMissingDependencies() {
- ctx.ModuleErrorf(
- "Boot image '%s' module '%s' not added as a dependency of platform_bootclasspath",
- imageConfig.name,
- imageConfig.modules.Jar(i))
- return []android.Module{}
- }
- }
- return modules
-}
diff --git a/rust/binary.go b/rust/binary.go
index 2de92c1..e6f1539 100644
--- a/rust/binary.go
+++ b/rust/binary.go
@@ -158,9 +158,6 @@
// Binaries default to dylib dependencies for device, rlib for host.
if binary.preferRlib() {
return rlibAutoDep
- } else if mod, ok := ctx.Module().(*Module); ok && mod.InVendor() {
- // Vendor Rust binaries should prefer rlibs.
- return rlibAutoDep
} else if ctx.Device() {
return dylibAutoDep
} else {
@@ -171,8 +168,6 @@
func (binary *binaryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
if binary.preferRlib() {
return RlibLinkage
- } else if ctx.RustModule().InVendor() {
- return RlibLinkage
}
return binary.baseCompiler.stdLinkage(ctx)
}
diff --git a/rust/bindgen.go b/rust/bindgen.go
index 7dc1b4b..59585aa 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -29,7 +29,7 @@
defaultBindgenFlags = []string{""}
// bindgen should specify its own Clang revision so updating Clang isn't potentially blocked on bindgen failures.
- bindgenClangVersion = "clang-r487747c"
+ bindgenClangVersion = "clang-r498229"
_ = pctx.VariableFunc("bindgenClangVersion", func(ctx android.PackageVarContext) string {
if override := ctx.Config().Getenv("LLVM_BINDGEN_PREBUILTS_VERSION"); override != "" {
diff --git a/rust/image.go b/rust/image.go
index 50bf02a..53fb5c0 100644
--- a/rust/image.go
+++ b/rust/image.go
@@ -220,9 +220,6 @@
}
func (mod *Module) ImageMutatorBegin(mctx android.BaseModuleContext) {
- // Rust does not support installing to the product image yet.
- vendorSpecific := mctx.SocSpecific() || mctx.DeviceSpecific()
-
if Bool(mod.VendorProperties.Double_loadable) {
mctx.PropertyErrorf("double_loadable",
"Rust modules do not yet support double loading")
@@ -232,11 +229,6 @@
mctx.PropertyErrorf("vendor_ramdisk_available", "cannot be set for rust_ffi or rust_ffi_shared modules.")
}
}
- if vendorSpecific {
- if lib, ok := mod.compiler.(libraryInterface); ok && lib.buildDylib() {
- mctx.PropertyErrorf("vendor", "Vendor-only dylibs are not yet supported, use rust_library_rlib.")
- }
- }
if mctx.ProductSpecific() {
if lib, ok := mod.compiler.(libraryInterface); ok && lib.buildDylib() {
mctx.PropertyErrorf("product", "Product-only dylibs are not yet supported, use rust_library_rlib.")
diff --git a/rust/library.go b/rust/library.go
index 331763a..3f480a2 100644
--- a/rust/library.go
+++ b/rust/library.go
@@ -21,7 +21,6 @@
"android/soong/android"
"android/soong/cc"
- "android/soong/snapshot"
)
var (
@@ -236,10 +235,7 @@
}
func (library *libraryDecorator) autoDep(ctx android.BottomUpMutatorContext) autoDep {
- if ctx.Module().(*Module).InVendor() {
- // Vendor modules should statically link libstd.
- return rlibAutoDep
- } else if library.preferRlib() {
+ if library.preferRlib() {
return rlibAutoDep
} else if library.rlib() || library.static() {
return rlibAutoDep
@@ -251,10 +247,7 @@
}
func (library *libraryDecorator) stdLinkage(ctx *depsContext) RustLinkage {
- if ctx.RustModule().InVendor() {
- // Vendor modules should statically link libstd.
- return RlibLinkage
- } else if library.static() || library.MutatedProperties.VariantIsStaticStd {
+ if library.static() || library.MutatedProperties.VariantIsStaticStd {
return RlibLinkage
} else if library.baseCompiler.preferRlib() {
return RlibLinkage
@@ -693,24 +686,6 @@
v.(*Module).Disable()
}
- variation := v.(*Module).ModuleBase.ImageVariation().Variation
- if strings.HasPrefix(variation, cc.VendorVariationPrefix) {
- // TODO(b/204303985)
- // Disable vendor dylibs until they are supported
- v.(*Module).Disable()
- }
-
- if strings.HasPrefix(variation, cc.VendorVariationPrefix) &&
- m.HasVendorVariant() &&
- !snapshot.IsVendorProprietaryModule(mctx) &&
- strings.TrimPrefix(variation, cc.VendorVariationPrefix) == mctx.DeviceConfig().VndkVersion() {
-
- // cc.MutateImage runs before LibraryMutator, so vendor variations which are meant for rlibs only are
- // produced for Dylibs; however, dylibs should not be enabled for boardVndkVersion for
- // non-vendor proprietary modules.
- v.(*Module).Disable()
- }
-
case "source":
v.(*Module).compiler.(libraryInterface).setSource()
// The source variant does not produce any library.
@@ -747,10 +722,9 @@
dylib := modules[1].(*Module)
rlib.compiler.(libraryInterface).setRlibStd()
dylib.compiler.(libraryInterface).setDylibStd()
- if dylib.ModuleBase.ImageVariation().Variation == android.VendorRamdiskVariation ||
- strings.HasPrefix(dylib.ModuleBase.ImageVariation().Variation, cc.VendorVariationPrefix) {
+ if dylib.ModuleBase.ImageVariation().Variation == android.VendorRamdiskVariation {
// TODO(b/165791368)
- // Disable rlibs that link against dylib-std on vendor and vendor ramdisk variations until those dylib
+ // Disable rlibs that link against dylib-std on vendor ramdisk variations until those dylib
// variants are properly supported.
dylib.Disable()
}
diff --git a/rust/rust.go b/rust/rust.go
index e524c9f..05fceee 100644
--- a/rust/rust.go
+++ b/rust/rust.go
@@ -43,6 +43,7 @@
android.PostDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("rust_sanitizers", rustSanitizerRuntimeMutator).Parallel()
})
+ pctx.Import("android/soong/android")
pctx.Import("android/soong/rust/config")
pctx.ImportAs("cc_config", "android/soong/cc/config")
android.InitRegistrationContext.RegisterParallelSingletonType("kythe_rust_extract", kytheExtractRustFactory)
@@ -91,6 +92,8 @@
// Used by vendor snapshot to record dependencies from snapshot modules.
SnapshotSharedLibs []string `blueprint:"mutated"`
SnapshotStaticLibs []string `blueprint:"mutated"`
+ SnapshotRlibs []string `blueprint:"mutated"`
+ SnapshotDylibs []string `blueprint:"mutated"`
// Make this module available when building for ramdisk.
// On device without a dedicated recovery partition, the module is only
@@ -258,6 +261,15 @@
return false
}
+func (mod *Module) RlibStd() bool {
+ if mod.compiler != nil {
+ if library, ok := mod.compiler.(libraryInterface); ok && library.rlib() {
+ return library.rlibStd()
+ }
+ }
+ panic(fmt.Errorf("RlibStd() called on non-rlib module: %q", mod.BaseModuleName()))
+}
+
func (mod *Module) Rlib() bool {
if mod.compiler != nil {
if library, ok := mod.compiler.(libraryInterface); ok {
@@ -1225,6 +1237,8 @@
}
directDylibDeps = append(directDylibDeps, rustDep)
mod.Properties.AndroidMkDylibs = append(mod.Properties.AndroidMkDylibs, makeLibName)
+ mod.Properties.SnapshotDylibs = append(mod.Properties.SnapshotDylibs, cc.BaseLibName(depName))
+
case rlibDepTag:
rlib, ok := rustDep.compiler.(libraryInterface)
@@ -1234,6 +1248,8 @@
}
directRlibDeps = append(directRlibDeps, rustDep)
mod.Properties.AndroidMkRlibs = append(mod.Properties.AndroidMkRlibs, makeLibName)
+ mod.Properties.SnapshotRlibs = append(mod.Properties.SnapshotRlibs, cc.BaseLibName(depName))
+
case procMacroDepTag:
directProcMacroDeps = append(directProcMacroDeps, rustDep)
mod.Properties.AndroidMkProcMacroLibs = append(mod.Properties.AndroidMkProcMacroLibs, makeLibName)
@@ -1518,10 +1534,10 @@
}
// dylibs
- actx.AddVariationDependencies(
- append(commonDepVariations, []blueprint.Variation{
- {Mutator: "rust_libraries", Variation: dylibVariation}}...),
- dylibDepTag, deps.Dylibs...)
+ dylibDepVariations := append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: dylibVariation})
+ for _, lib := range deps.Dylibs {
+ addDylibDependency(actx, lib, mod, &snapshotInfo, dylibDepVariations, dylibDepTag)
+ }
// rustlibs
if deps.Rustlibs != nil && !mod.compiler.Disabled() {
@@ -1536,8 +1552,11 @@
// otherwise select the rlib variant.
autoDepVariations := append(commonDepVariations,
blueprint.Variation{Mutator: "rust_libraries", Variation: autoDep.variation})
- if actx.OtherModuleDependencyVariantExists(autoDepVariations, lib) {
- actx.AddVariationDependencies(autoDepVariations, autoDep.depTag, lib)
+
+ replacementLib := cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Dylibs)
+
+ if actx.OtherModuleDependencyVariantExists(autoDepVariations, replacementLib) {
+ addDylibDependency(actx, lib, mod, &snapshotInfo, autoDepVariations, autoDep.depTag)
} else {
// If there's no dylib dependency available, try to add the rlib dependency instead.
addRlibDependency(actx, lib, mod, &snapshotInfo, rlibDepVariations)
@@ -1549,16 +1568,14 @@
if deps.Stdlibs != nil {
if mod.compiler.stdLinkage(ctx) == RlibLinkage {
for _, lib := range deps.Stdlibs {
- depTag := rlibDepTag
lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, &snapshotInfo, actx).Rlibs)
-
actx.AddVariationDependencies(append(commonDepVariations, []blueprint.Variation{{Mutator: "rust_libraries", Variation: "rlib"}}...),
- depTag, lib)
+ rlibDepTag, lib)
}
} else {
- actx.AddVariationDependencies(
- append(commonDepVariations, blueprint.Variation{Mutator: "rust_libraries", Variation: "dylib"}),
- dylibDepTag, deps.Stdlibs...)
+ for _, lib := range deps.Stdlibs {
+ addDylibDependency(actx, lib, mod, &snapshotInfo, dylibDepVariations, dylibDepTag)
+ }
}
}
@@ -1636,6 +1653,11 @@
actx.AddVariationDependencies(variations, rlibDepTag, lib)
}
+func addDylibDependency(actx android.BottomUpMutatorContext, lib string, mod *Module, snapshotInfo **cc.SnapshotInfo, variations []blueprint.Variation, depTag dependencyTag) {
+ lib = cc.GetReplaceModuleName(lib, cc.GetSnapshot(mod, snapshotInfo, actx).Dylibs)
+ actx.AddVariationDependencies(variations, depTag, lib)
+}
+
func BeginMutator(ctx android.BottomUpMutatorContext) {
if mod, ok := ctx.Module().(*Module); ok && mod.Enabled() {
mod.beginMutator(ctx)
diff --git a/rust/rust_test.go b/rust/rust_test.go
index 64f90b6..3f4e296 100644
--- a/rust/rust_test.go
+++ b/rust/rust_test.go
@@ -79,14 +79,18 @@
}
const (
- sharedVendorVariant = "android_vendor.29_arm64_armv8-a_shared"
- rlibVendorVariant = "android_vendor.29_arm64_armv8-a_rlib_rlib-std"
- sharedRecoveryVariant = "android_recovery_arm64_armv8-a_shared"
- rlibRecoveryVariant = "android_recovery_arm64_armv8-a_rlib_rlib-std"
- binaryCoreVariant = "android_arm64_armv8-a"
- binaryVendorVariant = "android_vendor.29_arm64_armv8-a"
- binaryProductVariant = "android_product.29_arm64_armv8-a"
- binaryRecoveryVariant = "android_recovery_arm64_armv8-a"
+ sharedVendorVariant = "android_vendor.29_arm64_armv8-a_shared"
+ rlibVendorVariant = "android_vendor.29_arm64_armv8-a_rlib_rlib-std"
+ rlibDylibStdVendorVariant = "android_vendor.29_arm64_armv8-a_rlib_rlib-std"
+ dylibVendorVariant = "android_vendor.29_arm64_armv8-a_dylib"
+ sharedRecoveryVariant = "android_recovery_arm64_armv8-a_shared"
+ rlibRecoveryVariant = "android_recovery_arm64_armv8-a_rlib_dylib-std"
+ rlibRlibStdRecoveryVariant = "android_recovery_arm64_armv8-a_rlib_rlib-std"
+ dylibRecoveryVariant = "android_recovery_arm64_armv8-a_dylib"
+ binaryCoreVariant = "android_arm64_armv8-a"
+ binaryVendorVariant = "android_vendor.29_arm64_armv8-a"
+ binaryProductVariant = "android_product.29_arm64_armv8-a"
+ binaryRecoveryVariant = "android_recovery_arm64_armv8-a"
)
func testRustVndkFs(t *testing.T, bp string, fs android.MockFS) *android.TestContext {
diff --git a/rust/snapshot_prebuilt.go b/rust/snapshot_prebuilt.go
index 2f79cc5..32d3916 100644
--- a/rust/snapshot_prebuilt.go
+++ b/rust/snapshot_prebuilt.go
@@ -21,10 +21,6 @@
"github.com/google/blueprint/proptools"
)
-const (
- snapshotRlibSuffix = "_rlib."
-)
-
type snapshotLibraryDecorator struct {
cc.BaseSnapshotDecorator
*libraryDecorator
@@ -44,6 +40,8 @@
func registerRustSnapshotModules(ctx android.RegistrationContext) {
cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
"vendor_snapshot_rlib", VendorSnapshotRlibFactory)
+ cc.VendorSnapshotImageSingleton.RegisterAdditionalModule(ctx,
+ "vendor_snapshot_dylib", VendorSnapshotDylibFactory)
cc.RecoverySnapshotImageSingleton.RegisterAdditionalModule(ctx,
"recovery_snapshot_rlib", RecoverySnapshotRlibFactory)
}
@@ -77,12 +75,11 @@
variant = cc.SnapshotSharedSuffix
} else if library.rlib() {
variant = cc.SnapshotRlibSuffix
+ } else if library.dylib() {
+ variant = cc.SnapshotDylibSuffix
}
- if !library.dylib() {
- // TODO(184042776): Remove this check when dylibs are supported in snapshots.
- library.SetSnapshotAndroidMkSuffix(ctx, variant)
- }
+ library.SetSnapshotAndroidMkSuffix(ctx, variant)
if !library.MatchesWithDevice(ctx.DeviceConfig()) {
return buildOutput{}
@@ -107,6 +104,17 @@
return module.Init()
}
+// vendor_snapshot_dylib is a special prebuilt dylib library which is auto-generated by
+// development/vendor_snapshot/update.py. As a part of vendor snapshot, vendor_snapshot_dylib
+// overrides the vendor variant of the rust dylib library with the same name, if BOARD_VNDK_VERSION
+// is set.
+func VendorSnapshotDylibFactory() android.Module {
+ module, prebuilt := snapshotLibraryFactory(cc.VendorSnapshotImageSingleton, cc.SnapshotDylibSuffix)
+ prebuilt.libraryDecorator.BuildOnlyDylib()
+ prebuilt.libraryDecorator.setNoStdlibs()
+ return module.Init()
+}
+
func RecoverySnapshotRlibFactory() android.Module {
module, prebuilt := snapshotLibraryFactory(cc.RecoverySnapshotImageSingleton, cc.SnapshotRlibSuffix)
prebuilt.libraryDecorator.BuildOnlyRlib()
diff --git a/rust/snapshot_utils.go b/rust/snapshot_utils.go
index 8dabd9b..55c85e6 100644
--- a/rust/snapshot_utils.go
+++ b/rust/snapshot_utils.go
@@ -42,8 +42,7 @@
func (mod *Module) IsSnapshotLibrary() bool {
if lib, ok := mod.compiler.(libraryInterface); ok {
- // Rust-native dylibs are not snapshot supported yet. Only snapshot the rlib-std variants of rlibs.
- return lib.shared() || lib.static() || (lib.rlib() && lib.rlibStd())
+ return lib.shared() || lib.static() || lib.rlib() || lib.dylib()
}
return false
}
@@ -61,6 +60,14 @@
return mod.Properties.SnapshotStaticLibs
}
+func (mod *Module) SnapshotRlibs() []string {
+ return mod.Properties.SnapshotRlibs
+}
+
+func (mod *Module) SnapshotDylibs() []string {
+ return mod.Properties.SnapshotDylibs
+}
+
func (mod *Module) Symlinks() []string {
// TODO update this to return the list of symlinks when Rust supports defining symlinks
return nil
diff --git a/rust/vendor_snapshot_test.go b/rust/vendor_snapshot_test.go
index 2e7a330..387d170 100644
--- a/rust/vendor_snapshot_test.go
+++ b/rust/vendor_snapshot_test.go
@@ -48,15 +48,13 @@
crate_name: "rustvendor_available",
srcs: ["lib.rs"],
vendor_available: true,
- include_dirs: ["rust_headers/"],
}
- rust_library_rlib {
+ rust_library {
name: "librustvendor",
crate_name: "rustvendor",
srcs: ["lib.rs"],
vendor: true,
- include_dirs: ["rust_headers/"],
}
rust_binary {
@@ -116,7 +114,7 @@
filepath.Join(staticDir, "libffivendor.a.json"))
// For rlib libraries, all vendor:true and vendor_available modules (including VNDK) are captured.
- rlibVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_rlib-std", archType, archVariant)
+ rlibVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_dylib-std", archType, archVariant)
rlibDir := filepath.Join(snapshotVariantPath, archDir, "rlib")
cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor_available", "librustvendor_available.rlib", rlibDir, rlibVariant)
cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor", "librustvendor.rlib", rlibDir, rlibVariant)
@@ -125,6 +123,25 @@
jsonFiles = append(jsonFiles,
filepath.Join(rlibDir, "librustvendor.rlib.json"))
+ // For rlib libraries, all rlib-std variants vendor:true and vendor_available modules (including VNDK) are captured.
+ rlibStdVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_rlib-std", archType, archVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor_available", "librustvendor_available.rlib-std.rlib", rlibDir, rlibStdVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor", "librustvendor.rlib-std.rlib", rlibDir, rlibStdVariant)
+ jsonFiles = append(jsonFiles,
+ filepath.Join(rlibDir, "librustvendor_available.rlib.json"))
+ jsonFiles = append(jsonFiles,
+ filepath.Join(rlibDir, "librustvendor.rlib.json"))
+
+ // For dylib libraries, all vendor:true and vendor_available modules (including VNDK) are captured.
+ dylibVariant := fmt.Sprintf("android_vendor.29_%s_%s_dylib", archType, archVariant)
+ dylibDir := filepath.Join(snapshotVariantPath, archDir, "dylib")
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor_available", "librustvendor_available.dylib.so", dylibDir, dylibVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor", "librustvendor.dylib.so", dylibDir, dylibVariant)
+ jsonFiles = append(jsonFiles,
+ filepath.Join(dylibDir, "librustvendor_available.dylib.so.json"))
+ jsonFiles = append(jsonFiles,
+ filepath.Join(dylibDir, "librustvendor.dylib.so.json"))
+
// For binary executables, all vendor:true and vendor_available modules are captured.
if archType == "arm64" {
binaryVariant := fmt.Sprintf("android_vendor.29_%s_%s", archType, archVariant)
@@ -209,21 +226,32 @@
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
- rlibVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_rlib-std", archType, archVariant)
+ rlibVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_dylib-std", archType, archVariant)
+ rlibRlibStdVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_rlib-std", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
rlibDir := filepath.Join(snapshotVariantPath, archDir, "rlib")
+ dylibVariant := fmt.Sprintf("android_vendor.29_%s_%s_dylib", archType, archVariant)
+ dylibDir := filepath.Join(snapshotVariantPath, archDir, "dylib")
// Included modules
cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor_available", "librustvendor_available.rlib", rlibDir, rlibVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor_available", "librustvendor_available.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librustvendor_available", "librustvendor_available.dylib.so", dylibDir, dylibVariant)
cc.CheckSnapshot(t, ctx, snapshotSingleton, "libffivendor_available", "libffivendor_available.so", sharedDir, sharedVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librustvendor_available.rlib.json"))
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librustvendor_available.rlib-std.rlib.json"))
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(dylibDir, "librustvendor_available.dylib.so.json"))
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libffivendor_available.so.json"))
// Excluded modules. Modules not included in the directed vendor snapshot
// are still include as fake modules.
cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librustvendor_exclude", "librustvendor_exclude.rlib", rlibDir, rlibVariant)
+ cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librustvendor_exclude", "librustvendor_exclude.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librustvendor_exclude", "librustvendor_exclude.dylib.so", dylibDir, dylibVariant)
cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "libffivendor_exclude", "libffivendor_exclude.so", sharedDir, sharedVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librustvendor_exclude.rlib.json"))
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librustvendor_exclude.rlib-std.rlib.json"))
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(dylibDir, "librustvendor_exclude.dylib.so.json"))
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libffivendor_exclude.so.json"))
}
@@ -274,7 +302,7 @@
vendor_available: true,
}
- rust_library_rlib {
+ rust_library {
name: "librust_exclude",
crate_name: "rust_exclude",
srcs: ["exclude.rs"],
@@ -308,6 +336,14 @@
cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_exclude", true, rlibVendorVariant)
cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_available_exclude", true, rlibVendorVariant)
+ cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_include", false, rlibDylibStdVendorVariant)
+ cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_exclude", true, rlibDylibStdVendorVariant)
+ cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_available_exclude", true, rlibDylibStdVendorVariant)
+
+ cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_include", false, dylibVendorVariant)
+ cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_exclude", true, dylibVendorVariant)
+ cc.AssertExcludeFromVendorSnapshotIs(t, ctx, "librust_available_exclude", true, dylibVendorVariant)
+
// Verify the content of the vendor snapshot.
snapshotDir := "vendor-snapshot"
@@ -327,14 +363,22 @@
sharedVariant := fmt.Sprintf("android_vendor.29_%s_%s_shared", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
- rlibVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_rlib-std", archType, archVariant)
+
+ rlibVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_dylib-std", archType, archVariant)
+ rlibRlibStdVariant := fmt.Sprintf("android_vendor.29_%s_%s_rlib_rlib-std", archType, archVariant)
rlibDir := filepath.Join(snapshotVariantPath, archDir, "rlib")
+ dylibVariant := fmt.Sprintf("android_vendor.29_%s_%s_dylib", archType, archVariant)
+ dylibDir := filepath.Join(snapshotVariantPath, archDir, "dylib")
// Included modules
cc.CheckSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json"))
cc.CheckSnapshot(t, ctx, snapshotSingleton, "librust_include", "librust_include.rlib", rlibDir, rlibVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librust_include.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librust_include", "librust_include.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librust_include.rlib-std.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librust_include", "librust_include.dylib.so", dylibDir, dylibVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(dylibDir, "librust_include.dylib.so.json"))
// Excluded modules
cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant)
@@ -345,6 +389,12 @@
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librust_exclude.rlib.json"))
cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librust_available_exclude", "librust_available_exclude.rlib", rlibDir, rlibVariant)
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librust_available_exclude.rlib.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librust_available_exclude", "librust_available_exclude.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librust_available_exclude.rlib.rlib-std.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librust_exclude", "librust_exclude.dylib.so", dylibDir, dylibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(dylibDir, "librust_exclude.dylib.so.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librust_available_exclude", "librust_available_exclude.dylib.so", dylibDir, dylibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(dylibDir, "librust_available_exclude.dylib.so.json"))
}
// Verify that each json file for an included module has a rule.
@@ -525,7 +575,7 @@
srcs: ["client.rs"],
}
- rust_library_rlib {
+ rust_library {
name: "libclient_rust",
crate_name: "client_rust",
vendor: true,
@@ -572,6 +622,11 @@
rlibs: [
"libstd",
"librust_vendor_available",
+ "librust_vendor_available.rlib-std"
+ ],
+ dylibs: [
+ "libstd",
+ "librust_vendor_available",
],
binaries: [
"bin",
@@ -600,6 +655,10 @@
"libstd",
"librust_vendor_available",
],
+ dylibs: [
+ "libstd",
+ "librust_vendor_available",
+ ],
binaries: [
"bin32",
],
@@ -679,6 +738,52 @@
},
}
+ vendor_snapshot_rlib {
+ name: "librust_vendor_available.rlib-std",
+ version: "30",
+ target_arch: "arm64",
+ vendor: true,
+ arch: {
+ arm64: {
+ src: "librust_vendor_available.rlib-std.rlib",
+ },
+ arm: {
+ src: "librust_vendor_available.rlib-std.rlib",
+ },
+ },
+ }
+
+ vendor_snapshot_dylib {
+ name: "libstd",
+ version: "30",
+ target_arch: "arm64",
+ vendor: true,
+ sysroot: true,
+ arch: {
+ arm64: {
+ src: "libstd.dylib.so",
+ },
+ arm: {
+ src: "libstd.dylib.so",
+ },
+ },
+ }
+
+ vendor_snapshot_dylib {
+ name: "librust_vendor_available",
+ version: "30",
+ target_arch: "arm64",
+ vendor: true,
+ arch: {
+ arm64: {
+ src: "librust_vendor_available.dylib.so",
+ },
+ arm: {
+ src: "librust_vendor_available.dylib.so",
+ },
+ },
+ }
+
vendor_snapshot_object {
name: "crtend_android",
version: "30",
@@ -921,6 +1026,9 @@
"vendor/liblog.so": nil,
"vendor/libstd.rlib": nil,
"vendor/librust_vendor_available.rlib": nil,
+ "vendor/librust_vendor_available.rlib-std.rlib": nil,
+ "vendor/libstd.dylib.so": nil,
+ "vendor/librust_vendor_available.dylib.so": nil,
"vendor/crtbegin_so.o": nil,
"vendor/crtend_so.o": nil,
"vendor/libclang_rt.builtins-aarch64-android.a": nil,
@@ -931,7 +1039,9 @@
}
sharedVariant := "android_vendor.30_arm64_armv8-a_shared"
- rlibVariant := "android_vendor.30_arm64_armv8-a_rlib_rlib-std"
+ rlibVariant := "android_vendor.30_arm64_armv8-a_rlib_dylib-std"
+ rlibRlibStdVariant := "android_vendor.30_arm64_armv8-a_rlib_rlib-std"
+ dylibVariant := "android_vendor.30_arm64_armv8-a_dylib"
staticVariant := "android_vendor.30_arm64_armv8-a_static"
binaryVariant := "android_vendor.30_arm64_armv8-a"
@@ -963,14 +1073,9 @@
t.Errorf("wanted libclient AndroidMkStaticLibs %q, got %q", w, g)
}
- libclientAndroidMkRlibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkRlibs
- if g, w := libclientAndroidMkRlibs, []string{"librust_vendor_available.vendor.rlib-std", "libstd.vendor"}; !reflect.DeepEqual(g, w) {
- t.Errorf("wanted libclient libclientAndroidMkRlibs %q, got %q", w, g)
- }
-
libclientAndroidMkDylibs := ctx.ModuleForTests("libclient", sharedVariant).Module().(*Module).Properties.AndroidMkDylibs
- if len(libclientAndroidMkDylibs) > 0 {
- t.Errorf("wanted libclient libclientAndroidMkDylibs [], got %q", libclientAndroidMkDylibs)
+ if g, w := libclientAndroidMkDylibs, []string{"librust_vendor_available.vendor", "libstd.vendor"}; !reflect.DeepEqual(g, w) {
+ t.Errorf("wanted libclient libclientAndroidMkDylibs %q, got %q", w, libclientAndroidMkDylibs)
}
libclient32AndroidMkSharedLibs := ctx.ModuleForTests("libclient", shared32Variant).Module().(*Module).Properties.AndroidMkSharedLibs
@@ -979,22 +1084,39 @@
}
libclientRustAndroidMkRlibs := ctx.ModuleForTests("libclient_rust", rlibVariant).Module().(*Module).Properties.AndroidMkRlibs
- if g, w := libclientRustAndroidMkRlibs, []string{"librust_vendor_available.vendor.rlib-std", "libstd.vendor"}; !reflect.DeepEqual(g, w) {
- t.Errorf("wanted libclient libclientAndroidMkRlibs %q, got %q", w, g)
+ if g, w := libclientRustAndroidMkRlibs, []string{"librust_vendor_available.vendor"}; !reflect.DeepEqual(g, w) {
+ t.Errorf("wanted rlib libclient libclientAndroidMkRlibs %q, got %q", w, g)
+ }
+
+ libclientRlibStdRustAndroidMkRlibs := ctx.ModuleForTests("libclient_rust", rlibRlibStdVariant).Module().(*Module).Properties.AndroidMkRlibs
+ if g, w := libclientRlibStdRustAndroidMkRlibs, []string{"librust_vendor_available.vendor.rlib-std", "libstd.vendor"}; !reflect.DeepEqual(g, w) {
+ t.Errorf("wanted rlib libclient libclientAndroidMkRlibs %q, got %q", w, g)
+ }
+
+ libclientRustDylibAndroidMkDylibs := ctx.ModuleForTests("libclient_rust", dylibVariant).Module().(*Module).Properties.AndroidMkDylibs
+ if g, w := libclientRustDylibAndroidMkDylibs, []string{"librust_vendor_available.vendor", "libstd.vendor"}; !reflect.DeepEqual(g, w) {
+ t.Errorf("wanted dylib libclient libclientRustDylibAndroidMkDylibs %q, got %q", w, g)
}
// rust vendor snapshot must have ".vendor" suffix in AndroidMk
librustVendorAvailableSnapshotModule := ctx.ModuleForTests("librust_vendor_available.vendor_rlib.30.arm64", rlibVariant).Module()
librustVendorSnapshotMkName := android.AndroidMkEntriesForTest(t, ctx, librustVendorAvailableSnapshotModule)[0].EntryMap["LOCAL_MODULE"][0]
- expectedRustVendorSnapshotName := "librust_vendor_available.vendor.rlib-std"
+ expectedRustVendorSnapshotName := "librust_vendor_available.vendor"
if librustVendorSnapshotMkName != expectedRustVendorSnapshotName {
t.Errorf("Unexpected rust vendor snapshot name in AndroidMk: %q, expected: %q\n", librustVendorSnapshotMkName, expectedRustVendorSnapshotName)
}
+ librustVendorAvailableDylibSnapshotModule := ctx.ModuleForTests("librust_vendor_available.vendor_dylib.30.arm64", dylibVariant).Module()
+ librustVendorSnapshotDylibMkName := android.AndroidMkEntriesForTest(t, ctx, librustVendorAvailableDylibSnapshotModule)[0].EntryMap["LOCAL_MODULE"][0]
+ expectedRustVendorDylibSnapshotName := "librust_vendor_available.vendor"
+ if librustVendorSnapshotDylibMkName != expectedRustVendorDylibSnapshotName {
+ t.Errorf("Unexpected rust vendor snapshot name in AndroidMk: %q, expected: %q\n", librustVendorSnapshotDylibMkName, expectedRustVendorDylibSnapshotName)
+ }
+
rustVendorBinModule := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Module()
- rustVendorBinMkRlibName := android.AndroidMkEntriesForTest(t, ctx, rustVendorBinModule)[0].EntryMap["LOCAL_RLIB_LIBRARIES"][0]
- if rustVendorBinMkRlibName != expectedRustVendorSnapshotName {
- t.Errorf("Unexpected rust rlib name in AndroidMk: %q, expected: %q\n", rustVendorBinMkRlibName, expectedRustVendorSnapshotName)
+ rustVendorBinMkDylibName := android.AndroidMkEntriesForTest(t, ctx, rustVendorBinModule)[0].EntryMap["LOCAL_DYLIB_LIBRARIES"][0]
+ if rustVendorBinMkDylibName != expectedRustVendorSnapshotName {
+ t.Errorf("Unexpected rust rlib name in AndroidMk: %q, expected: %q\n", rustVendorBinMkDylibName, expectedRustVendorSnapshotName)
}
binWithoutSnapshotLdFlags := ctx.ModuleForTests("bin_without_snapshot", binaryVariant).Rule("rustLink").Args["linkFlags"]
@@ -1051,18 +1173,18 @@
crate_name: "recovery_available",
}
- rust_library_rlib {
- name: "librecovery_rlib",
+ rust_library {
+ name: "librecovery_rustlib",
recovery: true,
srcs: ["foo.rs"],
- crate_name: "recovery_rlib",
+ crate_name: "recovery_rustlib",
}
- rust_library_rlib {
- name: "librecovery_available_rlib",
+ rust_library {
+ name: "librecovery_available_rustlib",
recovery_available: true,
srcs: ["foo.rs"],
- crate_name: "recovery_available_rlib",
+ crate_name: "recovery_available_rustlib",
}
rust_binary {
@@ -1113,13 +1235,29 @@
filepath.Join(staticDir, "librecovery_available.a.json"))
// For rlib libraries, all recovery:true and recovery_available modules are captured.
- rlibVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_rlib-std", archType, archVariant)
+ rlibVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_dylib-std", archType, archVariant)
rlibDir := filepath.Join(snapshotVariantPath, archDir, "rlib")
- cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rlib", "librecovery_rlib.rlib", rlibDir, rlibVariant)
- cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available_rlib", "librecovery_available_rlib.rlib", rlibDir, rlibVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.rlib", rlibDir, rlibVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available_rustlib", "librecovery_available_rustlib.rlib", rlibDir, rlibVariant)
jsonFiles = append(jsonFiles,
- filepath.Join(rlibDir, "librecovery_rlib.rlib.json"),
- filepath.Join(rlibDir, "librecovery_available_rlib.rlib.json"))
+ filepath.Join(rlibDir, "librecovery_rustlib.rlib.json"),
+ filepath.Join(rlibDir, "librecovery_available_rustlib.rlib.json"))
+
+ rlibRlibStdVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_rlib-std", archType, archVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available_rustlib", "librecovery_available_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ jsonFiles = append(jsonFiles,
+ filepath.Join(rlibDir, "librecovery_rustlib.rlib-std.rlib.json"),
+ filepath.Join(rlibDir, "librecovery_available_rustlib.rlib-std.rlib.json"))
+
+ // For dylib libraries, all recovery:true and recovery_available modules are captured.
+ dylibVariant := fmt.Sprintf("android_recovery_%s_%s_dylib", archType, archVariant)
+ dylibDir := filepath.Join(snapshotVariantPath, archDir, "dylib")
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.dylib.so", dylibDir, dylibVariant)
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_available_rustlib", "librecovery_available_rustlib.dylib.so", dylibDir, dylibVariant)
+ jsonFiles = append(jsonFiles,
+ filepath.Join(dylibDir, "librecovery_rustlib.dylib.so.json"),
+ filepath.Join(dylibDir, "librecovery_available_rustlib.dylib.so.json"))
// For binary executables, all recovery:true and recovery_available modules are captured.
if archType == "arm64" {
@@ -1169,25 +1307,25 @@
exclude_from_recovery_snapshot: true,
crate_name: "available_exclude",
}
- rust_library_rlib {
- name: "libinclude_rlib",
+ rust_library {
+ name: "libinclude_rustlib",
srcs: ["src/include.rs"],
recovery_available: true,
- crate_name: "include_rlib",
+ crate_name: "include_rustlib",
}
- rust_library_rlib {
- name: "libexclude_rlib",
+ rust_library {
+ name: "libexclude_rustlib",
srcs: ["src/exclude.rs"],
recovery: true,
exclude_from_recovery_snapshot: true,
- crate_name: "exclude_rlib",
+ crate_name: "exclude_rustlib",
}
- rust_library_rlib {
- name: "libavailable_exclude_rlib",
+ rust_library {
+ name: "libavailable_exclude_rustlib",
srcs: ["src/exclude.rs"],
recovery_available: true,
exclude_from_recovery_snapshot: true,
- crate_name: "available_exclude_rlib",
+ crate_name: "available_exclude_rustlib",
}
`
@@ -1198,11 +1336,11 @@
recovery: true,
crate_name: "recovery",
}
- rust_library_rlib {
- name: "librecovery_rlib",
+ rust_library {
+ name: "librecovery_rustlib",
srcs: ["recovery.rs"],
recovery: true,
- crate_name: "recovery_rlib",
+ crate_name: "recovery_rustlib",
}
`
@@ -1220,14 +1358,25 @@
cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libinclude", false, sharedRecoveryVariant)
cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libexclude", true, sharedRecoveryVariant)
cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libavailable_exclude", true, sharedRecoveryVariant)
- cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libinclude_rlib", false, rlibRecoveryVariant)
- cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libexclude_rlib", true, rlibRecoveryVariant)
- cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libavailable_exclude_rlib", true, rlibRecoveryVariant)
+
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libinclude_rustlib", false, rlibRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libexclude_rustlib", true, rlibRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libavailable_exclude_rustlib", true, rlibRlibStdRecoveryVariant)
+
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libinclude_rustlib", false, rlibRlibStdRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libexclude_rustlib", true, rlibRlibStdRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libavailable_exclude_rustlib", true, rlibRlibStdRecoveryVariant)
+
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libinclude_rustlib", false, dylibRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libexclude_rustlib", true, dylibRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "libavailable_exclude_rustlib", true, dylibRecoveryVariant)
// A recovery module is excluded, but by its path not the exclude_from_recovery_snapshot property
// ('device/' and 'vendor/' are default excluded). See snapshot/recovery_snapshot.go for more detail.
cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "librecovery", false, sharedRecoveryVariant)
- cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "librecovery_rlib", false, rlibRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "librecovery_rustlib", false, rlibRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "librecovery_rustlib", false, rlibRlibStdRecoveryVariant)
+ cc.AssertExcludeFromRecoverySnapshotIs(t, ctx, "librecovery_rustlib", false, dylibRecoveryVariant)
// Verify the content of the recovery snapshot.
@@ -1246,15 +1395,21 @@
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant)
- rlibVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_rlib-std", archType, archVariant)
+ rlibVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_dylib-std", archType, archVariant)
+ rlibRlibStdVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_rlib-std", archType, archVariant)
+ dylibVariant := fmt.Sprintf("android_recovery_%s_%s_dylib", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
rlibDir := filepath.Join(snapshotVariantPath, archDir, "rlib")
+ dylibDir := filepath.Join(snapshotVariantPath, archDir, "dylib")
// Included modules
+
cc.CheckSnapshot(t, ctx, snapshotSingleton, "libinclude", "libinclude.so", sharedDir, sharedVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "libinclude.so.json"))
- cc.CheckSnapshot(t, ctx, snapshotSingleton, "libinclude_rlib", "libinclude_rlib.rlib", rlibDir, rlibVariant)
- includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "libinclude_rlib.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "libinclude_rustlib", "libinclude_rustlib.rlib", rlibDir, rlibVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "libinclude_rustlib.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "libinclude_rustlib", "libinclude_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "libinclude_rustlib.rlib-std.rlib.json"))
// Excluded modules
cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude", "libexclude.so", sharedDir, sharedVariant)
@@ -1263,12 +1418,27 @@
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json"))
cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude", "libavailable_exclude.so", sharedDir, sharedVariant)
excludeJsonFiles = append(excludeJsonFiles, filepath.Join(sharedDir, "libavailable_exclude.so.json"))
- cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude_rlib", "libexclude_rlib.rlib", rlibDir, rlibVariant)
- excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libexclude_rlib.rlib.json"))
- cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librecovery_rlib", "librecovery_rlib.rlib", rlibDir, rlibVariant)
- excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librecovery_rlib.rlib.json"))
- cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude_rlib", "libavailable_exclude_rlib.rlib", rlibDir, rlibVariant)
- excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libavailable_exclude_rlib.rlib.json"))
+
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude_rustlib", "libexclude_rustlib.rlib", rlibDir, rlibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libexclude_rustlib.rlib.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.rlib", rlibDir, rlibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librecovery_rustlib.rlib.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude_rustlib", "libavailable_exclude_rustlib.rlib", rlibDir, rlibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libavailable_exclude_rustlib.rlib.json"))
+
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude_rustlib", "libexclude_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libexclude_rustlib.rlib-std.rlib.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librecovery_rustlib.rlib-std.rlib.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude_rustlib", "libavailable_exclude_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libavailable_exclude_rustlib.rlib-std.rlib.json"))
+
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libexclude_rustlib", "libexclude_rustlib.dylib.so", dylibDir, dylibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libexclude_rustlib.dylib.so.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.dylib.so", dylibDir, dylibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "librecovery_rustlib.dylib.so.json"))
+ cc.CheckSnapshotExclude(t, ctx, snapshotSingleton, "libavailable_exclude_rustlib", "libavailable_exclude_rustlib.dylib.so", dylibDir, dylibVariant)
+ excludeJsonFiles = append(excludeJsonFiles, filepath.Join(rlibDir, "libavailable_exclude_rustlib.dylib.so.json"))
}
// Verify that each json file for an included module has a rule.
@@ -1302,15 +1472,15 @@
srcs: ["foo.rs"],
}
- rust_library_rlib {
- name: "librecovery_rlib",
+ rust_library {
+ name: "librecovery_rustlib",
recovery: true,
crate_name: "recovery",
srcs: ["foo.rs"],
}
- rust_library_rlib {
- name: "librecovery_available_rlib",
+ rust_library {
+ name: "librecovery_available_rustlib",
recovery_available: true,
crate_name: "recovery_available",
srcs: ["foo.rs"],
@@ -1335,7 +1505,7 @@
ctx := testRustRecoveryFsVersions(t, bp, rustMockedFiles, "current", "29", "current")
ctx.Config().TestProductVariables.RecoverySnapshotModules = make(map[string]bool)
ctx.Config().TestProductVariables.RecoverySnapshotModules["librecovery"] = true
- ctx.Config().TestProductVariables.RecoverySnapshotModules["librecovery_rlib"] = true
+ ctx.Config().TestProductVariables.RecoverySnapshotModules["librecovery_rustlib"] = true
ctx.Config().TestProductVariables.DirectedRecoverySnapshot = true
// Check recovery snapshot output.
@@ -1353,15 +1523,22 @@
archDir := fmt.Sprintf("arch-%s-%s", archType, archVariant)
sharedVariant := fmt.Sprintf("android_recovery_%s_%s_shared", archType, archVariant)
- rlibVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_rlib-std", archType, archVariant)
+ rlibVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_dylib-std", archType, archVariant)
+ rlibRlibStdVariant := fmt.Sprintf("android_recovery_%s_%s_rlib_rlib-std", archType, archVariant)
+ dylibVariant := fmt.Sprintf("android_recovery_%s_%s_dylib", archType, archVariant)
sharedDir := filepath.Join(snapshotVariantPath, archDir, "shared")
rlibDir := filepath.Join(snapshotVariantPath, archDir, "rlib")
+ dylibDir := filepath.Join(snapshotVariantPath, archDir, "dylib")
// Included modules
cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery", "librecovery.so", sharedDir, sharedVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery.so.json"))
- cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rlib", "librecovery_rlib.rlib", rlibDir, rlibVariant)
- includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librecovery_rlib.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.rlib", rlibDir, rlibVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librecovery_rustlib.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librecovery_rustlib.rlib-std.rlib.json"))
+ cc.CheckSnapshot(t, ctx, snapshotSingleton, "librecovery_rustlib", "librecovery_rustlib.dylib.so", dylibDir, dylibVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(dylibDir, "librecovery_rustlib.dylib.so.json"))
// TODO: When Rust supports the "prefer" property for prebuilts, perform this check.
/*
@@ -1374,8 +1551,12 @@
// are still included as fake modules.
cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available", "librecovery_available.so", sharedDir, sharedVariant)
includeJsonFiles = append(includeJsonFiles, filepath.Join(sharedDir, "librecovery_available.so.json"))
- cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available_rlib", "librecovery_available_rlib.rlib", rlibDir, rlibVariant)
- includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librecovery_available_rlib.rlib.json"))
+ cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available_rustlib", "librecovery_available_rustlib.rlib", rlibDir, rlibVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librecovery_available_rustlib.rlib.json"))
+ cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available_rustlib", "librecovery_available_rustlib.rlib-std.rlib", rlibDir, rlibRlibStdVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(rlibDir, "librecovery_available_rustlib.rlib-std.rlib.json"))
+ cc.CheckSnapshotRule(t, ctx, snapshotSingleton, "librecovery_available_rustlib", "librecovery_available_rustlib.dylib.so", dylibDir, dylibVariant)
+ includeJsonFiles = append(includeJsonFiles, filepath.Join(dylibDir, "librecovery_available_rustlib.dylib.so.json"))
}
// Verify that each json file for an included module has a rule.
diff --git a/scripts/unpack-prebuilt-apex.sh b/scripts/unpack-prebuilt-apex.sh
index 2a20e45..18f4da2 100755
--- a/scripts/unpack-prebuilt-apex.sh
+++ b/scripts/unpack-prebuilt-apex.sh
@@ -17,7 +17,7 @@
# limitations under the License.
# Tool to unpack an apex file and verify that the required files were extracted.
-if [ $# -lt 7 ]; then
+if [ $# -lt 6 ]; then
echo "usage: $0 <deapaxer_path> <debugfs_path> <fsck.erofs_path> <apex file> <output_dir> <required_files>+" >&2
exit 1
fi
diff --git a/sdk/bootclasspath_fragment_sdk_test.go b/sdk/bootclasspath_fragment_sdk_test.go
index ac23aab..ee1b5db 100644
--- a/sdk/bootclasspath_fragment_sdk_test.go
+++ b/sdk/bootclasspath_fragment_sdk_test.go
@@ -145,8 +145,8 @@
preparerForSnapshot := fixtureAddPrebuiltApexForBootclasspathFragment("com.android.art", "art-bootclasspath-fragment")
// Check that source on its own configures the bootImageConfig correctly.
- java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/art-bootclasspath-fragment/android_common_apex10000/meta_lic")
- java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic")
+ java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
+ java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
CheckSnapshot(t, result, "mysdk", "",
checkAndroidBpContents(`
@@ -213,24 +213,24 @@
java.ApexBootJarDexJarPaths...,
)...,
)
- java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/snapshot/art-bootclasspath-fragment/android_common_com.android.art/meta_lic")
- java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic")
+ java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
+ java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
}),
snapshotTestPreparer(checkSnapshotWithSourcePreferred, preparerForSnapshot),
// Check the behavior of the snapshot when the source is preferred.
snapshotTestChecker(checkSnapshotWithSourcePreferred, func(t *testing.T, result *android.TestResult) {
- java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/art-bootclasspath-fragment/android_common_apex10000/meta_lic")
- java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic")
+ java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
+ java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
}),
snapshotTestPreparer(checkSnapshotPreferredWithSource, preparerForSnapshot),
// Check the behavior of the snapshot when it is preferred.
snapshotTestChecker(checkSnapshotPreferredWithSource, func(t *testing.T, result *android.TestResult) {
- java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/snapshot/prebuilt_art-bootclasspath-fragment/android_common_com.android.art/meta_lic")
- java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/frameworks/base/boot/platform-bootclasspath/android_common/meta_lic")
+ java.CheckMutatedArtBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
+ java.CheckMutatedFrameworkBootImageConfig(t, result, "out/soong/.intermediates/default/java/dex_bootjars/android_common/meta_lic")
}),
)
diff --git a/starlark_import/unmarshal.go b/starlark_import/unmarshal.go
index 1b54437..0e6f130 100644
--- a/starlark_import/unmarshal.go
+++ b/starlark_import/unmarshal.go
@@ -25,12 +25,14 @@
)
func Unmarshal[T any](value starlark.Value) (T, error) {
- var zero T
- x, err := UnmarshalReflect(value, reflect.TypeOf(zero))
+ x, err := UnmarshalReflect(value, reflect.TypeOf((*T)(nil)).Elem())
return x.Interface().(T), err
}
func UnmarshalReflect(value starlark.Value, ty reflect.Type) (reflect.Value, error) {
+ if ty == reflect.TypeOf((*starlark.Value)(nil)).Elem() {
+ return reflect.ValueOf(value), nil
+ }
zero := reflect.Zero(ty)
var result reflect.Value
if ty.Kind() == reflect.Interface {
@@ -286,3 +288,17 @@
return nil, fmt.Errorf("unimplemented starlark type: %s", value.Type())
}
}
+
+// NoneableString converts a starlark.Value to a string pointer. If the starlark.Value is NoneType,
+// a nil pointer will be returned instead. All other types of starlark values are errors.
+func NoneableString(value starlark.Value) (*string, error) {
+ switch v := value.(type) {
+ case starlark.String:
+ result := v.GoString()
+ return &result, nil
+ case starlark.NoneType:
+ return nil, nil
+ default:
+ return nil, fmt.Errorf("expected string or none, got %q", value.Type())
+ }
+}
diff --git a/starlark_import/unmarshal_test.go b/starlark_import/unmarshal_test.go
index ee7a9e3..bc0ea4c 100644
--- a/starlark_import/unmarshal_test.go
+++ b/starlark_import/unmarshal_test.go
@@ -30,7 +30,7 @@
return result["x"]
}
-func TestUnmarshallConcreteType(t *testing.T) {
+func TestUnmarshalConcreteType(t *testing.T) {
x, err := Unmarshal[string](createStarlarkValue(t, `"foo"`))
if err != nil {
t.Error(err)
@@ -41,7 +41,7 @@
}
}
-func TestUnmarshallConcreteTypeWithInterfaces(t *testing.T) {
+func TestUnmarshalConcreteTypeWithInterfaces(t *testing.T) {
x, err := Unmarshal[map[string]map[string]interface{}](createStarlarkValue(t,
`{"foo": {"foo2": "foo3"}, "bar": {"bar2": ["bar3"]}}`))
if err != nil {
@@ -57,7 +57,22 @@
}
}
-func TestUnmarshall(t *testing.T) {
+func TestUnmarshalToStarlarkValue(t *testing.T) {
+ x, err := Unmarshal[map[string]starlark.Value](createStarlarkValue(t,
+ `{"foo": "Hi", "bar": None}`))
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ if x["foo"].(starlark.String).GoString() != "Hi" {
+ t.Errorf("Expected \"Hi\", got: %q", x["foo"].(starlark.String).GoString())
+ }
+ if x["bar"].Type() != "NoneType" {
+ t.Errorf("Expected \"NoneType\", got: %q", x["bar"].Type())
+ }
+}
+
+func TestUnmarshal(t *testing.T) {
testCases := []struct {
input string
expected interface{}
diff --git a/tests/genrule_sandbox_test.py b/tests/genrule_sandbox_test.py
index a9f0c9b..0cebc2a 100755
--- a/tests/genrule_sandbox_test.py
+++ b/tests/genrule_sandbox_test.py
@@ -17,34 +17,37 @@
import argparse
import collections
import json
-import os.path
+import os
import subprocess
+import sys
import tempfile
-SRC_ROOT_DIR = os.path.abspath(__file__ + "/../../../..")
+def get_top() -> str:
+ path = '.'
+ while not os.path.isfile(os.path.join(path, 'build/soong/tests/genrule_sandbox_test.py')):
+ if os.path.abspath(path) == '/':
+ sys.exit('Could not find android source tree root.')
+ path = os.path.join(path, '..')
+ return os.path.abspath(path)
-
-def _module_graph_path(out_dir):
- return os.path.join(SRC_ROOT_DIR, out_dir, "soong", "module-actions.json")
-
-
-def _build_with_soong(targets, target_product, out_dir, extra_env={}):
+def _build_with_soong(targets, target_product, *, keep_going = False, extra_env={}):
env = {
+ **os.environ,
"TARGET_PRODUCT": target_product,
"TARGET_BUILD_VARIANT": "userdebug",
}
- env.update(os.environ)
env.update(extra_env)
args = [
"build/soong/soong_ui.bash",
"--make-mode",
"--skip-soong-tests",
]
+ if keep_going:
+ args.append("-k")
args.extend(targets)
try:
- out = subprocess.check_output(
+ subprocess.check_output(
args,
- cwd=SRC_ROOT_DIR,
env=env,
)
except subprocess.CalledProcessError as e:
@@ -55,14 +58,13 @@
def _find_outputs_for_modules(modules, out_dir, target_product):
- module_path = os.path.join(
- SRC_ROOT_DIR, out_dir, "soong", "module-actions.json"
- )
+ module_path = os.path.join(out_dir, "soong", "module-actions.json")
if not os.path.exists(module_path):
- _build_with_soong(["json-module-graph"], target_product, out_dir)
+ _build_with_soong(["json-module-graph"], target_product)
- action_graph = json.load(open(_module_graph_path(out_dir)))
+ with open(module_path) as f:
+ action_graph = json.load(f)
module_to_outs = collections.defaultdict(set)
for mod in action_graph:
@@ -74,50 +76,15 @@
return module_to_outs
-def _store_outputs_to_tmp(output_files):
- try:
- tempdir = tempfile.TemporaryDirectory()
- for f in output_files:
- out = subprocess.check_output(
- ["cp", "--parents", f, tempdir.name],
- cwd=SRC_ROOT_DIR,
- )
- return tempdir
- except subprocess.CalledProcessError as e:
- print(e)
- print(e.stdout)
- print(e.stderr)
-
-
-def _diff_outs(file1, file2, show_diff):
- output = None
- base_args = ["diff"]
- if not show_diff:
- base_args.append("--brief")
- try:
- args = base_args + [file1, file2]
- output = subprocess.check_output(
- args,
- cwd=SRC_ROOT_DIR,
- )
- except subprocess.CalledProcessError as e:
- if e.returncode == 1:
- if show_diff:
- return output
- return True
- return None
-
-
-def _compare_outputs(module_to_outs, tempdir, show_diff):
+def _compare_outputs(module_to_outs, tempdir) -> dict[str, list[str]]:
different_modules = collections.defaultdict(list)
for module, outs in module_to_outs.items():
for out in outs:
- output = None
- diff = _diff_outs(os.path.join(tempdir.name, out), out, show_diff)
- if diff:
- different_modules[module].append(diff)
+ try:
+ subprocess.check_output(["diff", os.path.join(tempdir, out), out])
+ except subprocess.CalledProcessError as e:
+ different_modules[module].append(e.stdout)
- tempdir.cleanup()
return different_modules
@@ -138,53 +105,56 @@
"--show-diff",
"-d",
action="store_true",
- required=False,
help="whether to display differing files",
)
parser.add_argument(
"--output-paths-only",
"-o",
action="store_true",
- required=False,
help="Whether to only return the output paths per module",
)
args = parser.parse_args()
+ os.chdir(get_top())
out_dir = os.environ.get("OUT_DIR", "out")
- target_product = args.target_product
- modules = set(args.modules)
- module_to_outs = _find_outputs_for_modules(modules, out_dir, target_product)
+ print("finding output files for the modules...")
+ module_to_outs = _find_outputs_for_modules(set(args.modules), out_dir, args.target_product)
if not module_to_outs:
- print("No outputs found")
- exit(1)
+ sys.exit("No outputs found")
if args.output_paths_only:
for m, o in module_to_outs.items():
print(f"{m} outputs: {o}")
- exit(0)
+ sys.exit(0)
- all_outs = set()
- for outs in module_to_outs.values():
- all_outs.update(outs)
- print("build without sandboxing")
- _build_with_soong(list(all_outs), target_product, out_dir)
- tempdir = _store_outputs_to_tmp(all_outs)
- print("build with sandboxing")
- _build_with_soong(
- list(all_outs),
- target_product,
- out_dir,
- extra_env={"GENRULE_SANDBOXING": "true"},
- )
- diffs = _compare_outputs(module_to_outs, tempdir, args.show_diff)
- if len(diffs) == 0:
- print("All modules are correct")
- elif args.show_diff:
- for m, d in diffs.items():
- print(f"Module {m} has diffs {d}")
- else:
- print(f"Modules {list(diffs.keys())} have diffs")
+ all_outs = list(set.union(*module_to_outs.values()))
+
+ print("building without sandboxing...")
+ _build_with_soong(all_outs, args.target_product)
+ with tempfile.TemporaryDirectory() as tempdir:
+ for f in all_outs:
+ subprocess.check_call(["cp", "--parents", f, tempdir])
+
+ print("building with sandboxing...")
+ _build_with_soong(
+ all_outs,
+ args.target_product,
+ # We've verified these build without sandboxing already, so do the sandboxing build
+ # with keep_going = True so that we can find all the genrules that fail to build with
+ # sandboxing.
+ keep_going = True,
+ extra_env={"GENRULE_SANDBOXING": "true"},
+ )
+
+ diffs = _compare_outputs(module_to_outs, tempdir)
+ if len(diffs) == 0:
+ print("All modules are correct")
+ elif args.show_diff:
+ for m, d in diffs.items():
+ print(f"Module {m} has diffs {d}")
+ else:
+ print(f"Modules {list(diffs.keys())} have diffs")
if __name__ == "__main__":
diff --git a/tests/run_integration_tests.sh b/tests/run_integration_tests.sh
index 43a9f0f..48f654e 100755
--- a/tests/run_integration_tests.sh
+++ b/tests/run_integration_tests.sh
@@ -10,7 +10,7 @@
"$TOP/build/soong/tests/persistent_bazel_test.sh"
"$TOP/build/soong/tests/soong_test.sh"
"$TOP/build/soong/tests/stale_metrics_files_test.sh"
-"$TOP/build/bazel/ci/rbc_regression_test.sh" aosp_arm64-userdebug
+"$TOP/prebuilts/build-tools/linux-x86/bin/py3-cmd" "$TOP/build/bazel/ci/rbc_dashboard.py" aosp_arm64-userdebug
# The following tests build against the full source tree and don't rely on the
# mock client.
diff --git a/tests/sbom_test.sh b/tests/sbom_test.sh
index 30a1d37..1241e89 100755
--- a/tests/sbom_test.sh
+++ b/tests/sbom_test.sh
@@ -111,6 +111,14 @@
-I /system/lib64/android.hardware.security.rkp-V3-ndk.so \
-I /system/lib64/android.hardware.security.sharedsecret-V1-ndk.so \
-I /system/lib64/android.security.compat-ndk.so \
+ -I /system/lib64/libcuttlefish_allocd_utils.so \
+ -I /system/lib64/libcuttlefish_device_config_proto.so \
+ -I /system/lib64/libcuttlefish_device_config.so \
+ -I /system/lib64/libcuttlefish_fs.so \
+ -I /system/lib64/libcuttlefish_kernel_log_monitor_utils.so \
+ -I /system/lib64/libcuttlefish_utils.so \
+ -I /system/lib64/libfruit.so \
+ -I /system/lib64/libgflags.so \
-I /system/lib64/libkeymaster4_1support.so \
-I /system/lib64/libkeymaster4support.so \
-I /system/lib64/libkeymint.so \
diff --git a/ui/metrics/bp2build_progress_metrics_proto/bp2build.proto b/ui/metrics/bp2build_progress_metrics_proto/bp2build.proto
index 4aee88b..5b44002 100644
--- a/ui/metrics/bp2build_progress_metrics_proto/bp2build.proto
+++ b/ui/metrics/bp2build_progress_metrics_proto/bp2build.proto
@@ -38,6 +38,9 @@
// Total number of transitive dependencies.
int32 num_deps = 5;
+
+ // Unconverted reasons from heuristics
+ repeated string unconverted_reasons_from_heuristics = 6;
}
// Modules that the transitive dependencies were identified for.
diff --git a/zip/cmd/main.go b/zip/cmd/main.go
index a2ccc20..5231fae 100644
--- a/zip/cmd/main.go
+++ b/zip/cmd/main.go
@@ -173,6 +173,7 @@
cpuProfile := flags.String("cpuprofile", "", "write cpu profile to file")
traceFile := flags.String("trace", "", "write trace to file")
sha256Checksum := flags.Bool("sha256", false, "add a zip header to each file containing its SHA256 digest")
+ doNotWrite := flags.Bool("n", false, "Nothing is written to disk -- all other work happens")
flags.Var(&rootPrefix{}, "P", "path prefix within the zip at which to place files")
flags.Var(&listFiles{}, "l", "file containing list of files to zip")
@@ -236,6 +237,7 @@
StoreSymlinks: *symlinks,
IgnoreMissingFiles: *ignoreMissingFiles,
Sha256Checksum: *sha256Checksum,
+ DoNotWrite: *doNotWrite,
})
if err != nil {
fmt.Fprintln(os.Stderr, "error:", err.Error())
diff --git a/zip/zip.go b/zip/zip.go
index 5e1a104..30a2ee7 100644
--- a/zip/zip.go
+++ b/zip/zip.go
@@ -282,6 +282,7 @@
StoreSymlinks bool
IgnoreMissingFiles bool
Sha256Checksum bool
+ DoNotWrite bool
Stderr io.Writer
Filesystem pathtools.FileSystem
@@ -400,7 +401,9 @@
var zipErr error
- if !args.WriteIfChanged {
+ if args.DoNotWrite {
+ out = io.Discard
+ } else if !args.WriteIfChanged {
f, err := os.Create(args.OutputFilePath)
if err != nil {
return err
@@ -421,7 +424,7 @@
return zipErr
}
- if args.WriteIfChanged {
+ if args.WriteIfChanged && !args.DoNotWrite {
err := pathtools.WriteFileIfChanged(args.OutputFilePath, buf.Bytes(), 0666)
if err != nil {
return err