summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go39
1 files changed, 10 insertions, 29 deletions
diff --git a/java/java.go b/java/java.go
index c12ada277..f5035e7df 100644
--- a/java/java.go
+++ b/java/java.go
@@ -406,25 +406,10 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
deps.aidlIncludeDirs = append(deps.aidlIncludeDirs, sdkDep.aidl)
}
- ctx.VisitDirectDeps(func(module blueprint.Module) {
+ ctx.VisitDirectDeps(func(module android.Module) {
otherName := ctx.OtherModuleName(module)
tag := ctx.OtherModuleDependencyTag(module)
- aDep, _ := module.(android.Module)
- if aDep == nil {
- ctx.ModuleErrorf("module %q not an android module", ctx.OtherModuleName(aDep))
- return
- }
-
- if !aDep.Enabled() {
- if ctx.AConfig().AllowMissingDependencies() {
- ctx.AddMissingDependencies([]string{ctx.OtherModuleName(aDep)})
- } else {
- ctx.ModuleErrorf("depends on disabled module %q", ctx.OtherModuleName(aDep))
- }
- return
- }
-
dep, _ := module.(Dependency)
if dep == nil {
switch tag {
@@ -536,7 +521,7 @@ func (j *Module) compile(ctx android.ModuleContext) {
flags = protoFlags(ctx, &j.protoProperties, flags)
}
- var srcJars classpath
+ var srcJars android.Paths
srcFiles, srcJars = j.genSources(ctx, srcFiles, flags)
srcJars = append(srcJars, deps.srcJars...)
srcJars = append(srcJars, j.ExtraSrcJars...)
@@ -591,7 +576,7 @@ func (j *Module) compile(ctx android.ModuleContext) {
}
}
}
- if len(uniqueSrcFiles) > 0 {
+ if len(uniqueSrcFiles) > 0 || len(srcJars) > 0 {
var extraJarDeps android.Paths
if ctx.AConfig().IsEnvTrue("RUN_ERROR_PRONE") {
// If error-prone is enabled, add an additional rule to compile the java files into
@@ -685,11 +670,11 @@ func (j *Module) compile(ctx android.ModuleContext) {
j.outputFile = outputFile
}
-func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles android.Paths, srcJars classpath,
+func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars android.Paths,
deps deps, flags javaBuilderFlags, jarName string) android.Path {
var jars android.Paths
- if len(srcFiles) > 0 {
+ if len(srcFiles) > 0 || len(srcJars) > 0 {
// Compile java sources into turbine.jar.
turbineJar := android.PathForModuleOut(ctx, "turbine", jarName)
TransformJavaToHeaderClasses(ctx, turbineJar, srcFiles, srcJars, flags)
@@ -704,15 +689,11 @@ func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles android.P
var headerJar android.Path
jars = append(jars, deps.staticHeaderJars...)
- if len(jars) == 0 {
- panic("The turbine.jar is empty without any sources and static libs.")
- } else {
- // we cannot skip the combine step for now if there is only one jar
- // since we have to strip META-INF/TRANSITIVE dir from turbine.jar
- combinedJar := android.PathForModuleOut(ctx, "turbine-combined", jarName)
- TransformJarsToJar(ctx, combinedJar, "for turbine", jars, android.OptionalPath{}, false, []string{"META-INF"})
- headerJar = combinedJar
- }
+ // we cannot skip the combine step for now if there is only one jar
+ // since we have to strip META-INF/TRANSITIVE dir from turbine.jar
+ combinedJar := android.PathForModuleOut(ctx, "turbine-combined", jarName)
+ TransformJarsToJar(ctx, combinedJar, "for turbine", jars, android.OptionalPath{}, false, []string{"META-INF"})
+ headerJar = combinedJar
if j.properties.Jarjar_rules != nil {
jarjar_rules := android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)