-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add AGP 8.1 wrapper * remove plugin library * fixed gradle version to 7.6.1: 1. plugin_publish require at least 7.6.1; 2. gradle 4.2 test will failure when gradle upgrade above 8.0; 3. AGP 8.1.1 running ok. * version 3.5.1
- Loading branch information
Showing
48 changed files
with
221 additions
and
372 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...android/plugin/utils/AbstractKlassPool.kt → ...oid/plugin/transform/AbstractKlassPool.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
...ndroid/plugin/transform/GrowingContext.kt → ...ndroid/plugin/transform/GrowingContext.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
plugins { | ||
id("org.jetbrains.kotlin.jvm") | ||
} | ||
|
||
java { | ||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
} | ||
|
||
dependencies { | ||
implementation(project(":agp-wrapper")) | ||
implementation(gradleApi()) | ||
compileOnly("com.android.tools.build:gradle-api:8.1.0") | ||
} |
22 changes: 22 additions & 0 deletions
22
...ain/kotlin/com/growingio/android/plugin/util/AndroidComponentsExtensionCompatApi81Impl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.growingio.android.plugin.util | ||
|
||
import com.android.build.api.variant.AndroidComponentsExtension | ||
import com.android.build.api.variant.HasAndroidTest | ||
import com.android.build.api.variant.HasUnitTest | ||
import org.gradle.api.Project | ||
|
||
class AndroidComponentsExtensionCompatApi81Impl( | ||
private val project: Project | ||
) : AndroidComponentsExtensionCompat { | ||
|
||
override fun onAllVariants(block: (ComponentCompat) -> Unit) { | ||
val actual = project.extensions.getByType(AndroidComponentsExtension::class.java) | ||
actual.onVariants { variant -> | ||
block.invoke(ComponentCompatApi81Impl(variant)) | ||
|
||
(variant as? HasAndroidTest)?.androidTest?.let { block.invoke(ComponentCompatApi81Impl(it)) } | ||
|
||
(variant as? HasUnitTest)?.unitTest?.let { block.invoke(ComponentCompatApi81Impl(it)) } | ||
} | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...-wrapper-81/src/main/kotlin/com/growingio/android/plugin/util/ComponentCompatApi81Impl.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package com.growingio.android.plugin.util | ||
|
||
import com.android.build.api.instrumentation.AsmClassVisitorFactory | ||
import com.android.build.api.instrumentation.FramesComputationMode | ||
import com.android.build.api.instrumentation.InstrumentationParameters | ||
import com.android.build.api.instrumentation.InstrumentationScope | ||
import com.android.build.api.variant.Component | ||
|
||
internal class ComponentCompatApi81Impl(private val component: Component) : ComponentCompat() { | ||
|
||
override val name: String | ||
get() = component.name | ||
|
||
override fun <ParamT : InstrumentationParameters> transformClassesWith( | ||
classVisitorFactoryImplClass: Class<out AsmClassVisitorFactory<ParamT>>, | ||
scope: InstrumentationScope, | ||
instrumentationParamsConfig: (ParamT) -> Unit | ||
) { | ||
component.instrumentation.transformClassesWith( | ||
classVisitorFactoryImplClass, | ||
scope, | ||
instrumentationParamsConfig | ||
) | ||
} | ||
|
||
override fun setAsmFramesComputationMode(mode: FramesComputationMode) { | ||
component.instrumentation.setAsmFramesComputationMode(mode) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
...-gradle-plugin/agp-wrapper/src/main/kotlin/com/growingio/android/plugin/util/FileUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package com.growingio.android.plugin.util | ||
|
||
fun <T> Iterator<T>.asIterable(): Iterable<T> = Iterable { this } | ||
|
||
fun String.simpleClass(): String { | ||
return this.split("/").last() | ||
} | ||
|
||
fun String.unNormalize(): String { | ||
return if (this.contains('.')) { | ||
this.replace('.', '/') | ||
} else { | ||
this | ||
} | ||
} | ||
|
||
fun normalize(type: String) = if (type.contains('/')) { | ||
type.replace('/', '.') | ||
} else { | ||
type | ||
} | ||
|
||
fun isAndroidGenerated(className: String): Boolean { | ||
return className.contains("R$") || | ||
className.contains("R2$") || | ||
className.contains("R.class") || | ||
className.contains("R2.class") || | ||
className.contains("BuildConfig.class") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.