aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-10-17 13:56:52 -0700
committerColin Cross <ccross@android.com>2017-10-18 17:09:54 +0000
commita482065454e22b1204ba495914e4b06ea317c7a4 (patch)
treeaf56aa9d43abd13e6dc225fe35a270a27250bdc2
parentfa86d794b0e92bbe5f8d8f7ab0daf434e5dbe7b2 (diff)
downloadbuild_soong-a482065454e22b1204ba495914e4b06ea317c7a4.tar.gz
build_soong-a482065454e22b1204ba495914e4b06ea317c7a4.tar.bz2
build_soong-a482065454e22b1204ba495914e4b06ea317c7a4.zip
Use soong_javac_wrapper in soong javac compiles
Test: m checkbuild Change-Id: I0f9ff0a719ac550a011c2878fc51595dc3427aed
-rw-r--r--cmd/javac_wrapper/javac_wrapper.go5
-rw-r--r--java/builder.go16
-rw-r--r--java/config/config.go7
-rw-r--r--java/config/makevars.go2
4 files changed, 20 insertions, 10 deletions
diff --git a/cmd/javac_wrapper/javac_wrapper.go b/cmd/javac_wrapper/javac_wrapper.go
index a86f1e92..4df49380 100644
--- a/cmd/javac_wrapper/javac_wrapper.go
+++ b/cmd/javac_wrapper/javac_wrapper.go
@@ -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 (
diff --git a/java/builder.go b/java/builder.go
index a03f8927..9086d518 100644
--- a/java/builder.go
+++ b/java/builder.go
@@ -39,14 +39,15 @@ 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}"},
- Rspfile: "$out.rsp",
- RspfileContent: "$in",
+ CommandDeps: []string{"${config.JavacCmd}", "${config.SoongZipCmd}"},
+ CommandOrderOnly: []string{"${config.SoongJavacWrapper}"},
+ Rspfile: "$out.rsp",
+ RspfileContent: "$in",
},
"javacFlags", "sourcepath", "bootClasspath", "classpath", "outDir", "annoDir", "javaVersion")
@@ -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,8 +81,9 @@ var (
"${config.ErrorProneJar}",
"${config.SoongZipCmd}",
},
- Rspfile: "$out.rsp",
- RspfileContent: "$in",
+ CommandOrderOnly: []string{"${config.SoongJavacWrapper}"},
+ Rspfile: "$out.rsp",
+ RspfileContent: "$in",
},
"javacFlags", "sourcepath", "bootClasspath", "classpath", "outDir", "annoDir", "javaVersion")
diff --git a/java/config/config.go b/java/config/config.go
index 7d1fa29b..eb71ddb6 100644
--- a/java/config/config.go
+++ b/java/config/config.go
@@ -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
diff --git a/java/config/makevars.go b/java/config/makevars.go
index 1453a078..6b495924 100644
--- a/java/config/makevars.go
+++ b/java/config/makevars.go
@@ -56,4 +56,6 @@ func makeVarsProvider(ctx android.MakeVarsContext) {
ctx.Strict("JLINK", "${JlinkCmd}")
ctx.Strict("JMOD", "${JmodCmd}")
}
+
+ ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
}