Shard Javac

Test: m nothing
Test: allowlist frameworks/opt/calendar to bp2build convert
Test: add `javac_shard_size: 2` to calendar-common
Test: b //frameworks/opt/calendar:calendar-common
Bug: 297356812
Change-Id: Ie22bcf04946f3945952a74a46772b777b1522b70
This commit is contained in:
usta 2023-09-26 18:25:57 -04:00
parent d7471ec5cc
commit 15ab550d04
2 changed files with 22 additions and 0 deletions

View file

@ -1109,3 +1109,23 @@ func TestJavaLibrarySameNameAsPrebuilt(t *testing.T) {
ctx.RegisterModuleType("java_import", java.ImportFactory)
})
}
func TestJavaLibrarySharding(t *testing.T) {
runJavaLibraryTestCase(t, Bp2buildTestCase{
Description: "java library with sharded compilation",
Blueprint: `java_library {
name: "lib1",
srcs: ["a.java"],
javac_shard_size: 3,
sdk_version: "current",
}`,
ExpectedBazelTargets: []string{
MakeBazelTarget("java_library", "lib1", AttrNameToString{
"srcs": `["a.java"]`,
"sdk_version": `"current"`,
"javac_shard_size": "3",
}),
MakeNeverlinkDuplicateTarget("java_library", "lib1"),
},
})
}

View file

@ -2916,6 +2916,7 @@ type javaCommonAttributes struct {
Sdk_version bazel.StringAttribute
Java_version bazel.StringAttribute
Errorprone_force_enable bazel.BoolAttribute
Javac_shard_size *int64
}
type javaDependencyLabels struct {
@ -3101,6 +3102,7 @@ func (m *Library) convertLibraryAttrsBp2Build(ctx android.Bp2buildMutatorContext
Java_version: bazel.StringAttribute{Value: m.properties.Java_version},
Sdk_version: bazel.StringAttribute{Value: m.deviceProperties.Sdk_version},
Errorprone_force_enable: errorproneForceEnable,
Javac_shard_size: m.properties.Javac_shard_size,
}
for axis, configToProps := range archVariantProps {