Loading Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,7 @@ bootstrap_go_package { deps: [ "blueprint-proptools", "soong-android", "soong-remoteexec", ], srcs: [ "java/config/config.go", Loading android/package_ctx.go +2 −34 Original line number Diff line number Diff line Loading @@ -232,30 +232,10 @@ func (p PackageContext) StaticRule(name string, params blueprint.RuleParams, }, 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 } // AndroidRemoteStaticRule wraps blueprint.StaticRule but uses goma or RBE's parallelism if goma or RBE are enabled Loading @@ -277,18 +257,6 @@ func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRule 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...) } cc/config/global.go +4 −4 Original line number Diff line number Diff line Loading @@ -257,10 +257,10 @@ func init() { 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) Loading java/builder.go +16 −6 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import ( "github.com/google/blueprint/proptools" "android/soong/android" "android/soong/remoteexec" ) var ( Loading @@ -38,12 +39,13 @@ var ( // this, all java rules write into separate directories and then are combined into a .jar file // (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. javac = pctx.AndroidRemoteStaticRule("javac", android.RemoteRuleSupports{Goma: true, RBE: true, RBEFlag: android.RBE_JAVAC}, // TODO(b/143658984): goma can't handle the --system argument to 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 ` + Loading @@ -58,9 +60,12 @@ var ( 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() }) Loading Loading @@ -199,6 +204,7 @@ var ( func init() { pctx.Import("android/soong/android") pctx.Import("android/soong/java/config") pctx.Import("android/soong/remoteexec") } type javaBuilderFlags struct { Loading Loading @@ -409,8 +415,12 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab 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, Loading java/config/config.go +7 −20 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import ( _ "github.com/google/blueprint/bootstrap" "android/soong/android" "android/soong/remoteexec" ) var ( Loading Loading @@ -139,30 +140,16 @@ func init() { 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") Loading Loading
Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,7 @@ bootstrap_go_package { deps: [ "blueprint-proptools", "soong-android", "soong-remoteexec", ], srcs: [ "java/config/config.go", Loading
android/package_ctx.go +2 −34 Original line number Diff line number Diff line Loading @@ -232,30 +232,10 @@ func (p PackageContext) StaticRule(name string, params blueprint.RuleParams, }, 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 } // AndroidRemoteStaticRule wraps blueprint.StaticRule but uses goma or RBE's parallelism if goma or RBE are enabled Loading @@ -277,18 +257,6 @@ func (p PackageContext) AndroidRemoteStaticRule(name string, supports RemoteRule 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...) }
cc/config/global.go +4 −4 Original line number Diff line number Diff line Loading @@ -257,10 +257,10 @@ func init() { 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) Loading
java/builder.go +16 −6 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import ( "github.com/google/blueprint/proptools" "android/soong/android" "android/soong/remoteexec" ) var ( Loading @@ -38,12 +39,13 @@ var ( // this, all java rules write into separate directories and then are combined into a .jar file // (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. javac = pctx.AndroidRemoteStaticRule("javac", android.RemoteRuleSupports{Goma: true, RBE: true, RBEFlag: android.RBE_JAVAC}, // TODO(b/143658984): goma can't handle the --system argument to 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 ` + Loading @@ -58,9 +60,12 @@ var ( 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() }) Loading Loading @@ -199,6 +204,7 @@ var ( func init() { pctx.Import("android/soong/android") pctx.Import("android/soong/java/config") pctx.Import("android/soong/remoteexec") } type javaBuilderFlags struct { Loading Loading @@ -409,8 +415,12 @@ func transformJavaToClasses(ctx android.ModuleContext, outputFile android.Writab 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, Loading
java/config/config.go +7 −20 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ import ( _ "github.com/google/blueprint/bootstrap" "android/soong/android" "android/soong/remoteexec" ) var ( Loading Loading @@ -139,30 +140,16 @@ func init() { 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") Loading