Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eecf47b1 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Shard Javac" into main

parents c52eb1ce 15ab550d
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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"),
		},
	})
}
+2 −0
Original line number Diff line number Diff line
@@ -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 {