Add support for .srcjar files from genrules and srcs

am: af05017b75

Change-Id: I381c6d6be55ccb8fe3e5af661ce948d9525b3489
This commit is contained in:
Colin Cross 2017-11-17 21:37:45 +00:00 committed by android-build-merger
commit 4a5899610d
4 changed files with 8 additions and 9 deletions

View file

@ -70,7 +70,7 @@ func init() {
pctx.SourcePathVariable("JrtFsJar", "${JavaHome}/lib/jrt-fs.jar")
pctx.SourcePathVariable("Ziptime", "prebuilts/build-tools/${hostPrebuiltTag}/bin/ziptime")
pctx.SourcePathVariable("ExtractSrcJarsCmd", "build/soong/scripts/extract-src-jars.sh")
pctx.SourcePathVariable("ExtractSrcJarsCmd", "build/soong/scripts/extract-srcjars.sh")
pctx.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh")
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")

View file

@ -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 {
var protoFiles android.Paths
outSrcFiles := make(android.Paths, 0, len(srcFiles))
@ -106,17 +106,15 @@ func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths,
}
}
var outSrcJars android.Paths
if len(protoFiles) > 0 {
protoSrcJar := android.PathForModuleGen(ctx, "proto.src.jar")
protoSrcJar := android.PathForModuleGen(ctx, "proto.srcjar")
genProto(ctx, protoSrcJar, protoFiles,
flags.protoFlags, flags.protoOutFlag, "")
outSrcJars = append(outSrcJars, protoSrcJar)
outSrcFiles = append(outSrcFiles, protoSrcJar)
}
return outSrcFiles, outSrcJars
return outSrcFiles
}
func LogtagsSingleton() blueprint.Singleton {

View file

@ -550,8 +550,9 @@ func (j *Module) compile(ctx android.ModuleContext) {
flags = protoFlags(ctx, &j.protoProperties, flags)
}
var srcJars android.Paths
srcFiles, srcJars = j.genSources(ctx, srcFiles, flags)
srcFiles = j.genSources(ctx, srcFiles, flags)
srcJars := srcFiles.FilterByExt(".srcjar")
srcJars = append(srcJars, deps.srcJars...)
srcJars = append(srcJars, j.ExtraSrcJars...)