Merge "Shard Javac" into main

This commit is contained in:
Treehugger Robot 2023-10-18 22:20:39 +00:00 committed by Gerrit Code Review
commit eecf47b14c
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 {
@ -3105,6 +3106,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 {