Merge "Update `RustDefaultVersion` to 1.58.1"
diff --git a/android/bazel.go b/android/bazel.go
index 7971451..528c7b1 100644
--- a/android/bazel.go
+++ b/android/bazel.go
@@ -285,6 +285,7 @@
"development/samples/USB/MissileLauncher": Bp2BuildDefaultTrue,
"development/samples/VoiceRecognitionService": Bp2BuildDefaultTrue,
"development/samples/VoicemailProviderDemo": Bp2BuildDefaultTrue,
+ "development/samples/WiFiDirectDemo": Bp2BuildDefaultTrue,
"development/sdk": Bp2BuildDefaultTrueRecursively,
"external/arm-optimized-routines": Bp2BuildDefaultTrueRecursively,
"external/boringssl": Bp2BuildDefaultTrueRecursively,
@@ -468,9 +469,13 @@
"libdexfiled", // depends on unconverted modules: dexfile_operator_srcs, libartbased, libartpalette
// go deps:
- "apex-protos", // depends on unconverted modules: soong_zip
+ "apex-protos", // depends on soong_zip, a go binary
+ "robolectric_tzdata", // depends on soong_zip, a go binary
"host_bionic_linker_asm", // depends on extract_linker, a go binary.
"host_bionic_linker_script", // depends on extract_linker, a go binary.
+
+ // java deps
+ "bin2c_fastdeployagent", // depends on deployagent, a java binary
}
// Per-module denylist of cc_library modules to only generate the static
diff --git a/bp2build/Android.bp b/bp2build/Android.bp
index ae0fb11..4bcfa61 100644
--- a/bp2build/Android.bp
+++ b/bp2build/Android.bp
@@ -38,7 +38,6 @@
"build_conversion_test.go",
"bzl_conversion_test.go",
"cc_binary_conversion_test.go",
- "cc_genrule_conversion_test.go",
"cc_library_conversion_test.go",
"cc_library_headers_conversion_test.go",
"cc_library_shared_conversion_test.go",
diff --git a/bp2build/android_app_conversion_test.go b/bp2build/android_app_conversion_test.go
index 153817b..28de06c 100644
--- a/bp2build/android_app_conversion_test.go
+++ b/bp2build/android_app_conversion_test.go
@@ -66,7 +66,7 @@
"resb/res.png": "",
"manifest/AndroidManifest.xml": "",
},
- blueprint: `
+ blueprint: simpleModuleDoNotConvertBp2build("android_app", "static_lib_dep") + `
android_app {
name: "TestApp",
srcs: ["app.java"],
@@ -74,6 +74,7 @@
package_name: "com.google",
resource_dirs: ["resa", "resb"],
manifest: "manifest/AndroidManifest.xml",
+ static_libs: ["static_lib_dep"]
}
`,
expectedBazelTargets: []string{
@@ -85,6 +86,7 @@
"resb/res.png",
]`,
"custom_package": `"com.google"`,
+ "deps": `[":static_lib_dep"]`,
}),
}})
}
diff --git a/bp2build/build_conversion.go b/bp2build/build_conversion.go
index 5887d06..b3bec65 100644
--- a/bp2build/build_conversion.go
+++ b/bp2build/build_conversion.go
@@ -259,7 +259,9 @@
// Simple metrics tracking for bp2build
metrics := CodegenMetrics{
- ruleClassCount: make(map[string]uint64),
+ ruleClassCount: make(map[string]uint64),
+ convertedModuleTypeCount: make(map[string]uint64),
+ totalModuleTypeCount: make(map[string]uint64),
}
dirs := make(map[string]bool)
@@ -269,6 +271,7 @@
bpCtx := ctx.Context()
bpCtx.VisitAllModules(func(m blueprint.Module) {
dir := bpCtx.ModuleDir(m)
+ moduleType := bpCtx.ModuleType(m)
dirs[dir] = true
var targets []BazelTarget
@@ -292,7 +295,7 @@
// targets in the same BUILD file (or package).
// Log the module.
- metrics.AddConvertedModule(m.Name(), Handcrafted)
+ metrics.AddConvertedModule(m, moduleType, Handcrafted)
pathToBuildFile := getBazelPackagePath(b)
if _, exists := buildFileToAppend[pathToBuildFile]; exists {
@@ -312,7 +315,7 @@
// Handle modules converted to generated targets.
// Log the module.
- metrics.AddConvertedModule(m.Name(), Generated)
+ metrics.AddConvertedModule(aModule, moduleType, Generated)
// Handle modules with unconverted deps. By default, emit a warning.
if unconvertedDeps := aModule.GetUnconvertedBp2buildDeps(); len(unconvertedDeps) > 0 {
@@ -340,7 +343,7 @@
metrics.IncrementRuleClassCount(t.ruleClass)
}
} else {
- metrics.IncrementUnconvertedCount()
+ metrics.AddUnconvertedModule(moduleType)
return
}
case QueryView:
diff --git a/bp2build/cc_genrule_conversion_test.go b/bp2build/cc_genrule_conversion_test.go
deleted file mode 100644
index 440b462..0000000
--- a/bp2build/cc_genrule_conversion_test.go
+++ /dev/null
@@ -1,235 +0,0 @@
-// Copyright 2021 Google Inc. All rights reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package bp2build
-
-import (
- "testing"
-
- "android/soong/android"
- "android/soong/cc"
-)
-
-var otherCcGenruleBp = map[string]string{
- "other/Android.bp": `cc_genrule {
- name: "foo.tool",
- out: ["foo_tool.out"],
- srcs: ["foo_tool.in"],
- cmd: "cp $(in) $(out)",
-}
-cc_genrule {
- name: "other.tool",
- out: ["other_tool.out"],
- srcs: ["other_tool.in"],
- cmd: "cp $(in) $(out)",
-}`,
-}
-
-func runCcGenruleTestCase(t *testing.T, tc bp2buildTestCase) {
- t.Helper()
- (&tc).moduleTypeUnderTest = "cc_genrule"
- (&tc).moduleTypeUnderTestFactory = cc.GenRuleFactory
- runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {}, tc)
-}
-
-func TestCliVariableReplacement(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule with command line variable replacements",
- blueprint: `cc_genrule {
- name: "foo.tool",
- out: ["foo_tool.out"],
- srcs: ["foo_tool.in"],
- cmd: "cp $(in) $(out)",
- bazel_module: { bp2build_available: true },
-}
-
-cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: ["foo.in"],
- tools: [":foo.tool"],
- cmd: "$(location :foo.tool) --genDir=$(genDir) arg $(in) $(out)",
- bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(location :foo.tool) --genDir=$(RULEDIR) arg $(SRCS) $(OUTS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[":foo.tool"]`,
- }),
- makeBazelTarget("genrule", "foo.tool", attrNameToString{
- "cmd": `"cp $(SRCS) $(OUTS)"`,
- "outs": `["foo_tool.out"]`,
- "srcs": `["foo_tool.in"]`,
- }),
- },
- })
-}
-
-func TestUsingLocationsLabel(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule using $(locations :label)",
- blueprint: `cc_genrule {
- name: "foo.tools",
- out: ["foo_tool.out", "foo_tool2.out"],
- srcs: ["foo_tool.in"],
- cmd: "cp $(in) $(out)",
- bazel_module: { bp2build_available: true },
-}
-
-cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: ["foo.in"],
- tools: [":foo.tools"],
- cmd: "$(locations :foo.tools) -s $(out) $(in)",
- bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations :foo.tools) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[":foo.tools"]`,
- }),
- makeBazelTarget("genrule", "foo.tools", attrNameToString{
- "cmd": `"cp $(SRCS) $(OUTS)"`,
- "outs": `[
- "foo_tool.out",
- "foo_tool2.out",
- ]`,
- "srcs": `["foo_tool.in"]`,
- }),
- },
- })
-}
-
-func TestUsingLocationsAbsoluteLabel(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule using $(locations //absolute:label)",
- blueprint: `cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: ["foo.in"],
- tool_files: [":foo.tool"],
- cmd: "$(locations :foo.tool) -s $(out) $(in)",
- bazel_module: { bp2build_available: true },
-}`,
- filesystem: otherCcGenruleBp,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `["//other:foo.tool"]`,
- }),
- },
- })
-}
-
-func TestSrcsUsingAbsoluteLabel(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule srcs using $(locations //absolute:label)",
- blueprint: `cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: [":other.tool"],
- tool_files: [":foo.tool"],
- cmd: "$(locations :foo.tool) -s $(out) $(location :other.tool)",
- bazel_module: { bp2build_available: true },
-}`,
- filesystem: otherCcGenruleBp,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(location //other:other.tool)"`,
- "outs": `["foo.out"]`,
- "srcs": `["//other:other.tool"]`,
- "tools": `["//other:foo.tool"]`,
- }),
- },
- })
-}
-
-func TestLocationsLabelUsesFirstToolFile(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule using $(location) label should substitute first tool label automatically",
- blueprint: `cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: ["foo.in"],
- tool_files: [":foo.tool", ":other.tool"],
- cmd: "$(location) -s $(out) $(in)",
- bazel_module: { bp2build_available: true },
-}`,
- filesystem: otherCcGenruleBp,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(location //other:foo.tool) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[
- "//other:foo.tool",
- "//other:other.tool",
- ]`,
- }),
- },
- })
-}
-
-func TestLocationsLabelUsesFirstTool(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule using $(locations) label should substitute first tool label automatically",
- blueprint: `cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: ["foo.in"],
- tools: [":foo.tool", ":other.tool"],
- cmd: "$(locations) -s $(out) $(in)",
- bazel_module: { bp2build_available: true },
-}`,
- filesystem: otherCcGenruleBp,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[
- "//other:foo.tool",
- "//other:other.tool",
- ]`,
- }),
- },
- })
-}
-
-func TestWithoutToolsOrToolFiles(t *testing.T) {
- runCcGenruleTestCase(t, bp2buildTestCase{
- description: "cc_genrule without tools or tool_files can convert successfully",
- blueprint: `cc_genrule {
- name: "foo",
- out: ["foo.out"],
- srcs: ["foo.in"],
- cmd: "cp $(in) $(out)",
- bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"cp $(SRCS) $(OUTS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- }),
- },
- })
-}
diff --git a/bp2build/genrule_conversion_test.go b/bp2build/genrule_conversion_test.go
index fd631a5..0666da7 100644
--- a/bp2build/genrule_conversion_test.go
+++ b/bp2build/genrule_conversion_test.go
@@ -16,7 +16,10 @@
import (
"android/soong/android"
+ "android/soong/cc"
"android/soong/genrule"
+ "android/soong/java"
+ "fmt"
"testing"
)
@@ -31,58 +34,114 @@
runBp2BuildTestCase(t, registerGenruleModuleTypes, tc)
}
-func TestGenruleBp2Build(t *testing.T) {
- otherGenruleBp := map[string]string{
- "other/Android.bp": `genrule {
+func otherGenruleBp(genruleTarget string) map[string]string {
+ return map[string]string{
+ "other/Android.bp": fmt.Sprintf(`%s {
name: "foo.tool",
out: ["foo_tool.out"],
srcs: ["foo_tool.in"],
cmd: "cp $(in) $(out)",
}
-genrule {
+%s {
name: "other.tool",
out: ["other_tool.out"],
srcs: ["other_tool.in"],
cmd: "cp $(in) $(out)",
-}`,
+}`, genruleTarget, genruleTarget),
+ }
+}
+
+func TestGenruleCliVariableReplacement(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ genDir string
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
+ genDir: "$(GENDIR)",
+ },
+ {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ genDir: "$(RULEDIR)",
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ genDir: "$(RULEDIR)",
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ genDir: "$(RULEDIR)",
+ },
}
- testCases := []bp2buildTestCase{
- {
- description: "genrule with command line variable replacements",
- blueprint: `genrule {
+ bp := `%s {
name: "foo.tool",
out: ["foo_tool.out"],
srcs: ["foo_tool.in"],
cmd: "cp $(in) $(out)",
- bazel_module: { bp2build_available: true },
+ bazel_module: { bp2build_available: false },
}
-genrule {
+%s {
name: "foo",
out: ["foo.out"],
srcs: ["foo.in"],
tools: [":foo.tool"],
cmd: "$(location :foo.tool) --genDir=$(genDir) arg $(in) $(out)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(location :foo.tool) --genDir=$(GENDIR) arg $(SRCS) $(OUTS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[":foo.tool"]`,
- }),
- makeBazelTarget("genrule", "foo.tool", attrNameToString{
- "cmd": `"cp $(SRCS) $(OUTS)"`,
- "outs": `["foo_tool.out"]`,
- "srcs": `["foo_tool.in"]`,
- }),
- },
+}`
+
+ for _, tc := range testCases {
+ expectedBazelTargets := []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": fmt.Sprintf(`"$(location :foo.tool) --genDir=%s arg $(SRCS) $(OUTS)"`, tc.genDir),
+ "outs": `["foo.out"]`,
+ "srcs": `["foo.in"]`,
+ "tools": `[":foo.tool"]`,
+ }),
+ }
+
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ })
+ })
+ }
+}
+
+func TestGenruleLocationsLabel(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
},
{
- description: "genrule using $(locations :label)",
- blueprint: `genrule {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ },
+ }
+
+ bp := `%s {
name: "foo.tools",
out: ["foo_tool.out", "foo_tool2.out"],
srcs: ["foo_tool.in"],
@@ -90,144 +149,322 @@
bazel_module: { bp2build_available: true },
}
-genrule {
+%s {
name: "foo",
out: ["foo.out"],
srcs: ["foo.in"],
tools: [":foo.tools"],
cmd: "$(locations :foo.tools) -s $(out) $(in)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations :foo.tools) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[":foo.tools"]`,
- }),
- makeBazelTarget("genrule", "foo.tools", attrNameToString{
- "cmd": `"cp $(SRCS) $(OUTS)"`,
- "outs": `[
+}`
+
+ expectedBazelTargets :=
+ []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": `"$(locations :foo.tools) -s $(OUTS) $(SRCS)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `["foo.in"]`,
+ "tools": `[":foo.tools"]`,
+ }),
+ makeBazelTarget("genrule", "foo.tools", attrNameToString{
+ "cmd": `"cp $(SRCS) $(OUTS)"`,
+ "outs": `[
"foo_tool.out",
"foo_tool2.out",
]`,
- "srcs": `["foo_tool.in"]`,
- }),
- },
+ "srcs": `["foo_tool.in"]`,
+ }),
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ })
+ })
+ }
+}
+
+func TestGenruleLocationsAbsoluteLabel(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
},
{
- description: "genrule using $(locations //absolute:label)",
- blueprint: `genrule {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ },
+ }
+
+ bp := `%s {
name: "foo",
out: ["foo.out"],
srcs: ["foo.in"],
tool_files: [":foo.tool"],
cmd: "$(locations :foo.tool) -s $(out) $(in)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `["//other:foo.tool"]`,
- }),
- },
- filesystem: otherGenruleBp,
+}`
+
+ expectedBazelTargets := []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `["foo.in"]`,
+ "tools": `["//other:foo.tool"]`,
+ }),
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ filesystem: otherGenruleBp(tc.moduleType),
+ })
+ })
+ }
+}
+
+func TestGenruleSrcsLocationsAbsoluteLabel(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
},
{
- description: "genrule srcs using $(locations //absolute:label)",
- blueprint: `genrule {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ },
+ }
+
+ bp := `%s {
name: "foo",
out: ["foo.out"],
srcs: [":other.tool"],
tool_files: [":foo.tool"],
cmd: "$(locations :foo.tool) -s $(out) $(location :other.tool)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(location //other:other.tool)"`,
- "outs": `["foo.out"]`,
- "srcs": `["//other:other.tool"]`,
- "tools": `["//other:foo.tool"]`,
- }),
- },
- filesystem: otherGenruleBp,
+}`
+
+ expectedBazelTargets := []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(location //other:other.tool)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `["//other:other.tool"]`,
+ "tools": `["//other:foo.tool"]`,
+ }),
+ }
+
+ for _, tc := range testCases {
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ filesystem: otherGenruleBp(tc.moduleType),
+ })
+ })
+ }
+}
+
+func TestGenruleLocationLabelShouldSubstituteFirstToolLabel(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
},
{
- description: "genrule using $(location) label should substitute first tool label automatically",
- blueprint: `genrule {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ },
+ }
+
+ bp := `%s {
name: "foo",
out: ["foo.out"],
srcs: ["foo.in"],
tool_files: [":foo.tool", ":other.tool"],
cmd: "$(location) -s $(out) $(in)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(location //other:foo.tool) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[
+}`
+
+ expectedBazelTargets := []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": `"$(location //other:foo.tool) -s $(OUTS) $(SRCS)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `["foo.in"]`,
+ "tools": `[
"//other:foo.tool",
"//other:other.tool",
]`,
- }),
- },
- filesystem: otherGenruleBp,
+ })}
+
+ for _, tc := range testCases {
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ filesystem: otherGenruleBp(tc.moduleType),
+ })
+ })
+ }
+}
+
+func TestGenruleLocationsLabelShouldSubstituteFirstToolLabel(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
},
{
- description: "genrule using $(locations) label should substitute first tool label automatically",
- blueprint: `genrule {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ },
+ }
+
+ bp := `%s {
name: "foo",
out: ["foo.out"],
srcs: ["foo.in"],
- tools: [":foo.tool", ":other.tool"],
+ tool_files: [":foo.tool", ":other.tool"],
cmd: "$(locations) -s $(out) $(in)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- "tools": `[
+}`
+
+ expectedBazelTargets := []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": `"$(locations //other:foo.tool) -s $(OUTS) $(SRCS)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `["foo.in"]`,
+ "tools": `[
"//other:foo.tool",
"//other:other.tool",
]`,
- }),
- },
- filesystem: otherGenruleBp,
+ })}
+
+ for _, tc := range testCases {
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ filesystem: otherGenruleBp(tc.moduleType),
+ })
+ })
+ }
+}
+
+func TestGenruleWithoutToolsOrToolFiles(t *testing.T) {
+ testCases := []struct {
+ moduleType string
+ factory android.ModuleFactory
+ }{
+ {
+ moduleType: "genrule",
+ factory: genrule.GenRuleFactory,
},
{
- description: "genrule without tools or tool_files can convert successfully",
- blueprint: `genrule {
+ moduleType: "cc_genrule",
+ factory: cc.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule",
+ factory: java.GenRuleFactory,
+ },
+ {
+ moduleType: "java_genrule_host",
+ factory: java.GenRuleFactoryHost,
+ },
+ }
+
+ bp := `%s {
name: "foo",
out: ["foo.out"],
srcs: ["foo.in"],
cmd: "cp $(in) $(out)",
bazel_module: { bp2build_available: true },
-}`,
- expectedBazelTargets: []string{
- makeBazelTarget("genrule", "foo", attrNameToString{
- "cmd": `"cp $(SRCS) $(OUTS)"`,
- "outs": `["foo.out"]`,
- "srcs": `["foo.in"]`,
- }),
- },
- },
- }
+}`
- for _, testCase := range testCases {
- t.Run(testCase.description, func(t *testing.T) {
- runGenruleTestCase(t, testCase)
+ expectedBazelTargets := []string{
+ makeBazelTarget("genrule", "foo", attrNameToString{
+ "cmd": `"cp $(SRCS) $(OUTS)"`,
+ "outs": `["foo.out"]`,
+ "srcs": `["foo.in"]`,
+ })}
+
+ for _, tc := range testCases {
+ t.Run(tc.moduleType, func(t *testing.T) {
+ runBp2BuildTestCase(t, func(ctx android.RegistrationContext) {},
+ bp2buildTestCase{
+ moduleTypeUnderTest: tc.moduleType,
+ moduleTypeUnderTestFactory: tc.factory,
+ blueprint: fmt.Sprintf(bp, tc.moduleType),
+ expectedBazelTargets: expectedBazelTargets,
+ })
})
}
}
-func TestBp2BuildInlinesDefaults(t *testing.T) {
+func TestGenruleBp2BuildInlinesDefaults(t *testing.T) {
testCases := []bp2buildTestCase{
{
description: "genrule applies properties from a genrule_defaults dependency if not specified",
diff --git a/bp2build/metrics.go b/bp2build/metrics.go
index 557ea99..8a0b1c9 100644
--- a/bp2build/metrics.go
+++ b/bp2build/metrics.go
@@ -9,6 +9,7 @@
"android/soong/android"
"android/soong/shared"
"android/soong/ui/metrics/bp2build_metrics_proto"
+ "github.com/google/blueprint"
)
// Simple metrics struct to collect information about a Blueprint to BUILD
@@ -36,16 +37,24 @@
// List of converted modules
convertedModules []string
+
+ // Counts of converted modules by module type.
+ convertedModuleTypeCount map[string]uint64
+
+ // Counts of total modules by module type.
+ totalModuleTypeCount map[string]uint64
}
// Serialize returns the protoized version of CodegenMetrics: bp2build_metrics_proto.Bp2BuildMetrics
func (metrics *CodegenMetrics) Serialize() bp2build_metrics_proto.Bp2BuildMetrics {
return bp2build_metrics_proto.Bp2BuildMetrics{
- GeneratedModuleCount: metrics.generatedModuleCount,
- HandCraftedModuleCount: metrics.handCraftedModuleCount,
- UnconvertedModuleCount: metrics.unconvertedModuleCount,
- RuleClassCount: metrics.ruleClassCount,
- ConvertedModules: metrics.convertedModules,
+ GeneratedModuleCount: metrics.generatedModuleCount,
+ HandCraftedModuleCount: metrics.handCraftedModuleCount,
+ UnconvertedModuleCount: metrics.unconvertedModuleCount,
+ RuleClassCount: metrics.ruleClassCount,
+ ConvertedModules: metrics.convertedModules,
+ ConvertedModuleTypeCount: metrics.convertedModuleTypeCount,
+ TotalModuleTypeCount: metrics.totalModuleTypeCount,
}
}
@@ -113,8 +122,9 @@
metrics.ruleClassCount[ruleClass] += 1
}
-func (metrics *CodegenMetrics) IncrementUnconvertedCount() {
+func (metrics *CodegenMetrics) AddUnconvertedModule(moduleType string) {
metrics.unconvertedModuleCount += 1
+ metrics.totalModuleTypeCount[moduleType] += 1
}
func (metrics *CodegenMetrics) TotalModuleCount() uint64 {
@@ -136,10 +146,12 @@
Handcrafted
)
-func (metrics *CodegenMetrics) AddConvertedModule(moduleName string, conversionType ConversionType) {
+func (metrics *CodegenMetrics) AddConvertedModule(m blueprint.Module, moduleType string, conversionType ConversionType) {
// Undo prebuilt_ module name prefix modifications
- moduleName = android.RemoveOptionalPrebuiltPrefix(moduleName)
+ moduleName := android.RemoveOptionalPrebuiltPrefix(m.Name())
metrics.convertedModules = append(metrics.convertedModules, moduleName)
+ metrics.convertedModuleTypeCount[moduleType] += 1
+ metrics.totalModuleTypeCount[moduleType] += 1
if conversionType == Handcrafted {
metrics.handCraftedModuleCount += 1
diff --git a/cc/config/bp2build.go b/cc/config/bp2build.go
index 4797acc..982b436 100644
--- a/cc/config/bp2build.go
+++ b/cc/config/bp2build.go
@@ -22,6 +22,7 @@
"strings"
"android/soong/android"
+
"github.com/google/blueprint"
)
@@ -162,6 +163,10 @@
exportedStringListVars.Set(name, value)
}
+func ExportStringList(name string, value []string) {
+ exportedStringListVars.Set(name, value)
+}
+
type exportedStringListDictVariables map[string]map[string][]string
func (m exportedStringListDictVariables) Set(k string, v map[string][]string) {
diff --git a/cc/ndk_library.go b/cc/ndk_library.go
index 7879a7d..7efe134 100644
--- a/cc/ndk_library.go
+++ b/cc/ndk_library.go
@@ -25,6 +25,7 @@
"github.com/google/blueprint/proptools"
"android/soong/android"
+ "android/soong/cc/config"
)
func init() {
@@ -208,20 +209,26 @@
*ndkKnownLibs = append(*ndkKnownLibs, name)
}
+var stubLibraryCompilerFlags = []string{
+ // We're knowingly doing some otherwise unsightly things with builtin
+ // functions here. We're just generating stub libraries, so ignore it.
+ "-Wno-incompatible-library-redeclaration",
+ "-Wno-incomplete-setjmp-declaration",
+ "-Wno-builtin-requires-header",
+ "-Wno-invalid-noreturn",
+ "-Wall",
+ "-Werror",
+ // These libraries aren't actually used. Don't worry about unwinding
+ // (avoids the need to link an unwinder into a fake library).
+ "-fno-unwind-tables",
+}
+
+func init() {
+ config.ExportStringList("StubLibraryCompilerFlags", stubLibraryCompilerFlags)
+}
+
func addStubLibraryCompilerFlags(flags Flags) Flags {
- flags.Global.CFlags = append(flags.Global.CFlags,
- // We're knowingly doing some otherwise unsightly things with builtin
- // functions here. We're just generating stub libraries, so ignore it.
- "-Wno-incompatible-library-redeclaration",
- "-Wno-incomplete-setjmp-declaration",
- "-Wno-builtin-requires-header",
- "-Wno-invalid-noreturn",
- "-Wall",
- "-Werror",
- // These libraries aren't actually used. Don't worry about unwinding
- // (avoids the need to link an unwinder into a fake library).
- "-fno-unwind-tables",
- )
+ flags.Global.CFlags = append(flags.Global.CFlags, stubLibraryCompilerFlags...)
// All symbols in the stubs library should be visible.
if inList("-fvisibility=hidden", flags.Local.CFlags) {
flags.Local.CFlags = append(flags.Local.CFlags, "-fvisibility=default")
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 6c68822..a054c91 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -42,6 +42,7 @@
"-fno-omit-frame-pointer",
"-Wno-frame-larger-than=",
"-fsanitize-hwaddress-abi=platform",
+ "-mllvm", "-hwasan-use-after-scope=1",
}
// ThinLTO performs codegen during link time, thus these flags need to
diff --git a/genrule/genrule.go b/genrule/genrule.go
index c3e3ba5..1679a57 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -862,7 +862,7 @@
cmd = strings.Replace(*m.properties.Cmd, "$(in)", "$(SRCS)", -1)
cmd = strings.Replace(cmd, "$(out)", "$(OUTS)", -1)
genDir := "$(GENDIR)"
- if ctx.ModuleType() == "cc_genrule" {
+ if t := ctx.ModuleType(); t == "cc_genrule" || t == "java_genrule" || t == "java_genrule_host" {
genDir = "$(RULEDIR)"
}
cmd = strings.Replace(cmd, "$(genDir)", genDir, -1)
diff --git a/java/app.go b/java/app.go
index f574599..7ae73f7 100755
--- a/java/app.go
+++ b/java/app.go
@@ -1436,6 +1436,7 @@
Manifest bazel.Label
Custom_package *string
Resource_files bazel.LabelListAttribute
+ Deps bazel.LabelListAttribute
}
// ConvertWithBp2build is used to convert android_app to Bazel.
@@ -1453,12 +1454,15 @@
resourceFiles.Includes = append(resourceFiles.Includes, files...)
}
+ deps := bazel.MakeLabelListAttribute(android.BazelLabelForModuleDeps(ctx, a.properties.Static_libs))
+
attrs := &bazelAndroidAppAttributes{
Srcs: srcs,
Manifest: android.BazelLabelForModuleSrcSingle(ctx, manifest),
// TODO(b/209576404): handle package name override by product variable PRODUCT_MANIFEST_PACKAGE_NAME_OVERRIDES
Custom_package: a.overridableAppProperties.Package_name,
Resource_files: bazel.MakeLabelListAttribute(resourceFiles),
+ Deps: deps,
}
props := bazel.BazelTargetModuleProperties{Rule_class: "android_binary",
Bzl_load_location: "@rules_android//rules:rules.bzl"}
diff --git a/java/genrule.go b/java/genrule.go
index 16743b3..5047c41 100644
--- a/java/genrule.go
+++ b/java/genrule.go
@@ -24,8 +24,8 @@
}
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 @@
// 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 @@
// 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 @@
// 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 @@
//
// 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
}
diff --git a/java/genrule_test.go b/java/genrule_test.go
new file mode 100644
index 0000000..1c294b2
--- /dev/null
+++ b/java/genrule_test.go
@@ -0,0 +1,118 @@
+// Copyright 2018 Google Inc. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package java
+
+import (
+ "reflect"
+ "strings"
+ "testing"
+
+ "android/soong/android"
+)
+
+func testGenruleContext(config android.Config) *android.TestContext {
+ ctx := android.NewTestArchContext(config)
+ ctx.RegisterModuleType("java_genrule", GenRuleFactory)
+ ctx.Register()
+
+ return ctx
+}
+
+func TestGenruleCmd(t *testing.T) {
+ fs := map[string][]byte{
+ "tool": nil,
+ "foo": nil,
+ }
+ bp := `
+ java_genrule {
+ name: "gen",
+ tool_files: ["tool"],
+ cmd: "$(location tool) $(in) $(out)",
+ srcs: ["foo"],
+ out: ["out"],
+ }
+ `
+ config := android.TestArchConfig(t.TempDir(), nil, bp, fs)
+
+ ctx := testGenruleContext(config)
+
+ _, errs := ctx.ParseFileList(".", []string{"Android.bp"})
+ if errs == nil {
+ _, errs = ctx.PrepareBuildActions(config)
+ }
+ if errs != nil {
+ t.Fatal(errs)
+ }
+
+ gen := ctx.ModuleForTests("gen", "android_common").Output("out")
+ expected := []string{"foo"}
+ if !reflect.DeepEqual(expected, gen.Implicits.Strings()[:len(expected)]) {
+ t.Errorf(`want arm inputs %v, got %v`, expected, gen.Implicits.Strings())
+ }
+}
+
+func TestJarGenrules(t *testing.T) {
+ ctx, _ := testJava(t, `
+ java_library {
+ name: "foo",
+ srcs: ["a.java"],
+ }
+
+ java_genrule {
+ name: "jargen",
+ tool_files: ["b.java"],
+ cmd: "$(location b.java) $(in) $(out)",
+ out: ["jargen.jar"],
+ srcs: [":foo"],
+ }
+
+ java_library {
+ name: "bar",
+ static_libs: ["jargen"],
+ srcs: ["c.java"],
+ }
+
+ java_library {
+ name: "baz",
+ libs: ["jargen"],
+ srcs: ["c.java"],
+ }
+ `)
+
+ foo := ctx.ModuleForTests("foo", "android_common").Output("javac/foo.jar")
+ jargen := ctx.ModuleForTests("jargen", "android_common").Output("jargen.jar")
+ bar := ctx.ModuleForTests("bar", "android_common").Output("javac/bar.jar")
+ baz := ctx.ModuleForTests("baz", "android_common").Output("javac/baz.jar")
+ barCombined := ctx.ModuleForTests("bar", "android_common").Output("combined/bar.jar")
+
+ if g, w := jargen.Implicits.Strings(), foo.Output.String(); !android.InList(w, g) {
+ t.Errorf("expected jargen inputs [%q], got %q", w, g)
+ }
+
+ if !strings.Contains(bar.Args["classpath"], jargen.Output.String()) {
+ t.Errorf("bar classpath %v does not contain %q", bar.Args["classpath"], jargen.Output.String())
+ }
+
+ if !strings.Contains(baz.Args["classpath"], jargen.Output.String()) {
+ t.Errorf("baz classpath %v does not contain %q", baz.Args["classpath"], jargen.Output.String())
+ }
+
+ if len(barCombined.Inputs) != 2 ||
+ barCombined.Inputs[0].String() != bar.Output.String() ||
+ barCombined.Inputs[1].String() != jargen.Output.String() {
+ t.Errorf("bar combined jar inputs %v is not [%q, %q]",
+ barCombined.Inputs.Strings(), bar.Output.String(), jargen.Output.String())
+ }
+}
diff --git a/java/java_test.go b/java/java_test.go
index 6e4e673..3a51981 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -997,60 +997,6 @@
}
}
-func TestJarGenrules(t *testing.T) {
- ctx, _ := testJava(t, `
- java_library {
- name: "foo",
- srcs: ["a.java"],
- }
-
- java_genrule {
- name: "jargen",
- tool_files: ["b.java"],
- cmd: "$(location b.java) $(in) $(out)",
- out: ["jargen.jar"],
- srcs: [":foo"],
- }
-
- java_library {
- name: "bar",
- static_libs: ["jargen"],
- srcs: ["c.java"],
- }
-
- java_library {
- name: "baz",
- libs: ["jargen"],
- srcs: ["c.java"],
- }
- `)
-
- foo := ctx.ModuleForTests("foo", "android_common").Output("javac/foo.jar")
- jargen := ctx.ModuleForTests("jargen", "android_common").Output("jargen.jar")
- bar := ctx.ModuleForTests("bar", "android_common").Output("javac/bar.jar")
- baz := ctx.ModuleForTests("baz", "android_common").Output("javac/baz.jar")
- barCombined := ctx.ModuleForTests("bar", "android_common").Output("combined/bar.jar")
-
- if g, w := jargen.Implicits.Strings(), foo.Output.String(); !android.InList(w, g) {
- t.Errorf("expected jargen inputs [%q], got %q", w, g)
- }
-
- if !strings.Contains(bar.Args["classpath"], jargen.Output.String()) {
- t.Errorf("bar classpath %v does not contain %q", bar.Args["classpath"], jargen.Output.String())
- }
-
- if !strings.Contains(baz.Args["classpath"], jargen.Output.String()) {
- t.Errorf("baz classpath %v does not contain %q", baz.Args["classpath"], jargen.Output.String())
- }
-
- if len(barCombined.Inputs) != 2 ||
- barCombined.Inputs[0].String() != bar.Output.String() ||
- barCombined.Inputs[1].String() != jargen.Output.String() {
- t.Errorf("bar combined jar inputs %v is not [%q, %q]",
- barCombined.Inputs.Strings(), bar.Output.String(), jargen.Output.String())
- }
-}
-
func TestExcludeFileGroupInSrcs(t *testing.T) {
ctx, _ := testJava(t, `
java_library {
diff --git a/ui/metrics/bp2build_metrics_proto/bp2build_metrics.pb.go b/ui/metrics/bp2build_metrics_proto/bp2build_metrics.pb.go
index 11177e4..95f02ca 100644
--- a/ui/metrics/bp2build_metrics_proto/bp2build_metrics.pb.go
+++ b/ui/metrics/bp2build_metrics_proto/bp2build_metrics.pb.go
@@ -49,6 +49,10 @@
RuleClassCount map[string]uint64 `protobuf:"bytes,4,rep,name=ruleClassCount,proto3" json:"ruleClassCount,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
// List of converted modules
ConvertedModules []string `protobuf:"bytes,5,rep,name=convertedModules,proto3" json:"convertedModules,omitempty"`
+ // Counts of converted modules by module type.
+ ConvertedModuleTypeCount map[string]uint64 `protobuf:"bytes,6,rep,name=convertedModuleTypeCount,proto3" json:"convertedModuleTypeCount,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
+ // Counts of total modules by module type.
+ TotalModuleTypeCount map[string]uint64 `protobuf:"bytes,7,rep,name=totalModuleTypeCount,proto3" json:"totalModuleTypeCount,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"`
}
func (x *Bp2BuildMetrics) Reset() {
@@ -118,13 +122,27 @@
return nil
}
+func (x *Bp2BuildMetrics) GetConvertedModuleTypeCount() map[string]uint64 {
+ if x != nil {
+ return x.ConvertedModuleTypeCount
+ }
+ return nil
+}
+
+func (x *Bp2BuildMetrics) GetTotalModuleTypeCount() map[string]uint64 {
+ if x != nil {
+ return x.TotalModuleTypeCount
+ }
+ return nil
+}
+
var File_bp2build_metrics_proto protoreflect.FileDescriptor
var file_bp2build_metrics_proto_rawDesc = []byte{
0x0a, 0x16, 0x62, 0x70, 0x32, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69,
0x63, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1c, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f,
0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x70, 0x32, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d,
- 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0x8f, 0x03, 0x0a, 0x0f, 0x42, 0x70, 0x32, 0x42, 0x75,
+ 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x22, 0xac, 0x06, 0x0a, 0x0f, 0x42, 0x70, 0x32, 0x42, 0x75,
0x69, 0x6c, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x12, 0x32, 0x0a, 0x14, 0x67, 0x65,
0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x43, 0x6f, 0x75,
0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x14, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61,
@@ -145,15 +163,40 @@
0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x10, 0x63, 0x6f, 0x6e,
0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x18, 0x05, 0x20,
0x03, 0x28, 0x09, 0x52, 0x10, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x4d, 0x6f,
- 0x64, 0x75, 0x6c, 0x65, 0x73, 0x1a, 0x41, 0x0a, 0x13, 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61,
- 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
- 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
- 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x31, 0x5a, 0x2f, 0x61, 0x6e, 0x64, 0x72,
- 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x75, 0x69, 0x2f, 0x6d, 0x65, 0x74,
- 0x72, 0x69, 0x63, 0x73, 0x2f, 0x62, 0x70, 0x32, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65,
- 0x74, 0x72, 0x69, 0x63, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
- 0x74, 0x6f, 0x33,
+ 0x64, 0x75, 0x6c, 0x65, 0x73, 0x12, 0x87, 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72,
+ 0x74, 0x65, 0x64, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75,
+ 0x6e, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x4b, 0x2e, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
+ 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x70, 0x32, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f,
+ 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x42, 0x70, 0x32, 0x42, 0x75, 0x69, 0x6c, 0x64,
+ 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65,
+ 0x64, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74,
+ 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x18, 0x63, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64,
+ 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12,
+ 0x7b, 0x0a, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79,
+ 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x47, 0x2e,
+ 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x5f, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x62, 0x70, 0x32, 0x62,
+ 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x42, 0x70, 0x32,
+ 0x42, 0x75, 0x69, 0x6c, 0x64, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x2e, 0x54, 0x6f, 0x74,
+ 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e,
+ 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x6f, 0x64,
+ 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x1a, 0x41, 0x0a, 0x13,
+ 0x52, 0x75, 0x6c, 0x65, 0x43, 0x6c, 0x61, 0x73, 0x73, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e,
+ 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+ 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
+ 0x4b, 0x0a, 0x1d, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x64, 0x4d, 0x6f, 0x64, 0x75,
+ 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79,
+ 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
+ 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x47, 0x0a, 0x19,
+ 0x54, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x54, 0x79, 0x70, 0x65, 0x43,
+ 0x6f, 0x75, 0x6e, 0x74, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x31, 0x5a, 0x2f, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64,
+ 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x75, 0x69, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63,
+ 0x73, 0x2f, 0x62, 0x70, 0x32, 0x62, 0x75, 0x69, 0x6c, 0x64, 0x5f, 0x6d, 0x65, 0x74, 0x72, 0x69,
+ 0x63, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -168,18 +211,22 @@
return file_bp2build_metrics_proto_rawDescData
}
-var file_bp2build_metrics_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
+var file_bp2build_metrics_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_bp2build_metrics_proto_goTypes = []interface{}{
(*Bp2BuildMetrics)(nil), // 0: soong_build_bp2build_metrics.Bp2BuildMetrics
nil, // 1: soong_build_bp2build_metrics.Bp2BuildMetrics.RuleClassCountEntry
+ nil, // 2: soong_build_bp2build_metrics.Bp2BuildMetrics.ConvertedModuleTypeCountEntry
+ nil, // 3: soong_build_bp2build_metrics.Bp2BuildMetrics.TotalModuleTypeCountEntry
}
var file_bp2build_metrics_proto_depIdxs = []int32{
1, // 0: soong_build_bp2build_metrics.Bp2BuildMetrics.ruleClassCount:type_name -> soong_build_bp2build_metrics.Bp2BuildMetrics.RuleClassCountEntry
- 1, // [1:1] is the sub-list for method output_type
- 1, // [1:1] is the sub-list for method input_type
- 1, // [1:1] is the sub-list for extension type_name
- 1, // [1:1] is the sub-list for extension extendee
- 0, // [0:1] is the sub-list for field type_name
+ 2, // 1: soong_build_bp2build_metrics.Bp2BuildMetrics.convertedModuleTypeCount:type_name -> soong_build_bp2build_metrics.Bp2BuildMetrics.ConvertedModuleTypeCountEntry
+ 3, // 2: soong_build_bp2build_metrics.Bp2BuildMetrics.totalModuleTypeCount:type_name -> soong_build_bp2build_metrics.Bp2BuildMetrics.TotalModuleTypeCountEntry
+ 3, // [3:3] is the sub-list for method output_type
+ 3, // [3:3] is the sub-list for method input_type
+ 3, // [3:3] is the sub-list for extension type_name
+ 3, // [3:3] is the sub-list for extension extendee
+ 0, // [0:3] is the sub-list for field type_name
}
func init() { file_bp2build_metrics_proto_init() }
@@ -207,7 +254,7 @@
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_bp2build_metrics_proto_rawDesc,
NumEnums: 0,
- NumMessages: 2,
+ NumMessages: 4,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/ui/metrics/bp2build_metrics_proto/bp2build_metrics.proto b/ui/metrics/bp2build_metrics_proto/bp2build_metrics.proto
index 5e88966..6d98a3d 100644
--- a/ui/metrics/bp2build_metrics_proto/bp2build_metrics.proto
+++ b/ui/metrics/bp2build_metrics_proto/bp2build_metrics.proto
@@ -32,4 +32,10 @@
// List of converted modules
repeated string convertedModules = 5;
+
+ // Counts of converted modules by module type.
+ map<string, uint64> convertedModuleTypeCount = 6;
+
+ // Counts of total modules by module type.
+ map<string, uint64> totalModuleTypeCount = 7;
}