diff options
author | 2022-01-11 21:55:46 +0000 | |
---|---|---|
committer | 2022-01-21 17:50:40 +0000 | |
commit | cd1b80f067c35f2b6aed13a42df22fc63ea4529d (patch) | |
tree | 26d20f61a35c4fb5cd26750af54dff439b71227d /java/genrule.go | |
parent | 341f73550d698d32328c06f223c0d2a51dd53d8c (diff) |
bp2build converts java_genrule and java_genrule_host
Bp2build currently supports building genrules for cc modules, but does
not support building java_genrule* modules. This commit adds this
functionality.
Bug: 213480907
Test: go test ./bp2build
Change-Id: I473196c5bcf5582ba0c8faa65b5005f81ac973a4
Diffstat (limited to 'java/genrule.go')
-rw-r--r-- | java/genrule.go | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/java/genrule.go b/java/genrule.go index 16743b357..5047c412f 100644 --- a/java/genrule.go +++ b/java/genrule.go @@ -24,8 +24,8 @@ func init() { } func RegisterGenRuleBuildComponents(ctx android.RegistrationContext) { - ctx.RegisterModuleType("java_genrule", genRuleFactory) - ctx.RegisterModuleType("java_genrule_host", genRuleFactoryHost) + ctx.RegisterModuleType("java_genrule", GenRuleFactory) + ctx.RegisterModuleType("java_genrule_host", GenRuleFactoryHost) } // java_genrule is a genrule that can depend on other java_* objects. @@ -33,7 +33,7 @@ func RegisterGenRuleBuildComponents(ctx android.RegistrationContext) { // By default a java_genrule has a single variant that will run against the device variant of its dependencies and // produce an output that can be used as an input to a device java rule. // -// Specifying `host_supported: true` will produce two variants, one that uses device dependencie sand one that uses +// Specifying `host_supported: true` will produce two variants, one that uses device dependencies and one that uses // host dependencies. Each variant will run the command. // // Use a java_genrule instead of a genrule when it needs to depend on or be depended on by other java modules, unless @@ -44,7 +44,7 @@ func RegisterGenRuleBuildComponents(ctx android.RegistrationContext) { // Use a java_genrule to package generated java resources: // // java_genrule { -// name: "generated_resources", +// name: "generated_resources", // tools: [ // "generator", // "soong_zip", @@ -60,11 +60,12 @@ func RegisterGenRuleBuildComponents(ctx android.RegistrationContext) { // srcs: ["src/**/*.java"], // static_libs: ["generated_resources"], // } -func genRuleFactory() android.Module { +func GenRuleFactory() android.Module { module := genrule.NewGenRule() android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommon) android.InitDefaultableModule(module) + android.InitBazelModule(module) return module } @@ -73,11 +74,12 @@ func genRuleFactory() android.Module { // // A java_genrule_host has a single variant that will run against the host variant of its dependencies and // produce an output that can be used as an input to a host java rule. -func genRuleFactoryHost() android.Module { +func GenRuleFactoryHost() android.Module { module := genrule.NewGenRule() android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommon) android.InitDefaultableModule(module) + android.InitBazelModule(module) return module } |