From daa220ae8ce36c3c155bb35b205a5826c779202c Mon Sep 17 00:00:00 2001 From: Spandan Das Date: Tue, 3 Jan 2023 22:25:01 +0000 Subject: R8/D8 should use sdk_version prop to determine API surface stability. `min_sdk_version` is used to represent the api_level of the device and its type will eventually become android.ApiLevel. OTOH, `sdk_version` property represents the API surface a module builds against _and_ the version of that API surface. For R8/D8, the additional `--android-platform-build` should be determined using the sdk_version of the soong module and not min_sdk_version, since min_sdk_version will not contain information about the api surface used for compilation. The unit test for `core_platform_app` in TestR8 were passing since min_sdk_version was not set, and therefore it implicitly defaulted to sdk_version. Also created a custom struct to propagate params to the helper dex functions Test: In build/soong, go test ./java Test: TH Bug: 208456999 Change-Id: I08ac6f496444d603557e498c8a1794af665abc7a --- java/java.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index b3abc9118..1e8d7b9e9 100644 --- a/java/java.go +++ b/java/java.go @@ -1981,7 +1981,15 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { j.dexpreopter.uncompressedDex = *j.dexProperties.Uncompress_dex var dexOutputFile android.OutputPath - dexOutputFile = j.dexer.compileDex(ctx, flags, j.MinSdkVersion(ctx), outputFile, jarName) + dexParams := &compileDexParams{ + flags: flags, + sdkVersion: j.SdkVersion(ctx), + minSdkVersion: j.MinSdkVersion(ctx), + classesJar: outputFile, + jarName: jarName, + } + + dexOutputFile = j.dexer.compileDex(ctx, dexParams) if ctx.Failed() { return } -- cgit v1.2.3-59-g8ed1b