Use soong_javac_wrapper in soong javac compiles

Test: m checkbuild
Change-Id: I0f9ff0a719ac550a011c2878fc51595dc3427aed
This commit is contained in:
Colin Cross 2017-10-17 13:56:52 -07:00
parent fa86d794b0
commit a482065454
4 changed files with 20 additions and 10 deletions

View file

@ -17,6 +17,11 @@
//
// It also hides the unhelpful and unhideable "warning there is a warning"
// messages.
//
// Each javac build statement has an order-only dependency on the
// soong_javac_wrapper tool, which means the javac command will not be rerun
// if soong_javac_wrapper changes. That means that soong_javac_wrapper must
// not do anything that will affect the results of the build.
package main
import (

View file

@ -39,12 +39,13 @@ var (
javac = pctx.AndroidGomaStaticRule("javac",
blueprint.RuleParams{
Command: `rm -rf "$outDir" "$annoDir" && mkdir -p "$outDir" "$annoDir" && ` +
`${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
`${config.SoongJavacWrapper} ${config.JavacWrapper}${config.JavacCmd} ${config.JavacHeapFlags} ${config.CommonJdkFlags} ` +
`$javacFlags $sourcepath $bootClasspath $classpath ` +
`-source $javaVersion -target $javaVersion ` +
`-d $outDir -s $annoDir @$out.rsp && ` +
`${config.SoongZipCmd} -jar -o $out -C $outDir -D $outDir`,
CommandDeps: []string{"${config.JavacCmd}", "${config.SoongZipCmd}"},
CommandOrderOnly: []string{"${config.SoongJavacWrapper}"},
Rspfile: "$out.rsp",
RspfileContent: "$in",
},
@ -69,7 +70,7 @@ var (
errorprone = pctx.AndroidStaticRule("errorprone",
blueprint.RuleParams{
Command: `rm -rf "$outDir" "$annoDir" && mkdir -p "$outDir" "$annoDir" && ` +
`${config.ErrorProneCmd} ` +
`${config.SoongJavacWrapper} ${config.ErrorProneCmd} ` +
`$javacFlags $sourcepath $bootClasspath $classpath ` +
`-source $javaVersion -target $javaVersion ` +
`-d $outDir -s $annoDir @$out.rsp && ` +
@ -80,6 +81,7 @@ var (
"${config.ErrorProneJar}",
"${config.SoongZipCmd}",
},
CommandOrderOnly: []string{"${config.SoongJavacWrapper}"},
Rspfile: "$out.rsp",
RspfileContent: "$in",
},

View file

@ -15,7 +15,6 @@
package config
import (
"path/filepath"
"strings"
_ "github.com/google/blueprint/bootstrap"
@ -76,12 +75,14 @@ func init() {
pctx.SourcePathVariable("JrtFsJar", "${JavaHome}/lib/jrt-fs.jar")
pctx.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh")
pctx.StaticVariable("SoongZipCmd", filepath.Join("${bootstrap.ToolDir}", "soong_zip"))
pctx.StaticVariable("MergeZipsCmd", filepath.Join("${bootstrap.ToolDir}", "merge_zips"))
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
pctx.HostBinToolVariable("DxCmd", "dx")
pctx.HostJavaToolVariable("JarjarCmd", "jarjar.jar")
pctx.HostJavaToolVariable("DesugarJar", "desugar.jar")
pctx.HostBinToolVariable("SoongJavacWrapper", "soong_javac_wrapper")
pctx.VariableFunc("JavacWrapper", func(config interface{}) (string, error) {
if override := config.(android.Config).Getenv("JAVAC_WRAPPER"); override != "" {
return override + " ", nil

View file

@ -56,4 +56,6 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("JLINK", "${JlinkCmd}")
ctx.Strict("JMOD", "${JmodCmd}")
}
ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
}