Skip to content

Commit

Permalink
AGP 7.3 compatibility support
Browse files Browse the repository at this point in the history
  • Loading branch information
neighbWang authored and johnsonlee committed Nov 12, 2022
1 parent 5000e6b commit 41d7282
Show file tree
Hide file tree
Showing 47 changed files with 1,202 additions and 43 deletions.
1 change: 0 additions & 1 deletion booster-android-api/src/main/java/android/util/Log.java
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,6 @@ public static int wtf(String tag, String msg) {
/**
* Like {@link #wtf(String, String)}, but also writes to the log the full
* call stack.
* @hide
*/
public static int wtfStack(String tag, String msg) {
throw new RuntimeException("Stub!");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,6 @@ public interface OnPreDrawListener {
* their scroll bounds or even to request a new layout before drawing occurs.
*
* @return Return true to proceed with the current drawing pass, or false to cancel.
* @see android.view.View#onMeasure
* @see android.view.View#onLayout
* @see android.view.View#onDraw
*/
public boolean onPreDraw();
}
Expand All @@ -96,9 +93,6 @@ public interface OnDrawListener {
* <p>An {@link OnDrawListener} listener <strong>cannot be added or removed</strong>
* from this method.</p>
*
* @see android.view.View#onMeasure
* @see android.view.View#onLayout
* @see android.view.View#onDraw
*/
public void onDraw();
}
Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ dependencies {
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')
compileOnly 'com.android.tools.build:gradle:3.0.0'
testCompileOnly 'com.android.tools.build:gradle:3.0.0'
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ 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.core.VariantType
import com.android.builder.model.ApiVersion
import com.android.sdklib.BuildToolInfo
import com.didiglobal.booster.kotlinx.file
Expand Down Expand Up @@ -146,9 +145,19 @@ val BaseVariant.minSdkVersion: ApiVersion
minSdkVersion
}

val BaseVariant.variantType: VariantType
val BaseVariant.isApplication: Boolean
get() = AGP.run {
variantType
isApplication
}

val BaseVariant.isLibrary: Boolean
get() = AGP.run {
isLibrary
}

val BaseVariant.isDynamicFeature: Boolean
get() = AGP.run {
isDynamicFeature
}

val BaseVariant.originalApplicationId: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ 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.core.VariantType
import com.android.builder.model.ApiVersion
import com.android.builder.model.Version
import com.android.repository.Revision
Expand Down Expand Up @@ -135,7 +134,11 @@ interface AGPInterface {

val BaseVariant.targetSdkVersion: ApiVersion

val BaseVariant.variantType: VariantType
val BaseVariant.isApplication: Boolean

val BaseVariant.isLibrary: Boolean

val BaseVariant.isDynamicFeature: Boolean

val BaseVariant.aar: FileCollection

Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v3_3/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,18 @@ internal object V33 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = variantData.variantConfiguration.targetSdkVersion

override val BaseVariant.variantType: VariantType
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)

Expand All @@ -167,7 +176,7 @@ internal object V33 : AGPInterface {
get() = getFinalArtifactFiles(when (this) {
is ApplicationVariant -> InternalArtifactType.MERGED_MANIFESTS
is LibraryVariant -> InternalArtifactType.LIBRARY_MANIFEST
else -> TODO("Unsupported variant type: $variantType")
else -> TODO("Unsupported variant type: $name")
})

override val BaseVariant.mergedRes: FileCollection
Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v3_4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ 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
Expand Down Expand Up @@ -155,9 +158,16 @@ internal object V34 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = variantData.variantConfiguration.targetSdkVersion

override val BaseVariant.variantType: VariantType
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)

Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v3_5/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ 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
Expand Down Expand Up @@ -153,9 +156,18 @@ internal object V35 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = variantData.variantConfiguration.targetSdkVersion

override val BaseVariant.variantType: VariantType
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)

Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v3_6/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ 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
Expand Down Expand Up @@ -151,8 +154,15 @@ object V36 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = variantData.variantConfiguration.targetSdkVersion

override val BaseVariant.variantType: VariantType
get() = variantData.type
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)
Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v4_0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ 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.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
Expand Down Expand Up @@ -177,8 +180,17 @@ internal object V40 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = variantData.variantDslInfo.targetSdkVersion

override val BaseVariant.variantType: VariantType
get() = variantData.variantDslInfo.variantType
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)
Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v4_1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ 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.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
Expand Down Expand Up @@ -194,9 +197,18 @@ internal object V41 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = componentProperties.targetSdkVersion

override val BaseVariant.variantType: VariantType
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)

Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v4_2/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ 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.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
Expand Down Expand Up @@ -195,9 +198,18 @@ internal object V42 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = component.targetSdkVersion

override val BaseVariant.variantType: VariantType
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)

Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v7_0/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ 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.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
Expand Down Expand Up @@ -203,9 +206,18 @@ internal object V70 : AGPInterface {
override val BaseVariant.targetSdkVersion: ApiVersion
get() = component.variantDslInfo.targetSdkVersion

override val BaseVariant.variantType: VariantType
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)

Expand Down
1 change: 1 addition & 0 deletions booster-android-gradle-v7_1/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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'
Expand Down
Loading

0 comments on commit 41d7282

Please sign in to comment.