Bring java support closer to current version of make

Make the javac arguments match what is used by make, and export them
back to make.  A future change will switch make to use the the
exported ones.

This makes a dx.jar compiled with soong have identical class files
as one compiled with make.

Test: manual
Change-Id: Ia5196f1f42bc564e99de22e32e72fd2930e9fbae
This commit is contained in:
Colin Cross
2017-08-08 13:17:59 -07:00
parent 74d73e2bfb
commit 6416271a1f
5 changed files with 99 additions and 29 deletions

View File

@@ -92,6 +92,9 @@ type CompilerProperties struct {
// if not blank, run jarjar using the specified rules file
Jarjar_rules *string
// If not blank, set the java version passed to javac as -source and -target
Java_version *string
}
type CompilerDeviceProperties struct {
@@ -285,6 +288,13 @@ func (j *Module) compile(ctx android.ModuleContext) {
var flags javaBuilderFlags
javacFlags := j.properties.Javacflags
if j.properties.Java_version != nil {
flags.javaVersion = *j.properties.Java_version
} else {
flags.javaVersion = "${config.DefaultJavaVersion}"
}
if len(javacFlags) > 0 {
ctx.Variable(pctx, "javacFlags", strings.Join(javacFlags, " "))
flags.javacFlags = "$javacFlags"