summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Jaewoong Jung <jungjw@google.com> 2019-05-30 15:51:14 -0700
committer Jaewoong Jung <jungjw@google.com> 2019-06-03 10:51:42 -0700
commitc27ab6678bbf25cca5aec485f8ad1ed0bc3b3c83 (patch)
tree3de9b2bfbce4d9fdaa2d4d60551c07aa625c4b85 /java/java.go
parent06b2c69cfecaef535b1e1ccfd256d840dc80afe4 (diff)
Touch up manifest if there's no source code.
The new package manager behavior requires packages without source code to have an application element with hasCode attribute set to false in their manifest. With this change, Soong can now automatically insert one for codeless apps. Test: app_test.go, manifest_fixer_test.py Fixes: 124375490 Change-Id: Ied89a8d07c63805ab910859a4f7c45fc1c60bb73
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go13
1 files changed, 6 insertions, 7 deletions
diff --git a/java/java.go b/java/java.go
index 31c6afec8..41e21b1f1 100644
--- a/java/java.go
+++ b/java/java.go
@@ -966,8 +966,6 @@ func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaB
func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
- hasSrcs := false
-
j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Export_include_dirs)
deps := j.collectDeps(ctx)
@@ -982,9 +980,6 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
}
srcFiles = j.genSources(ctx, srcFiles, flags)
- if len(srcFiles) > 0 {
- hasSrcs = true
- }
srcJars := srcFiles.FilterByExt(".srcjar")
srcJars = append(srcJars, deps.srcJars...)
@@ -1181,7 +1176,6 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
if len(deps.staticJars) > 0 {
jars = append(jars, deps.staticJars...)
- hasSrcs = true
}
manifest := j.overrideManifest
@@ -1293,7 +1287,7 @@ func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
j.implementationAndResourcesJar = implementationAndResourcesJar
- if ctx.Device() && hasSrcs &&
+ if ctx.Device() && j.hasCode(ctx) &&
(Bool(j.properties.Installable) || Bool(j.deviceProperties.Compile_dex)) {
// Dex compilation
var dexOutputFile android.ModuleOutPath
@@ -1498,6 +1492,11 @@ func (j *Module) CompilerDeps() []string {
return jdeps
}
+func (j *Module) hasCode(ctx android.ModuleContext) bool {
+ srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
+ return len(srcFiles) > 0 || len(ctx.GetDirectDepsWithTag(staticLibTag)) > 0
+}
+
//
// Java libraries (.jar file)
//