Merge "Use FORCE_BUILD_LLVM_COMPONENTS."
diff --git a/Android.bp b/Android.bp
index 7cdd928..a9eceb2 100644
--- a/Android.bp
+++ b/Android.bp
@@ -349,6 +349,7 @@
deps: [
"blueprint-proptools",
"soong-android",
+ "soong-remoteexec",
],
srcs: [
"java/config/config.go",
diff --git a/android/package_ctx.go b/android/package_ctx.go
index 5a43ea9..0de356e 100644
--- a/android/package_ctx.go
+++ b/android/package_ctx.go
@@ -232,30 +232,10 @@
}, argNames...)
}
-// RBEExperimentalFlag indicates which flag should be set for the AndroidRemoteStaticRule
-// to use RBE.
-type RBEExperimentalFlag int
-
-const (
- // RBE_NOT_EXPERIMENTAL indicates the rule should use RBE in every build that has
- // UseRBE set.
- RBE_NOT_EXPERIMENTAL RBEExperimentalFlag = iota
- // RBE_JAVAC indicates the rule should use RBE only if the RBE_JAVAC variable is
- // set in an RBE enabled build.
- RBE_JAVAC
- // RBE_R8 indicates the rule should use RBE only if the RBE_R8 variable is set in
- // an RBE enabled build.
- RBE_R8
- // RBE_D8 indicates the rule should use RBE only if the RBE_D8 variable is set in
- // an RBE enabled build.
- RBE_D8
-)
-
// RemoteRuleSupports configures rules with whether they have Goma and/or RBE support.
type RemoteRuleSupports struct {
- Goma bool
- RBE bool
- RBEFlag RBEExperimentalFlag
+ Goma bool
+ RBE bool
}
// AndroidRemoteStaticRule wraps blueprint.StaticRule but uses goma or RBE's parallelism if goma or RBE are enabled
@@ -277,18 +257,6 @@
params.Pool = localPool
}
- if ctx.Config().UseRBE() && supports.RBE {
- if supports.RBEFlag == RBE_JAVAC && !ctx.Config().UseRBEJAVAC() {
- params.Pool = localPool
- }
- if supports.RBEFlag == RBE_R8 && !ctx.Config().UseRBER8() {
- params.Pool = localPool
- }
- if supports.RBEFlag == RBE_D8 && !ctx.Config().UseRBED8() {
- params.Pool = localPool
- }
- }
-
return params, nil
}, argNames...)
}
diff --git a/apex/apex.go b/apex/apex.go
index 043f1a9..714cf9c 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -62,6 +62,7 @@
certificateTag = dependencyTag{name: "certificate"}
usesTag = dependencyTag{name: "uses"}
androidAppTag = dependencyTag{name: "androidApp", payload: true}
+ rroTag = dependencyTag{name: "rro", payload: true}
apexAvailWl = makeApexAvailableWhitelist()
inverseApexAvailWl = invertApexWhiteList(apexAvailWl)
@@ -1118,6 +1119,9 @@
// List of APKs to package inside APEX
Apps []string
+ // List of runtime resource overlays (RROs) inside APEX
+ Rros []string
+
// Names of modules to be overridden. Listed modules can only be other binaries
// (in Make or Soong).
// This does not completely prevent installation of the overridden binaries, but if both
@@ -1528,6 +1532,8 @@
func (a *apexBundle) OverridablePropertiesDepsMutator(ctx android.BottomUpMutatorContext) {
ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
androidAppTag, a.overridableProperties.Apps...)
+ ctx.AddFarVariationDependencies(ctx.Config().AndroidCommonTarget.Variations(),
+ rroTag, a.overridableProperties.Rros...)
}
func (a *apexBundle) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
@@ -1745,6 +1751,21 @@
return af
}
+func apexFileForRuntimeResourceOverlay(ctx android.BaseModuleContext, rro java.RuntimeResourceOverlayModule) apexFile {
+ rroDir := "overlay"
+ dirInApex := filepath.Join(rroDir, rro.Theme())
+ fileToCopy := rro.OutputFile()
+ af := newApexFile(ctx, fileToCopy, rro.Name(), dirInApex, app, rro)
+ af.certificate = rro.Certificate()
+
+ if a, ok := rro.(interface {
+ OverriddenManifestPackageName() string
+ }); ok {
+ af.overriddenPackageName = a.OverriddenManifestPackageName()
+ }
+ return af
+}
+
// Context "decorator", overriding the InstallBypassMake method to always reply `true`.
type flattenedApexContext struct {
android.ModuleContext
@@ -2038,6 +2059,12 @@
} else {
ctx.PropertyErrorf("apps", "%q is not an android_app module", depName)
}
+ case rroTag:
+ if rro, ok := child.(java.RuntimeResourceOverlayModule); ok {
+ filesInfo = append(filesInfo, apexFileForRuntimeResourceOverlay(ctx, rro))
+ } else {
+ ctx.PropertyErrorf("rros", "%q is not an runtime_resource_overlay module", depName)
+ }
case prebuiltTag:
if prebuilt, ok := child.(android.PrebuiltEtcModule); ok {
filesInfo = append(filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, depName))
diff --git a/apex/apex_test.go b/apex/apex_test.go
index c4ab0be..dea7a08 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -521,6 +521,7 @@
native_shared_libs: ["mylib"],
java_libs: ["myjar"],
apps: ["AppFoo"],
+ rros: ["rro"],
}
prebuilt_etc {
@@ -561,12 +562,19 @@
system_modules: "none",
apex_available: [ "myapex" ],
}
+
+ runtime_resource_overlay {
+ name: "rro",
+ theme: "blue",
+ }
+
`)
ensureExactContents(t, ctx, "myapex", "android_common_myapex_image", []string{
"etc/myetc",
"javalib/myjar.jar",
"lib64/mylib.so",
"app/AppFoo/AppFoo.apk",
+ "overlay/blue/rro.apk",
})
}
diff --git a/cc/config/global.go b/cc/config/global.go
index 39c4c33..f9255be 100644
--- a/cc/config/global.go
+++ b/cc/config/global.go
@@ -257,10 +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))
+ pctx.VariableFunc("RECXXPool", remoteexec.EnvOverrideFunc("RBE_CXX_POOL", remoteexec.DefaultPool))
+ pctx.VariableFunc("RECXXLinksPool", remoteexec.EnvOverrideFunc("RBE_CXX_LINKS_POOL", remoteexec.DefaultPool))
+ pctx.VariableFunc("RECXXLinksExecStrategy", remoteexec.EnvOverrideFunc("RBE_CXX_LINKS_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
+ pctx.VariableFunc("REAbiDumperExecStrategy", remoteexec.EnvOverrideFunc("RBE_ABI_DUMPER_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
}
var HostPrebuiltTag = pctx.VariableConfigMethod("HostPrebuiltTag", android.Config.PrebuiltOS)
diff --git a/java/app.go b/java/app.go
index f296f7b..4f4a8d3 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1424,6 +1424,15 @@
Overrides []string
}
+// RuntimeResourceOverlayModule interface is used by the apex package to gather information from
+// a RuntimeResourceOverlay module.
+type RuntimeResourceOverlayModule interface {
+ android.Module
+ OutputFile() android.Path
+ Certificate() Certificate
+ Theme() string
+}
+
func (r *RuntimeResourceOverlay) DepsMutator(ctx android.BottomUpMutatorContext) {
sdkDep := decodeSdkDep(ctx, sdkContext(r))
if sdkDep.hasFrameworkLibs() {
@@ -1476,6 +1485,18 @@
return r.sdkVersion()
}
+func (r *RuntimeResourceOverlay) Certificate() Certificate {
+ return r.certificate
+}
+
+func (r *RuntimeResourceOverlay) OutputFile() android.Path {
+ return r.outputFile
+}
+
+func (r *RuntimeResourceOverlay) Theme() string {
+ return String(r.properties.Theme)
+}
+
// runtime_resource_overlay generates a resource-only apk file that can overlay application and
// system resources at run time.
func RuntimeResourceOverlayFactory() android.Module {
diff --git a/java/builder.go b/java/builder.go
index 6844809..3a4a10d 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -27,6 +27,7 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/remoteexec"
)
var (
@@ -39,12 +40,12 @@
// (if the rule produces .class files) or a .srcjar file (if the rule produces .java files).
// .srcjar files are unzipped into a temporary directory when compiled with javac.
// TODO(b/143658984): goma can't handle the --system argument to javac.
- javac = pctx.AndroidRemoteStaticRule("javac", android.RemoteRuleSupports{Goma: false, RBE: true, RBEFlag: android.RBE_JAVAC},
+ javac, javacRE = remoteexec.StaticRules(pctx, "javac",
blueprint.RuleParams{
Command: `rm -rf "$outDir" "$annoDir" "$srcJarDir" && mkdir -p "$outDir" "$annoDir" "$srcJarDir" && ` +
`${config.ZipSyncCmd} -d $srcJarDir -l $srcJarDir/list -f "*.java" $srcJars && ` +
`(if [ -s $srcJarDir/list ] || [ -s $out.rsp ] ; then ` +
- `${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ` +
+ `${config.SoongJavacWrapper} $reTemplate${config.JavacCmd} ` +
`${config.JavacHeapFlags} ${config.JavacVmFlags} ${config.CommonJdkFlags} ` +
`$processorpath $processor $javacFlags $bootClasspath $classpath ` +
`-source $javaVersion -target $javaVersion ` +
@@ -59,9 +60,12 @@
CommandOrderOnly: []string{"${config.SoongJavacWrapper}"},
Rspfile: "$out.rsp",
RspfileContent: "$in",
- },
- "javacFlags", "bootClasspath", "classpath", "processorpath", "processor", "srcJars", "srcJarDir",
- "outDir", "annoDir", "javaVersion")
+ }, &remoteexec.REParams{
+ Labels: map[string]string{"type": "compile", "lang": "java", "compiler": "javac"},
+ ExecStrategy: "${config.REJavacExecStrategy}",
+ Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"},
+ }, []string{"javacFlags", "bootClasspath", "classpath", "processorpath", "processor", "srcJars", "srcJarDir",
+ "outDir", "annoDir", "javaVersion"}, nil)
_ = pctx.VariableFunc("kytheCorpus",
func(ctx android.PackageVarContext) string { return ctx.Config().XrefCorpusName() })
@@ -188,6 +192,7 @@
func init() {
pctx.Import("android/soong/android")
pctx.Import("android/soong/java/config")
+ pctx.Import("android/soong/remoteexec")
}
type javaBuilderFlags struct {
@@ -398,8 +403,12 @@
outDir = filepath.Join(shardDir, outDir)
annoDir = filepath.Join(shardDir, annoDir)
}
+ rule := javac
+ if ctx.Config().IsEnvTrue("RBE_JAVAC") {
+ rule = javacRE
+ }
ctx.Build(pctx, android.BuildParams{
- Rule: javac,
+ Rule: rule,
Description: desc,
Output: outputFile,
Inputs: srcFiles,
diff --git a/java/config/config.go b/java/config/config.go
index 54c89cd..c4f2363 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -22,6 +22,7 @@
_ "github.com/google/blueprint/bootstrap"
"android/soong/android"
+ "android/soong/remoteexec"
)
var (
@@ -137,30 +138,16 @@
pctx.HostJavaToolVariable("MetalavaJar", "metalava.jar")
pctx.HostJavaToolVariable("DokkaJar", "dokka.jar")
pctx.HostJavaToolVariable("JetifierJar", "jetifier.jar")
+ pctx.HostJavaToolVariable("R8Jar", "r8-compat-proguard.jar")
+ pctx.HostJavaToolVariable("D8Jar", "d8.jar")
pctx.HostBinToolVariable("SoongJavacWrapper", "soong_javac_wrapper")
pctx.HostBinToolVariable("DexpreoptGen", "dexpreopt_gen")
- pctx.VariableFunc("JavacWrapper", func(ctx android.PackageVarContext) string {
- if override := ctx.Config().Getenv("JAVAC_WRAPPER"); override != "" {
- return override + " "
- }
- return ""
- })
-
- pctx.VariableFunc("R8Wrapper", func(ctx android.PackageVarContext) string {
- if override := ctx.Config().Getenv("R8_WRAPPER"); override != "" {
- return override + " "
- }
- return ""
- })
-
- pctx.VariableFunc("D8Wrapper", func(ctx android.PackageVarContext) string {
- if override := ctx.Config().Getenv("D8_WRAPPER"); override != "" {
- return override + " "
- }
- return ""
- })
+ pctx.VariableFunc("REJavaPool", remoteexec.EnvOverrideFunc("RBE_JAVA_POOL", "java16"))
+ pctx.VariableFunc("REJavacExecStrategy", remoteexec.EnvOverrideFunc("RBE_JAVAC_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
+ pctx.VariableFunc("RED8ExecStrategy", remoteexec.EnvOverrideFunc("RBE_D8_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
+ pctx.VariableFunc("RER8ExecStrategy", remoteexec.EnvOverrideFunc("RBE_R8_EXEC_STRATEGY", remoteexec.LocalExecStrategy))
pctx.HostJavaToolVariable("JacocoCLIJar", "jacoco-cli.jar")
diff --git a/java/dex.go b/java/dex.go
index 6afdb6d..27ec6ee 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -20,12 +20,13 @@
"github.com/google/blueprint"
"android/soong/android"
+ "android/soong/remoteexec"
)
-var d8 = pctx.AndroidRemoteStaticRule("d8", android.RemoteRuleSupports{RBE: true, RBEFlag: android.RBE_D8},
+var d8, d8RE = remoteexec.StaticRules(pctx, "d8",
blueprint.RuleParams{
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
- `${config.D8Wrapper}${config.D8Cmd} ${config.DexFlags} --output $outDir $d8Flags $in && ` +
+ `$reTemplate${config.D8Cmd} ${config.DexFlags} --output $outDir $d8Flags $in && ` +
`${config.SoongZipCmd} $zipFlags -o $outDir/classes.dex.jar -C $outDir -f "$outDir/classes*.dex" && ` +
`${config.MergeZipsCmd} -D -stripFile "**/*.class" $out $outDir/classes.dex.jar $in`,
CommandDeps: []string{
@@ -33,14 +34,19 @@
"${config.SoongZipCmd}",
"${config.MergeZipsCmd}",
},
- },
- "outDir", "d8Flags", "zipFlags")
+ }, &remoteexec.REParams{
+ Labels: map[string]string{"type": "compile", "compiler": "d8"},
+ Inputs: []string{"${config.D8Jar}"},
+ ExecStrategy: "${config.RED8ExecStrategy}",
+ ToolchainInputs: []string{"${config.JavaCmd}"},
+ Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"},
+ }, []string{"outDir", "d8Flags", "zipFlags"}, nil)
-var r8 = pctx.AndroidRemoteStaticRule("r8", android.RemoteRuleSupports{RBE: true, RBEFlag: android.RBE_R8},
+var r8, r8RE = remoteexec.StaticRules(pctx, "r8",
blueprint.RuleParams{
Command: `rm -rf "$outDir" && mkdir -p "$outDir" && ` +
`rm -f "$outDict" && ` +
- `${config.R8Wrapper}${config.R8Cmd} ${config.DexFlags} -injars $in --output $outDir ` +
+ `$reTemplate${config.R8Cmd} ${config.DexFlags} -injars $in --output $outDir ` +
`--force-proguard-compatibility ` +
`--no-data-resources ` +
`-printmapping $outDict ` +
@@ -53,8 +59,13 @@
"${config.SoongZipCmd}",
"${config.MergeZipsCmd}",
},
- },
- "outDir", "outDict", "r8Flags", "zipFlags")
+ }, &remoteexec.REParams{
+ Labels: map[string]string{"type": "compile", "compiler": "r8"},
+ Inputs: []string{"$implicits", "${config.R8Jar}"},
+ ExecStrategy: "${config.RER8ExecStrategy}",
+ ToolchainInputs: []string{"${config.JavaCmd}"},
+ Platform: map[string]string{remoteexec.PoolKey: "${config.REJavaPool}"},
+ }, []string{"outDir", "outDict", "r8Flags", "zipFlags"}, []string{"implicits"})
func (j *Module) dexCommonFlags(ctx android.ModuleContext) []string {
flags := j.deviceProperties.Dxflags
@@ -185,24 +196,34 @@
proguardDictionary := android.PathForModuleOut(ctx, "proguard_dictionary")
j.proguardDictionary = proguardDictionary
r8Flags, r8Deps := j.r8Flags(ctx, flags)
+ rule := r8
+ args := map[string]string{
+ "r8Flags": strings.Join(r8Flags, " "),
+ "zipFlags": zipFlags,
+ "outDict": j.proguardDictionary.String(),
+ "outDir": outDir.String(),
+ }
+ if ctx.Config().IsEnvTrue("RBE_R8") {
+ rule = r8RE
+ args["implicits"] = strings.Join(r8Deps.Strings(), ",")
+ }
ctx.Build(pctx, android.BuildParams{
- Rule: r8,
+ Rule: rule,
Description: "r8",
Output: javalibJar,
ImplicitOutput: proguardDictionary,
Input: classesJar,
Implicits: r8Deps,
- Args: map[string]string{
- "r8Flags": strings.Join(r8Flags, " "),
- "zipFlags": zipFlags,
- "outDict": j.proguardDictionary.String(),
- "outDir": outDir.String(),
- },
+ Args: args,
})
} else {
d8Flags, d8Deps := j.d8Flags(ctx, flags)
+ rule := d8
+ if ctx.Config().IsEnvTrue("RBE_D8") {
+ rule = d8RE
+ }
ctx.Build(pctx, android.BuildParams{
- Rule: d8,
+ Rule: rule,
Description: "d8",
Output: javalibJar,
Input: classesJar,
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 51e680b..6fa3150 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -83,9 +83,6 @@
// module name.
moduleSuffix string
- // The suffix to add to the make variable that references the location of the api file.
- apiFileMakeVariableSuffix string
-
// SDK version that the stubs library is built against. Note that this is always
// *current. Older stubs library built with a numbered SDK version is created from
// the prebuilt jar.
@@ -133,20 +130,18 @@
sdkVersion: "current",
})
apiScopeSystem = initApiScope(&apiScope{
- name: "system",
- apiFilePrefix: "system-",
- moduleSuffix: sdkSystemApiSuffix,
- apiFileMakeVariableSuffix: "_SYSTEM",
- sdkVersion: "system_current",
- droidstubsArgs: []string{"-showAnnotation android.annotation.SystemApi"},
+ name: "system",
+ apiFilePrefix: "system-",
+ moduleSuffix: sdkSystemApiSuffix,
+ sdkVersion: "system_current",
+ droidstubsArgs: []string{"-showAnnotation android.annotation.SystemApi"},
})
apiScopeTest = initApiScope(&apiScope{
- name: "test",
- apiFilePrefix: "test-",
- moduleSuffix: sdkTestApiSuffix,
- apiFileMakeVariableSuffix: "_TEST",
- sdkVersion: "test_current",
- droidstubsArgs: []string{"-showAnnotation android.annotation.TestApi"},
+ name: "test",
+ apiFilePrefix: "test-",
+ moduleSuffix: sdkTestApiSuffix,
+ sdkVersion: "test_current",
+ droidstubsArgs: []string{"-showAnnotation android.annotation.TestApi"},
})
allApiScopes = apiScopes{
apiScopePublic,
diff --git a/remoteexec/remoteexec.go b/remoteexec/remoteexec.go
index f511922..860db55 100644
--- a/remoteexec/remoteexec.go
+++ b/remoteexec/remoteexec.go
@@ -154,3 +154,14 @@
return ctx.AndroidStaticRule(name, ruleParams, commonArgs...),
ctx.AndroidRemoteStaticRule(name+"RE", android.RemoteRuleSupports{RBE: true}, ruleParamsRE, append(commonArgs, reArgs...)...)
}
+
+// EnvOverrideFunc retrieves a variable func that evaluates to the value of the given environment
+// variable if set, otherwise the given default.
+func EnvOverrideFunc(envVar, defaultVal string) func(ctx android.PackageVarContext) string {
+ return func(ctx android.PackageVarContext) string {
+ if override := ctx.Config().Getenv(envVar); override != "" {
+ return override
+ }
+ return defaultVal
+ }
+}
diff --git a/ui/build/config.go b/ui/build/config.go
index 55e0d03..437e441 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -783,48 +783,6 @@
return false
}
-func (c *configImpl) UseRBEJAVAC() bool {
- if !c.UseRBE() {
- return false
- }
-
- if v, ok := c.environ.Get("RBE_JAVAC"); ok {
- v = strings.TrimSpace(v)
- if v != "" && v != "false" {
- return true
- }
- }
- return false
-}
-
-func (c *configImpl) UseRBER8() bool {
- if !c.UseRBE() {
- return false
- }
-
- if v, ok := c.environ.Get("RBE_R8"); ok {
- v = strings.TrimSpace(v)
- if v != "" && v != "false" {
- return true
- }
- }
- return false
-}
-
-func (c *configImpl) UseRBED8() bool {
- if !c.UseRBE() {
- return false
- }
-
- if v, ok := c.environ.Get("RBE_D8"); ok {
- v = strings.TrimSpace(v)
- if v != "" && v != "false" {
- return true
- }
- }
- return false
-}
-
func (c *configImpl) StartRBE() bool {
if !c.UseRBE() {
return false