java: add genrule support to java builds

Add support for source files generated by genrule or gensrcs to
java builds.

Change-Id: I39762b2ab65fa4cf92724300edc4ba995845ce92
This commit is contained in:
Colin Cross
2015-04-28 13:28:51 -07:00
parent d350ecd102
commit 0607cf7daa
3 changed files with 13 additions and 6 deletions

View File

@@ -141,6 +141,7 @@ bootstrap_go_package {
"blueprint",
"blueprint-pathtools",
"soong-common",
"soong-genrule",
],
srcs: [
"java/app_builder.go",

View File

@@ -53,7 +53,7 @@ rule g.bootstrap.link
# Variant:
# Type: bootstrap_go_binary
# Factory: github.com/google/blueprint/bootstrap.newGoBinaryModule
# Defined: build/soong/Blueprints:159:1
# Defined: build/soong/Blueprints:160:1
build .bootstrap/androidmk/obj/androidmk.a: g.bootstrap.gc $
${g.bootstrap.srcDir}/build/soong/androidmk/cmd/androidmk/android.go $
@@ -79,7 +79,7 @@ default .bootstrap/bin/androidmk
# Variant:
# Type: bootstrap_go_package
# Factory: github.com/google/blueprint/bootstrap.newGoPackageModule
# Defined: build/soong/Blueprints:172:1
# Defined: build/soong/Blueprints:173:1
build .bootstrap/androidmk-parser/pkg/android/soong/androidmk/parser.a: $
g.bootstrap.gc $
@@ -439,8 +439,9 @@ build .bootstrap/soong-java/pkg/android/soong/java.a: g.bootstrap.gc $
.bootstrap/blueprint-bootstrap/pkg/github.com/google/blueprint/bootstrap.a $
.bootstrap/soong-env/pkg/android/soong/env.a $
.bootstrap/soong-glob/pkg/android/soong/glob.a $
.bootstrap/soong-common/pkg/android/soong/common.a
incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg
.bootstrap/soong-common/pkg/android/soong/common.a $
.bootstrap/soong-genrule/pkg/android/soong/genrule.a
incFlags = -I .bootstrap/blueprint-parser/pkg -I .bootstrap/blueprint-pathtools/pkg -I .bootstrap/blueprint-proptools/pkg -I .bootstrap/blueprint/pkg -I .bootstrap/blueprint-deptools/pkg -I .bootstrap/blueprint-bootstrap/pkg -I .bootstrap/soong-env/pkg -I .bootstrap/soong-glob/pkg -I .bootstrap/soong-common/pkg -I .bootstrap/soong-genrule/pkg
pkgPath = android/soong/java
default .bootstrap/soong-java/pkg/android/soong/java.a

View File

@@ -27,6 +27,7 @@ import (
"github.com/google/blueprint/pathtools"
"android/soong/common"
"android/soong/genrule"
)
// TODO:
@@ -243,8 +244,6 @@ func (j *javaBase) collectDeps(ctx common.AndroidModuleContext) (classpath []str
}
}
}
} else {
ctx.ModuleErrorf("unknown dependency module type for %q", otherName)
}
})
@@ -294,6 +293,12 @@ func (j *javaBase) GenerateJavaBuildActions(ctx common.AndroidModuleContext) {
srcFiles = j.genSources(ctx, srcFiles, flags)
ctx.VisitDirectDeps(func(module blueprint.Module) {
if gen, ok := module.(genrule.SourceFileGenerator); ok {
srcFiles = append(srcFiles, gen.GeneratedSourceFiles()...)
}
})
srcFileLists = append(srcFileLists, j.ExtraSrcLists...)
if len(srcFiles) > 0 {