diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bfda9c705..c8a39a0ea 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -302,3 +302,27 @@ jobs: with: name: booster-android-gradle-v7_2 path: booster-android-gradle-v7_2/build/reports/tests/integrationTest + + integration-test-agp-v7_3: + name: AGP 7.3 Integration Test + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'adopt' + java-version: '11' + cache: 'gradle' + - uses: actions/cache@v3 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ github.run_number }} + - shell: bash + run: ./gradlew booster-android-gradle-v7_3:integrationTest -S --no-daemon -Pversion=${{ github.run_number }} + - uses: actions/upload-artifact@v3 + if: failure() + with: + name: booster-android-gradle-v7_3 + path: booster-android-gradle-v7_3/build/reports/tests/integrationTest + diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/BaseVariant.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/BaseVariant.kt index 97c0cad48..d89d09175 100644 --- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/BaseVariant.kt +++ b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/BaseVariant.kt @@ -20,7 +20,6 @@ import java.io.File /** * The project which this variant belongs */ -@Suppress("DEPRECATION") val BaseVariant.project: Project get() = AGP.run { project } diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/ResolvedArtifactResults.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/ResolvedArtifactResults.kt index d06e43d55..e5cebf362 100644 --- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/ResolvedArtifactResults.kt +++ b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/ResolvedArtifactResults.kt @@ -35,9 +35,9 @@ class ResolvedArtifactResults(private val variant: BaseVariant) : Collection - get() = @Suppress("DEPRECATION") project.tasks.named("transformNativeLibsWithMergeJniLibsFor${name.capitalize()}") + get() = project.tasks.named("transformNativeLibsWithMergeJniLibsFor${name.capitalize()}") override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider get() = processJavaResourcesProvider diff --git a/booster-android-gradle-v3_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34IntegrationTest.kt b/booster-android-gradle-v3_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34IntegrationTest.kt index e75fa5e03..5f94d641c 100644 --- a/booster-android-gradle-v3_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34IntegrationTest.kt +++ b/booster-android-gradle-v3_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v3_4 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.android.sdklib.BuildToolInfo import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid @@ -31,12 +28,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 26 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=3.4.0", "-Pcompile_sdk_version=28", @@ -53,7 +49,7 @@ abstract class V34IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "5.1.1", *ARGS) + GradleExecutor(projectDir::getRoot, "5.1.1", *ARGS.toTypedArray()) } } @@ -139,10 +135,6 @@ abstract class V34IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() = Unit - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() = Unit @@ -328,18 +320,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34.kt b/booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34.kt index 6521f0118..5e407a774 100644 --- a/booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34.kt +++ b/booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34.kt @@ -82,7 +82,7 @@ internal object V34 : AGPInterface { get() = mergeResourcesProvider override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider - get() = @Suppress("DEPRECATION") project.tasks.named("transformNativeLibsWithMergeJniLibsFor${name.capitalize()}") + get() = project.tasks.named("transformNativeLibsWithMergeJniLibsFor${name.capitalize()}") override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider get() = processJavaResourcesProvider diff --git a/booster-android-gradle-v3_5/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35IntegrationTest.kt b/booster-android-gradle-v3_5/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35IntegrationTest.kt index de074837c..fff44153b 100644 --- a/booster-android-gradle-v3_5/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35IntegrationTest.kt +++ b/booster-android-gradle-v3_5/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v3_5 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.android.sdklib.BuildToolInfo import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid @@ -31,18 +28,17 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 26 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=3.5.0", "-Pcompile_sdk_version=28", "-Pbuild_tools_version=26.0.3", "-Pmin_sdk_version=${MIN_SDK_VERSION}", - "-Ptarget_sdk_version=${TARGET_SDK_VERSION}" + "-Ptarget_sdk_version=${TARGET_SDK_VERSION}", ) @Suppress("RemoveCurlyBracesFromTemplate", "FunctionName") @@ -53,7 +49,7 @@ abstract class V35IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "5.4.1", *ARGS) + GradleExecutor(projectDir::getRoot, "5.4.1", *ARGS.toTypedArray()) } } @@ -139,10 +135,6 @@ abstract class V35IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() = Unit - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() = Unit @@ -328,18 +320,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v3_6/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36IntegrationTest.kt b/booster-android-gradle-v3_6/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36IntegrationTest.kt index 711fc5619..45bc035db 100644 --- a/booster-android-gradle-v3_6/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36IntegrationTest.kt +++ b/booster-android-gradle-v3_6/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v3_6 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.android.sdklib.BuildToolInfo import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid @@ -31,12 +28,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 26 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=3.6.0", "-Pcompile_sdk_version=28", @@ -53,7 +49,7 @@ abstract class V36IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "5.6.4", *ARGS) + GradleExecutor(projectDir::getRoot, "5.6.4", *ARGS.toTypedArray()) } } @@ -139,10 +135,6 @@ abstract class V36IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() = Unit - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() = Unit @@ -328,18 +320,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v4_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40IntegrationTest.kt b/booster-android-gradle-v4_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40IntegrationTest.kt index 541c8728e..377cede0e 100644 --- a/booster-android-gradle-v4_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40IntegrationTest.kt +++ b/booster-android-gradle-v4_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v4_0 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.android.sdklib.BuildToolInfo import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid @@ -31,12 +28,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 26 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=4.0.0", "-Pcompile_sdk_version=28", @@ -53,7 +49,7 @@ abstract class V40IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "6.1.1", *ARGS) + GradleExecutor(projectDir::getRoot, "6.1.1", *ARGS.toTypedArray()) } } @@ -139,10 +135,6 @@ abstract class V40IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() = Unit - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() = Unit @@ -328,18 +320,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v4_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41IntegrationTest.kt b/booster-android-gradle-v4_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41IntegrationTest.kt index e4a28b2df..8a67145e4 100644 --- a/booster-android-gradle-v4_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41IntegrationTest.kt +++ b/booster-android-gradle-v4_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v4_1 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.android.sdklib.BuildToolInfo import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid @@ -31,12 +28,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 26 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=4.1.0", "-Pcompile_sdk_version=28", @@ -53,7 +49,7 @@ abstract class V41IntegrationTest(val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "6.5", *ARGS) + GradleExecutor(projectDir::getRoot, "6.5", *ARGS.toTypedArray()) } } @@ -139,10 +135,6 @@ abstract class V41IntegrationTest(val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() = Unit - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() = Unit @@ -328,18 +320,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v4_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42IntegrationTest.kt b/booster-android-gradle-v4_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42IntegrationTest.kt index 9f6421524..39049e8e7 100644 --- a/booster-android-gradle-v4_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42IntegrationTest.kt +++ b/booster-android-gradle-v4_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v4_2 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.android.sdklib.BuildToolInfo import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid @@ -31,12 +28,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 26 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=4.2.1", "-Pcompile_sdk_version=28", @@ -53,7 +49,7 @@ abstract class V42IntegrationTest(val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "6.7.1", *ARGS) + GradleExecutor(projectDir::getRoot, "6.7.1", *ARGS.toTypedArray()) } } @@ -139,10 +135,6 @@ abstract class V42IntegrationTest(val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() = Unit - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() = Unit @@ -328,18 +320,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle b/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle index a9db67a64..aa3c5f2d6 100644 --- a/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle +++ b/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v4_2/src/integrationTest/resources/buildSrc/build.gradle index bb9648dce..79a9b104a 100644 --- a/booster-android-gradle-v4_2/src/integrationTest/resources/buildSrc/build.gradle +++ b/booster-android-gradle-v4_2/src/integrationTest/resources/buildSrc/build.gradle @@ -20,5 +20,5 @@ dependencies { implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") { exclude group: 'com.google.guava' } - implementation "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v4_2/src/integrationTest/resources/lib.gradle index 64a9540e9..adc9b1ca0 100644 --- a/booster-android-gradle-v4_2/src/integrationTest/resources/lib.gradle +++ b/booster-android-gradle-v4_2/src/integrationTest/resources/lib.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42.kt b/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42.kt index 2fc0be9c9..346463c0c 100644 --- a/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42.kt +++ b/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42.kt @@ -147,7 +147,6 @@ internal object V42 : AGPInterface { override val BaseVariant.variantScope: VariantScope get() = component.variantScope - @Suppress("DEPRECATION") private val BaseVariant.globalScope: GlobalScope get() = component.globalScope diff --git a/booster-android-gradle-v7_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70IntegrationTest.kt b/booster-android-gradle-v7_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70IntegrationTest.kt index fbf22c5d1..d9aba7781 100644 --- a/booster-android-gradle-v7_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70IntegrationTest.kt +++ b/booster-android-gradle-v7_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v7_0 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid import com.didiglobal.booster.kotlinx.search @@ -30,12 +27,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 30 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=7.0.0", "-Pcompile_sdk_version=30", @@ -52,7 +48,7 @@ abstract class V70IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "7.0.2", *ARGS) + GradleExecutor(projectDir::getRoot, "7.0.2", *ARGS.toTypedArray()) } } @@ -138,11 +134,6 @@ abstract class V70IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() { - } - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() { @@ -333,18 +324,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle index a9db67a64..aa3c5f2d6 100644 --- a/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle +++ b/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v7_0/src/integrationTest/resources/buildSrc/build.gradle index bb9648dce..79a9b104a 100644 --- a/booster-android-gradle-v7_0/src/integrationTest/resources/buildSrc/build.gradle +++ b/booster-android-gradle-v7_0/src/integrationTest/resources/buildSrc/build.gradle @@ -20,5 +20,5 @@ dependencies { implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") { exclude group: 'com.google.guava' } - implementation "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v7_0/src/integrationTest/resources/lib.gradle index 64a9540e9..adc9b1ca0 100644 --- a/booster-android-gradle-v7_0/src/integrationTest/resources/lib.gradle +++ b/booster-android-gradle-v7_0/src/integrationTest/resources/lib.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70.kt b/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70.kt index 6dad42f81..6f70d7eb5 100644 --- a/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70.kt +++ b/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70.kt @@ -69,7 +69,6 @@ private val MULTIPLE_ARTIFACT_TYPES = arrayOf( it.javaClass.simpleName } -@Suppress("DEPRECATION") internal object V70 : AGPInterface { private val BaseVariant.component: ComponentImpl @@ -155,7 +154,6 @@ internal object V70 : AGPInterface { override val BaseVariant.variantScope: VariantScope get() = component.variantScope - @Suppress("DEPRECATION") private val BaseVariant.globalScope: GlobalScope get() = component.globalScope diff --git a/booster-android-gradle-v7_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71IntegrationTest.kt b/booster-android-gradle-v7_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71IntegrationTest.kt index 7d6a0b755..46ae8b850 100644 --- a/booster-android-gradle-v7_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71IntegrationTest.kt +++ b/booster-android-gradle-v7_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v7_1 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid import com.didiglobal.booster.kotlinx.search @@ -30,12 +27,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 30 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=7.1.0", "-Pcompile_sdk_version=30", @@ -52,7 +48,7 @@ abstract class V71IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "7.2", *ARGS) + GradleExecutor(projectDir::getRoot, "7.2", *ARGS.toTypedArray()) } } @@ -138,11 +134,6 @@ abstract class V71IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() { - } - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() { @@ -333,18 +324,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle index a9db67a64..aa3c5f2d6 100644 --- a/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle +++ b/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v7_1/src/integrationTest/resources/buildSrc/build.gradle index bb9648dce..79a9b104a 100644 --- a/booster-android-gradle-v7_1/src/integrationTest/resources/buildSrc/build.gradle +++ b/booster-android-gradle-v7_1/src/integrationTest/resources/buildSrc/build.gradle @@ -20,5 +20,5 @@ dependencies { implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") { exclude group: 'com.google.guava' } - implementation "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v7_1/src/integrationTest/resources/lib.gradle index 64a9540e9..adc9b1ca0 100644 --- a/booster-android-gradle-v7_1/src/integrationTest/resources/lib.gradle +++ b/booster-android-gradle-v7_1/src/integrationTest/resources/lib.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71.kt b/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71.kt index b04432538..0795be336 100644 --- a/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71.kt +++ b/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71.kt @@ -67,7 +67,6 @@ private val MULTIPLE_ARTIFACT_TYPES = arrayOf( it.javaClass.simpleName } -@Suppress("DEPRECATION") internal object V71 : AGPInterface { private val BaseVariant.component: ComponentImpl @@ -151,7 +150,6 @@ internal object V71 : AGPInterface { override val BaseVariant.variantScope: VariantScope get() = component.variantScope - @Suppress("DEPRECATION") private val BaseVariant.globalScope: GlobalScope get() = component.globalScope diff --git a/booster-android-gradle-v7_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72IntegrationTest.kt b/booster-android-gradle-v7_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72IntegrationTest.kt index e3d897001..e4dc6f904 100644 --- a/booster-android-gradle-v7_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72IntegrationTest.kt +++ b/booster-android-gradle-v7_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v7_2 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid import com.didiglobal.booster.kotlinx.search @@ -30,12 +27,11 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 30 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=7.2.0", "-Pcompile_sdk_version=30", @@ -52,7 +48,7 @@ abstract class V72IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "7.3.3", *ARGS) + GradleExecutor(projectDir::getRoot, "7.3.3", *ARGS.toTypedArray()) } } @@ -138,11 +134,6 @@ abstract class V72IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() { - } - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() { @@ -338,18 +329,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle index a9db67a64..aa3c5f2d6 100644 --- a/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle +++ b/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v7_2/src/integrationTest/resources/buildSrc/build.gradle index bb9648dce..79a9b104a 100644 --- a/booster-android-gradle-v7_2/src/integrationTest/resources/buildSrc/build.gradle +++ b/booster-android-gradle-v7_2/src/integrationTest/resources/buildSrc/build.gradle @@ -20,5 +20,5 @@ dependencies { implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") { exclude group: 'com.google.guava' } - implementation "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v7_2/src/integrationTest/resources/lib.gradle index 64a9540e9..adc9b1ca0 100644 --- a/booster-android-gradle-v7_2/src/integrationTest/resources/lib.gradle +++ b/booster-android-gradle-v7_2/src/integrationTest/resources/lib.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72.kt b/booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72.kt index 15d178e2b..d7545453a 100644 --- a/booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72.kt +++ b/booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72.kt @@ -67,7 +67,6 @@ private val MULTIPLE_ARTIFACT_TYPES = arrayOf( it.javaClass.simpleName } -@Suppress("DEPRECATION") internal object V72 : AGPInterface { private val BaseVariant.component: ComponentImpl @@ -161,7 +160,6 @@ internal object V72 : AGPInterface { override val BaseVariant.variantScope: VariantScope get() = component.variantScope - @Suppress("DEPRECATION") private val BaseVariant.globalScope: GlobalTaskCreationConfigImpl get() = component.global as GlobalTaskCreationConfigImpl diff --git a/booster-android-gradle-v7_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73IntegrationTest.kt b/booster-android-gradle-v7_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73IntegrationTest.kt index 563ec2fa8..70b386fd1 100644 --- a/booster-android-gradle-v7_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73IntegrationTest.kt +++ b/booster-android-gradle-v7_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73IntegrationTest.kt @@ -1,12 +1,9 @@ -@file:Suppress("DEPRECATION") - package com.didiglobal.booster.android.gradle.v7_3 import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension import com.android.build.gradle.LibraryExtension import com.android.build.gradle.api.BaseVariant -import com.android.builder.core.VariantTypeImpl import com.didiglobal.booster.gradle.AGP import com.didiglobal.booster.gradle.getAndroid import com.didiglobal.booster.kotlinx.search @@ -30,18 +27,17 @@ import kotlin.test.assertNotNull import kotlin.test.assertTrue import kotlin.test.fail -private const val MIN_SDK_VERSION = 18 +private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt() private const val TARGET_SDK_VERSION = 30 -private val ARGS = arrayOf( - "assemble", "-S", +private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf( "-Pbooster_version=${Build.VERSION}", "-Pandroid_gradle_version=7.3.0", "-Pcompile_sdk_version=30", "-Pbuild_tools_version=29.0.2", - "-Pmin_sdk_version=$MIN_SDK_VERSION", - "-Ptarget_sdk_version=$TARGET_SDK_VERSION" + "-Pmin_sdk_version=${MIN_SDK_VERSION}", + "-Ptarget_sdk_version=${TARGET_SDK_VERSION}" ) @Suppress("RemoveCurlyBracesFromTemplate", "FunctionName") @@ -52,7 +48,7 @@ abstract class V73IntegrationTest(private val isLib: Boolean) { @get:Rule val ruleChain: TestRule = rule(projectDir) { rule(LocalProperties(projectDir::getRoot)) { - GradleExecutor(projectDir::getRoot, "7.3.3", *ARGS) + GradleExecutor(projectDir::getRoot, "7.3.3", *ARGS.toTypedArray()) } } @@ -138,11 +134,6 @@ abstract class V73IntegrationTest(private val isLib: Boolean) { @Case(TargetSdkVersionTestUnit::class) fun `test AGPInterface#targetSdkVersion`() = Unit - @Test - @Case(VariantTypeTestUnit::class) - fun `test AGPInterface#variantType`() { - } - @Test @Case(AarTestUnit::class) fun `test AGPInterface#aar`() { @@ -338,18 +329,6 @@ class TargetSdkVersionTestUnit : VariantTestCase() { } } -class VariantTypeTestUnit : VariantTestCase() { - override fun apply(variant: BaseVariant) { - val project = AGP.run { variant.project } - val variantType = AGP.run { variant.variantType } - if (project.plugins.hasPlugin("com.android.application")) { - assertEquals(VariantTypeImpl.BASE_APK, variantType) - } else if (project.plugins.hasPlugin("com.android.library")) { - assertEquals(VariantTypeImpl.LIBRARY, variantType) - } - } -} - class AarTestUnit : VariantTestCase() { override fun apply(project: Project) { if (project.plugins.hasPlugin("com.android.library")) { diff --git a/booster-android-gradle-v7_3/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_3/src/integrationTest/resources/app.gradle index a9db67a64..aa3c5f2d6 100644 --- a/booster-android-gradle-v7_3/src/integrationTest/resources/app.gradle +++ b/booster-android-gradle-v7_3/src/integrationTest/resources/app.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_3/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v7_3/src/integrationTest/resources/buildSrc/build.gradle index bb9648dce..79a9b104a 100644 --- a/booster-android-gradle-v7_3/src/integrationTest/resources/buildSrc/build.gradle +++ b/booster-android-gradle-v7_3/src/integrationTest/resources/buildSrc/build.gradle @@ -20,5 +20,5 @@ dependencies { implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") { exclude group: 'com.google.guava' } - implementation "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } diff --git a/booster-android-gradle-v7_3/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v7_3/src/integrationTest/resources/lib.gradle index 64a9540e9..adc9b1ca0 100644 --- a/booster-android-gradle-v7_3/src/integrationTest/resources/lib.gradle +++ b/booster-android-gradle-v7_3/src/integrationTest/resources/lib.gradle @@ -11,7 +11,7 @@ buildscript { classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") { exclude group: 'com.google.guava' } - classpath "io.bootstage.testkit:testkit-gradle-plugin:1.1.0" + classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0" } } diff --git a/booster-android-gradle-v7_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73.kt b/booster-android-gradle-v7_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73.kt index fefa4d24a..6fec075ce 100644 --- a/booster-android-gradle-v7_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73.kt +++ b/booster-android-gradle-v7_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73.kt @@ -63,7 +63,6 @@ private val MULTIPLE_ARTIFACT_TYPES = arrayOf( it.javaClass.simpleName } -@Suppress("DEPRECATION") internal object V73 : AGPInterface { private val BaseVariant.component: ComponentImpl @@ -157,7 +156,6 @@ internal object V73 : AGPInterface { override val BaseVariant.variantScope: VariantScope get() = component.variantScope - @Suppress("DEPRECATION") private val BaseVariant.globalScope: GlobalTaskCreationConfigImpl get() = component.global as GlobalTaskCreationConfigImpl diff --git a/booster-build/src/main/kotlin/com/didiglobal/booster/build/AndroidSdk.kt b/booster-build/src/main/kotlin/com/didiglobal/booster/build/AndroidSdk.kt index 27f32bd5c..f555e33f7 100644 --- a/booster-build/src/main/kotlin/com/didiglobal/booster/build/AndroidSdk.kt +++ b/booster-build/src/main/kotlin/com/didiglobal/booster/build/AndroidSdk.kt @@ -30,7 +30,7 @@ class AndroidSdk { it.name.startsWith("android-") && File(it, "android.jar").exists() }?.map { it.name.substringAfter("android-") - }?.maxOrNull()?.toInt() ?: throw RuntimeException("No platform found") + }?.max()?.toInt() ?: throw RuntimeException("No platform found") /** * Returns the Android SDK location, the search order: diff --git a/booster-cha/src/main/kotlin/com/didiglobal/booster/cha/CompositeClassSet.kt b/booster-cha/src/main/kotlin/com/didiglobal/booster/cha/CompositeClassSet.kt index 56de232f3..4a3ec7b67 100644 --- a/booster-cha/src/main/kotlin/com/didiglobal/booster/cha/CompositeClassSet.kt +++ b/booster-cha/src/main/kotlin/com/didiglobal/booster/cha/CompositeClassSet.kt @@ -26,7 +26,7 @@ internal class CompositeClassSet( private val once = Once>() override val size: Int by lazy { - load().classSets.sumOf(ClassSet::size) + load().classSets.sumBy(ClassSet::size) } override val classpath: List by lazy { @@ -114,7 +114,7 @@ internal class CompositeClassSet( } } val t1 = System.nanoTime() - val size = classSets.sumOf(ClassSet::size) + val size = classSets.sumBy(ClassSet::size) println(classpath.joinToString("\n", "Load ${green(size)} classes from ${green(n)} class sets in ${yellow(Duration.ofNanos(t1 - t0).toMillis())} ms\n") { " ✨ $it" }) diff --git a/booster-kotlinx/src/main/kotlin/com/didiglobal/booster/kotlinx/OS.kt b/booster-kotlinx/src/main/kotlin/com/didiglobal/booster/kotlinx/OS.kt index 673ad86a4..4bb5cc965 100644 --- a/booster-kotlinx/src/main/kotlin/com/didiglobal/booster/kotlinx/OS.kt +++ b/booster-kotlinx/src/main/kotlin/com/didiglobal/booster/kotlinx/OS.kt @@ -2,17 +2,17 @@ package com.didiglobal.booster.kotlinx object OS { - val name: String = System.getProperty("os.name", "").lowercase() + val name: String = System.getProperty("os.name", "").toLowerCase() - val arch: String = System.getProperty("os.arch", "").lowercase() + val arch: String = System.getProperty("os.arch", "").toLowerCase() val version = object : Comparable { - private val version = System.getProperty("os.version", "").lowercase() + private val version = System.getProperty("os.version", "").toLowerCase() override fun compareTo(other: String): Int { - val part1 = version.split("[\\._\\-]".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() - val part2 = other.split("[\\._\\-]".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + val part1 = version.split("[._\\-]".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() + val part2 = other.split("[._\\-]".toRegex()).dropLastWhile { it.isEmpty() }.toTypedArray() var idx = 0 while (idx < part1.size && idx < part2.size) { diff --git a/booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/AnalysisVariantProcessor.kt b/booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/AnalysisVariantProcessor.kt index 8773b564a..9d3d35069 100644 --- a/booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/AnalysisVariantProcessor.kt +++ b/booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/AnalysisVariantProcessor.kt @@ -77,7 +77,7 @@ class AnalysisVariantProcessor : VariantProcessor { } internal inline val KClass.category: String - get() = T::class.java.simpleName.substringBefore(AnalysisTask::class.java.simpleName).lowercase() + get() = T::class.java.simpleName.substringBefore(AnalysisTask::class.java.simpleName).toLowerCase() internal inline val KClass.taskName: String - get() = @Suppress("DEPRECATION") "analyse${category.capitalize()}" + get() = "analyse${category.capitalize()}" diff --git a/booster-task-check-snapshot/src/main/kotlin/com/didiglobal/booster/task/dependency/CheckSnapshotVariantProcessor.kt b/booster-task-check-snapshot/src/main/kotlin/com/didiglobal/booster/task/dependency/CheckSnapshotVariantProcessor.kt index 6e4e33e1d..2f5fc465a 100644 --- a/booster-task-check-snapshot/src/main/kotlin/com/didiglobal/booster/task/dependency/CheckSnapshotVariantProcessor.kt +++ b/booster-task-check-snapshot/src/main/kotlin/com/didiglobal/booster/task/dependency/CheckSnapshotVariantProcessor.kt @@ -24,7 +24,6 @@ class CheckSnapshotVariantProcessor : VariantProcessor { it.description = "Check snapshot dependencies" } } - @Suppress("DEPRECATION") tasks.register("check${variant.name.capitalize()}Snapshot", CheckSnapshot::class.java) { it.group = BOOSTER it.description = "Check snapshot dependencies for ${variant.name}" diff --git a/booster-task-compression-processed-res/src/main/kotlin/com/didiglobal/booster/task/compression/processed/res/ProcessedResourcesCompressionVariantProcessor.kt b/booster-task-compression-processed-res/src/main/kotlin/com/didiglobal/booster/task/compression/processed/res/ProcessedResourcesCompressionVariantProcessor.kt index 06a949ebf..3c213be18 100644 --- a/booster-task-compression-processed-res/src/main/kotlin/com/didiglobal/booster/task/compression/processed/res/ProcessedResourcesCompressionVariantProcessor.kt +++ b/booster-task-compression-processed-res/src/main/kotlin/com/didiglobal/booster/task/compression/processed/res/ProcessedResourcesCompressionVariantProcessor.kt @@ -36,7 +36,6 @@ import java.util.zip.ZipFile class ProcessedResourcesCompressionVariantProcessor : VariantProcessor { override fun process(variant: BaseVariant) { - @Suppress("DEPRECATION") val compress = variant.project.tasks.register("compress${variant.name.capitalize()}ProcessedRes", CompressProcessedRes::class.java) { it.group = BOOSTER it.description = "Compress the processed resource file for ${variant.name}" @@ -119,10 +118,10 @@ private fun BaseVariant.generateReport(results: CompressionResults) { it.fourth ) } - val maxWith1 = table.maxOfOrNull { it.first.length } ?: 0 - val maxWith5 = table.maxOfOrNull { it.fifth.length } ?: 0 - val maxWith6 = table.maxOfOrNull { it.sixth.length } ?: 0 - val maxWith7 = table.maxOfOrNull { it.seventh.length } ?: 0 + val maxWith1 = table.map { it.first.length }.max() ?: 0 + val maxWith5 = table.map { it.fifth.length }.max() ?: 0 + val maxWith6 = table.map { it.sixth.length }.max() ?: 0 + val maxWith7 = table.map { it.seventh.length }.max() ?: 0 val fullWith = maxWith1 + maxWith5 + maxWith6 + 8 project.buildDir.file("reports", Build.ARTIFACT, name, "report.txt").touch().printWriter().use { logger -> @@ -135,7 +134,7 @@ private fun BaseVariant.generateReport(results: CompressionResults) { logger.println("${it.sixth.padStart(maxWith6)} ${it.first.padEnd(maxWith1)} ${it.fifth.padStart(maxWith5)} ${it.seventh.padStart(maxWith7)} ${it.eighth}") } logger.println("-".repeat(maxWith1 + maxWith5 + maxWith6 + 2)) - logger.println(" TOTAL ${decimal(table.sumOf { it.fourth.toDouble() }).padStart(fullWith - 13)}") + logger.println(" TOTAL ${decimal(table.sumByDouble { it.fourth.toDouble() }).padStart(fullWith - 13)}") } } diff --git a/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionReport.kt b/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionReport.kt index c0cc064f2..f72c4fb7d 100644 --- a/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionReport.kt +++ b/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionReport.kt @@ -32,10 +32,10 @@ fun CompressionResults.generateReport(variant: BaseVariant, artifact: String) { it.fourth ) } - val maxWith1 = table.maxOfOrNull { it.first.length } ?: 0 - val maxWith5 = table.maxOfOrNull { it.fifth.length } ?: 0 - val maxWith6 = table.maxOfOrNull { it.sixth.length } ?: 0 - val maxWith7 = table.maxOfOrNull { it.seventh.length } ?: 0 + val maxWith1 = table.map { it.first.length }.max() ?: 0 + val maxWith5 = table.map { it.fifth.length }.max() ?: 0 + val maxWith6 = table.map { it.sixth.length }.max() ?: 0 + val maxWith7 = table.map { it.seventh.length }.max() ?: 0 val fullWith = maxWith1 + maxWith5 + maxWith6 + 8 variant.getReport(artifact, "report.txt").touch().printWriter().use { logger -> @@ -48,7 +48,7 @@ fun CompressionResults.generateReport(variant: BaseVariant, artifact: String) { logger.println("${it.sixth.padStart(maxWith6)} ${it.first.padEnd(maxWith1)} ${it.fifth.padStart(maxWith5)} ${it.seventh.padStart(maxWith7)} ${it.eighth}") } logger.println("-".repeat(maxWith1 + maxWith5 + maxWith6 + 2)) - logger.println(" TOTAL ${decimal(table.sumOf { it.fourth.toDouble() }).padStart((fullWith - 13).coerceAtLeast(0))}") + logger.println(" TOTAL ${decimal(table.sumByDouble { it.fourth.toDouble() }).padStart((fullWith - 13).coerceAtLeast(0))}") } } diff --git a/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/SimpleCompressionTaskCreator.kt b/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/SimpleCompressionTaskCreator.kt index 8ed8c6d11..539ea5e63 100644 --- a/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/SimpleCompressionTaskCreator.kt +++ b/booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/SimpleCompressionTaskCreator.kt @@ -42,7 +42,6 @@ class SimpleCompressionTaskCreator(private val tool: CompressionTool, private va val aapt2 = project.isAapt2Enabled val install = getCommandInstaller(variant) - @Suppress("DEPRECATION") return project.tasks.register("compress${variant.name.capitalize()}${name.capitalize()}With${tool.command.name.substringBefore('.').capitalize()}", getCompressionTaskClass(aapt2).java) { task -> task.group = BOOSTER task.description = "Compress image resources by ${tool.command.name} for ${variant.name}" @@ -84,7 +83,6 @@ class SimpleCompressionTaskCreator(private val tool: CompressionTool, private va } private fun getInstallTaskName(variant: String = ""): String { - @Suppress("DEPRECATION") return "install${variant.capitalize()}${tool.command.name.substringBefore('.').capitalize()}" } diff --git a/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifact.kt b/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifact.kt index 942506cf3..af85d24af 100644 --- a/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifact.kt +++ b/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifact.kt @@ -15,7 +15,7 @@ internal open class ListArtifact : DefaultTask() { @TaskAction fun run() { val artifacts = this.variant.allArtifacts - val maxTypeWidth: Int = artifacts.keys.maxOf { it.length } + val maxTypeWidth: Int = artifacts.keys.map { it.length }.max() ?: 0 artifacts.forEach { (type, files) -> println("${".".repeat(maxTypeWidth - type.length + 1)}$type : ${try { diff --git a/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifactVariantProcessor.kt b/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifactVariantProcessor.kt index 0c6b946de..b2f7945f7 100644 --- a/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifactVariantProcessor.kt +++ b/booster-task-list-artifact/src/main/kotlin/com/didiglobal/booster/task/artifact/ListArtifactVariantProcessor.kt @@ -23,7 +23,6 @@ class ListArtifactVariantProcessor : VariantProcessor { it.description = "List build artifacts" } } - @Suppress("DEPRECATION") tasks.register("list${variant.name.capitalize()}Artifacts", ListArtifact::class.java) { it.group = BOOSTER it.description = "List build artifacts for ${variant.name}" diff --git a/booster-task-list-permission/src/main/kotlin/com/didiglobal/booster/task/permission/ListPermissionVariantProcessor.kt b/booster-task-list-permission/src/main/kotlin/com/didiglobal/booster/task/permission/ListPermissionVariantProcessor.kt index eab14946b..929804f76 100644 --- a/booster-task-list-permission/src/main/kotlin/com/didiglobal/booster/task/permission/ListPermissionVariantProcessor.kt +++ b/booster-task-list-permission/src/main/kotlin/com/didiglobal/booster/task/permission/ListPermissionVariantProcessor.kt @@ -23,7 +23,6 @@ class ListPermissionVariantProcessor : VariantProcessor { it.description = "List the permissions declared in AndroidManifest.xml" } } - @Suppress("DEPRECATION") tasks.register("list${variant.name.capitalize()}Permissions", ListPermission::class.java) { it.group = BOOSTER it.description = "List the permission declared in AndroidManifest.xml for ${variant.name}" diff --git a/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibrary.kt b/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibrary.kt index acd19a1d9..d99280994 100644 --- a/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibrary.kt +++ b/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibrary.kt @@ -18,7 +18,7 @@ internal open class ListSharedLibrary : DefaultTask() { @TaskAction fun run() { variant.dependencies.forEach { result -> - when (result.file.extension.lowercase()) { + when (result.file.extension.toLowerCase()) { "aar", "jar" -> { JarFile(result.file).use { jar -> jar.entries().asSequence().filter { diff --git a/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibraryVariantProcessor.kt b/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibraryVariantProcessor.kt index 3d3504851..0357655c8 100644 --- a/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibraryVariantProcessor.kt +++ b/booster-task-list-shared-library/src/main/kotlin/com/didiglobal/booster/task/so/ListSharedLibraryVariantProcessor.kt @@ -23,7 +23,6 @@ class ListSharedLibraryVariantProcessor : VariantProcessor { it.description = "List the shared libraries that current project depends on" } } - @Suppress("DEPRECATION") tasks.register("list${variant.name.capitalize()}SharedLibraries", ListSharedLibrary::class.java) { it.group = BOOSTER it.description = "List the shared libraries that current project depends on for ${variant.name}" diff --git a/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/RemoveRedundantFlatImages.kt b/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/RemoveRedundantFlatImages.kt index 161f01526..c58620905 100644 --- a/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/RemoveRedundantFlatImages.kt +++ b/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/RemoveRedundantFlatImages.kt @@ -51,7 +51,7 @@ internal open class RemoveRedundantFlatImages : RemoveRedundantImages() { it.first to it.second }).map { group -> // resource name with configuration => resources // calculate the maximum density of the resource group with same name - val highest = group.value.maxByOrNull { + val highest = group.value.maxBy { it.second.configuration.screenType.density }?.second?.configuration?.screenType?.density diff --git a/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/ResourceDeredundancyVariantProcessor.kt b/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/ResourceDeredundancyVariantProcessor.kt index 817b9e511..d984ec542 100644 --- a/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/ResourceDeredundancyVariantProcessor.kt +++ b/booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/ResourceDeredundancyVariantProcessor.kt @@ -29,7 +29,6 @@ class ResourceDeredundancyVariantProcessor : VariantProcessor { val project = variant.project val results = CompressionResults() val klassRemoveRedundantImages = if (project.isAapt2Enabled) RemoveRedundantFlatImages::class else RemoveRedundantImages::class - @Suppress("DEPRECATION") val deredundancy = variant.project.tasks.register("remove${variant.name.capitalize()}RedundantResources", klassRemoveRedundantImages.java) { task -> task.group = BOOSTER task.description = "Remove redundant resources for ${variant.name}" diff --git a/booster-transform-asm/src/main/kotlin/com/didiglobal/booster/transform/asm/AsmTransformer.kt b/booster-transform-asm/src/main/kotlin/com/didiglobal/booster/transform/asm/AsmTransformer.kt index de5795372..1beaca5b4 100644 --- a/booster-transform-asm/src/main/kotlin/com/didiglobal/booster/transform/asm/AsmTransformer.kt +++ b/booster-transform-asm/src/main/kotlin/com/didiglobal/booster/transform/asm/AsmTransformer.kt @@ -86,7 +86,7 @@ class AsmTransformer : Transformer { val w1 = this.durations.keys.map { it.javaClass.name.length - }.maxOrNull() ?: 20 + }.max() ?: 20 this.durations.forEach { (transformer, ns) -> println("${transformer.javaClass.name.padEnd(w1 + 1)}: ${ns.toMillis()} ms") } diff --git a/booster-transform-br-inline/src/main/kotlin/com/didiglobal/booster/transform/br/inline/BRInlineTransformer.kt b/booster-transform-br-inline/src/main/kotlin/com/didiglobal/booster/transform/br/inline/BRInlineTransformer.kt index de06874e1..daf54a0c6 100644 --- a/booster-transform-br-inline/src/main/kotlin/com/didiglobal/booster/transform/br/inline/BRInlineTransformer.kt +++ b/booster-transform-br-inline/src/main/kotlin/com/didiglobal/booster/transform/br/inline/BRInlineTransformer.kt @@ -48,8 +48,8 @@ class BRInlineTransformer : ClassTransformer { } // Remove all BR class files allBR.also { pairs -> - val totalSize = allBR.sumOf { it.first.length() } - val maxWidth = allBR.maxOfOrNull { it.second.length }?.plus(10) ?: 10 + val totalSize = allBR.map { it.first.length() }.sum() + val maxWidth = allBR.map { it.second.length }.max()?.plus(10) ?: 10 logger.println("Delete files:") diff --git a/booster-transform-javassist/src/main/kotlin/com/didiglobal/booster/transform/javassist/JavassistTransformer.kt b/booster-transform-javassist/src/main/kotlin/com/didiglobal/booster/transform/javassist/JavassistTransformer.kt index fddb32207..3b9c5263f 100644 --- a/booster-transform-javassist/src/main/kotlin/com/didiglobal/booster/transform/javassist/JavassistTransformer.kt +++ b/booster-transform-javassist/src/main/kotlin/com/didiglobal/booster/transform/javassist/JavassistTransformer.kt @@ -91,7 +91,7 @@ class JavassistTransformer : Transformer { val w1 = this.durations.keys.map { it.javaClass.name.length - }.maxOrNull() ?: 20 + }.max() ?: 20 this.durations.forEach { (transformer, ns) -> println("${transformer.javaClass.name.padEnd(w1 + 1)}: ${ns.toMillis()} ms") } diff --git a/booster-transform-r-inline/src/main/kotlin/com/didiglobal/booster/transform/r/inline/RInlineTransformer.kt b/booster-transform-r-inline/src/main/kotlin/com/didiglobal/booster/transform/r/inline/RInlineTransformer.kt index d6bc0e3b4..562252129 100644 --- a/booster-transform-r-inline/src/main/kotlin/com/didiglobal/booster/transform/r/inline/RInlineTransformer.kt +++ b/booster-transform-r-inline/src/main/kotlin/com/didiglobal/booster/transform/r/inline/RInlineTransformer.kt @@ -109,7 +109,7 @@ class RInlineTransformer : ClassTransformer { override fun onPostTransform(context: TransformContext) { val totalSize = removedR.map { it.value }.sum() - val maxWidth = removedR.map { it.key.length }.maxOrNull()?.plus(10) ?: 10 + val maxWidth = removedR.map { it.key.length }.max()?.plus(10) ?: 10 this.logger.run { println("Delete files:") removedR.toSortedMap().forEach { diff --git a/booster-transform-service-loader/src/main/kotlin/com/didiglobal/booster/transform/serviceloader/ServiceLoaderTransformer.kt b/booster-transform-service-loader/src/main/kotlin/com/didiglobal/booster/transform/serviceloader/ServiceLoaderTransformer.kt index 41aeb5c01..391fabd8c 100644 --- a/booster-transform-service-loader/src/main/kotlin/com/didiglobal/booster/transform/serviceloader/ServiceLoaderTransformer.kt +++ b/booster-transform-service-loader/src/main/kotlin/com/didiglobal/booster/transform/serviceloader/ServiceLoaderTransformer.kt @@ -145,7 +145,7 @@ private val File.services: List>> }.map { spi -> spi.name to spi.readLines().services } - isFile -> when (extension.lowercase()) { + isFile -> when (extension.toLowerCase()) { "jar" -> ZipFile(this).use { zip -> zip.entries() .asSequence() diff --git a/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/ArgumentsParser.kt b/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/ArgumentsParser.kt index 96ee27ea7..dcea014dd 100644 --- a/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/ArgumentsParser.kt +++ b/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/ArgumentsParser.kt @@ -64,6 +64,6 @@ class ArgumentsParser(private val signature: String, private val offset: Int = 0 return buf.toString() } - private fun nextChar() = if (pos < limit) signature[pos++].code else -1 + private fun nextChar() = if (pos < limit) signature[pos++].toInt() else -1 } diff --git a/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/transform.kt b/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/transform.kt index b5b136a6c..464239794 100644 --- a/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/transform.kt +++ b/booster-transform-util/src/main/kotlin/com/didiglobal/booster/transform/util/transform.kt @@ -37,7 +37,7 @@ fun File.transform(output: File, transformer: (ByteArray) -> ByteArray = { it -> it.transform(File(output, base.relativize(it.toURI()).path), transformer) } } - isFile -> when (extension.lowercase()) { + isFile -> when (extension.toLowerCase()) { "jar" -> JarFile(this).use { it.transform(output, ::JarArchiveEntry, transformer) } diff --git a/gradle/booster.gradle b/gradle/booster.gradle index e53909d3f..5f9698dcd 100644 --- a/gradle/booster.gradle +++ b/gradle/booster.gradle @@ -25,11 +25,17 @@ sourceSets { } compileKotlin { - kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 + kotlinOptions{ + jvmTarget = JavaVersion.VERSION_1_8 + apiVersion = "1.3" + } } compileTestKotlin { - kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 + kotlinOptions{ + jvmTarget = JavaVersion.VERSION_1_8 + apiVersion = "1.3" + } } dependencies { diff --git a/gradle/functional-test.gradle b/gradle/functional-test.gradle index b686abb3d..caffdf16e 100644 --- a/gradle/functional-test.gradle +++ b/gradle/functional-test.gradle @@ -26,10 +26,15 @@ task functionalTest(type: Test) { testLogging { events "passed", "skipped", "failed", "standardError" } + systemProperty('gradle.args', 'buildEnv dependencies assemble -S') + systemProperty 'android.minsdk.version', 18 } check.dependsOn functionalTest compileFunctionalTestKotlin { - kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + apiVersion = "1.3" + } } \ No newline at end of file diff --git a/gradle/integration-test.gradle b/gradle/integration-test.gradle index 7693ebf2d..7dc1f35bf 100644 --- a/gradle/integration-test.gradle +++ b/gradle/integration-test.gradle @@ -26,12 +26,17 @@ task integrationTest(type: Test) { testLogging { events "passed", "skipped", "failed", "standardOut", "standardError" } + systemProperty('gradle.args', 'buildEnv dependencies assemble -S') + systemProperty 'android.minsdk.version', 18 } check.dependsOn integrationTest compileIntegrationTestKotlin { - kotlinOptions.jvmTarget = JavaVersion.VERSION_1_8 + kotlinOptions { + jvmTarget = JavaVersion.VERSION_1_8 + apiVersion = "1.3" + } } tasks.withType(ProcessResources).configureEach {