Add support for .srcjar files from genrules and srcs
Allow srcs to contain .srcjar files, which will be extracted just before javac. Also allow genrules and generated sources to directly return .srcjar files. Test: m checkbuild Change-Id: Ie4cf60ecb9d2ec63a4c2275221544203b1383597
This commit is contained in:
parent
ebe1a51c81
commit
af05017b75
4 changed files with 8 additions and 9 deletions
|
@ -70,7 +70,7 @@ func init() {
|
||||||
pctx.SourcePathVariable("JrtFsJar", "${JavaHome}/lib/jrt-fs.jar")
|
pctx.SourcePathVariable("JrtFsJar", "${JavaHome}/lib/jrt-fs.jar")
|
||||||
pctx.SourcePathVariable("Ziptime", "prebuilts/build-tools/${hostPrebuiltTag}/bin/ziptime")
|
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.SourcePathVariable("JarArgsCmd", "build/soong/scripts/jar-args.sh")
|
||||||
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
|
pctx.HostBinToolVariable("SoongZipCmd", "soong_zip")
|
||||||
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
|
pctx.HostBinToolVariable("MergeZipsCmd", "merge_zips")
|
||||||
|
|
10
java/gen.go
10
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,
|
func (j *Module) genSources(ctx android.ModuleContext, srcFiles android.Paths,
|
||||||
flags javaBuilderFlags) (android.Paths, android.Paths) {
|
flags javaBuilderFlags) android.Paths {
|
||||||
|
|
||||||
var protoFiles android.Paths
|
var protoFiles android.Paths
|
||||||
outSrcFiles := make(android.Paths, 0, len(srcFiles))
|
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 {
|
if len(protoFiles) > 0 {
|
||||||
protoSrcJar := android.PathForModuleGen(ctx, "proto.src.jar")
|
protoSrcJar := android.PathForModuleGen(ctx, "proto.srcjar")
|
||||||
genProto(ctx, protoSrcJar, protoFiles,
|
genProto(ctx, protoSrcJar, protoFiles,
|
||||||
flags.protoFlags, flags.protoOutFlag, "")
|
flags.protoFlags, flags.protoOutFlag, "")
|
||||||
|
|
||||||
outSrcJars = append(outSrcJars, protoSrcJar)
|
outSrcFiles = append(outSrcFiles, protoSrcJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
return outSrcFiles, outSrcJars
|
return outSrcFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
func LogtagsSingleton() blueprint.Singleton {
|
func LogtagsSingleton() blueprint.Singleton {
|
||||||
|
|
|
@ -550,8 +550,9 @@ func (j *Module) compile(ctx android.ModuleContext) {
|
||||||
flags = protoFlags(ctx, &j.protoProperties, flags)
|
flags = protoFlags(ctx, &j.protoProperties, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
var srcJars android.Paths
|
srcFiles = j.genSources(ctx, srcFiles, flags)
|
||||||
srcFiles, srcJars = j.genSources(ctx, srcFiles, flags)
|
|
||||||
|
srcJars := srcFiles.FilterByExt(".srcjar")
|
||||||
srcJars = append(srcJars, deps.srcJars...)
|
srcJars = append(srcJars, deps.srcJars...)
|
||||||
srcJars = append(srcJars, j.ExtraSrcJars...)
|
srcJars = append(srcJars, j.ExtraSrcJars...)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue