From d62ca3afa231719fd285e3d196d1f9f810ca3182 Mon Sep 17 00:00:00 2001
From: neighbWang
Date: Mon, 25 Sep 2023 19:07:05 +0800
Subject: [PATCH] Support AGP 8.0 & 8.1 & 8.2
---
.github/workflows/dokka.yml | 2 +-
.github/workflows/publish.yml | 6 +-
.github/workflows/test.yml | 247 +--------
booster-aapt2/build.gradle | 4 +-
.../src/main/java/android/os/Build.java | 2 -
.../src/main/java/android/util/Log.java | 5 +-
.../java/android/view/ViewTreeObserver.java | 1 -
booster-android-gradle-api/build.gradle | 19 +-
.../didiglobal/booster/gradle/BaseVariant.kt | 375 --------------
.../com/didiglobal/booster/gradle/Context.kt | 7 -
.../com/didiglobal/booster/gradle/Project.kt | 71 +--
.../booster/gradle/ResolvedArtifactResults.kt | 11 +-
.../booster/gradle/TransformInvocation.kt | 64 ---
.../booster/gradle/TransformManager.kt | 16 -
.../com/didiglobal/booster/gradle/Variant.kt | 262 ++++++++++
.../com/didiglobal/booster/gradle/Version.kt | 18 +-
booster-android-gradle-compat/build.gradle | 4 +-
.../didiglobal/booster/gradle/AGPInterface.kt | 165 +++---
booster-android-gradle-v3_3/README.md | 6 -
booster-android-gradle-v3_3/build.gradle | 19 -
.../android/gradle/v3_3/V33IntegrationTest.kt | 475 -----------------
.../booster/android/gradle/v3_3/V33.kt | 253 ---------
.../booster/android/gradle/v3_3/V33Factory.kt | 15 -
booster-android-gradle-v3_4/build.gradle | 19 -
.../android/gradle/v3_4/V34IntegrationTest.kt | 475 -----------------
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../booster/android/gradle/v3_4/V34.kt | 255 ----------
booster-android-gradle-v3_5/README.md | 6 -
booster-android-gradle-v3_5/build.gradle | 19 -
.../android/gradle/v3_5/V35IntegrationTest.kt | 476 -----------------
.../booster/android/gradle/v3_5/V35.kt | 254 ---------
booster-android-gradle-v3_6/README.md | 6 -
booster-android-gradle-v3_6/build.gradle | 19 -
.../android/gradle/v3_6/V36IntegrationTest.kt | 479 -----------------
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v3_6/V36.kt | 264 ----------
.../booster/android/gradle/v3_6/V36Factory.kt | 15 -
booster-android-gradle-v4_0/README.md | 6 -
booster-android-gradle-v4_0/build.gradle | 19 -
.../android/gradle/v4_0/V40IntegrationTest.kt | 481 ------------------
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v4_0/V40.kt | 286 -----------
.../booster/android/gradle/v4_0/V40Factory.kt | 15 -
booster-android-gradle-v4_1/README.md | 6 -
booster-android-gradle-v4_1/build.gradle | 19 -
.../android/gradle/v4_1/V41IntegrationTest.kt | 481 ------------------
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v4_1/V41.kt | 299 -----------
.../booster/android/gradle/v4_1/V41Factory.kt | 15 -
booster-android-gradle-v4_2/README.md | 6 -
booster-android-gradle-v4_2/build.gradle | 19 -
.../android/gradle/v4_2/V42IntegrationTest.kt | 481 ------------------
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v4_2/V42.kt | 300 -----------
.../booster/android/gradle/v4_2/V42Factory.kt | 15 -
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v7_0/V70.kt | 308 -----------
.../booster/android/gradle/v7_0/V70Factory.kt | 15 -
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v7_1/V71.kt | 304 -----------
.../booster/android/gradle/v7_1/V71Factory.kt | 15 -
.../android/gradle/v7_2/V72IntegrationTest.kt | 478 -----------------
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v7_2/V72.kt | 314 ------------
.../booster/android/gradle/v7_2/V72Factory.kt | 15 -
booster-android-gradle-v7_3/README.md | 6 -
booster-android-gradle-v7_3/build.gradle | 27 -
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v7_3/V73.kt | 328 ------------
.../booster/android/gradle/v7_3/V73Factory.kt | 15 -
booster-android-gradle-v7_4/README.md | 6 -
booster-android-gradle-v7_4/build.gradle | 27 -
.../android/gradle/v7_4/V74IntegrationTest.kt | 480 -----------------
.../src/integrationTest/resources/app.gradle | 60 ---
.../resources/buildSrc/build.gradle | 24 -
.../src/integrationTest/resources/lib.gradle | 57 ---
.../resources/src/main/AndroidManifest.xml | 9 -
.../booster/android/test/MainActivity.java | 6 -
.../booster/android/test/TestApplication.java | 7 -
.../resources/src/main/res/values/strings.xml | 4 -
.../booster/android/gradle/v7_4/V74.kt | 333 ------------
.../booster/android/gradle/v7_4/V74Factory.kt | 15 -
.../README.md | 6 +-
.../build.gradle | 7 +-
.../android/gradle/v8_0/V80IntegrationTest.kt | 252 ++++-----
.../src/integrationTest/resources/app.gradle | 3 +-
.../resources/buildSrc/build.gradle | 2 +-
.../src/integrationTest/resources/lib.gradle | 3 +-
.../resources/src/main/AndroidManifest.xml | 7 +-
.../booster/android/test/MainActivity.java | 0
.../booster/android/test/TestApplication.java | 0
.../resources/src/main/res/values/strings.xml | 0
.../booster/android/gradle/v8_0/V80.kt | 333 ++++++++++++
.../booster/android/gradle/v8_0/V80Factory.kt | 16 +
.../README.md | 6 +-
.../build.gradle | 8 +-
.../android/gradle/v8_1/V81IntegrationTest.kt | 254 ++++-----
.../src/integrationTest/resources/app.gradle | 3 +-
.../resources/buildSrc/build.gradle | 2 +-
.../src/integrationTest/resources/lib.gradle | 3 +-
.../resources/src/main/AndroidManifest.xml | 7 +-
.../booster/android/test/MainActivity.java | 0
.../booster/android/test/TestApplication.java | 0
.../resources/src/main/res/values/strings.xml | 0
.../booster/android/gradle/v8_1/V81.kt | 336 ++++++++++++
.../booster/android/gradle/v8_1/V81Factory.kt | 8 +-
.../README.md | 6 +-
.../build.gradle | 8 +-
.../android/gradle/v8_2/V82IntegrationTest.kt | 272 ++++------
.../src/integrationTest/resources/app.gradle | 3 +-
.../resources/buildSrc/build.gradle | 2 +-
.../src/integrationTest/resources/lib.gradle | 3 +-
.../resources/src/main/AndroidManifest.xml | 7 +-
.../booster/android/test/MainActivity.java | 0
.../booster/android/test/TestApplication.java | 0
.../resources/src/main/res/values/strings.xml | 0
.../booster/android/gradle/v8_2/V82.kt | 336 ++++++++++++
.../booster/android/gradle/v8_2/V82Factory.kt | 8 +-
.../build.gradle | 7 -
.../instrument/ShadowSharedPreferences.java | 30 --
.../BoosterSharedPreferences.java | 317 ------------
.../SharedPreferencesManager.java | 143 ------
.../io/BoosterXmlSerializer.java | 335 ------------
.../sharedpreferences/io/IoUtils.java | 22 -
.../sharedpreferences/io/XmlUtils.java | 389 --------------
.../build.gradle | 7 -
.../booster/instrument/ShadowWebView.java | 58 ---
booster-api/build.gradle | 4 +-
.../booster/RelativeResourceUtils.kt | 155 ++++++
.../transform/VariantTransformHelper.kt | 25 +-
booster-gradle-plugin/build.gradle | 5 +-
.../booster/gradle/BoosterPlugin.kt | 54 +-
.../booster/gradle/BoosterTransform.kt | 77 ---
.../gradle/BoosterTransformInvocation.kt | 275 ----------
.../booster/gradle/BoosterTransformTask.kt | 221 ++++++++
.../BoosterTransformTaskExecutionListener.kt | 25 -
.../booster/gradle/ServiceLoader.kt | 8 +
.../booster/gradle/TransformParameter.kt | 19 -
.../gradle/internal/BoosterTransformV34.kt | 23 -
.../didiglobal/booster/gradle/util/Dexer.kt | 63 ---
.../com/didiglobal/booster/kotlinx/text.kt | 5 +
booster-task-analyser/README.md | 78 ---
booster-task-analyser/build.gradle | 13 -
.../booster/task/analyser/AnalysisTask.kt | 38 --
.../task/analyser/AnalysisVariantProcessor.kt | 83 ---
.../analyser/performance/LayoutHandler.kt | 17 -
.../performance/PerformanceAnalyser.kt | 454 -----------------
.../performance/PerformanceAnalysisTask.kt | 35 --
.../task/analyser/performance/constants.kt | 86 ----
.../reference/ReferenceAnalysisTask.kt | 83 ---
.../reference/ReferencePageRenderer.kt | 58 ---
.../src/main/resources/blacklist.txt | 166 ------
.../src/main/resources/style.css | 7 -
.../src/main/resources/whitelist.txt | 2 -
.../java/androidx/annotation/MainThread.java | 11 -
.../org/greenrobot/eventbus/Subscribe.java | 14 -
.../org/greenrobot/eventbus/ThreadMode.java | 9 -
.../booster/task/analyser/AnalyserTaskTest.kt | 20 -
.../task/analyser/AnnotationExample1.kt | 20 -
.../task/analyser/AnnotationExample2.kt | 24 -
.../booster/task/analyser/URITest.kt | 18 -
.../test/resources/AnnotationExample1.class | Bin 971 -> 0 bytes
.../test/resources/AnnotationExample2.class | Bin 1073 -> 0 bytes
booster-task-check-snapshot/README.md | 12 -
booster-task-check-snapshot/build.gradle | 9 -
.../booster/task/dependency/CheckSnapshot.kt | 31 --
.../CheckSnapshotVariantProcessor.kt | 40 --
booster-task-compression-cwebp/README.md | 24 -
booster-task-compression-cwebp/build.gradle | 10 -
.../cwebp/AbstractCwebpCompressImages.kt | 24 -
.../task/compression/cwebp/CWebpProvider.kt | 17 -
.../booster/task/compression/cwebp/Cwebp.kt | 82 ---
.../cwebp/CwebpCompressFlatImages.kt | 106 ----
.../compression/cwebp/CwebpCompressImages.kt | 55 --
.../cwebp/CwebpCompressOpaqueFlatImages.kt | 17 -
.../cwebp/CwebpCompressOpaqueImages.kt | 41 --
.../cwebp/CwebpCompressionVariantProcessor.kt | 43 --
.../compression/cwebp/LauncherIconHandler.kt | 31 --
.../src/main/resources/bin/linux/x64/cwebp | Bin 2419040 -> 0 bytes
.../src/main/resources/bin/macosx/arm64/cwebp | Bin 2510232 -> 0 bytes
.../main/resources/bin/macosx/x64/10.12/cwebp | Bin 1417248 -> 0 bytes
.../main/resources/bin/macosx/x64/10.13/cwebp | Bin 1467212 -> 0 bytes
.../main/resources/bin/macosx/x64/10.14/cwebp | Bin 1479480 -> 0 bytes
.../main/resources/bin/macosx/x64/10.15/cwebp | Bin 2089788 -> 0 bytes
.../main/resources/bin/windows/x64/cwebp.exe | Bin 713216 -> 0 bytes
.../compression/cwebp/CwebpProviderTest.kt | 17 -
booster-task-compression-pngquant/README.md | 31 --
.../build.gradle | 11 -
.../AbstractPngquantCompressImages.kt | 25 -
.../task/compression/pngquant/Pngquant.kt | 39 --
.../pngquant/PngquantCompressFlatImages.kt | 86 ----
.../pngquant/PngquantCompressImages.kt | 48 --
.../PngquantCompressionVariantProcessor.kt | 53 --
.../compression/pngquant/PngquantOptions.kt | 5 -
.../README.md | 3 -
.../build.gradle | 10 -
...sedResourcesCompressionVariantProcessor.kt | 160 ------
booster-task-compression/README.md | 3 -
booster-task-compression/build.gradle | 12 -
booster-task-compression/packages-zh-CN.md | 8 -
.../booster/compression/CompressionOptions.kt | 5 -
.../booster/compression/CompressionReport.kt | 92 ----
.../compression/CompressionTaskCreator.kt | 61 ---
.../CompressionTaskCreatorFactory.kt | 15 -
.../booster/compression/CompressionTool.kt | 15 -
.../SimpleCompressionTaskCreator.kt | 92 ----
.../compression/task/CompressImages.kt | 93 ----
.../booster/task/compression/FileNameTest.kt | 21 -
booster-task-graph/build.gradle | 4 +-
.../task/graph/GraphVariantProcessor.kt | 17 +-
booster-task-list-artifact/build.gradle | 4 +-
.../booster/task/artifact/ListArtifact.kt | 4 +-
.../artifact/ListArtifactVariantProcessor.kt | 8 +-
booster-task-list-permission/build.gradle | 4 +-
.../booster/task/permission/ListPermission.kt | 77 +--
.../ListPermissionVariantProcessor.kt | 11 +-
booster-task-list-shared-library/build.gradle | 4 +-
.../booster/task/so/ListSharedLibrary.kt | 4 +-
.../so/ListSharedLibraryVariantProcessor.kt | 8 +-
booster-task-resource-deredundancy/README.md | 2 -
.../build.gradle | 10 -
.../resource/deredundancy/LayoutDirHandler.kt | 16 -
.../deredundancy/RemoveRedundantFlatImages.kt | 81 ---
.../deredundancy/RemoveRedundantImages.kt | 46 --
.../ResourceDeredundancyVariantProcessor.kt | 62 ---
booster-task-spi/build.gradle | 5 +-
.../booster/task/spi/VariantProcessor.kt | 14 +-
.../build.gradle | 4 +-
.../ActivityThreadVariantProcessor.kt | 26 +
.../ActivityThreadVarinatProcessor.kt | 23 -
booster-transform-asm/build.gradle | 10 +-
booster-transform-br-inline/README.md | 4 -
booster-transform-br-inline/build.gradle | 8 -
.../br/inline/BRInlineTransformer.kt | 130 -----
.../booster/transform/br/inline/SymbolList.kt | 63 ---
.../transform/br/inline/SymbolListTest.kt | 18 -
.../src/test/resources/BR.class | Bin 553 -> 0 bytes
.../build.gradle | 4 +-
.../FinalizerWatchdogDaemonTransformer.kt | 3 +-
...FinalizerWatchdogDaemonVariantProcessor.kt | 20 +-
booster-transform-logcat/build.gradle | 4 +-
.../transform/logcat/LogcatTransformer.kt | 3 +-
.../logcat/LogcatVariantProcessor.kt | 25 +
.../logcat/LogcatVarinatProcessor.kt | 22 -
booster-transform-media-player/build.gradle | 4 +-
.../mediaplayer/MediaPlayerTransformer.kt | 3 +-
.../MediaPlayerVariantProcessor.kt | 25 +
.../MediaPlayerVarinatProcessor.kt | 23 -
.../transform/r/inline/RInlineTransformer.kt | 5 +-
booster-transform-res-check/build.gradle | 4 +-
.../res/check/ResCheckVariantProcessor.kt | 25 +
.../res/check/ResCheckVarinatProcessor.kt | 22 -
booster-transform-service-loader/README.md | 17 -
booster-transform-service-loader/build.gradle | 9 -
.../serviceloader/ServiceLoaderTransformer.kt | 176 -------
.../build.gradle | 9 -
.../SharedPreferencesTransformer.kt | 93 ----
.../SharedPreferencesVariantProcessor.kt | 23 -
booster-transform-thread/build.gradle | 4 +-
.../thread/ThreadVariantProcessor.kt | 19 +-
booster-transform-toast/build.gradle | 4 +-
.../transform/toast/ToastVariantProcessor.kt | 19 +-
booster-transform-webview/build.gradle | 9 -
.../transform/webview/WebViewTransformer.kt | 86 ----
.../webview/WebViewVariantProcessor.kt | 22 -
build.gradle | 31 +-
gradle.properties | 2 +-
gradle/booster.gradle | 13 +-
gradle/functional-test.gradle | 2 +-
gradle/integration-test.gradle | 2 +-
gradle/wrapper/gradle-wrapper.properties | 2 +-
settings.gradle.kts | 28 +-
319 files changed, 2436 insertions(+), 16815 deletions(-)
delete mode 100644 booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/BaseVariant.kt
delete mode 100644 booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Context.kt
delete mode 100644 booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/TransformInvocation.kt
delete mode 100644 booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/TransformManager.kt
create mode 100644 booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Variant.kt
delete mode 100644 booster-android-gradle-v3_3/README.md
delete mode 100644 booster-android-gradle-v3_3/build.gradle
delete mode 100644 booster-android-gradle-v3_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33IntegrationTest.kt
delete mode 100644 booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33.kt
delete mode 100644 booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33Factory.kt
delete mode 100644 booster-android-gradle-v3_4/build.gradle
delete mode 100644 booster-android-gradle-v3_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34IntegrationTest.kt
delete mode 100644 booster-android-gradle-v3_4/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v3_4/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34.kt
delete mode 100644 booster-android-gradle-v3_5/README.md
delete mode 100644 booster-android-gradle-v3_5/build.gradle
delete mode 100644 booster-android-gradle-v3_5/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35IntegrationTest.kt
delete mode 100644 booster-android-gradle-v3_5/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35.kt
delete mode 100644 booster-android-gradle-v3_6/README.md
delete mode 100644 booster-android-gradle-v3_6/build.gradle
delete mode 100644 booster-android-gradle-v3_6/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36IntegrationTest.kt
delete mode 100644 booster-android-gradle-v3_6/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v3_6/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v3_6/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36.kt
delete mode 100644 booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36Factory.kt
delete mode 100644 booster-android-gradle-v4_0/README.md
delete mode 100644 booster-android-gradle-v4_0/build.gradle
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40IntegrationTest.kt
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v4_0/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40.kt
delete mode 100644 booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40Factory.kt
delete mode 100644 booster-android-gradle-v4_1/README.md
delete mode 100644 booster-android-gradle-v4_1/build.gradle
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41IntegrationTest.kt
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v4_1/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41.kt
delete mode 100644 booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41Factory.kt
delete mode 100644 booster-android-gradle-v4_2/README.md
delete mode 100644 booster-android-gradle-v4_2/build.gradle
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42IntegrationTest.kt
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v4_2/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42.kt
delete mode 100644 booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42Factory.kt
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v7_0/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70.kt
delete mode 100644 booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70Factory.kt
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v7_1/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71.kt
delete mode 100644 booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71Factory.kt
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72IntegrationTest.kt
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v7_2/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72.kt
delete mode 100644 booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72Factory.kt
delete mode 100644 booster-android-gradle-v7_3/README.md
delete mode 100644 booster-android-gradle-v7_3/build.gradle
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v7_3/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v7_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73.kt
delete mode 100644 booster-android-gradle-v7_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73Factory.kt
delete mode 100644 booster-android-gradle-v7_4/README.md
delete mode 100644 booster-android-gradle-v7_4/build.gradle
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_4/V74IntegrationTest.kt
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/app.gradle
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/buildSrc/build.gradle
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/lib.gradle
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/src/main/AndroidManifest.xml
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
delete mode 100644 booster-android-gradle-v7_4/src/integrationTest/resources/src/main/res/values/strings.xml
delete mode 100644 booster-android-gradle-v7_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_4/V74.kt
delete mode 100644 booster-android-gradle-v7_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_4/V74Factory.kt
rename {booster-android-gradle-v7_0 => booster-android-gradle-v8_0}/README.md (66%)
rename {booster-android-gradle-v7_0 => booster-android-gradle-v8_0}/build.gradle (81%)
rename booster-android-gradle-v7_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70IntegrationTest.kt => booster-android-gradle-v8_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v8_0/V80IntegrationTest.kt (57%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_0}/src/integrationTest/resources/app.gradle (93%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_0}/src/integrationTest/resources/buildSrc/build.gradle (90%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_0}/src/integrationTest/resources/lib.gradle (92%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_0}/src/integrationTest/resources/src/main/AndroidManifest.xml (53%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_0}/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java (100%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_0}/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java (100%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_0}/src/integrationTest/resources/src/main/res/values/strings.xml (100%)
create mode 100644 booster-android-gradle-v8_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v8_0/V80.kt
create mode 100644 booster-android-gradle-v8_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v8_0/V80Factory.kt
rename {booster-android-gradle-v7_1 => booster-android-gradle-v8_1}/README.md (66%)
rename {booster-android-gradle-v7_1 => booster-android-gradle-v8_1}/build.gradle (77%)
rename booster-android-gradle-v7_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71IntegrationTest.kt => booster-android-gradle-v8_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v8_1/V81IntegrationTest.kt (56%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_1}/src/integrationTest/resources/app.gradle (93%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_1}/src/integrationTest/resources/buildSrc/build.gradle (90%)
rename {booster-android-gradle-v3_3 => booster-android-gradle-v8_1}/src/integrationTest/resources/lib.gradle (92%)
rename {booster-android-gradle-v3_4 => booster-android-gradle-v8_1}/src/integrationTest/resources/src/main/AndroidManifest.xml (53%)
rename {booster-android-gradle-v3_4 => booster-android-gradle-v8_1}/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java (100%)
rename {booster-android-gradle-v3_4 => booster-android-gradle-v8_1}/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java (100%)
rename {booster-android-gradle-v3_4 => booster-android-gradle-v8_1}/src/integrationTest/resources/src/main/res/values/strings.xml (100%)
create mode 100644 booster-android-gradle-v8_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v8_1/V81.kt
rename booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34Factory.kt => booster-android-gradle-v8_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v8_1/V81Factory.kt (53%)
rename {booster-android-gradle-v7_2 => booster-android-gradle-v8_2}/README.md (66%)
rename {booster-android-gradle-v7_2 => booster-android-gradle-v8_2}/build.gradle (77%)
rename booster-android-gradle-v7_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_3/V73IntegrationTest.kt => booster-android-gradle-v8_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v8_2/V82IntegrationTest.kt (54%)
rename {booster-android-gradle-v3_6 => booster-android-gradle-v8_2}/src/integrationTest/resources/app.gradle (93%)
rename {booster-android-gradle-v3_6 => booster-android-gradle-v8_2}/src/integrationTest/resources/buildSrc/build.gradle (90%)
rename {booster-android-gradle-v3_4 => booster-android-gradle-v8_2}/src/integrationTest/resources/lib.gradle (92%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_2}/src/integrationTest/resources/src/main/AndroidManifest.xml (53%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_2}/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java (100%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_2}/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java (100%)
rename {booster-android-gradle-v3_5 => booster-android-gradle-v8_2}/src/integrationTest/resources/src/main/res/values/strings.xml (100%)
create mode 100644 booster-android-gradle-v8_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v8_2/V82.kt
rename booster-android-gradle-v3_5/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35Factory.kt => booster-android-gradle-v8_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v8_2/V82Factory.kt (53%)
delete mode 100644 booster-android-instrument-shared-preferences/build.gradle
delete mode 100644 booster-android-instrument-shared-preferences/src/main/java/com/didiglobal/booster/instrument/ShadowSharedPreferences.java
delete mode 100755 booster-android-instrument-shared-preferences/src/main/java/com/didiglobal/booster/instrument/sharedpreferences/BoosterSharedPreferences.java
delete mode 100755 booster-android-instrument-shared-preferences/src/main/java/com/didiglobal/booster/instrument/sharedpreferences/SharedPreferencesManager.java
delete mode 100755 booster-android-instrument-shared-preferences/src/main/java/com/didiglobal/booster/instrument/sharedpreferences/io/BoosterXmlSerializer.java
delete mode 100644 booster-android-instrument-shared-preferences/src/main/java/com/didiglobal/booster/instrument/sharedpreferences/io/IoUtils.java
delete mode 100755 booster-android-instrument-shared-preferences/src/main/java/com/didiglobal/booster/instrument/sharedpreferences/io/XmlUtils.java
delete mode 100644 booster-android-instrument-webview/build.gradle
delete mode 100644 booster-android-instrument-webview/src/main/java/com/didiglobal/booster/instrument/ShadowWebView.java
create mode 100644 booster-api/src/main/kotlin/com/didiglobal/booster/RelativeResourceUtils.kt
delete mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/BoosterTransform.kt
delete mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/BoosterTransformInvocation.kt
create mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/BoosterTransformTask.kt
delete mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/BoosterTransformTaskExecutionListener.kt
delete mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/TransformParameter.kt
delete mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/internal/BoosterTransformV34.kt
delete mode 100644 booster-gradle-plugin/src/main/kotlin/com/didiglobal/booster/gradle/util/Dexer.kt
delete mode 100644 booster-task-analyser/README.md
delete mode 100644 booster-task-analyser/build.gradle
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/AnalysisTask.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/AnalysisVariantProcessor.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/performance/LayoutHandler.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/performance/PerformanceAnalyser.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/performance/PerformanceAnalysisTask.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/performance/constants.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/reference/ReferenceAnalysisTask.kt
delete mode 100644 booster-task-analyser/src/main/kotlin/com/didiglobal/booster/task/analyser/reference/ReferencePageRenderer.kt
delete mode 100644 booster-task-analyser/src/main/resources/blacklist.txt
delete mode 100644 booster-task-analyser/src/main/resources/style.css
delete mode 100644 booster-task-analyser/src/main/resources/whitelist.txt
delete mode 100644 booster-task-analyser/src/test/java/androidx/annotation/MainThread.java
delete mode 100644 booster-task-analyser/src/test/java/org/greenrobot/eventbus/Subscribe.java
delete mode 100644 booster-task-analyser/src/test/java/org/greenrobot/eventbus/ThreadMode.java
delete mode 100644 booster-task-analyser/src/test/kotlin/com/didiglobal/booster/task/analyser/AnalyserTaskTest.kt
delete mode 100644 booster-task-analyser/src/test/kotlin/com/didiglobal/booster/task/analyser/AnnotationExample1.kt
delete mode 100644 booster-task-analyser/src/test/kotlin/com/didiglobal/booster/task/analyser/AnnotationExample2.kt
delete mode 100644 booster-task-analyser/src/test/kotlin/com/didiglobal/booster/task/analyser/URITest.kt
delete mode 100644 booster-task-analyser/src/test/resources/AnnotationExample1.class
delete mode 100644 booster-task-analyser/src/test/resources/AnnotationExample2.class
delete mode 100644 booster-task-check-snapshot/README.md
delete mode 100644 booster-task-check-snapshot/build.gradle
delete mode 100644 booster-task-check-snapshot/src/main/kotlin/com/didiglobal/booster/task/dependency/CheckSnapshot.kt
delete mode 100644 booster-task-check-snapshot/src/main/kotlin/com/didiglobal/booster/task/dependency/CheckSnapshotVariantProcessor.kt
delete mode 100644 booster-task-compression-cwebp/README.md
delete mode 100644 booster-task-compression-cwebp/build.gradle
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/AbstractCwebpCompressImages.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/CWebpProvider.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/Cwebp.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/CwebpCompressFlatImages.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/CwebpCompressImages.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/CwebpCompressOpaqueFlatImages.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/CwebpCompressOpaqueImages.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/CwebpCompressionVariantProcessor.kt
delete mode 100644 booster-task-compression-cwebp/src/main/kotlin/com/didiglobal/booster/task/compression/cwebp/LauncherIconHandler.kt
delete mode 100644 booster-task-compression-cwebp/src/main/resources/bin/linux/x64/cwebp
delete mode 100755 booster-task-compression-cwebp/src/main/resources/bin/macosx/arm64/cwebp
delete mode 100644 booster-task-compression-cwebp/src/main/resources/bin/macosx/x64/10.12/cwebp
delete mode 100644 booster-task-compression-cwebp/src/main/resources/bin/macosx/x64/10.13/cwebp
delete mode 100644 booster-task-compression-cwebp/src/main/resources/bin/macosx/x64/10.14/cwebp
delete mode 100755 booster-task-compression-cwebp/src/main/resources/bin/macosx/x64/10.15/cwebp
delete mode 100644 booster-task-compression-cwebp/src/main/resources/bin/windows/x64/cwebp.exe
delete mode 100644 booster-task-compression-cwebp/src/test/kotlin/com/didiglobal/booster/task/compression/cwebp/CwebpProviderTest.kt
delete mode 100644 booster-task-compression-pngquant/README.md
delete mode 100644 booster-task-compression-pngquant/build.gradle
delete mode 100644 booster-task-compression-pngquant/src/main/kotlin/com/didiglobal/booster/task/compression/pngquant/AbstractPngquantCompressImages.kt
delete mode 100644 booster-task-compression-pngquant/src/main/kotlin/com/didiglobal/booster/task/compression/pngquant/Pngquant.kt
delete mode 100644 booster-task-compression-pngquant/src/main/kotlin/com/didiglobal/booster/task/compression/pngquant/PngquantCompressFlatImages.kt
delete mode 100644 booster-task-compression-pngquant/src/main/kotlin/com/didiglobal/booster/task/compression/pngquant/PngquantCompressImages.kt
delete mode 100644 booster-task-compression-pngquant/src/main/kotlin/com/didiglobal/booster/task/compression/pngquant/PngquantCompressionVariantProcessor.kt
delete mode 100644 booster-task-compression-pngquant/src/main/kotlin/com/didiglobal/booster/task/compression/pngquant/PngquantOptions.kt
delete mode 100644 booster-task-compression-processed-res/README.md
delete mode 100644 booster-task-compression-processed-res/build.gradle
delete mode 100644 booster-task-compression-processed-res/src/main/kotlin/com/didiglobal/booster/task/compression/processed/res/ProcessedResourcesCompressionVariantProcessor.kt
delete mode 100644 booster-task-compression/README.md
delete mode 100644 booster-task-compression/build.gradle
delete mode 100644 booster-task-compression/packages-zh-CN.md
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionOptions.kt
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionReport.kt
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionTaskCreator.kt
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionTaskCreatorFactory.kt
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/CompressionTool.kt
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/SimpleCompressionTaskCreator.kt
delete mode 100644 booster-task-compression/src/main/kotlin/com/didiglobal/booster/compression/task/CompressImages.kt
delete mode 100644 booster-task-compression/src/test/kotlin/com/didiglobal/booster/task/compression/FileNameTest.kt
delete mode 100644 booster-task-resource-deredundancy/README.md
delete mode 100644 booster-task-resource-deredundancy/build.gradle
delete mode 100644 booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/LayoutDirHandler.kt
delete mode 100644 booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/RemoveRedundantFlatImages.kt
delete mode 100644 booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/RemoveRedundantImages.kt
delete mode 100644 booster-task-resource-deredundancy/src/main/kotlin/com/didiglobal/booster/task/resource/deredundancy/ResourceDeredundancyVariantProcessor.kt
create mode 100644 booster-transform-activity-thread/src/main/kotlin/com/didiglobal/booster/transform/activitythread/ActivityThreadVariantProcessor.kt
delete mode 100644 booster-transform-activity-thread/src/main/kotlin/com/didiglobal/booster/transform/activitythread/ActivityThreadVarinatProcessor.kt
delete mode 100644 booster-transform-br-inline/README.md
delete mode 100644 booster-transform-br-inline/build.gradle
delete mode 100644 booster-transform-br-inline/src/main/kotlin/com/didiglobal/booster/transform/br/inline/BRInlineTransformer.kt
delete mode 100644 booster-transform-br-inline/src/main/kotlin/com/didiglobal/booster/transform/br/inline/SymbolList.kt
delete mode 100644 booster-transform-br-inline/src/test/kotlin/com/didiglobal/booster/transform/br/inline/SymbolListTest.kt
delete mode 100644 booster-transform-br-inline/src/test/resources/BR.class
create mode 100644 booster-transform-logcat/src/main/kotlin/com/didiglobal/booster/transform/logcat/LogcatVariantProcessor.kt
delete mode 100644 booster-transform-logcat/src/main/kotlin/com/didiglobal/booster/transform/logcat/LogcatVarinatProcessor.kt
create mode 100644 booster-transform-media-player/src/main/kotlin/com/didiglobal/booster/transform/mediaplayer/MediaPlayerVariantProcessor.kt
delete mode 100644 booster-transform-media-player/src/main/kotlin/com/didiglobal/booster/transform/mediaplayer/MediaPlayerVarinatProcessor.kt
create mode 100644 booster-transform-res-check/src/main/kotlin/com/didiglobal/booster/transform/res/check/ResCheckVariantProcessor.kt
delete mode 100644 booster-transform-res-check/src/main/kotlin/com/didiglobal/booster/transform/res/check/ResCheckVarinatProcessor.kt
delete mode 100644 booster-transform-service-loader/README.md
delete mode 100644 booster-transform-service-loader/build.gradle
delete mode 100644 booster-transform-service-loader/src/main/kotlin/com/didiglobal/booster/transform/serviceloader/ServiceLoaderTransformer.kt
delete mode 100644 booster-transform-shared-preferences/build.gradle
delete mode 100644 booster-transform-shared-preferences/src/main/kotlin/com/didiglobal/booster/transform/sharedpreferences/SharedPreferencesTransformer.kt
delete mode 100644 booster-transform-shared-preferences/src/main/kotlin/com/didiglobal/booster/transform/sharedpreferences/SharedPreferencesVariantProcessor.kt
delete mode 100644 booster-transform-webview/build.gradle
delete mode 100644 booster-transform-webview/src/main/kotlin/com/didiglobal/booster/transform/webview/WebViewTransformer.kt
delete mode 100644 booster-transform-webview/src/main/kotlin/com/didiglobal/booster/transform/webview/WebViewVariantProcessor.kt
diff --git a/.github/workflows/dokka.yml b/.github/workflows/dokka.yml
index 96d009ed4..df9d2d81e 100644
--- a/.github/workflows/dokka.yml
+++ b/.github/workflows/dokka.yml
@@ -19,7 +19,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- shell: bash
run: ./gradlew reference -S --no-daemon
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 1e108f431..2d58afe7a 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -16,7 +16,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- shell: bash
run: |
@@ -24,8 +24,8 @@ jobs:
echo $GPG_KEY_ARMOR | base64 --decode > $GITHUB_WORKSPACE/secring.gpg
./gradlew publishToSonatype closeAndReleaseStagingRepository -Pversion=${GITHUB_REF/refs\/tags\/v/} -POSSRH_USERNAME=${OSSRH_USERNAME} -POSSRH_PASSWORD=${OSSRH_PASSWORD} -POSSRH_STAGING_PROFILE_ID=${OSSRH_STAGING_PROFILE_ID} -Psigning.keyId=${GPG_KEY_ID} -Psigning.password=${GPG_PASSPHRASE} -Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/secring.gpg -S --no-daemon
env:
- JAVA_OPTS: -Xmx8g -XX:MaxPermSize=1g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
- JVM_OPTS: -Xmx8g -XX:MaxPermSize=1g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
+ JAVA_OPTS: -Xmx8g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
+ JVM_OPTS: -Xmx8g -XX:MetaspaceSize=1g -Dfile.encoding=UTF-8
GPG_KEY_ARMOR: ${{ secrets.GPG_KEY_ARMOR }}
GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index cdf96b391..7f16192a4 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -29,7 +29,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- uses: actions/cache@v3
with:
@@ -55,7 +55,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- uses: actions/cache@v3
with:
@@ -73,8 +73,8 @@ jobs:
name: unit-test-report
path: '**/build/reports/tests/test'
- integration-test-agp-v3_3:
- name: AGP 3.3 Integration Test
+ integration-test-agp-v8_0:
+ name: AGP 8.0 Integration Test
needs: build
runs-on: ubuntu-latest
steps:
@@ -82,22 +82,22 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
- run: ./gradlew booster-android-gradle-v3_3:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
+ run: ./gradlew booster-android-gradle-v8_0:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- uses: actions/upload-artifact@v3
if: failure()
with:
- name: booster-android-gradle-v3_3
- path: booster-android-gradle-v3_3/build/reports/tests/integrationTest
+ name: booster-android-gradle-v8_0
+ path: booster-android-gradle-v8_0/build/reports/tests/integrationTest
- integration-test-agp-v3_4:
- name: AGP 3.4 Integration Test
+ integration-test-agp-v8_1:
+ name: AGP 8.1 Integration Test
needs: build
runs-on: ubuntu-latest
steps:
@@ -105,22 +105,22 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
- run: ./gradlew booster-android-gradle-v3_4:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
+ run: ./gradlew booster-android-gradle-v8_1:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- uses: actions/upload-artifact@v3
if: failure()
with:
- name: booster-android-gradle-v3_4
- path: booster-android-gradle-v3_4/build/reports/tests/integrationTest
+ name: booster-android-gradle-v8_1
+ path: booster-android-gradle-v8_1/build/reports/tests/integrationTest
- integration-test-agp-v3_5:
- name: AGP 3.5 Integration Test
+ integration-test-agp-v8_2:
+ name: AGP 8.2 Integration Test
needs: build
runs-on: ubuntu-latest
steps:
@@ -128,223 +128,16 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'adopt'
- java-version: '11'
+ java-version: '17'
cache: 'gradle'
- uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ github.run_number }}
- shell: bash
- run: ./gradlew booster-android-gradle-v3_5:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
+ run: ./gradlew booster-android-gradle-v8_2:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- uses: actions/upload-artifact@v3
if: failure()
with:
- name: booster-android-gradle-v3_5
- path: booster-android-gradle-v3_5/build/reports/tests/integrationTest
-
- integration-test-agp-v3_6:
- name: AGP 3.6 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-v3_6:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v3_6
- path: booster-android-gradle-v3_6/build/reports/tests/integrationTest
-
- integration-test-agp-v4_0:
- name: AGP 4.0 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-v4_0:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v4_0
- path: booster-android-gradle-v4_0/build/reports/tests/integrationTest
-
- integration-test-agp-v4_1:
- name: AGP 4.1 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-v4_1:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v4_1
- path: booster-android-gradle-v4_1/build/reports/tests/integrationTest
-
- integration-test-agp-v4_2:
- name: AGP 4.2 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-v4_2:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v4_2
- path: booster-android-gradle-v4_2/build/reports/tests/integrationTest
-
- integration-test-agp-v7_0:
- name: AGP 7.0 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_0:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v7_0
- path: booster-android-gradle-v7_0/build/reports/tests/integrationTest
-
- integration-test-agp-v7_1:
- name: AGP 7.1 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_1:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v7_1
- path: booster-android-gradle-v7_1/build/reports/tests/integrationTest
-
- integration-test-agp-v7_2:
- name: AGP 7.2 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_2:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- 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
-
- integration-test-agp-v7_4:
- name: AGP 7.4 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_4:integrationTest -S --no-daemon -Pversion=${{ github.run_number }}
- - uses: actions/upload-artifact@v3
- if: failure()
- with:
- name: booster-android-gradle-v7_4
- path: booster-android-gradle-v7_4/build/reports/tests/integrationTest
+ name: booster-android-gradle-v8_2
+ path: booster-android-gradle-v8_2/build/reports/tests/integrationTest
\ No newline at end of file
diff --git a/booster-aapt2/build.gradle b/booster-aapt2/build.gradle
index 74077106e..88d5f8922 100644
--- a/booster-aapt2/build.gradle
+++ b/booster-aapt2/build.gradle
@@ -1,6 +1,6 @@
apply from: "$rootDir/gradle/booster.gradle"
dependencies {
- api 'com.google.protobuf:protobuf-java:3.10.0'
- testImplementation 'com.android.tools.build:gradle:4.0.0'
+ api 'com.google.protobuf:protobuf-java:3.19.3'
+ testImplementation 'com.android.tools.build:gradle:8.0.0'
}
diff --git a/booster-android-api/src/main/java/android/os/Build.java b/booster-android-api/src/main/java/android/os/Build.java
index 4a32e93f0..83302fde0 100644
--- a/booster-android-api/src/main/java/android/os/Build.java
+++ b/booster-android-api/src/main/java/android/os/Build.java
@@ -151,7 +151,6 @@ public static class VERSION {
private static final String[] ALL_CODENAMES = getStringList("ro.build.version.all_codenames", ",");
/**
- * @hide
*/
public static final String[] ACTIVE_CODENAMES = "REL".equals(ALL_CODENAMES[0])
? new String[0] : ALL_CODENAMES;
@@ -161,7 +160,6 @@ public static class VERSION {
* Use the current SDK version code. For every active development codename
* we are operating under, we bump the assumed resource platform version by 1.
*
- * @hide
*/
public static final int RESOURCES_SDK_INT = SDK_INT + ACTIVE_CODENAMES.length;
diff --git a/booster-android-api/src/main/java/android/util/Log.java b/booster-android-api/src/main/java/android/util/Log.java
index 1ee313da7..d4a8b0c02 100644
--- a/booster-android-api/src/main/java/android/util/Log.java
+++ b/booster-android-api/src/main/java/android/util/Log.java
@@ -12,15 +12,14 @@
* into an application except during development. Debug logs are compiled
* in but stripped at runtime. Error, warning and info logs are always kept.
*
- * Tip: A good convention is to declare a TAG
constant
+ * Tip: A good convention is to declare a TAG
constant
* in your class:
*
*
private static final String TAG = "MyActivity";
*
* and use that in subsequent calls to the log methods.
- *
*
- * Tip: Don't forget that when you make a call like
+ * Tip: Don't forget that when you make a call like
*
Log.v(TAG, "index=" + i);
* that when you're building the string to pass into Log.d, the compiler uses a
* StringBuilder and at least three allocations occur: the StringBuilder
diff --git a/booster-android-api/src/main/java/android/view/ViewTreeObserver.java b/booster-android-api/src/main/java/android/view/ViewTreeObserver.java
index c1b458330..2c8dc2fab 100644
--- a/booster-android-api/src/main/java/android/view/ViewTreeObserver.java
+++ b/booster-android-api/src/main/java/android/view/ViewTreeObserver.java
@@ -127,7 +127,6 @@ public interface OnScrollChangedListener {
* This is only used for non-Activity windows. Activity windows can use
* Activity.onEnterAnimationComplete() to get the same signal.
*
- * @hide
*/
public interface OnWindowShownListener {
/**
diff --git a/booster-android-gradle-api/build.gradle b/booster-android-gradle-api/build.gradle
index 3258fbff7..334a8f42f 100644
--- a/booster-android-gradle-api/build.gradle
+++ b/booster-android-gradle-api/build.gradle
@@ -3,18 +3,9 @@ apply from: "$rootDir/gradle/booster.gradle"
dependencies {
api project(':booster-kotlinx')
api project(':booster-android-gradle-compat')
- implementation project(':booster-android-gradle-v3_3')
- implementation project(':booster-android-gradle-v3_4')
- implementation project(':booster-android-gradle-v3_5')
- implementation project(':booster-android-gradle-v3_6')
- implementation project(':booster-android-gradle-v4_0')
- implementation project(':booster-android-gradle-v4_1')
- implementation project(':booster-android-gradle-v4_2')
- implementation project(':booster-android-gradle-v7_0')
- implementation project(':booster-android-gradle-v7_1')
- implementation project(':booster-android-gradle-v7_2')
- implementation project(':booster-android-gradle-v7_3')
- implementation project(':booster-android-gradle-v7_4')
- compileOnly 'com.android.tools.build:gradle:3.0.0'
- testCompileOnly 'com.android.tools.build:gradle:3.0.0'
+ implementation project(':booster-android-gradle-v8_0')
+ implementation project(':booster-android-gradle-v8_1')
+ implementation project(':booster-android-gradle-v8_2')
+ compileOnly 'com.android.tools.build:gradle:8.0.0'
+ testCompileOnly 'com.android.tools.build:gradle:8.0.0'
}
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
deleted file mode 100644
index 57472121f..000000000
--- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/BaseVariant.kt
+++ /dev/null
@@ -1,375 +0,0 @@
-package com.didiglobal.booster.gradle
-
-import com.android.build.gradle.BaseExtension
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.tasks.ProcessAndroidResources
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.kotlinx.file
-import org.gradle.api.Incubating
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.UnknownTaskException
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.provider.Provider
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-
-/**
- * The project which this variant belongs
- */
-@Suppress("DEPRECATION")
-val BaseVariant.project: Project
- get() = AGP.run { project }
-
-
-fun BaseVariant.getReport(artifactName: String, fileName: String): File {
- return project.buildDir.file("reports", artifactName, name, fileName)
-}
-
-
-/**
- * The `android` extension associates with this variant
- */
-val BaseVariant.extension: BaseExtension
- get() = project.getAndroid()
-
-/**
- * The location of `$ANDROID_HOME`/platforms/android-`${compileSdkVersion}`
- */
-val BaseVariant.platform: File
- get() = extension.run {
- sdkDirectory.resolve("platforms").resolve(compileSdkVersion!!)
- }
-
-/**
- * The variant dependencies
- */
-val BaseVariant.dependencies: Collection
- get() = AGP.run {
- getDependencies(true)
- }
-
-val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = AGP.run { javaCompilerTaskProvider }
-
-val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = AGP.run { preBuildTaskProvider }
-
-val BaseVariant.assembleTaskProvider: TaskProvider
- get() = AGP.run { assembleTaskProvider }
-
-val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = AGP.run { mergeAssetsTaskProvider }
-
-val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = AGP.run { mergeResourcesTaskProvider }
-
-val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = AGP.run { mergeNativeLibsTaskProvider }
-
-val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = AGP.run { processJavaResourcesTaskProvider }
-
-val BaseVariant.processResTaskProvider: TaskProvider?
- get() = try {
- project.tasks.named(getTaskName("process", "Resources"))
- } catch (_: UnknownTaskException) {
- null
- }
-
-val BaseVariant.bundleResourcesTaskProvider: TaskProvider?
- get() = try {
- project.tasks.named(getTaskName("bundle", "Resources"))
- } catch (_: UnknownTaskException) {
- null
- }
-
-val BaseVariant.packageTaskProvider: TaskProvider?
- get() = try {
- project.tasks.named(getTaskName("package"))
- } catch (_: UnknownTaskException) {
- null
- }
-
-val BaseVariant.packageBundleTaskProvider: TaskProvider?
- get() = try {
- project.tasks.named(getTaskName("package", "Bundle"))
- } catch (_: UnknownTaskException) {
- null
- }
-
-val BaseVariant.mergeJavaResourceTaskProvider: TaskProvider?
- get() = try {
- project.tasks.named(getTaskName("merge", "JavaResource"))
- } catch (_: UnknownTaskException) {
- null
- }
-
-val BaseVariant.createFullJarTaskProvider: TaskProvider?
- get() = try {
- project.tasks.named(getTaskName("createFullJar"))
- } catch (_: UnknownTaskException) {
- null
- }
-
-val BaseVariant.bundleClassesTaskProvider: TaskProvider?
- get() = try {
- // for AGP < 7.2.0
- project.tasks.named(getTaskName("bundle", "Classes"))
- } catch (_: UnknownTaskException) {
- // for AGP >= 7.2.0+
- try {
- project.tasks.named(getTaskName("bundle", "ClassesToRuntimeJar"))
- } catch (_: UnknownTaskException) {
- try {
- project.tasks.named(getTaskName("bundle", "ClassesToCompileJar"))
- } catch (_: UnknownTaskException) {
- null
- }
- }
- }
-
-fun BaseVariant.getTaskName(prefix: String): String = AGP.run {
- getTaskName(prefix)
-}
-
-fun BaseVariant.getTaskName(prefix: String, suffix: String): String = AGP.run {
- getTaskName(prefix, suffix)
-}
-
-val BaseVariant.minSdkVersion: ApiVersion
- get() = AGP.run {
- minSdkVersion
- }
-
-val BaseVariant.isApplication: Boolean
- get() = AGP.run {
- isApplication
- }
-
-val BaseVariant.isLibrary: Boolean
- get() = AGP.run {
- isLibrary
- }
-
-val BaseVariant.isDynamicFeature: Boolean
- get() = AGP.run {
- isDynamicFeature
- }
-
-val BaseVariant.originalApplicationId: String
- get() = AGP.run {
- originalApplicationId
- }
-
-@Incubating
-fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: AndroidArtifacts.ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
-): ArtifactCollection = AGP.run {
- getArtifactCollection(configType, scope, artifactType)
-}
-
-@Incubating
-fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: AndroidArtifacts.ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
-): FileCollection = AGP.run {
- getArtifactFileCollection(configType, scope, artifactType)
-}
-
-val BaseVariant.aar: FileCollection
- get() = AGP.run {
- aar
- }
-
-/**
- * The output directory of APK files
- */
-val BaseVariant.apk: FileCollection
- get() = AGP.run {
- apk
- }
-
-/**
- * The output directory of merged [AndroidManifest.xml](https://developer.android.com/guide/topics/manifest/manifest-intro)
- */
-val BaseVariant.mergedManifests: FileCollection
- get() = AGP.run {
- mergedManifests
- }
-
-/**
- * The output directory of merged resources
- */
-val BaseVariant.mergedRes: FileCollection
- get() = AGP.run {
- mergedRes
- }
-
-/**
- * The output directory of merged assets
- */
-val BaseVariant.mergedAssets: FileCollection
- get() = AGP.run {
- mergedAssets
- }
-
-/**
- * The output directory of merged native libs
- */
-val BaseVariant.mergedNativeLibs: FileCollection
- get() = AGP.run {
- mergedNativeLibs
- }
-
-/**
- * The output directory of processed resources: *resources-**variant**.ap\_*
- */
-val BaseVariant.processedRes: FileCollection
- get() = AGP.run {
- processedRes
- }
-
-/**
- * All of classes
- */
-val BaseVariant.allClasses: FileCollection
- get() = AGP.run {
- allClasses
- }
-
-val BaseVariant.symbolList: FileCollection
- get() = AGP.run {
- symbolList
- }
-
-val BaseVariant.symbolListWithPackageName: FileCollection
- get() = AGP.run {
- symbolListWithPackageName
- }
-
-val BaseVariant.allArtifacts: Map
- get() = AGP.run {
- allArtifacts
- }
-
-val BaseVariant.buildTools: BuildToolInfo
- get() = AGP.run {
- buildTools
- }
-
-val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = AGP.run {
- isPrecompileDependenciesResourcesEnabled
- }
-
-/**
- * The `compileJava` task associates with this variant
- */
-@Deprecated(
- message = "Use javaCompilerTaskProvider instead",
- replaceWith = ReplaceWith(expression = "javaCompilerTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.javaCompilerTask: Task
- get() = AGP.run { javaCompilerTask }
-
-/**
- * The `preBuild` task associates with this variant
- */
-@Deprecated(
- message = "Use preBuildTaskProvider instead",
- replaceWith = ReplaceWith(expression = "preBuildTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.preBuildTask: Task
- get() = AGP.run { preBuildTask }
-
-/**
- * The `assemble` task associates with this variant
- */
-@Deprecated(
- message = "Use assembleTaskProvider instead",
- replaceWith = ReplaceWith(expression = "assembleTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.assembleTask: Task
- get() = AGP.run { assembleTask }
-
-/**
- * The `mergeAssets` task associates with this variant
- */
-@Deprecated(
- message = "Use mergeAssetsTaskProvider instead",
- replaceWith = ReplaceWith(expression = "mergeAssetsTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.mergeAssetsTask: Task
- get() = AGP.run { mergeAssetsTask }
-
-/**
- * The `mergeResources` task associates with this variant
- */
-@Deprecated(
- message = "Use mergeResourcesTaskProvider instead",
- replaceWith = ReplaceWith(expression = "mergeResourcesTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.mergeResourcesTask: Task
- get() = AGP.run { mergeResourcesTask }
-
-@Deprecated(
- message = "Use processJavaResourcesTaskProvider instead",
- replaceWith = ReplaceWith(expression = "processJavaResourcesTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.processJavaResourcesTask: Task
- get() = AGP.run { processJavaResourcesTask }
-
-/**
- * The `processRes` task associates with this variant
- */
-@Deprecated(
- message = "Use processResTaskProvider instead",
- replaceWith = ReplaceWith(expression = "processResTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.processResTask: ProcessAndroidResources?
- get() = project.tasks.findByName(getTaskName("process", "Resources")) as? ProcessAndroidResources
-
-/**
- * The `bundleResources` tasks associates with this variant
- */
-@Deprecated(
- message = "Use bundleResourcesTaskProvider instead",
- replaceWith = ReplaceWith(expression = "bundleResourcesTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.bundleResourcesTask: Task?
- get() = project.tasks.findByName(getTaskName("bundle", "Resources"))
-
-/**
- * The `packageBundle` tasks associates with this variant
- */
-@Deprecated(
- message = "Use packageBundleTaskProvider instead",
- replaceWith = ReplaceWith(expression = "packageBundleTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.packageBundleTask: Task?
- get() = project.tasks.findByName(getTaskName("package", "Bundle"))
-
-@Deprecated(
- message = "Use mergeJavaResourceTaskProvider instead",
- replaceWith = ReplaceWith(expression = "mergeJavaResourceTaskProvider"),
- level = DeprecationLevel.WARNING
-)
-val BaseVariant.mergeJavaResourceTask: Task?
- get() = project.tasks.findByName(getTaskName("merge", "JavaResource"))
diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Context.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Context.kt
deleted file mode 100644
index aa6bdeb97..000000000
--- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Context.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.gradle
-
-import com.android.build.api.transform.Context
-import com.android.build.gradle.internal.pipeline.TransformTask
-
-val Context.task: TransformTask
- get() = AGP.run { task }
\ No newline at end of file
diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Project.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Project.kt
index 96abbb360..5e3060695 100644
--- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Project.kt
+++ b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Project.kt
@@ -1,12 +1,10 @@
package com.didiglobal.booster.gradle
-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.build.api.variant.Variant
+import com.android.build.gradle.internal.SdkComponentsBuildService
+import com.android.build.gradle.internal.services.getBuildService
import com.android.repository.Revision
import org.gradle.api.Project
-import org.gradle.api.Task
import org.gradle.api.artifacts.component.ComponentArtifactIdentifier
import org.gradle.api.artifacts.component.ComponentIdentifier
import org.gradle.api.artifacts.component.ProjectComponentIdentifier
@@ -16,10 +14,8 @@ import org.gradle.api.attributes.Attribute
import org.gradle.api.attributes.AttributeContainer
import org.gradle.api.capabilities.Capability
import org.gradle.api.component.Artifact
-import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.plugins.JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME
import org.gradle.api.provider.Provider
-import org.gradle.api.tasks.TaskProvider
import org.gradle.maven.MavenPomArtifact
import java.io.File
import java.util.Optional
@@ -31,17 +27,10 @@ import java.util.Stack
val Project.gradleVersion: Revision
get() = Revision.parseRevision(gradle.gradleVersion)
-@Deprecated(
- message = "Use isAapt2Enabled instead",
- replaceWith = ReplaceWith(
- expression = "isAapt2Enabled"
- )
-)
-val Project.aapt2Enabled: Boolean
- get() = AGP.run { isAapt2Enabled }
-
-val Project.isAapt2Enabled: Boolean
- get() = AGP.run { isAapt2Enabled }
+val Project.androidSdkLocation: File
+ get() = getBuildService(gradle.sharedServices, SdkComponentsBuildService::class.java).flatMap {
+ it.sdkDirectoryProvider
+ }.get().asFile
val Project.isAndroid: Boolean
get() = plugins.hasPlugin("com.android.application")
@@ -72,7 +61,7 @@ fun Project.getProperty(name: String, defaultValue: T): T {
fun Project.getUpstreamProjects(
transitive: Boolean = true,
- variant: BaseVariant? = null
+ variant: Variant? = null
): Set = getResolvedArtifactResults(transitive, variant).mapNotNull {
(it.id.componentIdentifier as? ProjectComponentIdentifier)?.projectPath?.let { projectPath ->
rootProject.project(projectPath)
@@ -81,12 +70,11 @@ fun Project.getUpstreamProjects(
fun Project.getResolvedArtifactResults(
transitive: Boolean = true,
- variant: BaseVariant? = null
+ variant: Variant? = null
): Set = when {
+ variant == null -> emptySet()
isAndroid -> getResolvedArtifactResultsRecursively(transitive) {
- filterByVariant(variant).map { v ->
- AGP.run { v.getDependencies(transitive) }
- }.flatten()
+ AGP.run { variant.getDependencies(transitive) }.toList()
}
isJava -> getResolvedArtifactResultsRecursively(transitive) {
configurations.getByName(RUNTIME_CLASSPATH_CONFIGURATION_NAME).resolvedConfiguration.resolvedArtifacts.map {
@@ -123,43 +111,6 @@ private fun Project.getResolvedArtifactResultsRecursively(transitive: Boolean, r
return results.values.toSet()
}
-/**
- * Returns the jar files which could be the outputs of the jar task or createFullJar task
- *
- * @param variant The build variant
- */
-fun Project.getJars(variant: BaseVariant? = null): Set = getJarTaskProviders(variant).map {
- it.get().outputs.files
-}.flatten().toSet()
-
-fun Project.getJarTaskProviders(variant: BaseVariant? = null): Collection> = when {
- isAndroid -> when (getAndroidOrNull()) {
- is LibraryExtension -> filterByVariant(variant).mapNotNull(BaseVariant::createFullJarTaskProvider)
- is AppExtension -> filterByVariant(variant).mapNotNull(BaseVariant::bundleClassesTaskProvider)
- else -> emptyList()
- }
- isJavaLibrary -> listOf(tasks.named(JavaPlugin.JAR_TASK_NAME))
- else -> emptyList()
-}
-
-private fun Project.filterByVariant(variant: BaseVariant? = null): Collection {
- val variants = when (val android = getAndroidOrNull()) {
- is AppExtension -> android.applicationVariants
- is LibraryExtension -> android.libraryVariants
- else -> emptyList()
- }
-
- if (null == variant) return variants
-
- return variants.filter {
- it.name == variant.name
- }.takeIf {
- it.isNotEmpty()
- } ?: variants.filter {
- it.buildType.name == variant.buildType.name
- }
-}
-
private data class ResolvedArtifactResultImpl(
private val artifactId: ComponentArtifactIdentifier,
private val artifactFile: File
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..45b93ccfb 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
@@ -1,11 +1,10 @@
package com.didiglobal.booster.gradle
-import com.android.build.gradle.api.BaseVariant
+import com.android.build.api.variant.Variant
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope.ALL
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactType.AAR
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactType.JAR
import com.android.build.gradle.internal.publishing.AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH
-import com.android.builder.model.AndroidProject
import com.didiglobal.booster.kotlinx.file
import com.didiglobal.booster.kotlinx.separatorsToSystem
import com.didiglobal.booster.kotlinx.touch
@@ -21,10 +20,10 @@ import java.io.PrintWriter
@Suppress("UnstableApiUsage")
@Deprecated(
message = "Use AGPInterface instead",
- replaceWith = ReplaceWith("BaseVariant.getDependencies(Boolean, (ComponentIdentifier) -> Boolean)"),
+ replaceWith = ReplaceWith("Variant.getDependencies(Boolean, (ComponentIdentifier) -> Boolean)"),
level = DeprecationLevel.WARNING
)
-class ResolvedArtifactResults(private val variant: BaseVariant) : Collection {
+class ResolvedArtifactResults(private val variant: Variant) : Collection {
private val results = listOf(AAR, JAR)
.asSequence()
@@ -80,9 +79,9 @@ class ResolvedArtifactResults(private val variant: BaseVariant) : Collection
- get() = AGP.run { bootClasspath }
-
-/**
- * Returns the compile classpath of this transform invocation
- *
- * @author johnsonlee
- */
-val TransformInvocation.compileClasspath: Collection
- get() = listOf(inputs, referencedInputs).flatten().map {
- it.jarInputs + it.directoryInputs
- }.flatten().map {
- it.file
- }
-
-/**
- * Returns the runtime classpath of this transform invocation
- *
- * @author johnsonlee
- */
-val TransformInvocation.runtimeClasspath: Collection
- get() = compileClasspath + bootClasspath
-
-/**
- * Returns the application id
- */
-val TransformInvocation.applicationId: String
- get() = variant.applicationId
-
-/**
- * Returns the original application ID before any overrides from flavors
- */
-val TransformInvocation.originalApplicationId: String
- get() = variant.originalApplicationId
-
-val TransformInvocation.isDataBindingEnabled: Boolean
- get() = AGP.run { isDataBindingEnabled }
diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/TransformManager.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/TransformManager.kt
deleted file mode 100644
index 0df666e70..000000000
--- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/TransformManager.kt
+++ /dev/null
@@ -1,16 +0,0 @@
-package com.didiglobal.booster.gradle
-
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.internal.pipeline.TransformManager
-
-val SCOPE_PROJECT: MutableSet = TransformManager.PROJECT_ONLY
-
-val SCOPE_FULL_PROJECT: MutableSet = TransformManager.SCOPE_FULL_PROJECT
-
-val SCOPE_FULL_WITH_FEATURES: MutableSet = AGP.run {
- scopeFullWithFeatures
-}
-
-val SCOPE_FULL_LIBRARY_WITH_FEATURES: MutableSet = AGP.run {
- scopeFullLibraryWithFeatures
-}
diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Variant.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Variant.kt
new file mode 100644
index 000000000..5a4af51da
--- /dev/null
+++ b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Variant.kt
@@ -0,0 +1,262 @@
+package com.didiglobal.booster.gradle
+
+import com.android.build.api.artifact.Artifact
+import com.android.build.api.variant.AndroidVersion
+import com.android.build.api.variant.Variant
+import com.android.build.gradle.internal.SdkComponentsBuildService
+import com.android.build.gradle.internal.publishing.AndroidArtifacts
+import com.android.build.gradle.internal.services.getBuildService
+import com.android.sdklib.BuildToolInfo
+import org.apache.groovy.lang.annotation.Incubating
+import org.gradle.api.Project
+import org.gradle.api.Task
+import org.gradle.api.UnknownTaskException
+import org.gradle.api.artifacts.ArtifactCollection
+import org.gradle.api.artifacts.result.ResolvedArtifactResult
+import org.gradle.api.file.FileCollection
+import org.gradle.api.file.FileSystemLocation
+import org.gradle.api.provider.Provider
+import org.gradle.api.tasks.TaskProvider
+import java.io.File
+
+/**
+ * The project which this variant belongs
+ */
+val Variant.project: Project
+ get() = AGP.run { project }
+
+/**
+ * The location of `$ANDROID_HOME`/platforms/android-`${compileSdkVersion}`
+ */
+val Variant.platform: File
+ get() = getBuildService(project.gradle.sharedServices, SdkComponentsBuildService::class.java).flatMap {
+ it.sdkDirectoryProvider
+ }.get().asFile.resolve("platform").resolve("android-${targetVersion.apiLevel}")
+
+/**
+ * The variant dependencies
+ */
+val Variant.dependencies: Collection
+ get() = AGP.run {
+ getDependencies(true)
+ }
+
+val Variant.targetVersion: AndroidVersion
+ get() = AGP.run { targetVersion }
+
+val Variant.javaCompilerTaskProvider: TaskProvider
+ get() = AGP.run { javaCompilerTaskProvider }
+
+val Variant.preBuildTaskProvider: TaskProvider
+ get() = AGP.run { preBuildTaskProvider }
+
+val Variant.assembleTaskProvider: TaskProvider
+ get() = AGP.run { assembleTaskProvider }
+
+val Variant.mergeAssetsTaskProvider: TaskProvider
+ get() = AGP.run { mergeAssetsTaskProvider }
+
+val Variant.mergeResourcesTaskProvider: TaskProvider
+ get() = AGP.run { mergeResourcesTaskProvider }
+
+val Variant.mergeNativeLibsTaskProvider: TaskProvider
+ get() = AGP.run { mergeNativeLibsTaskProvider }
+
+val Variant.processJavaResourcesTaskProvider: TaskProvider
+ get() = AGP.run { processJavaResourcesTaskProvider }
+
+val Variant.processResTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("process", "Resources"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+
+val Variant.bundleResourcesTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("bundle", "Resources"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+
+val Variant.packageTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("package"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+
+val Variant.packageBundleTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("package", "Bundle"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+
+val Variant.mergeJavaResourceTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("merge", "JavaResource"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+
+val Variant.createFullJarTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("createFullJar"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+
+val Variant.bundleClassesTaskProvider: TaskProvider?
+ get() = try {
+ project.tasks.named(getTaskName("bundle", "ClassesToRuntimeJar"))
+ } catch (_: UnknownTaskException) {
+ try {
+ project.tasks.named(getTaskName("bundle", "ClassesToCompileJar"))
+ } catch (_: UnknownTaskException) {
+ null
+ }
+ }
+
+fun Variant.getTaskName(prefix: String): String = AGP.run {
+ getTaskName(prefix)
+}
+
+fun Variant.getTaskName(prefix: String, suffix: String): String = AGP.run {
+ getTaskName(prefix, suffix)
+}
+
+val Variant.isApplication: Boolean
+ get() = AGP.run {
+ isApplication
+ }
+
+val Variant.isLibrary: Boolean
+ get() = AGP.run {
+ isLibrary
+ }
+
+val Variant.isDynamicFeature: Boolean
+ get() = AGP.run {
+ isDynamicFeature
+ }
+
+val Variant.originalApplicationId: String
+ get() = AGP.run {
+ originalApplicationId
+ }
+
+fun Variant.getSingleArtifact(
+ type: Artifact.Single
+): Provider = AGP.run {
+ getSingleArtifact(type)
+}
+
+@Incubating
+fun Variant.getArtifactCollection(
+ configType: AndroidArtifacts.ConsumedConfigType,
+ scope: AndroidArtifacts.ArtifactScope,
+ artifactType: AndroidArtifacts.ArtifactType
+): ArtifactCollection = AGP.run {
+ getArtifactCollection(configType, scope, artifactType)
+}
+
+@Incubating
+fun Variant.getArtifactFileCollection(
+ configType: AndroidArtifacts.ConsumedConfigType,
+ scope: AndroidArtifacts.ArtifactScope,
+ artifactType: AndroidArtifacts.ArtifactType
+): FileCollection = AGP.run {
+ getArtifactFileCollection(configType, scope, artifactType)
+}
+
+val Variant.aar: FileCollection
+ get() = AGP.run {
+ aar
+ }
+
+val Variant.resourceSetMap: FileCollection
+ get() = AGP.run {
+ sourceSetMap
+ }
+
+/**
+ * The output directory of APK files
+ */
+val Variant.apk: FileCollection
+ get() = AGP.run {
+ apk
+ }
+
+/**
+ * The output directory of merged [AndroidManifest.xml](https://developer.android.com/guide/topics/manifest/manifest-intro)
+ */
+val Variant.mergedManifests: FileCollection
+ get() = AGP.run {
+ mergedManifests
+ }
+
+/**
+ * The output directory of merged resources
+ */
+val Variant.mergedRes: FileCollection
+ get() = AGP.run {
+ mergedRes
+ }
+
+/**
+ * The output directory of merged assets
+ */
+val Variant.mergedAssets: FileCollection
+ get() = AGP.run {
+ mergedAssets
+ }
+
+/**
+ * The output directory of merged native libs
+ */
+val Variant.mergedNativeLibs: FileCollection
+ get() = AGP.run {
+ mergedNativeLibs
+ }
+
+/**
+ * The output directory of processed resources: *resources-**variant**.ap\_*
+ */
+val Variant.processedRes: FileCollection
+ get() = AGP.run {
+ processedRes
+ }
+
+/**
+ * All of classes
+ */
+val Variant.allClasses: FileCollection
+ get() = AGP.run {
+ allClasses
+ }
+
+val Variant.symbolList: FileCollection
+ get() = AGP.run {
+ symbolList
+ }
+
+val Variant.symbolListWithPackageName: FileCollection
+ get() = AGP.run {
+ symbolListWithPackageName
+ }
+
+val Variant.allArtifacts: Map
+ get() = AGP.run {
+ allArtifacts
+ }
+
+val Variant.buildTools: BuildToolInfo
+ get() = AGP.run {
+ buildTools
+ }
+
+val Variant.isPrecompileDependenciesResourcesEnabled: Boolean
+ get() = AGP.run {
+ isPrecompileDependenciesResourcesEnabled
+ }
diff --git a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Version.kt b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Version.kt
index 6e87bc531..48b5dba45 100644
--- a/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Version.kt
+++ b/booster-android-gradle-api/src/main/kotlin/com/didiglobal/booster/gradle/Version.kt
@@ -1,19 +1,7 @@
package com.didiglobal.booster.gradle
-val GTE_V3_X: Boolean by lazy { AGP.revision.major >= 3 }
-val GTE_V3_6: Boolean by lazy { AGP.revision.major > 3 || (AGP.revision.major == 3 && AGP.revision.minor >= 6) }
-val GTE_V3_5: Boolean by lazy { AGP.revision.major > 3 || (AGP.revision.major == 3 && AGP.revision.minor >= 5) }
-val GTE_V3_4: Boolean by lazy { AGP.revision.major > 3 || (AGP.revision.major == 3 && AGP.revision.minor >= 4) }
-val GTE_V3_3: Boolean by lazy { AGP.revision.major > 3 || (AGP.revision.major == 3 && AGP.revision.minor >= 3) }
-val GTE_V3_2: Boolean by lazy { AGP.revision.major > 3 || (AGP.revision.major == 3 && AGP.revision.minor >= 2) }
-val GTE_V3_1: Boolean by lazy { AGP.revision.major > 3 || (AGP.revision.major == 3 && AGP.revision.minor >= 1) }
+val GTE_V8_X: Boolean by lazy { AGP.revision.major >= 8 }
-val GTE_V4_X: Boolean by lazy { AGP.revision.major >= 4 }
-val GTE_V4_2: Boolean by lazy { AGP.revision.major > 4 || (AGP.revision.major == 4 && AGP.revision.minor >= 2) }
-val GTE_V4_1: Boolean by lazy { AGP.revision.major > 4 || (AGP.revision.major == 4 && AGP.revision.minor >= 1) }
+val GTE_V8_1: Boolean by lazy { AGP.revision.major > 8 || (AGP.revision.major == 8 && AGP.revision.minor >= 1) }
-val GTE_V7_X: Boolean by lazy { AGP.revision.major >= 7 }
-val GTE_V7_4: Boolean by lazy { AGP.revision.major > 7 || (AGP.revision.major == 7 && AGP.revision.minor >= 4) }
-val GTE_V7_3: Boolean by lazy { AGP.revision.major > 7 || (AGP.revision.major == 7 && AGP.revision.minor >= 3) }
-val GTE_V7_2: Boolean by lazy { AGP.revision.major > 7 || (AGP.revision.major == 7 && AGP.revision.minor >= 2) }
-val GTE_V7_1: Boolean by lazy { AGP.revision.major > 7 || (AGP.revision.major == 7 && AGP.revision.minor >= 1) }
+val GTE_V8_2: Boolean by lazy { AGP.revision.major > 8 || (AGP.revision.major == 8 && AGP.revision.minor >= 2) }
diff --git a/booster-android-gradle-compat/build.gradle b/booster-android-gradle-compat/build.gradle
index 49cacd5c7..899e1b1e8 100644
--- a/booster-android-gradle-compat/build.gradle
+++ b/booster-android-gradle-compat/build.gradle
@@ -4,8 +4,8 @@ dependencies {
api gradleApi()
api 'com.android.tools:repository:26.0.0'
api 'com.android.tools:sdklib:26.0.0'
- compileOnly 'com.android.tools.build:gradle:3.0.0'
- testCompileOnly 'com.android.tools.build:gradle:3.0.0'
+ compileOnly 'com.android.tools.build:gradle:8.0.0'
+ testCompileOnly 'com.android.tools.build:gradle:8.0.0'
testApi project(':booster-build')
testApi gradleTestKit()
testApi 'org.spockframework:spock-core:1.3-groovy-2.5'
diff --git a/booster-android-gradle-compat/src/main/kotlin/com/didiglobal/booster/gradle/AGPInterface.kt b/booster-android-gradle-compat/src/main/kotlin/com/didiglobal/booster/gradle/AGPInterface.kt
index a417adea5..673a9fa6b 100644
--- a/booster-android-gradle-compat/src/main/kotlin/com/didiglobal/booster/gradle/AGPInterface.kt
+++ b/booster-android-gradle-compat/src/main/kotlin/com/didiglobal/booster/gradle/AGPInterface.kt
@@ -1,18 +1,12 @@
package com.didiglobal.booster.gradle
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.api.transform.TransformInvocation
-import com.android.build.gradle.AppExtension
+import com.android.build.api.artifact.Artifact
+import com.android.build.api.variant.AndroidComponentsExtension
+import com.android.build.api.variant.AndroidVersion
+import com.android.build.api.variant.Variant
import com.android.build.gradle.BaseExtension
-import com.android.build.gradle.LibraryExtension
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.scope.VariantScope
import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.model.ApiVersion
import com.android.builder.model.Version
import com.android.repository.Revision
import com.android.sdklib.BuildToolInfo
@@ -23,8 +17,9 @@ import org.gradle.api.artifacts.ArtifactCollection
import org.gradle.api.artifacts.component.ComponentIdentifier
import org.gradle.api.artifacts.result.ResolvedArtifactResult
import org.gradle.api.file.FileCollection
+import org.gradle.api.file.FileSystemLocation
+import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskProvider
-import java.io.File
import java.util.ServiceLoader
interface AGPInterface {
@@ -32,20 +27,14 @@ interface AGPInterface {
val revision: Revision
get() = REVISION
- val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_PROJECT
-
- val scopeFullLibraryWithFeatures: MutableSet
- get() = TransformManager.PROJECT_ONLY
-
- val BaseVariant.project: Project
+ val Variant.project: Project
@Deprecated(
message = "Use javaCompilerTaskProvider instead",
replaceWith = ReplaceWith(expression = "javaCompilerTaskProvider"),
level = DeprecationLevel.WARNING
)
- val BaseVariant.javaCompilerTask: Task
+ val Variant.javaCompilerTask: Task
get() = javaCompilerTaskProvider.get()
@Deprecated(
@@ -53,7 +42,7 @@ interface AGPInterface {
replaceWith = ReplaceWith(expression = "preBuildTaskProvider"),
level = DeprecationLevel.WARNING
)
- val BaseVariant.preBuildTask: Task
+ val Variant.preBuildTask: Task
get() = preBuildTaskProvider.get()
@Deprecated(
@@ -61,7 +50,7 @@ interface AGPInterface {
replaceWith = ReplaceWith(expression = "preBuildTaskProvider"),
level = DeprecationLevel.WARNING
)
- val BaseVariant.assembleTask: Task
+ val Variant.assembleTask: Task
get() = assembleTaskProvider.get()
@Deprecated(
@@ -69,7 +58,7 @@ interface AGPInterface {
replaceWith = ReplaceWith(expression = "mergeAssetsTaskProvider"),
level = DeprecationLevel.WARNING
)
- val BaseVariant.mergeAssetsTask: Task
+ val Variant.mergeAssetsTask: Task
get() = mergeAssetsTaskProvider.get()
@Deprecated(
@@ -77,7 +66,7 @@ interface AGPInterface {
replaceWith = ReplaceWith(expression = "mergeResourcesTaskProvider"),
level = DeprecationLevel.WARNING
)
- val BaseVariant.mergeResourcesTask: Task
+ val Variant.mergeResourcesTask: Task
get() = mergeResourcesTaskProvider.get()
@@ -86,145 +75,121 @@ interface AGPInterface {
replaceWith = ReplaceWith(expression = "processJavaResourcesTaskProvider"),
level = DeprecationLevel.WARNING
)
- val BaseVariant.processJavaResourcesTask: Task
+ val Variant.processJavaResourcesTask: Task
get() = processJavaResourcesTaskProvider.get()
- fun BaseVariant.getTaskName(prefix: String): String
+ fun Variant.getTaskName(prefix: String): String
- fun BaseVariant.getTaskName(prefix: String, suffix: String): String
+ fun Variant.getTaskName(prefix: String, suffix: String): String
- val BaseVariant.variantData: BaseVariantData
+ val Variant.variantData: BaseVariantData
@Deprecated(
- message = "Use BaseVariant.namespace instead",
+ message = "Use Variant.namespace instead",
replaceWith = ReplaceWith(expression = "variant.namespace"),
)
- val BaseVariant.originalApplicationId: String
+ val Variant.originalApplicationId: String
- val BaseVariant.hasDynamicFeature: Boolean
+ val Variant.hasDynamicFeature: Boolean
@Deprecated(message = "Deprecated, don't use it")
- val BaseVariant.rawAndroidResources: FileCollection
+ val Variant.rawAndroidResources: FileCollection
+
+ val Variant.sourceSetMap: FileCollection
+
+ val Variant.localAndroidResources: FileCollection
- val BaseVariant.localAndroidResources: FileCollection
+ val Variant.javaCompilerTaskProvider: TaskProvider
- val BaseVariant.javaCompilerTaskProvider: TaskProvider
+ val Variant.preBuildTaskProvider: TaskProvider
- val BaseVariant.preBuildTaskProvider: TaskProvider
+ val Variant.assembleTaskProvider: TaskProvider
- val BaseVariant.assembleTaskProvider: TaskProvider
+ val Variant.mergeAssetsTaskProvider: TaskProvider
- val BaseVariant.mergeAssetsTaskProvider: TaskProvider
+ val Variant.mergeResourcesTaskProvider: TaskProvider
- val BaseVariant.mergeResourcesTaskProvider: TaskProvider
+ val Variant.mergeNativeLibsTaskProvider: TaskProvider
- val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
+ val Variant.processJavaResourcesTaskProvider: TaskProvider
- val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
+ fun Variant.getSingleArtifact(
+ type: Artifact.Single
+ ): Provider
- fun BaseVariant.getArtifactCollection(
+ fun Variant.getArtifactCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: AndroidArtifacts.ArtifactScope,
artifactType: AndroidArtifacts.ArtifactType
): ArtifactCollection
- fun BaseVariant.getArtifactFileCollection(
+ fun Variant.getArtifactFileCollection(
configType: AndroidArtifacts.ConsumedConfigType,
scope: AndroidArtifacts.ArtifactScope,
artifactType: AndroidArtifacts.ArtifactType
): FileCollection
- val BaseVariant.allArtifacts: Map
+ val Variant.allArtifacts: Map
- val BaseVariant.minSdkVersion: ApiVersion
+ val Variant.targetVersion: AndroidVersion
- val BaseVariant.targetSdkVersion: ApiVersion
+ val Variant.isApplication: Boolean
- val BaseVariant.isApplication: Boolean
+ val Variant.isLibrary: Boolean
- val BaseVariant.isLibrary: Boolean
+ val Variant.isDynamicFeature: Boolean
- val BaseVariant.isDynamicFeature: Boolean
+ val Variant.aar: FileCollection
- val BaseVariant.aar: FileCollection
+ val Variant.apk: FileCollection
- val BaseVariant.apk: FileCollection
+ val Variant.mergedManifests: FileCollection
- val BaseVariant.mergedManifests: FileCollection
+ val Variant.mergedRes: FileCollection
- val BaseVariant.mergedRes: FileCollection
+ val Variant.mergedAssets: FileCollection
- val BaseVariant.mergedAssets: FileCollection
+ val Variant.mergedNativeLibs: FileCollection
- val BaseVariant.mergedNativeLibs: FileCollection
+ val Variant.processedRes: FileCollection
- val BaseVariant.processedRes: FileCollection
+ val Variant.symbolList: FileCollection
- val BaseVariant.symbolList: FileCollection
+ val Variant.symbolListWithPackageName: FileCollection
- val BaseVariant.symbolListWithPackageName: FileCollection
+ val Variant.dataBindingDependencyArtifacts: FileCollection
- val BaseVariant.dataBindingDependencyArtifacts: FileCollection
+ val Variant.allClasses: FileCollection
- val BaseVariant.allClasses: FileCollection
+ val Variant.buildTools: BuildToolInfo
- val BaseVariant.buildTools: BuildToolInfo
+ val Variant.isPrecompileDependenciesResourcesEnabled: Boolean
- val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
-
- fun BaseVariant.getDependencies(
+ fun Variant.getDependencies(
transitive: Boolean = true,
filter: (ComponentIdentifier) -> Boolean = { true }
): Collection
- val Context.task: TransformTask
-
- @Deprecated(
- message = "Use isAapt2Enabled instead",
- replaceWith = ReplaceWith(
- expression = "isAapt2Enabled"
- )
- )
- val Project.aapt2Enabled: Boolean
-
- @Suppress("DEPRECATION")
- val Project.isAapt2Enabled: Boolean
- get() = aapt2Enabled
-
- val TransformInvocation.variant: BaseVariant
- get() = project.getAndroid().let { android ->
- this.context.variantName.let { variant ->
- when (android) {
- is AppExtension -> when {
- variant.endsWith("AndroidTest") -> android.testVariants.single { it.name == variant }
- variant.endsWith("UnitTest") -> android.unitTestVariants.single { it.name == variant }
- else -> android.applicationVariants.single { it.name == variant }
- }
- is LibraryExtension -> android.libraryVariants.single { it.name == variant }
- else -> TODO("variant not found")
- }
- }
- }
-
- val TransformInvocation.project: Project
- get() = context.task.project
-
- val TransformInvocation.bootClasspath: Collection
- get() = project.getAndroid().bootClasspath
-
- val TransformInvocation.isDataBindingEnabled: Boolean
- get() = project.getAndroid().dataBinding.isEnabled
-
}
+@Deprecated("Deprecated", ReplaceWith("getAndroidComponent"))
inline fun Project.getAndroid(): T = extensions.getByName("android") as T
+@Deprecated("Deprecated", ReplaceWith("getAndroidComponent"))
inline fun Project.getAndroidOrNull(): T? = try {
extensions.getByName("android") as? T
} catch (e: UnknownDomainObjectException) {
null
}
+inline fun > Project.getAndroidComponents() = extensions.getByType(AndroidComponentsExtension::class.java) as T
+
+inline fun > Project.getAndroidComponentsOrNull() = try {
+ getAndroidComponents()
+} catch (e: UnknownDomainObjectException) {
+ null
+}
+
private val REVISION: Revision by lazy {
Revision.parseRevision(Version.ANDROID_GRADLE_PLUGIN_VERSION)
}
diff --git a/booster-android-gradle-v3_3/README.md b/booster-android-gradle-v3_3/README.md
deleted file mode 100644
index 715630dc5..000000000
--- a/booster-android-gradle-v3_3/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# booster-android-gradle-v3_3
-
-This module is an implementation of [booster-android-gradle-api](../booster-android-gradle-api) for Android gradle plugin 3.3 and above.
-
-本模块是 [booster-android-gradle-api](../booster-android-gradle-api) 针对 Android gradle plugin 3.3 以上版本的实现。
-
diff --git a/booster-android-gradle-v3_3/build.gradle b/booster-android-gradle-v3_3/build.gradle
deleted file mode 100644
index 7fc6eb17b..000000000
--- a/booster-android-gradle-v3_3/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:3.3.0'
- testImplementation 'com.android.tools.build:gradle:3.3.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.4.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v3_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33IntegrationTest.kt b/booster-android-gradle-v3_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33IntegrationTest.kt
deleted file mode 100644
index 84595ce26..000000000
--- a/booster-android-gradle-v3_3/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33IntegrationTest.kt
+++ /dev/null
@@ -1,475 +0,0 @@
-@file:Suppress("DEPRECATION")
-
-package com.didiglobal.booster.android.gradle.v3_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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-private val ARGS = System.getProperty("gradle.args").split("\\s+".toRegex()) + listOf(
- "-Pbooster_version=${Build.VERSION}",
- "-Pandroid_gradle_version=3.3.0",
- "-Pcompile_sdk_version=28",
- "-Pbuild_tools_version=26.0.3",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V33IntegrationTest(private val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "4.10.1", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(3, AGP.revision.major)
- assertEquals(3, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V33AppIntegrationTest : V33IntegrationTest(false)
-
-class V33LibIntegrationTest : V33IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty()) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty()) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty()) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty()) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty()) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33.kt b/booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33.kt
deleted file mode 100644
index 592165acb..000000000
--- a/booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33.kt
+++ /dev/null
@@ -1,253 +0,0 @@
-package com.didiglobal.booster.android.gradle.v3_3
-
-import com.android.build.api.artifact.ArtifactType
-import com.android.build.api.artifact.BuildArtifactType
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.VariantType
-import com.android.builder.model.AndroidProject
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val ARTIFACT_TYPES = arrayOf>(
- AnchorOutputType.values(),
- BuildArtifactType.values(),
- SourceArtifactType.values(),
- InternalArtifactType.values()
-).flatten().associateBy(ArtifactType::name)
-
-internal object V33 : AGPInterface {
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: ArtifactType): FileCollection {
- return try {
- variantScope.artifacts.getFinalArtifactFiles(type).get()
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.files()
- }
- }
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = mergeResourcesProvider
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = @Suppress("DEPRECATION") project.tasks.named("transformNativeLibsWithMergeJniLibsFor${name.capitalize()}")
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return variantScope.getTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return variantScope.getTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = variantData.scope
-
- private val BaseVariant.globalScope: GlobalScope
- get() = variantScope.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = variantData.variantConfiguration.originalApplicationId
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = variantData.androidResources.values.map {
- it.get()
- }.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return variantScope.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return variantScope.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = ARTIFACT_TYPES.entries.associateTo(TreeMap()) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = variantData.variantConfiguration.minSdkVersion.let { minSdkVersion ->
- object : ApiVersion {
- override fun getApiLevel(): Int = minSdkVersion.apiLevel
- override fun getCodename(): String? = minSdkVersion.codename
- override fun getApiString(): String = minSdkVersion.apiString
- override fun equals(other: Any?): Boolean {
- if (this === other) return true
- if (other !is ApiVersion) return false
- return apiLevel == other.apiLevel || codename.equals(other.codename, false)
- }
-
- override fun hashCode(): Int = codename?.hashCode() ?: apiLevel
- }
- }
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = variantData.variantConfiguration.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = variantScope.type
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = getFinalArtifactFiles(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_MANIFESTS
- is LibraryVariant -> InternalArtifactType.LIBRARY_MANIFEST
- else -> TODO("Unsupported variant type: $name")
- })
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = project.files("build${File.separatorChar}${AndroidProject.FD_INTERMEDIATES}${File.separatorChar}transforms${File.separatorChar}mergeJniLibs${File.separatorChar}$name")
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = getFinalArtifactFiles(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_ASSETS
- is LibraryVariant -> InternalArtifactType.LIBRARY_ASSETS
- else -> TODO("Unsupported variant type: $variantType")
- })
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST)
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = getFinalArtifactFiles(AnchorOutputType.ALL_CLASSES)
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.androidBuilder.buildToolInfo
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = false
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = listOf(AndroidArtifacts.ArtifactType.AAR, AndroidArtifacts.ArtifactType.JAR)
- .asSequence()
- .map {
- getArtifactCollection(AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH, ArtifactScope.ALL, it).filter { result ->
- filter(result.id.componentIdentifier)
- }
- }
- .flatten()
- .associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = this as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33Factory.kt b/booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33Factory.kt
deleted file mode 100644
index 732d3e4cd..000000000
--- a/booster-android-gradle-v3_3/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_3/V33Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v3_3
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V33Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(3, 3, 0)
-
- override fun newAGPInterface(): AGPInterface = V33
-
-}
diff --git a/booster-android-gradle-v3_4/build.gradle b/booster-android-gradle-v3_4/build.gradle
deleted file mode 100644
index 686414cbe..000000000
--- a/booster-android-gradle-v3_4/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:3.4.0'
- testImplementation 'com.android.tools.build:gradle:3.4.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.4.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
\ No newline at end of file
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
deleted file mode 100644
index 6c20bf1a5..000000000
--- a/booster-android-gradle-v3_4/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34IntegrationTest.kt
+++ /dev/null
@@ -1,475 +0,0 @@
-@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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-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",
- "-Pbuild_tools_version=26.0.3",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V34IntegrationTest(private val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "5.1.1", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(3, AGP.revision.major)
- assertEquals(4, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V34AppIntegrationTest : V34IntegrationTest(false)
-
-class V34LibIntegrationTest : V34IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty()) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty()) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty()) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty()) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty()) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v3_4/src/integrationTest/resources/app.gradle b/booster-android-gradle-v3_4/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v3_4/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v3_4/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v3_4/src/integrationTest/resources/buildSrc/build.gradle
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v3_4/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
-}
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
deleted file mode 100644
index dc1ad351d..000000000
--- a/booster-android-gradle-v3_4/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_4/V34.kt
+++ /dev/null
@@ -1,255 +0,0 @@
-package com.didiglobal.booster.android.gradle.v3_4
-
-import com.android.build.api.artifact.ArtifactType
-import com.android.build.api.artifact.BuildArtifactType
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.AppPlugin
-import com.android.build.gradle.DynamicFeaturePlugin
-import com.android.build.gradle.LibraryPlugin
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.scope.getOutputDir
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.VariantType
-import com.android.builder.model.AndroidProject
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val ARTIFACT_TYPES = arrayOf>(
- AnchorOutputType.values(),
- BuildArtifactType.values(),
- SourceArtifactType.values(),
- InternalArtifactType.values()
-).flatten().associateBy(ArtifactType::name)
-
-internal object V34 : AGPInterface {
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: ArtifactType): FileCollection {
- return try {
- variantScope.artifacts.getFinalArtifactFiles(type).get()
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.files()
- }
- }
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = mergeResourcesProvider
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = @Suppress("DEPRECATION") project.tasks.named("transformNativeLibsWithMergeJniLibsFor${name.capitalize()}")
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return variantScope.getTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return variantScope.getTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = variantData.scope
-
- private val BaseVariant.globalScope: GlobalScope
- get() = variantScope.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = variantData.variantConfiguration.originalApplicationId
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = variantData.androidResources.values.map {
- it.get()
- }.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return variantScope.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return variantScope.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = ARTIFACT_TYPES.entries.associateTo(TreeMap()) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = variantData.variantConfiguration.minSdkVersion.let { minSdkVersion ->
- object : ApiVersion {
- override fun getApiLevel(): Int = minSdkVersion.apiLevel
- override fun getCodename(): String? = minSdkVersion.codename
- override fun getApiString(): String = minSdkVersion.apiString
- override fun equals(other: Any?): Boolean {
- if (this === other) return true
- if (other !is ApiVersion) return false
- return apiLevel == other.apiLevel || codename.equals(other.codename, false)
- }
-
- override fun hashCode(): Int = codename?.hashCode() ?: apiLevel
- }
- }
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = variantData.variantConfiguration.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = variantScope.type
-
- override val BaseVariant.isApplication: Boolean
- get() = project.plugins.hasPlugin(AppPlugin::class.java)
- override val BaseVariant.isLibrary: Boolean
- get() = project.plugins.hasPlugin(LibraryPlugin::class.java)
- override val BaseVariant.isDynamicFeature: Boolean
- get() = project.plugins.hasPlugin(DynamicFeaturePlugin::class.java)
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = project.files(File(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_MANIFESTS
- is LibraryVariant -> InternalArtifactType.LIBRARY_MANIFEST
- else -> TODO("Unsupported variant type: $variantType")
- }.getOutputDir(project.buildDir), name))
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = project.files("build${File.separatorChar}${AndroidProject.FD_INTERMEDIATES}${File.separatorChar}transforms${File.separatorChar}mergeJniLibs${File.separatorChar}$name")
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = getFinalArtifactFiles(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_ASSETS
- is LibraryVariant -> InternalArtifactType.LIBRARY_ASSETS
- else -> TODO("Unsupported variant type: $variantType")
- })
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST)
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = getFinalArtifactFiles(AnchorOutputType.ALL_CLASSES)
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.androidBuilder.buildToolInfo
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = false
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = listOf(AndroidArtifacts.ArtifactType.AAR, AndroidArtifacts.ArtifactType.JAR)
- .asSequence()
- .map {
- getArtifactCollection(AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH, ArtifactScope.ALL, it).filter { result ->
- filter(result.id.componentIdentifier)
- }
- }
- .flatten()
- .associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = this as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v3_5/README.md b/booster-android-gradle-v3_5/README.md
deleted file mode 100644
index 77ebfe5ec..000000000
--- a/booster-android-gradle-v3_5/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# booster-android-gradle-v3_5
-
-This module is an implementation of [booster-android-gradle-api](../booster-android-gradle-api) for Android gradle plugin above 3.5.
-
-本模块是 [booster-android-gradle-api](../booster-android-gradle-api) 针对 Android gradle plugin 3.5 以上版本的实现。
-
diff --git a/booster-android-gradle-v3_5/build.gradle b/booster-android-gradle-v3_5/build.gradle
deleted file mode 100644
index 4084399d0..000000000
--- a/booster-android-gradle-v3_5/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:3.5.0'
- testImplementation 'com.android.tools.build:gradle:3.5.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.4.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
\ No newline at end of file
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
deleted file mode 100644
index dd19ade8e..000000000
--- a/booster-android-gradle-v3_5/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35IntegrationTest.kt
+++ /dev/null
@@ -1,476 +0,0 @@
-@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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-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}",
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V35IntegrationTest(private val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "5.4.1", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(3, AGP.revision.major)
- assertEquals(5, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V35AppIntegrationTest : V35IntegrationTest(false)
-
-class V35LibIntegrationTest : V35IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doLast {
- val mergedAssets = AGP.run { variant.mergedAssets }
- println(mergedAssets)
- if (mergedAssets.isEmpty) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v3_5/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35.kt b/booster-android-gradle-v3_5/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35.kt
deleted file mode 100644
index 23515ab6c..000000000
--- a/booster-android-gradle-v3_5/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_5/V35.kt
+++ /dev/null
@@ -1,254 +0,0 @@
-package com.didiglobal.booster.android.gradle.v3_5
-
-import com.android.build.api.artifact.ArtifactType
-import com.android.build.api.artifact.BuildArtifactType
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.scope.getOutputDir
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val ARTIFACT_TYPES = arrayOf>(
- AnchorOutputType.values(),
- BuildArtifactType.values(),
- SourceArtifactType.values(),
- InternalArtifactType.values()
-).flatten().associateBy(ArtifactType::name)
-
-internal object V35 : AGPInterface {
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: ArtifactType): FileCollection {
- return try {
- project.objects.fileCollection().from(variantScope.artifacts.getFinalArtifactFiles(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(variantScope.artifacts.getFinalArtifactFiles(type))
- }
- }
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = mergeResourcesProvider
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return variantScope.getTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return variantScope.getTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = variantData.scope
-
- private val BaseVariant.globalScope: GlobalScope
- get() = variantScope.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = variantData.variantConfiguration.originalApplicationId
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = variantData.androidResources.values.map {
- it.get()
- }.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: AndroidArtifacts.ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return variantScope.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: AndroidArtifacts.ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return variantScope.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- @Suppress("UnstableApiUsage")
- override val BaseVariant.allArtifacts: Map
- get() = ARTIFACT_TYPES.entries.associateTo(TreeMap()) { (name, type) ->
- val artifacts: FileCollection by lazy {
- when (type) {
- InternalArtifactType.MERGED_MANIFESTS,
- InternalArtifactType.LIBRARY_MANIFEST -> {
- project.files(File(type.getOutputDir(globalScope.buildDir), name))
- }
- InternalArtifactType.LIBRARY_ASSETS,
- InternalArtifactType.MERGED_ASSETS -> {
- project.files(File(type.getOutputDir(globalScope.buildDir), "out"))
- }
- else -> getFinalArtifactFiles(type)
- }
- }
- name to artifacts
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(variantData.variantConfiguration.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = variantData.variantConfiguration.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = variantScope.type
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.APK)
-
- @Suppress("UnstableApiUsage")
- override val BaseVariant.mergedManifests: FileCollection
- get() = project.files(File(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_MANIFESTS
- is LibraryVariant -> InternalArtifactType.LIBRARY_MANIFEST
- else -> TODO("Unsupported variant type: $variantType")
- }.getOutputDir(globalScope.buildDir), name))
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- @Suppress("UnstableApiUsage")
- override val BaseVariant.mergedAssets: FileCollection
- get() = project.files(File(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_ASSETS
- is LibraryVariant -> InternalArtifactType.LIBRARY_ASSETS
- else -> TODO("Unsupported variant type: $variantType")
- }.getOutputDir(globalScope.buildDir), "out"))
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST)
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = getFinalArtifactFiles(AnchorOutputType.ALL_CLASSES)
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.sdkComponents.buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = false
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = listOf(AndroidArtifacts.ArtifactType.AAR, AndroidArtifacts.ArtifactType.JAR)
- .asSequence()
- .map {
- getArtifactCollection(AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH, AndroidArtifacts.ArtifactScope.ALL, it).filter { result ->
- filter(result.id.componentIdentifier)
- }
- }
- .flatten()
- .associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = this as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v3_6/README.md b/booster-android-gradle-v3_6/README.md
deleted file mode 100644
index 0858da90e..000000000
--- a/booster-android-gradle-v3_6/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# booster-android-gradle-v3_6
-
-This module is an implementation of [booster-android-gradle-api](../booster-android-gradle-api) for Android gradle plugin above 3.6.
-
-本模块是 [booster-android-gradle-api](../booster-android-gradle-api) 针对 Android gradle plugin 3.6 以上版本的实现。
-
diff --git a/booster-android-gradle-v3_6/build.gradle b/booster-android-gradle-v3_6/build.gradle
deleted file mode 100644
index fea47241c..000000000
--- a/booster-android-gradle-v3_6/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:3.6.0'
- testImplementation 'com.android.tools.build:gradle:3.6.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.4.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
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
deleted file mode 100644
index 135cb3b14..000000000
--- a/booster-android-gradle-v3_6/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36IntegrationTest.kt
+++ /dev/null
@@ -1,479 +0,0 @@
-@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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-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",
- "-Pbuild_tools_version=26.0.3",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V36IntegrationTest(private val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "5.6.4", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(3, AGP.revision.major)
- assertEquals(6, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V36AppIntegrationTest : V36IntegrationTest(false)
-
-class V36LibIntegrationTest : V36IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.aar }.files
- assertTrue("AAR: $location", location::isNotEmpty)
- assertTrue("No aar found at $location") {
- location.search {
- it.extension == "aar"
- }.isNotEmpty()
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v3_6/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v3_6/src/integrationTest/resources/lib.gradle
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v3_6/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v3_6/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
diff --git a/booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36.kt b/booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36.kt
deleted file mode 100644
index bb9188445..000000000
--- a/booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36.kt
+++ /dev/null
@@ -1,264 +0,0 @@
-package com.didiglobal.booster.android.gradle.v3_6
-
-import com.android.build.api.artifact.ArtifactType
-import com.android.build.api.artifact.BuildArtifactType
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.AppPlugin
-import com.android.build.gradle.DynamicFeaturePlugin
-import com.android.build.gradle.LibraryPlugin
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-internal val ARTIFACT_TYPES = arrayOf(
- AnchorOutputType::class,
- BuildArtifactType::class,
- SourceArtifactType::class,
- InternalArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as ArtifactType
-}.associateBy {
- it.javaClass.simpleName
-}
-
-object V36 : AGPInterface {
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: ArtifactType): FileCollection {
- return try {
- project.objects.fileCollection().from(variantScope.artifacts.getFinalProducts(type))
- } catch (e: Throwable) {
- project.objects.fileCollection().builtBy(variantScope.artifacts.getFinalProducts(type))
- }
- }
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = try {
- project.tasks.named(getTaskName("merge", "Resources"))
- } catch (e: Throwable) {
- mergeResourcesProvider
- }
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return variantScope.getTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return variantScope.getTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = variantData.scope
-
- private val BaseVariant.globalScope: GlobalScope
- get() = variantScope.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = variantData.variantConfiguration.originalApplicationId
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = variantData.androidResources.values.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return variantScope.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return variantScope.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = ARTIFACT_TYPES.entries.associateTo(TreeMap()) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(variantData.variantConfiguration.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = variantData.variantConfiguration.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = variantScope.type
-
- override val BaseVariant.isApplication: Boolean
- get() = project.plugins.hasPlugin(AppPlugin::class.java)
- override val BaseVariant.isLibrary: Boolean
- get() = project.plugins.hasPlugin(LibraryPlugin::class.java)
- override val BaseVariant.isDynamicFeature: Boolean
- get() = project.plugins.hasPlugin(DynamicFeaturePlugin::class.java)
-
- override val BaseVariant.aar: FileCollection
- get() = project.files(variantScope.aarLocation.absolutePath)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.MERGED_MANIFESTS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_MANIFEST)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- @Suppress("UnstableApiUsage")
- override val BaseVariant.mergedAssets: FileCollection
- get() = getFinalArtifactFiles(when (this) {
- is ApplicationVariant -> InternalArtifactType.MERGED_ASSETS
- is LibraryVariant -> InternalArtifactType.LIBRARY_ASSETS
- else -> TODO("Unsupported variant type: $variantType")
- })
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = getFinalArtifactFiles(when (this) {
- is ApplicationVariant -> InternalArtifactType.RUNTIME_SYMBOL_LIST
- is LibraryVariant -> InternalArtifactType.COMPILE_SYMBOL_LIST
- else -> TODO("Unsupported variant type : $variantType")
- })
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.JAVAC) + project.files("build${File.separator}tmp${File.separator}kotlin-classes${File.separator}${dirName}")
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.AAR_MAIN_JAR)
- else -> project.files()
- }
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.sdkComponents.buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = variantScope.isPrecompileDependenciesResourcesEnabled
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = listOf(AndroidArtifacts.ArtifactType.AAR, AndroidArtifacts.ArtifactType.JAR)
- .asSequence()
- .map {
- getArtifactCollection(AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH, ArtifactScope.ALL, it).filter { result ->
- filter(result.id.componentIdentifier)
- }
- }
- .flatten()
- .associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = javaClass.getDeclaredField("this$1").apply {
- isAccessible = true
- }.get(this).run {
- javaClass.getDeclaredField("this$0").apply {
- isAccessible = true
- }.get(this)
- } as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36Factory.kt b/booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36Factory.kt
deleted file mode 100644
index 1d65da31f..000000000
--- a/booster-android-gradle-v3_6/src/main/kotlin/com/didiglobal/booster/android/gradle/v3_6/V36Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v3_6
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V36Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(3, 6, 0)
-
- override fun newAGPInterface(): AGPInterface = V36
-
-}
diff --git a/booster-android-gradle-v4_0/README.md b/booster-android-gradle-v4_0/README.md
deleted file mode 100644
index a69564199..000000000
--- a/booster-android-gradle-v4_0/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# booster-android-gradle-v4_0
-
-This module is an implementation of [booster-android-gradle-api](../booster-android-gradle-api) for Android gradle plugin above 4.0.
-
-本模块是 [booster-android-gradle-api](../booster-android-gradle-api) 针对 Android gradle plugin 4.0 以上版本的实现。
-
diff --git a/booster-android-gradle-v4_0/build.gradle b/booster-android-gradle-v4_0/build.gradle
deleted file mode 100644
index 94b0d1476..000000000
--- a/booster-android-gradle-v4_0/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:4.0.0'
- testImplementation 'com.android.tools.build:gradle:4.0.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.4.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
\ No newline at end of file
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
deleted file mode 100644
index be401bfde..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40IntegrationTest.kt
+++ /dev/null
@@ -1,481 +0,0 @@
-@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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-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",
- "-Pbuild_tools_version=26.0.3",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V40IntegrationTest(private val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "6.1.1", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(4, AGP.revision.major)
- assertEquals(0, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V40AppIntegrationTest : V40IntegrationTest(false)
-
-class V40LibIntegrationTest : V40IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/app.gradle b/booster-android-gradle-v4_0/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v4_0/src/integrationTest/resources/buildSrc/build.gradle
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
-}
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v4_0/src/integrationTest/resources/lib.gradle
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v4_0/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
diff --git a/booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40.kt b/booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40.kt
deleted file mode 100644
index 41b87e81f..000000000
--- a/booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40.kt
+++ /dev/null
@@ -1,286 +0,0 @@
-package com.didiglobal.booster.android.gradle.v4_0
-
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.MultipleArtifactType
-import com.android.build.gradle.internal.scope.SingleArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-internal val SINGLE_ARTIFACT_TYPES = arrayOf(
- AnchorOutputType::class,
- InternalArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as SingleArtifactType
-}.associateBy {
- it.javaClass.simpleName
-}
-
-@Suppress("UnstableApiUsage")
-internal val MULTIPLE_ARTIFACT_TYPES = arrayOf(
- MultipleArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as MultipleArtifactType
-}.associateBy {
- it.javaClass.simpleName
-}
-
-internal object V40 : AGPInterface {
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: SingleArtifactType): FileCollection {
- return try {
- project.objects.fileCollection().from(variantScope.artifacts.getOperations().get(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(variantScope.artifacts.getOperations().get(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: MultipleArtifactType): FileCollection {
- return try {
- project.objects.fileCollection().from(variantScope.artifacts.getOperations().getAll(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(variantScope.artifacts.getOperations().getAll(type))
- }
- }
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = try {
- project.tasks.named(getTaskName("merge", "Resources"))
- } catch (e: Throwable) {
- mergeResourcesProvider
- }
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return variantScope.getTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return variantScope.getTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = variantData.scope
-
- private val BaseVariant.globalScope: GlobalScope
- get() = variantScope.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = variantData.variantDslInfo.originalApplicationId
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = variantData.androidResources.values.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: AndroidArtifacts.ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return variantScope.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: AndroidArtifacts.ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return variantScope.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = TreeMap().also { all ->
- SINGLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- MULTIPLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(variantData.variantDslInfo.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = variantData.variantDslInfo.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = variantScope.type
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.MERGED_MANIFESTS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_MANIFEST)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.MERGED_ASSETS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_ASSETS)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.RUNTIME_SYMBOL_LIST)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.COMPILE_SYMBOL_LIST)
- else -> TODO("Unsupported variant type : $variantType")
- }
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.JAVAC) + project.files("build${File.separator}tmp${File.separator}kotlin-classes${File.separator}${dirName}")
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.AAR_MAIN_JAR)
- else -> project.files()
- }
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.sdkComponents.buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = variantScope.isPrecompileDependenciesResourcesEnabled
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = getArtifactCollection(
- AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
- AndroidArtifacts.ArtifactScope.ALL,
- AndroidArtifacts.ArtifactType.CLASSES_JAR
- ).filter { result ->
- filter(result.id.componentIdentifier)
- }.associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = javaClass.getDeclaredField("this$1").apply {
- isAccessible = true
- }.get(this).run {
- javaClass.getDeclaredField("this$0").apply {
- isAccessible = true
- }.get(this)
- } as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40Factory.kt b/booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40Factory.kt
deleted file mode 100644
index 5ca2c0331..000000000
--- a/booster-android-gradle-v4_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_0/V40Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v4_0
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V40Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(4, 0, 0)
-
- override fun newAGPInterface(): AGPInterface = V40
-
-}
diff --git a/booster-android-gradle-v4_1/README.md b/booster-android-gradle-v4_1/README.md
deleted file mode 100644
index d85cbf5a2..000000000
--- a/booster-android-gradle-v4_1/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# booster-android-gradle-v4_1
-
-This module is an implementation of [booster-android-gradle-api](../booster-android-gradle-api) for Android gradle plugin above 4.1.
-
-本模块是 [booster-android-gradle-api](../booster-android-gradle-api) 针对 Android gradle plugin 4.1 以上版本的实现。
-
diff --git a/booster-android-gradle-v4_1/build.gradle b/booster-android-gradle-v4_1/build.gradle
deleted file mode 100644
index fc24cb46e..000000000
--- a/booster-android-gradle-v4_1/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:4.1.0'
- testImplementation 'com.android.tools.build:gradle:4.1.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.4.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
\ No newline at end of file
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
deleted file mode 100644
index ea804d3c8..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41IntegrationTest.kt
+++ /dev/null
@@ -1,481 +0,0 @@
-@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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-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",
- "-Pbuild_tools_version=26.0.3",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V41IntegrationTest(val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "6.5", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(4, AGP.revision.major)
- assertEquals(1, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V41AppIntegrationTest : V41IntegrationTest(false)
-
-class V41LibIntegrationTest : V41IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/app.gradle b/booster-android-gradle-v4_1/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/buildSrc/build.gradle b/booster-android-gradle-v4_1/src/integrationTest/resources/buildSrc/build.gradle
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- implementation "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
-}
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/lib.gradle b/booster-android-gradle-v4_1/src/integrationTest/resources/lib.gradle
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v4_1/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
diff --git a/booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41.kt b/booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41.kt
deleted file mode 100644
index f4b07c51b..000000000
--- a/booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41.kt
+++ /dev/null
@@ -1,299 +0,0 @@
-package com.didiglobal.booster.android.gradle.v4_1
-
-import com.android.build.api.artifact.Artifact
-import com.android.build.api.artifact.ArtifactType
-import com.android.build.api.artifact.MultipleArtifactType
-import com.android.build.api.artifact.impl.ArtifactsImpl
-import com.android.build.api.component.impl.ComponentPropertiesImpl
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.BaseVariantImpl
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.InternalMultipleArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val SINGLE_ARTIFACT_TYPES = arrayOf(
- ArtifactType::class,
- AnchorOutputType::class,
- InternalArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.SingleArtifact
-}.associateBy {
- it.javaClass.simpleName
-}
-
-@Suppress("UnstableApiUsage")
-private val MULTIPLE_ARTIFACT_TYPES = arrayOf(
- MultipleArtifactType::class,
- InternalMultipleArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.MultipleArtifact
-}.associateBy {
- it.javaClass.simpleName
-}
-
-internal object V41 : AGPInterface {
-
- private val BaseVariant.componentProperties: ComponentPropertiesImpl
- get() = BaseVariantImpl::class.java.getDeclaredField("componentProperties").apply {
- isAccessible = true
- }.get(this) as ComponentPropertiesImpl
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.SingleArtifact): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.get(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(artifacts.get(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.MultipleArtifact): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.getAll(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(artifacts.getAll(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private val BaseVariant.artifacts: ArtifactsImpl
- get() = componentProperties.artifacts
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = try {
- project.tasks.named(getTaskName("merge", "Resources"))
- } catch (e: Throwable) {
- mergeResourcesProvider
- }
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return componentProperties.computeTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return componentProperties.computeTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = componentProperties.variantScope
-
- private val BaseVariant.globalScope: GlobalScope
- get() = componentProperties.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = componentProperties.variantDslInfo.packageName.get()
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = componentProperties.variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = componentProperties.variantData.androidResources.values.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return componentProperties.variantDependencies.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return componentProperties.variantDependencies.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = TreeMap().also { all ->
- SINGLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- MULTIPLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(componentProperties.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = componentProperties.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = componentProperties.variantType
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(ArtifactType.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = getFinalArtifactFiles(ArtifactType.MERGED_MANIFEST)
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.MERGED_ASSETS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_ASSETS)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.RUNTIME_SYMBOL_LIST)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.COMPILE_SYMBOL_LIST)
- else -> TODO("Unsupported variant type : $variantType")
- }
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.JAVAC) + project.files("build${File.separator}tmp${File.separator}kotlin-classes${File.separator}${dirName}")
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.AAR_MAIN_JAR)
- else -> project.files()
- }
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.sdkComponents.get().buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = variantScope.isPrecompileDependenciesResourcesEnabled
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = getArtifactCollection(
- AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
- AndroidArtifacts.ArtifactScope.ALL,
- AndroidArtifacts.ArtifactType.CLASSES_JAR
- ).filter { result ->
- filter(result.id.componentIdentifier)
- }.associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = javaClass.getDeclaredField("this$1").apply {
- isAccessible = true
- }.get(this).run {
- javaClass.getDeclaredField("this$0").apply {
- isAccessible = true
- }.get(this)
- } as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41Factory.kt b/booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41Factory.kt
deleted file mode 100644
index 9fb0adcb3..000000000
--- a/booster-android-gradle-v4_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_1/V41Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v4_1
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V41Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(4, 1, 0)
-
- override fun newAGPInterface(): AGPInterface = V41
-
-}
diff --git a/booster-android-gradle-v4_2/README.md b/booster-android-gradle-v4_2/README.md
deleted file mode 100644
index 5e8eec8ea..000000000
--- a/booster-android-gradle-v4_2/README.md
+++ /dev/null
@@ -1,6 +0,0 @@
-# booster-android-gradle-v4_2
-
-This module is an implementation of [booster-android-gradle-api](../booster-android-gradle-api) for Android gradle plugin above 4.2.
-
-本模块是 [booster-android-gradle-api](../booster-android-gradle-api) 针对 Android gradle plugin 4.2 以上版本的实现。
-
diff --git a/booster-android-gradle-v4_2/build.gradle b/booster-android-gradle-v4_2/build.gradle
deleted file mode 100644
index c07f4fbe9..000000000
--- a/booster-android-gradle-v4_2/build.gradle
+++ /dev/null
@@ -1,19 +0,0 @@
-apply plugin: 'java-gradle-plugin'
-
-apply from: "$rootDir/gradle/booster.gradle"
-apply from: "$rootDir/gradle/integration-test.gradle"
-apply from: "$rootDir/gradle/functional-test.gradle"
-
-dependencies {
- kapt 'com.google.auto.service:auto-service:1.0'
- api 'com.google.auto.service:auto-service:1.0'
- api project(':booster-android-gradle-compat')
- compileOnly 'com.android.tools.build:gradle:4.2.0'
- testImplementation 'com.android.tools.build:gradle:4.2.0'
- testImplementation 'io.bootstage.testkit:testkit-gradle-plugin:1.1.0'
- testImplementation project(':booster-build')
-}
-
-gradlePlugin {
- testSourceSets sourceSets.functionalTest, sourceSets.integrationTest
-}
\ No newline at end of file
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
deleted file mode 100644
index 0c04f7814..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42IntegrationTest.kt
+++ /dev/null
@@ -1,481 +0,0 @@
-@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.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 26
-
-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",
- "-Pbuild_tools_version=26.0.3",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V42IntegrationTest(val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "6.7.1", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(4, AGP.revision.major)
- assertEquals(2, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() = Unit
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() = Unit
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() = Unit
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() = Unit
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() = Unit
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() = Unit
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() = Unit
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() = Unit
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() = Unit
-
- @Test
- @Case(BuildToolsTestUnit::class)
- fun `test AGPInterface#buildTools`() = Unit
-
-}
-
-class V42AppIntegrationTest : V42IntegrationTest(false)
-
-class V42LibIntegrationTest : V42IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty()) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty()) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty()) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty()) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty()) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
-
-class BuildToolsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val buildTools = AGP.run { variant.buildTools }
- assertNotNull(buildTools)
- BuildToolInfo.PathId.values().map {
- it.name to buildTools.getPath(it)
- }.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
-}
diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle b/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
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
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- 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
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v4_2/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
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
deleted file mode 100644
index 1af49b16d..000000000
--- a/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42.kt
+++ /dev/null
@@ -1,300 +0,0 @@
-package com.didiglobal.booster.android.gradle.v4_2
-
-import com.android.build.api.artifact.Artifact
-import com.android.build.api.artifact.ArtifactType
-import com.android.build.api.artifact.MultipleArtifactType
-import com.android.build.api.artifact.impl.ArtifactsImpl
-import com.android.build.api.component.impl.ComponentImpl
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.BaseVariantImpl
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.InternalMultipleArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val SINGLE_ARTIFACT_TYPES = arrayOf(
- ArtifactType::class,
- AnchorOutputType::class,
- InternalArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.SingleArtifact
-}.associateBy {
- it.javaClass.simpleName
-}
-
-@Suppress("UnstableApiUsage")
-private val MULTIPLE_ARTIFACT_TYPES = arrayOf(
- MultipleArtifactType::class,
- InternalMultipleArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.MultipleArtifact
-}.associateBy {
- it.javaClass.simpleName
-}
-
-internal object V42 : AGPInterface {
-
- private val BaseVariant.component: ComponentImpl
- get() = BaseVariantImpl::class.java.getDeclaredField("component").apply {
- isAccessible = true
- }.get(this) as ComponentImpl
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.SingleArtifact): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.get(type).get())
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(artifacts.get(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.MultipleArtifact): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.getAll(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(artifacts.getAll(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private val BaseVariant.artifacts: ArtifactsImpl
- get() = component.artifacts
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.project
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = try {
- project.tasks.named(getTaskName("merge", "Resources"))
- } catch (e: Throwable) {
- mergeResourcesProvider
- }
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return component.computeTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return component.computeTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = component.variantScope
-
- @Suppress("DEPRECATION")
- private val BaseVariant.globalScope: GlobalScope
- get() = component.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = component.variantDslInfo.packageName.get()
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = component.variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = component.variantData.androidResources.values.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return component.variantDependencies.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return component.variantDependencies.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = TreeMap().also { all ->
- SINGLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- MULTIPLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(component.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = component.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = component.variantType
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(ArtifactType.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(ArtifactType.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = getFinalArtifactFiles(ArtifactType.MERGED_MANIFEST)
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.MERGED_ASSETS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_ASSETS)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.RUNTIME_SYMBOL_LIST)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.COMPILE_SYMBOL_LIST)
- else -> TODO("Unsupported variant type : $variantType")
- }
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.JAVAC) + project.files("build${File.separator}tmp${File.separator}kotlin-classes${File.separator}${dirName}")
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.AAR_MAIN_JAR)
- else -> project.files()
- }
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.versionedSdkLoader.get().buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = component.isPrecompileDependenciesResourcesEnabled
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = getArtifactCollection(
- AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
- AndroidArtifacts.ArtifactScope.ALL,
- AndroidArtifacts.ArtifactType.CLASSES_JAR
- ).filter { result ->
- filter(result.id.componentIdentifier)
- }.associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = javaClass.getDeclaredField("this$1").apply {
- isAccessible = true
- }.get(this).run {
- javaClass.getDeclaredField("this$0").apply {
- isAccessible = true
- }.get(this)
- } as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42Factory.kt b/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42Factory.kt
deleted file mode 100644
index e62782bf6..000000000
--- a/booster-android-gradle-v4_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v4_2/V42Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v4_2
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V42Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(4, 2, 0)
-
- override fun newAGPInterface(): AGPInterface = V42
-
-}
diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
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
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- 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
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v7_0/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
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
deleted file mode 100644
index 29e088279..000000000
--- a/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70.kt
+++ /dev/null
@@ -1,308 +0,0 @@
-package com.didiglobal.booster.android.gradle.v7_0
-
-import com.android.build.api.artifact.Artifact
-import com.android.build.api.artifact.MultipleArtifact
-import com.android.build.api.artifact.SingleArtifact
-import com.android.build.api.artifact.impl.ArtifactsImpl
-import com.android.build.api.component.impl.ComponentImpl
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.BaseVariantImpl
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.AnchorOutputType
-import com.android.build.gradle.internal.scope.BuildArtifactType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.InternalMultipleArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val SINGLE_ARTIFACT_TYPES = arrayOf(
- AnchorOutputType::class,
- BuildArtifactType::class,
- InternalArtifactType::class,
- SingleArtifact::class,
- SourceArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.Single
-}.associateBy {
- it.javaClass.simpleName
-}
-
-private val MULTIPLE_ARTIFACT_TYPES = arrayOf(
- MultipleArtifact::class,
- InternalMultipleArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.Multiple
-}.associateBy {
- it.javaClass.simpleName
-}
-
-@Suppress("DEPRECATION")
-internal object V70 : AGPInterface {
-
- private val BaseVariant.component: ComponentImpl
- get() = BaseVariantImpl::class.java.getDeclaredField("component").apply {
- isAccessible = true
- }.get(this) as ComponentImpl
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.Single): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.get(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(artifacts.get(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.Multiple): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.getAll(type))
- } catch (e: Throwable) {
- project.logger.warn(e.message, e)
- project.objects.fileCollection().builtBy(artifacts.getAll(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private val BaseVariant.artifacts: ArtifactsImpl
- get() = component.artifacts
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.run {
- javaClass.getDeclaredField("project").apply {
- isAccessible = true
- }.get(this) as Project
- }
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = try {
- project.tasks.named(getTaskName("merge", "Resources"))
- } catch (e: Throwable) {
- mergeResourcesProvider
- }
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return component.computeTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return component.computeTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = component.variantScope
-
- @Suppress("DEPRECATION")
- private val BaseVariant.globalScope: GlobalScope
- get() = component.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = component.variantDslInfo.namespace.get()
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = component.variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = component.variantData.androidResources.values.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return component.variantDependencies.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return component.variantDependencies.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = TreeMap().also { all ->
- SINGLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- MULTIPLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(component.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = component.variantDslInfo.targetSdkVersion
-
- private val BaseVariant.variantType: VariantType
- get() = component.variantType
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(SingleArtifact.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(SingleArtifact.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = getFinalArtifactFiles(SingleArtifact.MERGED_MANIFEST)
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.MERGED_ASSETS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_ASSETS)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.RUNTIME_SYMBOL_LIST)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.COMPILE_SYMBOL_LIST)
- else -> TODO("Unsupported variant type : $variantType")
- }
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.JAVAC) + project.files("build${File.separator}tmp${File.separator}kotlin-classes${File.separator}${dirName}")
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.AAR_MAIN_JAR)
- else -> project.files()
- }
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.versionedSdkLoader.get().buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = component.isPrecompileDependenciesResourcesEnabled
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = getArtifactCollection(
- AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
- AndroidArtifacts.ArtifactScope.ALL,
- AndroidArtifacts.ArtifactType.CLASSES_JAR
- ).filter { result ->
- filter(result.id.componentIdentifier)
- }.associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = javaClass.getDeclaredField("this$1").apply {
- isAccessible = true
- }.get(this).run {
- javaClass.getDeclaredField("this$0").apply {
- isAccessible = true
- }.get(this)
- } as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70Factory.kt b/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70Factory.kt
deleted file mode 100644
index 2d91acecc..000000000
--- a/booster-android-gradle-v7_0/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_0/V70Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v7_0
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V70Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(7, 0, 0)
-
- override fun newAGPInterface(): AGPInterface = V70
-
-}
diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
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
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- 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
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v7_1/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
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
deleted file mode 100644
index 772453781..000000000
--- a/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71.kt
+++ /dev/null
@@ -1,304 +0,0 @@
-package com.didiglobal.booster.android.gradle.v7_1
-
-import com.android.build.api.artifact.Artifact
-import com.android.build.api.artifact.MultipleArtifact
-import com.android.build.api.artifact.SingleArtifact
-import com.android.build.api.artifact.impl.ArtifactsImpl
-import com.android.build.api.component.impl.ComponentImpl
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.BaseVariantImpl
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.BuildArtifactType
-import com.android.build.gradle.internal.scope.GlobalScope
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.InternalMultipleArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val SINGLE_ARTIFACT_TYPES = arrayOf(
- BuildArtifactType::class,
- InternalArtifactType::class,
- SingleArtifact::class,
- SourceArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.Single
-}.associateBy {
- it.javaClass.simpleName
-}
-
-private val MULTIPLE_ARTIFACT_TYPES = arrayOf(
- MultipleArtifact::class,
- InternalMultipleArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.Multiple
-}.associateBy {
- it.javaClass.simpleName
-}
-
-@Suppress("DEPRECATION")
-internal object V71 : AGPInterface {
-
- private val BaseVariant.component: ComponentImpl
- get() = BaseVariantImpl::class.java.getDeclaredField("component").apply {
- isAccessible = true
- }.get(this) as ComponentImpl
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.Single): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.get(type))
- } catch (e: Throwable) {
- project.objects.fileCollection().builtBy(artifacts.get(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.Multiple): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.getAll(type))
- } catch (e: Throwable) {
- project.objects.fileCollection().builtBy(artifacts.getAll(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private val BaseVariant.artifacts: ArtifactsImpl
- get() = component.artifacts
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = globalScope.run {
- javaClass.getDeclaredField("project").apply {
- isAccessible = true
- }.get(this) as Project
- }
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider
- get() = assembleProvider
-
- override val BaseVariant.mergeAssetsTaskProvider: TaskProvider
- get() = mergeAssetsProvider
-
- override val BaseVariant.mergeResourcesTaskProvider: TaskProvider
- get() = try {
- project.tasks.named(getTaskName("merge", "Resources"))
- } catch (e: Throwable) {
- mergeResourcesProvider
- }
-
- override val BaseVariant.mergeNativeLibsTaskProvider: TaskProvider
- get() = project.tasks.named(getTaskName("merge", "NativeLibs"))
-
- override val BaseVariant.processJavaResourcesTaskProvider: TaskProvider
- get() = processJavaResourcesProvider
-
- override fun BaseVariant.getTaskName(prefix: String): String {
- return component.computeTaskName(prefix)
- }
-
- override fun BaseVariant.getTaskName(prefix: String, suffix: String): String {
- return component.computeTaskName(prefix, suffix)
- }
-
- override val BaseVariant.variantData: BaseVariantData
- get() = javaClass.getDeclaredMethod("getVariantData").apply {
- isAccessible = true
- }.invoke(this) as BaseVariantData
-
- val BaseVariant.variantScope: VariantScope
- get() = component.variantScope
-
- @Suppress("DEPRECATION")
- private val BaseVariant.globalScope: GlobalScope
- get() = component.globalScope
-
- override val BaseVariant.originalApplicationId: String
- get() = component.variantDslInfo.namespace.get()
-
- override val BaseVariant.hasDynamicFeature: Boolean
- get() = globalScope.hasDynamicFeatures()
-
- override val BaseVariant.rawAndroidResources: FileCollection
- get() = component.variantData.allRawAndroidResources
-
- override val BaseVariant.localAndroidResources: FileCollection
- get() = component.variantData.androidResources.values.reduce { collection, file ->
- collection.plus(file)
- }
-
- override fun BaseVariant.getArtifactCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): ArtifactCollection {
- return component.variantDependencies.getArtifactCollection(configType, scope, artifactType)
- }
-
- override fun BaseVariant.getArtifactFileCollection(
- configType: AndroidArtifacts.ConsumedConfigType,
- scope: ArtifactScope,
- artifactType: AndroidArtifacts.ArtifactType
- ): FileCollection {
- return component.variantDependencies.getArtifactFileCollection(configType, scope, artifactType)
- }
-
- override val BaseVariant.allArtifacts: Map
- get() = TreeMap().also { all ->
- SINGLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- MULTIPLE_ARTIFACT_TYPES.entries.associateTo(all) { (name, type) ->
- val artifacts: FileCollection by lazy {
- getFinalArtifactFiles(type)
- }
- name to artifacts
- }
- }
-
- override val BaseVariant.minSdkVersion: ApiVersion
- get() = DefaultApiVersion(component.minSdkVersion.apiLevel)
-
- override val BaseVariant.targetSdkVersion: ApiVersion
- get() = DefaultApiVersion(component.targetSdkVersion.apiLevel)
-
- private val BaseVariant.variantType: VariantType
- get() = component.variantType
-
- override val BaseVariant.isApplication: Boolean
- get() = variantType.isApk
-
- override val BaseVariant.isLibrary: Boolean
- get() = variantType.isAar
-
- override val BaseVariant.isDynamicFeature: Boolean
- get() = variantType.isDynamicFeature
-
- override val BaseVariant.aar: FileCollection
- get() = getFinalArtifactFiles(SingleArtifact.AAR)
-
- override val BaseVariant.apk: FileCollection
- get() = getFinalArtifactFiles(SingleArtifact.APK)
-
- override val BaseVariant.mergedManifests: FileCollection
- get() = getFinalArtifactFiles(SingleArtifact.MERGED_MANIFEST)
-
- override val BaseVariant.mergedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_RES)
-
- override val BaseVariant.mergedNativeLibs: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.MERGED_NATIVE_LIBS)
-
- override val BaseVariant.mergedAssets: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.COMPRESSED_ASSETS)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.LIBRARY_ASSETS)
- else -> TODO("Unsupported variant type: $variantType")
- }
-
- override val BaseVariant.processedRes: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.PROCESSED_RES)
-
- override val BaseVariant.symbolList: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.RUNTIME_SYMBOL_LIST)
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.COMPILE_SYMBOL_LIST)
- else -> TODO("Unsupported variant type : $variantType")
- }
-
- override val BaseVariant.symbolListWithPackageName: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.SYMBOL_LIST_WITH_PACKAGE_NAME)
-
- override val BaseVariant.dataBindingDependencyArtifacts: FileCollection
- get() = getFinalArtifactFiles(InternalArtifactType.DATA_BINDING_DEPENDENCY_ARTIFACTS)
-
- override val BaseVariant.allClasses: FileCollection
- get() = when (this) {
- is ApplicationVariant -> getFinalArtifactFiles(InternalArtifactType.JAVAC) + project.files("build${File.separator}tmp${File.separator}kotlin-classes${File.separator}${dirName}")
- is LibraryVariant -> getFinalArtifactFiles(InternalArtifactType.AAR_MAIN_JAR)
- else -> project.files()
- }
-
- override val BaseVariant.buildTools: BuildToolInfo
- get() = globalScope.versionedSdkLoader.get().buildToolInfoProvider.get()
-
- override val BaseVariant.isPrecompileDependenciesResourcesEnabled: Boolean
- get() = component.isPrecompileDependenciesResourcesEnabled
-
- override fun BaseVariant.getDependencies(transitive: Boolean, filter: (ComponentIdentifier) -> Boolean): Collection {
- val all = getArtifactCollection(
- AndroidArtifacts.ConsumedConfigType.RUNTIME_CLASSPATH,
- AndroidArtifacts.ArtifactScope.ALL,
- AndroidArtifacts.ArtifactType.CLASSES_JAR
- ).filter { result ->
- filter(result.id.componentIdentifier)
- }.associateBy {
- it.id.componentIdentifier.displayName
- }
- val result = if (!transitive) {
- runtimeConfiguration.incoming.resolutionResult.root.dependencies.filterIsInstance().mapNotNull {
- it.selected.id.displayName.takeIf { id -> id in all.keys }
- }.associateWith {
- all[it]!!
- }
- } else {
- all
- }
- return result.values.toSet()
- }
-
- override val Context.task: TransformTask
- get() = javaClass.getDeclaredField("this$1").apply {
- isAccessible = true
- }.get(this).run {
- javaClass.getDeclaredField("this$0").apply {
- isAccessible = true
- }.get(this)
- } as TransformTask
-
- override val Project.aapt2Enabled: Boolean
- get() = true
-
-}
diff --git a/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71Factory.kt b/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71Factory.kt
deleted file mode 100644
index 64d4a7d90..000000000
--- a/booster-android-gradle-v7_1/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_1/V71Factory.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.didiglobal.booster.android.gradle.v7_1
-
-import com.android.repository.Revision
-import com.didiglobal.booster.gradle.AGPInterface
-import com.didiglobal.booster.gradle.AGPInterfaceFactory
-import com.google.auto.service.AutoService
-
-@AutoService(AGPInterfaceFactory::class)
-class V71Factory : AGPInterfaceFactory {
-
- override val revision: Revision = Revision(7, 1, 0)
-
- override fun newAGPInterface(): AGPInterface = V71
-
-}
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
deleted file mode 100644
index 4d2c89ce2..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72IntegrationTest.kt
+++ /dev/null
@@ -1,478 +0,0 @@
-@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.didiglobal.booster.gradle.AGP
-import com.didiglobal.booster.gradle.getAndroid
-import com.didiglobal.booster.kotlinx.search
-import io.bootstage.testkit.gradle.Case
-import io.bootstage.testkit.gradle.TestCase
-import io.bootstage.testkit.gradle.VariantTestCase
-import io.bootstage.testkit.gradle.rules.GradleExecutor
-import io.bootstage.testkit.gradle.rules.LocalProperties
-import io.bootstage.testkit.gradle.rules.copyFromResource
-import io.bootstage.testkit.gradle.rules.rule
-import org.gradle.api.Project
-import org.junit.Before
-import org.junit.Rule
-import org.junit.rules.TemporaryFolder
-import org.junit.rules.TestRule
-import java.io.File
-import kotlin.test.Test
-import kotlin.test.assertEquals
-import kotlin.test.assertFalse
-import kotlin.test.assertNotNull
-import kotlin.test.assertTrue
-import kotlin.test.fail
-
-private val MIN_SDK_VERSION = System.getProperty("android.minsdk.version").toInt()
-
-private const val TARGET_SDK_VERSION = 30
-
-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",
- "-Pbuild_tools_version=29.0.2",
- "-Pmin_sdk_version=${MIN_SDK_VERSION}",
- "-Ptarget_sdk_version=${TARGET_SDK_VERSION}"
-)
-
-@Suppress("RemoveCurlyBracesFromTemplate", "FunctionName")
-abstract class V72IntegrationTest(private val isLib: Boolean) {
-
- private val projectDir = TemporaryFolder()
-
- @get:Rule
- val ruleChain: TestRule = rule(projectDir) {
- rule(LocalProperties(projectDir::getRoot)) {
- GradleExecutor(projectDir::getRoot, "7.3.3", *ARGS.toTypedArray())
- }
- }
-
- @Before
- fun setup() {
- projectDir.copyFromResource("${if (isLib) "lib" else "app"}.gradle", "build.gradle")
- projectDir.copyFromResource("buildSrc")
- projectDir.copyFromResource("src")
- projectDir.newFile("gradle.properties").writeText("org.gradle.jvmargs=-Xmx4g -XX:MaxMetaspaceSize=2g")
- assertEquals(7, AGP.revision.major)
- assertEquals(2, AGP.revision.minor)
- }
-
- @Test
- @Case(ScopeFullWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullWithFeatures`() = Unit
-
- @Test
- @Case(ScopeFullLibraryWithFeaturesTest::class)
- fun `test AGPInterface#scopeFullLibraryWithFeatures`() = Unit
-
- @Test
- @Case(ProjectTest::class)
- fun `test AGPInterface#project`() = Unit
-
- @Test
- @Case(JavaCompilerTaskTestUnit::class)
- fun `test AGPInterface#javaCompilerTask`() = Unit
-
- @Test
- @Case(PreBuildTaskTestUnit::class)
- fun `test AGPInterface#preBuildTask`() = Unit
-
- @Test
- @Case(AssembleTaskTestUnit::class)
- fun `test AGPInterface#assembleTask`() = Unit
-
- @Test
- @Case(MergeAssetsTaskTestUnit::class)
- fun `test AGPInterface#mergeAssetsTask`() = Unit
-
- @Test
- @Case(MergeResourcesTaskTestUnit::class)
- fun `test AGPInterface#mergeResources`() = Unit
-
- @Test
- @Case(GetTaskNameTestUnit::class)
- fun `test AGPInterface#getTaskName(String)`() = Unit
-
- @Test
- @Case(GetTaskName2TestUnit::class)
- fun `test AGPInterface#getTaskName(String, String)`() = Unit
-
- @Test
- @Case(VariantDataTestUnit::class)
- fun `test AGPInterface#variantData`() = Unit
-
- @Test
- @Case(OriginalApplicationIdTestUnit::class)
- fun `test AGPInterface#originalApplicationId`() = Unit
-
- @Test
- @Case(HasDynamicFeatureTestUnit::class)
- fun `test AGPInterface#hasDynamicFeature`() = Unit
-
- @Test
- @Case(RawAndroidResourcesTestUnit::class)
- fun `test AGPInterface#rawAndroidResources`() = Unit
-
- @Test
- @Case(AllArtifactsTestUnit::class)
- fun `test AGPInterface#allArtifacts`() = Unit
-
- @Test
- @Case(MinSdkVersionTestUnit::class)
- fun `test AGPInterface#minSdkVersion`() = Unit
-
- @Test
- @Case(TargetSdkVersionTestUnit::class)
- fun `test AGPInterface#targetSdkVersion`() = Unit
-
- @Test
- @Case(AarTestUnit::class)
- fun `test AGPInterface#aar`() {
- }
-
- @Test
- @Case(ApkTestUnit::class)
- fun `test AGPInterface#apk`() {
- }
-
- @Test
- @Case(MergedManifestsTestUnit::class)
- fun `test AGPInterface#mergedManifests`() {
- }
-
- @Test
- @Case(MergedResourcesTestUnit::class)
- fun `test AGPInterface#mergedRes`() {
- }
-
- @Test
- @Case(MergedAssetsTestUnit::class)
- fun `test AGPInterface#mergedAssets`() {
- }
-
- @Test
- @Case(ProcessedResTestUnit::class)
- fun `test AGPInterface#processedRes`() {
- }
-
- @Test
- @Case(SymbolListTestUnit::class)
- fun `test AGPInterface#symbolList`() {
- }
-
- @Test
- @Case(SymbolListWithPackageNameTestUnit::class)
- fun `test AGPInterface#symbolListWithPackageName`() {
- }
-
- @Test
- @Case(AllClassesTestUnit::class)
- fun `test AGPInterface#allClasses`() {
- }
-
-// @Test
-// @Case(BuildToolsTestUnit::class)
-// fun `test AGPInterface#buildTools`() {
-// }
-
-}
-
-class V72AppIntegrationTest : V72IntegrationTest(false)
-
-class V72LibIntegrationTest : V72IntegrationTest(true)
-
-class ScopeFullWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("PROJECT,SUB_PROJECTS,EXTERNAL_LIBRARIES,FEATURES", AGP.scopeFullWithFeatures.joinToString(","))
- }
-}
-
-class ScopeFullLibraryWithFeaturesTest : TestCase {
- override fun apply(project: Project) {
- assertEquals("FEATURES,PROJECT", AGP.scopeFullLibraryWithFeatures.joinToString(","))
- }
-}
-
-class ProjectTest : TestCase {
- override fun apply(project: Project) {
- val assert: (BaseVariant) -> Unit = { variant ->
- assertEquals(project, AGP.run { variant.project })
- }
- project.afterEvaluate {
- when (val android = project.getAndroid()) {
- is AppExtension -> android.applicationVariants.forEach(assert)
- is LibraryExtension -> android.libraryVariants.forEach(assert)
- }
- }
- }
-}
-
-class JavaCompilerTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.javaCompilerTask })
- }
-}
-
-class PreBuildTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.preBuildTask })
- }
-}
-
-class AssembleTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.assembleTask })
- }
-}
-
-class MergeAssetsTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeAssetsTask })
- }
-}
-
-class MergeResourcesTaskTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.mergeResourcesTask })
- }
-}
-
-class GetTaskNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("assemble${variant.name.capitalize()}", AGP.run { variant.getTaskName("assemble") })
- }
-}
-
-
-class GetTaskName2TestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertEquals("merge${variant.name.capitalize()}Resources", AGP.run { variant.getTaskName("merge", "Resources") })
- }
-}
-
-class VariantDataTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.variantData })
- }
-}
-
-class OriginalApplicationIdTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertNotNull(AGP.run { variant.originalApplicationId })
- }
-}
-
-class HasDynamicFeatureTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- assertFalse(AGP.run { variant.hasDynamicFeature })
- }
-}
-
-class RawAndroidResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val rawAndroidResources = AGP.run { variant.rawAndroidResources }
- assertNotNull(rawAndroidResources)
- if (rawAndroidResources.isEmpty()) {
- fail("rawAndroidResources is empty")
- }
- rawAndroidResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllArtifactsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val allArtifacts = AGP.run { variant.allArtifacts }
- assertNotNull(allArtifacts)
- if (allArtifacts.isEmpty()) {
- fail("allArtifacts is empty")
- }
- allArtifacts.forEach { (k, v) ->
- println(" - $k => $v")
- }
- }
- }
-}
-
-class MinSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val minSdkVersion = AGP.run { variant.minSdkVersion }
- assertNotNull(minSdkVersion)
- assertEquals(MIN_SDK_VERSION, minSdkVersion.apiLevel)
- }
-}
-
-class TargetSdkVersionTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- val targetSdkVersion = AGP.run { variant.targetSdkVersion }
- assertNotNull(targetSdkVersion)
- assertEquals(TARGET_SDK_VERSION, targetSdkVersion.apiLevel)
- }
-}
-
-class AarTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.library")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val aar = AGP.run { variant.aar }.search {
- it.extension == "aar"
- }
- if (aar.isEmpty()) {
- fail("aar is empty")
- }
- aar.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ApkTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val apk = AGP.run { variant.apk }.search {
- it.extension == "apk"
- }
- if (apk.isEmpty()) {
- fail("apk is empty")
- }
- apk.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedManifestsTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedManifests = AGP.run { variant.mergedManifests }.search {
- it.name == "AndroidManifest.xml"
- }
- if (mergedManifests.isEmpty()) {
- fail("mergedManifests is empty")
- }
- mergedManifests.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedResourcesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedResources = AGP.run { variant.mergedRes }
- if (mergedResources.isEmpty()) {
- fail("mergedRes is empty")
- }
- mergedResources.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class MergedAssetsTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val mergedAssets = AGP.run { variant.mergedAssets }
- if (mergedAssets.isEmpty()) {
- fail("mergedAssets is empty")
- }
- mergedAssets.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class ProcessedResTestUnit : VariantTestCase() {
- override fun apply(project: Project) {
- if (project.plugins.hasPlugin("com.android.application")) {
- super.apply(project)
- }
- }
-
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val processedRes = AGP.run { variant.processedRes }.search {
- it.extension == "ap_"
- }
- if (processedRes.isEmpty()) {
- fail("processedRes is empty")
- }
- processedRes.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolList = AGP.run { variant.symbolList }
- if (symbolList.isEmpty()) {
- fail("symbolList is empty")
- }
- symbolList.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class SymbolListWithPackageNameTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val symbolListWithPackageName = AGP.run { variant.symbolListWithPackageName }
- if (symbolListWithPackageName.isEmpty()) {
- fail("symbolListWithPackageName is empty")
- }
- symbolListWithPackageName.forEach {
- println(" - ${it.path}")
- }
- }
- }
-}
-
-class AllClassesTestUnit : VariantTestCase() {
- override fun apply(variant: BaseVariant) {
- AGP.run { variant.assembleTask }.doFirst {
- val location = AGP.run { variant.allClasses }.files
- assertTrue("ALL_CLASSES: $location", location::isNotEmpty)
- assertTrue("No class file found at $location") {
- location.search(File::isFile).isNotEmpty()
- }
- }
- }
-}
diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle b/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle
deleted file mode 100644
index aa3c5f2d6..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/app.gradle
+++ /dev/null
@@ -1,60 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.application'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- applicationId 'com.didiglobal.booster.test'
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- applicationIdSuffix '.en'
- }
- cn {
- dimension 'lang'
- applicationIdSuffix '.cn'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
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
deleted file mode 100644
index 79a9b104a..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/buildSrc/build.gradle
+++ /dev/null
@@ -1,24 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
-
-dependencies {
- implementation "com.android.tools.build:gradle:${project.android_gradle_version}"
- implementation("com.didiglobal.booster:booster-android-gradle-api:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- 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
deleted file mode 100644
index adc9b1ca0..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/lib.gradle
+++ /dev/null
@@ -1,57 +0,0 @@
-buildscript {
- repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
- maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
- }
- dependencies {
- classpath "com.android.tools.build:gradle:${project.android_gradle_version}"
- classpath("com.didiglobal.booster:booster-gradle-plugin:${project.booster_version}") {
- exclude group: 'com.google.guava'
- }
- classpath "io.bootstage.testkit:testkit-gradle-plugin:1.4.0"
- }
-}
-
-apply plugin: 'com.android.library'
-apply plugin: 'com.didiglobal.booster'
-apply plugin: 'io.bootstage.testkit'
-
-android {
- compileSdkVersion project.compile_sdk_version as Integer
- buildToolsVersion project.build_tools_version
- defaultConfig {
- minSdkVersion project.min_sdk_version as Integer
- targetSdkVersion project.target_sdk_version as Integer
- versionCode 1
- versionName "1.0"
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- }
- buildTypes {
- debug {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
- flavorDimensions 'lang'
- productFlavors {
- en {
- dimension 'lang'
- }
- cn {
- dimension 'lang'
- }
- }
- lintOptions {
- checkReleaseBuilds false
- }
-}
-
-repositories {
- mavenLocal()
- mavenCentral()
- google()
- maven { url 'https://oss.sonatype.org/content/repositories/public/' }
-}
diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/AndroidManifest.xml b/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/AndroidManifest.xml
deleted file mode 100644
index 30800c604..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java b/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
deleted file mode 100644
index 0eb4ec7b4..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/MainActivity.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Activity;
-
-public class MainActivity extends Activity {
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java b/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
deleted file mode 100644
index 3ecfb1507..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/java/com/didiglobal/booster/android/test/TestApplication.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.didiglobal.booster.android.test;
-
-import android.app.Application;
-
-public class TestApplication extends Application {
-
-}
\ No newline at end of file
diff --git a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/res/values/strings.xml b/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/res/values/strings.xml
deleted file mode 100644
index 8b2247616..000000000
--- a/booster-android-gradle-v7_2/src/integrationTest/resources/src/main/res/values/strings.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
- Test
-
\ No newline at end of file
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
deleted file mode 100644
index f561fc468..000000000
--- a/booster-android-gradle-v7_2/src/main/kotlin/com/didiglobal/booster/android/gradle/v7_2/V72.kt
+++ /dev/null
@@ -1,314 +0,0 @@
-package com.didiglobal.booster.android.gradle.v7_2
-
-import com.android.build.api.artifact.Artifact
-import com.android.build.api.artifact.MultipleArtifact
-import com.android.build.api.artifact.SingleArtifact
-import com.android.build.api.artifact.impl.ArtifactsImpl
-import com.android.build.api.component.impl.ComponentImpl
-import com.android.build.api.transform.Context
-import com.android.build.api.transform.QualifiedContent
-import com.android.build.gradle.api.ApplicationVariant
-import com.android.build.gradle.api.BaseVariant
-import com.android.build.gradle.api.LibraryVariant
-import com.android.build.gradle.internal.api.BaseVariantImpl
-import com.android.build.gradle.internal.api.artifact.SourceArtifactType
-import com.android.build.gradle.internal.pipeline.TransformManager
-import com.android.build.gradle.internal.pipeline.TransformTask
-import com.android.build.gradle.internal.publishing.AndroidArtifacts
-import com.android.build.gradle.internal.publishing.AndroidArtifacts.ArtifactScope
-import com.android.build.gradle.internal.scope.BuildArtifactType
-import com.android.build.gradle.internal.scope.InternalArtifactType
-import com.android.build.gradle.internal.scope.InternalMultipleArtifactType
-import com.android.build.gradle.internal.scope.VariantScope
-import com.android.build.gradle.internal.tasks.factory.GlobalTaskCreationConfigImpl
-import com.android.build.gradle.internal.variant.BaseVariantData
-import com.android.builder.core.DefaultApiVersion
-import com.android.builder.core.VariantType
-import com.android.builder.model.ApiVersion
-import com.android.sdklib.BuildToolInfo
-import com.didiglobal.booster.gradle.AGPInterface
-import org.gradle.api.Project
-import org.gradle.api.Task
-import org.gradle.api.artifacts.ArtifactCollection
-import org.gradle.api.artifacts.component.ComponentIdentifier
-import org.gradle.api.artifacts.result.ResolvedArtifactResult
-import org.gradle.api.artifacts.result.ResolvedDependencyResult
-import org.gradle.api.file.FileCollection
-import org.gradle.api.file.FileSystemLocation
-import org.gradle.api.tasks.TaskProvider
-import java.io.File
-import java.util.TreeMap
-
-@Suppress("UnstableApiUsage")
-private val SINGLE_ARTIFACT_TYPES = arrayOf(
- BuildArtifactType::class,
- InternalArtifactType::class,
- SingleArtifact::class,
- SourceArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.Single
-}.associateBy {
- it.javaClass.simpleName
-}
-
-private val MULTIPLE_ARTIFACT_TYPES = arrayOf(
- MultipleArtifact::class,
- InternalMultipleArtifactType::class
-).map {
- it.sealedSubclasses
-}.flatten().map {
- it.objectInstance as Artifact.Multiple
-}.associateBy {
- it.javaClass.simpleName
-}
-
-@Suppress("DEPRECATION")
-internal object V72 : AGPInterface {
-
- private val BaseVariant.component: ComponentImpl
- get() = BaseVariantImpl::class.java.getDeclaredField("component").apply {
- isAccessible = true
- }.get(this) as ComponentImpl
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.Single): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.get(type))
- } catch (e: Throwable) {
- project.objects.fileCollection().builtBy(artifacts.get(type))
- }
- }
-
- @Suppress("UnstableApiUsage")
- private fun BaseVariant.getFinalArtifactFiles(type: Artifact.Multiple): FileCollection {
- return try {
- project.objects.fileCollection().from(artifacts.getAll(type))
- } catch (e: Throwable) {
- project.objects.fileCollection().builtBy(artifacts.getAll(type))
- }
- }
-
- private inline fun Sequence.firstOfOrNull(transform: (T) -> R?): R? {
- for (element in this) {
- val result = transform(element)
- if (result != null) {
- return result
- }
- }
- return null
- }
-
- @Suppress("UnstableApiUsage")
- private val BaseVariant.artifacts: ArtifactsImpl
- get() = component.artifacts
-
- override val scopeFullWithFeatures: MutableSet
- get() = TransformManager.SCOPE_FULL_WITH_FEATURES
-
- override val scopeFullLibraryWithFeatures: MutableSet
- get() = (TransformManager.SCOPE_FEATURES + QualifiedContent.Scope.PROJECT).toMutableSet()
-
- override val BaseVariant.project: Project
- get() = component.variantDependencies.run {
- javaClass.getDeclaredField("project").apply {
- isAccessible = true
- }.get(this) as Project
- }
-
- override val BaseVariant.javaCompilerTaskProvider: TaskProvider
- get() = javaCompileProvider
-
- override val BaseVariant.preBuildTaskProvider: TaskProvider
- get() = preBuildProvider
-
- override val BaseVariant.assembleTaskProvider: TaskProvider