Merge "Do not propagate dynamic dependencies for stub libs."
diff --git a/apex/apex.go b/apex/apex.go
index 39968ab..043f1a9 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1073,6 +1073,10 @@
// Should be only used in tests#.
Test_only_no_hashtree *bool
+ // Whenever apex_payload.img of the APEX should not be dm-verity signed.
+ // Should be only used in tests#.
+ Test_only_unsigned_payload *bool
+
IsCoverageVariant bool `blueprint:"mutated"`
// Whether this APEX is considered updatable or not. When set to true, this will enforce additional
@@ -1562,6 +1566,10 @@
return proptools.Bool(a.properties.Test_only_no_hashtree)
}
+func (a *apexBundle) testOnlyShouldSkipPayloadSign() bool {
+ return proptools.Bool(a.properties.Test_only_unsigned_payload)
+}
+
func (a *apexBundle) getImageVariation(config android.DeviceConfig) string {
if a.vndkApex {
return cc.VendorVariationPrefix + a.vndkVersion(config)
diff --git a/apex/builder.go b/apex/builder.go
index 5a2134a..fba6b94 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -493,6 +493,10 @@
optFlags = append(optFlags, "--no_hashtree")
}
+ if a.testOnlyShouldSkipPayloadSign() {
+ optFlags = append(optFlags, "--unsigned_payload")
+ }
+
if a.properties.Apex_name != nil {
// If apex_name is set, apexer can skip checking if key name matches with apex name.
// Note that apex_manifest is also mended.
diff --git a/cc/androidmk.go b/cc/androidmk.go
index 5438b14..671adb5 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -92,6 +92,9 @@
if len(c.Properties.AndroidMkWholeStaticLibs) > 0 {
entries.AddStrings("LOCAL_WHOLE_STATIC_LIBRARIES", c.Properties.AndroidMkWholeStaticLibs...)
}
+ if len(c.Properties.AndroidMkHeaderLibs) > 0 {
+ entries.AddStrings("LOCAL_HEADER_LIBRARIES", c.Properties.AndroidMkHeaderLibs...)
+ }
entries.SetString("LOCAL_SOONG_LINK_TYPE", c.makeLinkType)
if c.UseVndk() {
entries.SetBool("LOCAL_USE_VNDK", true)
diff --git a/cc/builder.go b/cc/builder.go
index 990069d..2bedd9c 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -58,7 +58,7 @@
ld, ldRE = remoteexec.StaticRules(pctx, "ld",
blueprint.RuleParams{
- Command: "$ldCmd ${crtBegin} @${out}.rsp " +
+ Command: "$reTemplate$ldCmd ${crtBegin} @${out}.rsp " +
"${libFlags} ${crtEnd} -o ${out} ${ldFlags} ${extraLibFlags}",
CommandDeps: []string{"$ldCmd"},
Rspfile: "${out}.rsp",
@@ -66,28 +66,29 @@
// clang -Wl,--out-implib doesn't update its output file if it hasn't changed.
Restat: true,
},
- &remoteexec.REParams{Labels: map[string]string{"type": "link", "tool": "clang"},
+ &remoteexec.REParams{
+ Labels: map[string]string{"type": "link", "tool": "clang"},
ExecStrategy: "${config.RECXXLinksExecStrategy}",
Inputs: []string{"${out}.rsp"},
RSPFile: "${out}.rsp",
- OutputFiles: []string{"${out}"},
+ OutputFiles: []string{"${out}", "$implicitOutputs"},
ToolchainInputs: []string{"$ldCmd"},
Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXLinksPool}"},
- }, []string{"ldCmd", "crtBegin", "libFlags", "crtEnd", "ldFlags", "extraLibFlags"}, nil)
+ }, []string{"ldCmd", "crtBegin", "libFlags", "crtEnd", "ldFlags", "extraLibFlags"}, []string{"implicitOutputs"})
partialLd, partialLdRE = remoteexec.StaticRules(pctx, "partialLd",
blueprint.RuleParams{
// Without -no-pie, clang 7.0 adds -pie to link Android files,
// but -r and -pie cannot be used together.
- Command: "$ldCmd -fuse-ld=lld -nostdlib -no-pie -Wl,-r ${in} -o ${out} ${ldFlags}",
+ Command: "$reTemplate$ldCmd -fuse-ld=lld -nostdlib -no-pie -Wl,-r ${in} -o ${out} ${ldFlags}",
CommandDeps: []string{"$ldCmd"},
}, &remoteexec.REParams{
Labels: map[string]string{"type": "link", "tool": "clang"},
ExecStrategy: "${config.RECXXLinksExecStrategy}", Inputs: []string{"$inCommaList"},
- OutputFiles: []string{"${out}"},
+ OutputFiles: []string{"${out}", "$implicitOutputs"},
ToolchainInputs: []string{"$ldCmd"},
Platform: map[string]string{remoteexec.PoolKey: "${config.RECXXLinksPool}"},
- }, []string{"ldCmd", "ldFlags"}, []string{"inCommaList"})
+ }, []string{"ldCmd", "ldFlags"}, []string{"inCommaList", "implicitOutputs"})
ar = pctx.AndroidStaticRule("ar",
blueprint.RuleParams{
@@ -192,12 +193,18 @@
_ = pctx.SourcePathVariable("sAbiDumper", "prebuilts/clang-tools/${config.HostPrebuiltTag}/bin/header-abi-dumper")
// -w has been added since header-abi-dumper does not need to produce any sort of diagnostic information.
- sAbiDump = pctx.AndroidStaticRule("sAbiDump",
+ sAbiDump, sAbiDumpRE = remoteexec.StaticRules(pctx, "sAbiDump",
blueprint.RuleParams{
- Command: "rm -f $out && $sAbiDumper -o ${out} $in $exportDirs -- $cFlags -w -isystem prebuilts/clang-tools/${config.HostPrebuiltTag}/clang-headers",
+ Command: "rm -f $out && $reTemplate$sAbiDumper -o ${out} $in $exportDirs -- $cFlags -w -isystem prebuilts/clang-tools/${config.HostPrebuiltTag}/clang-headers",
CommandDeps: []string{"$sAbiDumper"},
- },
- "cFlags", "exportDirs")
+ }, &remoteexec.REParams{
+ Labels: map[string]string{"type": "abi-dump", "tool": "header-abi-dumper"},
+ ExecStrategy: "${config.REAbiDumperExecStrategy}",
+ Platform: map[string]string{
+ remoteexec.PoolKey: "${config.RECXXPool}",
+ "InputRootAbsolutePath": android.AbsSrcDirForExistingUseCases(),
+ },
+ }, []string{"cFlags", "exportDirs"}, nil)
_ = pctx.SourcePathVariable("sAbiLinker", "prebuilts/clang-tools/${config.HostPrebuiltTag}/bin/header-abi-linker")
@@ -559,8 +566,12 @@
sAbiDumpFile := android.ObjPathWithExt(ctx, subdir, srcFile, "sdump")
sAbiDumpFiles = append(sAbiDumpFiles, sAbiDumpFile)
+ dumpRule := sAbiDump
+ if ctx.Config().IsEnvTrue("RBE_ABI_DUMPER") {
+ dumpRule = sAbiDumpRE
+ }
ctx.Build(pctx, android.BuildParams{
- Rule: sAbiDump,
+ Rule: dumpRule,
Description: "header-abi-dumper " + srcFile.Rel(),
Output: sAbiDumpFile,
Input: srcFile,
@@ -664,8 +675,17 @@
}
rule := ld
+ args := map[string]string{
+ "ldCmd": ldCmd,
+ "crtBegin": crtBegin.String(),
+ "libFlags": strings.Join(libFlagsList, " "),
+ "extraLibFlags": flags.extraLibFlags,
+ "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
+ "crtEnd": crtEnd.String(),
+ }
if ctx.Config().IsEnvTrue("RBE_CXX_LINKS") {
rule = ldRE
+ args["implicitOutputs"] = strings.Join(implicitOutputs.Strings(), ",")
}
ctx.Build(pctx, android.BuildParams{
@@ -675,14 +695,7 @@
ImplicitOutputs: implicitOutputs,
Inputs: objFiles,
Implicits: deps,
- Args: map[string]string{
- "ldCmd": ldCmd,
- "crtBegin": crtBegin.String(),
- "libFlags": strings.Join(libFlagsList, " "),
- "extraLibFlags": flags.extraLibFlags,
- "ldFlags": flags.globalLdFlags + " " + flags.localLdFlags,
- "crtEnd": crtEnd.String(),
- },
+ Args: args,
})
}
diff --git a/cc/cc.go b/cc/cc.go
index 66425c7..082816e 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -223,6 +223,7 @@
AndroidMkStaticLibs []string `blueprint:"mutated"`
AndroidMkRuntimeLibs []string `blueprint:"mutated"`
AndroidMkWholeStaticLibs []string `blueprint:"mutated"`
+ AndroidMkHeaderLibs []string `blueprint:"mutated"`
HideFromMake bool `blueprint:"mutated"`
PreventInstall bool `blueprint:"mutated"`
ApexesProvidingSharedLibs []string `blueprint:"mutated"`
@@ -2606,6 +2607,9 @@
case wholeStaticDepTag:
c.Properties.AndroidMkWholeStaticLibs = append(
c.Properties.AndroidMkWholeStaticLibs, makeLibName(depName))
+ case headerDepTag:
+ c.Properties.AndroidMkHeaderLibs = append(
+ c.Properties.AndroidMkHeaderLibs, makeLibName(depName))
}
})
diff --git a/cc/config/global.go b/cc/config/global.go
index d85ac5f..39c4c33 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -257,8 +257,10 @@
return ""
})
+ pctx.VariableFunc("RECXXPool", envOverrideFunc("RBE_CXX_POOL", remoteexec.DefaultPool))
pctx.VariableFunc("RECXXLinksPool", envOverrideFunc("RBE_CXX_LINKS_POOL", remoteexec.DefaultPool))
pctx.VariableFunc("RECXXLinksExecStrategy", envOverrideFunc("RBE_CXX_LINKS_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
+ pctx.VariableFunc("REAbiDumperExecStrategy", envOverrideFunc("RBE_ABI_DUMPER_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
}
var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS)
diff --git a/cc/fuzz.go b/cc/fuzz.go
index b7173a3..ebe4252 100644
--- a/cc/fuzz.go
+++ b/cc/fuzz.go
@@ -366,10 +366,10 @@
return
}
- // Discard vendor-NDK-linked + ramdisk + recovery modules, they're duplicates of
+ // Discard ramdisk + recovery modules, they're duplicates of
// fuzz targets we're going to package anyway.
if !ccModule.Enabled() || ccModule.Properties.PreventInstall ||
- ccModule.UseVndk() || ccModule.InRamdisk() || ccModule.InRecovery() {
+ ccModule.InRamdisk() || ccModule.InRecovery() {
return
}
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index 0e1bfc6..f984966 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -47,6 +47,8 @@
const SystemPartition = "/system/"
const SystemOtherPartition = "/system_other/"
+var DexpreoptRunningInSoong = false
+
// GenerateDexpreoptRule generates a set of commands that will preopt a module based on a GlobalConfig and a
// ModuleConfig. The produced files and their install locations will be available through rule.Installs().
func GenerateDexpreoptRule(ctx android.PathContext, globalSoong *GlobalSoongConfig,
@@ -589,7 +591,14 @@
// at that time (Soong processes the jars in dependency order, which may be different from the
// the system server classpath order).
func SystemServerDexJarHostPath(ctx android.PathContext, jar string) android.OutputPath {
- return android.PathForOutput(ctx, "system_server_dexjars", jar+".jar")
+ if DexpreoptRunningInSoong {
+ // Soong module, just use the default output directory $OUT/soong.
+ return android.PathForOutput(ctx, "system_server_dexjars", jar+".jar")
+ } else {
+ // Make module, default output directory is $OUT (passed via the "null config" created
+ // by dexpreopt_gen). Append Soong subdirectory to match Soong module paths.
+ return android.PathForOutput(ctx, "soong", "system_server_dexjars", jar+".jar")
+ }
}
func contains(l []string, s string) bool {
diff --git a/java/androidmk.go b/java/androidmk.go
index 68da23e..2c29192 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -676,6 +676,7 @@
func(entries *android.AndroidMkEntries) {
entries.SetString("LOCAL_CERTIFICATE", r.certificate.AndroidMkString())
entries.SetPath("LOCAL_MODULE_PATH", r.installDir.ToMakePath())
+ entries.AddStrings("LOCAL_OVERRIDES_PACKAGES", r.properties.Overrides...)
},
},
}}
diff --git a/java/app.go b/java/app.go
index 276ab9c..f296f7b 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1415,6 +1415,13 @@
// list of android_app modules whose resources are extracted and linked against
Resource_libs []string
+
+ // Names of modules to be overridden. Listed modules can only be other overlays
+ // (in Make or Soong).
+ // This does not completely prevent installation of the overridden overlays, but if both
+ // overlays would be installed by default (in PRODUCT_PACKAGES) the other overlay will be removed
+ // from PRODUCT_PACKAGES.
+ Overrides []string
}
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
diff --git a/java/app_test.go b/java/app_test.go
index 4178d5e..c1a0cdd 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -2489,6 +2489,7 @@
certificate: "platform",
product_specific: true,
theme: "faza",
+ overrides: ["foo"],
}
android_library {
@@ -2536,14 +2537,15 @@
if expected != signingFlag {
t.Errorf("Incorrect signing flags, expected: %q, got: %q", expected, signingFlag)
}
- path := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_CERTIFICATE"]
+ androidMkEntries := android.AndroidMkEntriesForTest(t, config, "", m.Module())[0]
+ path := androidMkEntries.EntryMap["LOCAL_CERTIFICATE"]
expectedPath := []string{"build/make/target/product/security/platform.x509.pem"}
if !reflect.DeepEqual(path, expectedPath) {
t.Errorf("Unexpected LOCAL_CERTIFICATE value: %v, expected: %v", path, expectedPath)
}
// Check device location.
- path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
+ path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"]
expectedPath = []string{"/tmp/target/product/test_device/product/overlay"}
if !reflect.DeepEqual(path, expectedPath) {
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
@@ -2551,9 +2553,16 @@
// A themed module has a different device location
m = ctx.ModuleForTests("foo_themed", "android_common")
- path = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0].EntryMap["LOCAL_MODULE_PATH"]
+ androidMkEntries = android.AndroidMkEntriesForTest(t, config, "", m.Module())[0]
+ path = androidMkEntries.EntryMap["LOCAL_MODULE_PATH"]
expectedPath = []string{"/tmp/target/product/test_device/product/overlay/faza"}
if !reflect.DeepEqual(path, expectedPath) {
t.Errorf("Unexpected LOCAL_MODULE_PATH value: %v, expected: %v", path, expectedPath)
}
+
+ overrides := androidMkEntries.EntryMap["LOCAL_OVERRIDES_PACKAGES"]
+ expectedOverrides := []string{"foo"}
+ if !reflect.DeepEqual(overrides, expectedOverrides) {
+ t.Errorf("Unexpected LOCAL_OVERRIDES_PACKAGES value: %v, expected: %v", overrides, expectedOverrides)
+ }
}
diff --git a/java/dexpreopt.go b/java/dexpreopt.go
index fba0b97..4725b07 100644
--- a/java/dexpreopt.go
+++ b/java/dexpreopt.go
@@ -62,6 +62,10 @@
}
}
+func init() {
+ dexpreopt.DexpreoptRunningInSoong = true
+}
+
func (d *dexpreopter) dexpreoptDisabled(ctx android.BaseModuleContext) bool {
global := dexpreopt.GetGlobalConfig(ctx)
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index d43dc6c..f511922 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -148,7 +148,8 @@
// locally executable rule and the second rule is a remotely executable rule.
func StaticRules(ctx android.PackageContext, name string, ruleParams blueprint.RuleParams, reParams *REParams, commonArgs []string, reArgs []string) (blueprint.Rule, blueprint.Rule) {
ruleParamsRE := ruleParams
- ruleParamsRE.Command = reParams.Template() + ruleParamsRE.Command
+ ruleParams.Command = strings.ReplaceAll(ruleParams.Command, "$reTemplate", "")
+ ruleParamsRE.Command = strings.ReplaceAll(ruleParamsRE.Command, "$reTemplate", reParams.Template())
return ctx.AndroidStaticRule(name, ruleParams, commonArgs...),
ctx.AndroidRemoteStaticRule(name+"RE", android.RemoteRuleSupports{RBE: true}, ruleParamsRE, append(commonArgs, reArgs...)...)