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

Commit fd620b2b authored by Colin Cross's avatar Colin Cross
Browse files

Put extraCombinedJars after the compiled jars

extraCombinedJars contains the R.jar generated by
ResourceProcessorBusyBox for apps.  It needs to go before any
static_libs dependencies so that the finalized R values take
precedence over any non-final R values that may have been included
in the dependencies.  Moving after the javac and kotlinc compiled
jars helps minimize differences when turning on use_resource_processor
by default by using the MANIFEST.MF generated by soong_zip instead of
the one generated by ResourceProcessorBusyBox, which contains a
different Created-By field.

Bug: 294256649
Test: m javac-check
Change-Id: I8d060594404121fd36ef650ac317f0c5d5f92b23
parent c52d5233
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -931,8 +931,8 @@ func TestAndroidResourceProcessor(t *testing.T) {
				"out/soong/.intermediates/direct_import/android_common/aar/classes-combined.jar",
			},
			appCombined: []string{
				"out/soong/.intermediates/app/android_common/busybox/R.jar",
				"out/soong/.intermediates/app/android_common/javac/app.jar",
				"out/soong/.intermediates/app/android_common/busybox/R.jar",
				"out/soong/.intermediates/direct/android_common/combined/direct.jar",
				"out/soong/.intermediates/direct_import/android_common/aar/classes-combined.jar",
			},
@@ -1037,8 +1037,8 @@ func TestAndroidResourceProcessor(t *testing.T) {
				"out/soong/.intermediates/direct_import/android_common/aar/classes-combined.jar",
			},
			appCombined: []string{
				"out/soong/.intermediates/app/android_common/busybox/R.jar",
				"out/soong/.intermediates/app/android_common/javac/app.jar",
				"out/soong/.intermediates/app/android_common/busybox/R.jar",
				"out/soong/.intermediates/direct/android_common/combined/direct.jar",
				"out/soong/.intermediates/direct_import/android_common/aar/classes-combined.jar",
			},
+4 −4
Original line number Diff line number Diff line
@@ -1296,7 +1296,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
		}
	}

	jars := append(android.Paths(nil), kotlinJars...)
	jars := slices.Clone(kotlinJars)

	j.compiledSrcJars = srcJars

@@ -1311,7 +1311,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
			// allow for the use of annotation processors that do function correctly
			// with sharding enabled. See: b/77284273.
		}
		extraJars := append(android.CopyOf(extraCombinedJars), kotlinHeaderJars...)
		extraJars := append(slices.Clone(kotlinHeaderJars), extraCombinedJars...)
		headerJarFileWithoutDepsOrJarjar, j.headerJarFile, j.repackagedHeaderJarFile =
			j.compileJavaHeader(ctx, uniqueJavaFiles, srcJars, deps, flags, jarName, extraJars)
		if ctx.Failed() {
@@ -1385,6 +1385,8 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
		}
	}

	jars = append(jars, extraCombinedJars...)

	j.srcJarArgs, j.srcJarDeps = resourcePathsToJarArgs(srcFiles), srcFiles

	var includeSrcJar android.WritablePath
@@ -1471,8 +1473,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
		jars = append(jars, servicesJar)
	}

	jars = append(android.CopyOf(extraCombinedJars), jars...)

	// Combine the classes built from sources, any manifests, and any static libraries into
	// classes.jar. If there is only one input jar this step will be skipped.
	var outputFile android.OutputPath