From 3d56ed5605cb41ae89ffa6be1db63e49bc626a76 Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 18 Nov 2021 22:23:12 -0800 Subject: Prepend header jar for sharded javac compilation When compiling without sharding javac will prefer classes built from source over classes in the classpath. Compiling with sharding puts the header classes for all the sources onto the classpath, including the sources that are not part of the current shard. Emulate the behavior when building without sharding by putting the header jar first on the classpath so classes are resolved from the rest of the sources before the real classpath. Also switch to using the header jar without static libs dependencies merged in, as those will already be present in the classpath. Test: m framework-minus-apex Test: m services.core Test: TestSharding Change-Id: Id11b39c15d89ce70da27d746a5c7e6b603c3c0f9 --- java/java_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'java/java_test.go') diff --git a/java/java_test.go b/java/java_test.go index c039f7246..6e4e673ec 100644 --- a/java/java_test.go +++ b/java/java_test.go @@ -988,11 +988,11 @@ func TestSharding(t *testing.T) { } `) - barHeaderJar := filepath.Join("out", "soong", ".intermediates", "bar", "android_common", "turbine-combined", "bar.jar") + barHeaderJar := filepath.Join("out", "soong", ".intermediates", "bar", "android_common", "turbine", "bar.jar") for i := 0; i < 3; i++ { barJavac := ctx.ModuleForTests("bar", "android_common").Description("javac" + strconv.Itoa(i)) - if !strings.Contains(barJavac.Args["classpath"], barHeaderJar) { - t.Errorf("bar javac classpath %v does not contain %q", barJavac.Args["classpath"], barHeaderJar) + if !strings.HasPrefix(barJavac.Args["classpath"], "-classpath "+barHeaderJar+":") { + t.Errorf("bar javac classpath %v does start with %q", barJavac.Args["classpath"], barHeaderJar) } } } -- cgit v1.2.3-59-g8ed1b