diff options
author | Colin Cross <ccross@android.com> | 2017-10-16 18:07:29 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-10-16 19:39:39 -0700 |
commit | 59149b6df59b8dcc7b4eddd2ebc95352608291a8 (patch) | |
tree | 4487ba6289a976f7e55fe500420493f5431dad0f /java/gen.go | |
parent | e9a275b440f2e23217081e16bdbe74f981f00239 (diff) | |
download | build_soong-59149b6df59b8dcc7b4eddd2ebc95352608291a8.tar.gz build_soong-59149b6df59b8dcc7b4eddd2ebc95352608291a8.tar.bz2 build_soong-59149b6df59b8dcc7b4eddd2ebc95352608291a8.zip |
Use jars containg sources for java generators
srcFileLists was an ill-fated attempt to deal with generators that
produce a set of java sources that is not known ahead of time.
For example, the list of files produced by protoc depends on the
package statement in the .proto file. srcFileLists put the list
of generated files into a file, which was then passed to javac
using the @file syntax. This worked, but it was too easy to cause
missing dependencies, and will not work well in a future distributed
build environment.
Switch to putting generated sources into a jar, and then pass them
jar to javac using -sourcepath.
Test: m checkbuild
Change-Id: Iaab7a588a6c1239f7bf46e4f1b102b3ef517619b
Diffstat (limited to 'java/gen.go')
-rw-r--r-- | java/gen.go | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/java/gen.go b/java/gen.go index e55be916..e12a71c4 100644 --- a/java/gen.go +++ b/java/gen.go @@ -85,7 +85,7 @@ func genLogtags(ctx android.ModuleContext, logtagsFile android.Path) android.Pat } func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths, - flags javaBuilderFlags) (android.Paths, android.Paths) { + flags javaBuilderFlags) (android.Paths, classpath) { var protoFiles android.Paths outSrcFiles := make(android.Paths, 0, len(srcFiles)) @@ -106,16 +106,17 @@ func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths, } } - var outSrcFileLists android.Paths + var outSrcJars classpath if len(protoFiles) > 0 { - protoFileList := genProto(ctx, protoFiles, + protoSrcJar := android.PathForModuleGen(ctx, "proto.src.jar") + genProto(ctx, protoSrcJar, protoFiles, flags.protoFlags, flags.protoOutFlag, "") - outSrcFileLists = append(outSrcFileLists, protoFileList) + outSrcJars = append(outSrcJars, protoSrcJar) } - return outSrcFiles, outSrcFileLists + return outSrcFiles, outSrcJars } func LogtagsSingleton() blueprint.Singleton { |