diff --git a/gradle.properties b/gradle.properties index 66b821f..b028402 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,7 +19,7 @@ android.useAndroidX=true #android.enableJetifier=true ANDROID_GRADLE_VERSION=8.0.2 #SO_PLUGIN_VERSION=2.0.0 -SO_PLUGIN_VERSION=2.0.0-fix-local +SO_PLUGIN_VERSION=2.0.0-fix-local111 userPlugin=true GROUP_ID=com.imf.so diff --git a/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookExtensions.kt b/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookExtensions.kt index 70e8f34..7ad764a 100644 --- a/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookExtensions.kt +++ b/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookExtensions.kt @@ -5,6 +5,9 @@ import org.gradle.api.tasks.Input import java.io.Serializable open class SoLoadHookExtensions : InstrumentationParameters, Serializable { + @get:Input + var enable: Boolean = true + @get:Input var excludePackage: Set = emptySet() diff --git a/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookPlugin.kt b/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookPlugin.kt index b9bd119..c91f8f5 100644 --- a/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookPlugin.kt +++ b/load-hook-plugin/src/main/kotlin/com/imf/plugin/so/SoLoadHookPlugin.kt @@ -16,14 +16,17 @@ open class SoLoadHookPlugin : Plugin { val config = create("SoLoadHookConfig", SoLoadHookExtensions::class.java) val androidComponents = findByType(AndroidComponentsExtension::class.java) androidComponents?.onVariants { variant -> - variant.instrumentation.transformClassesWith( - SoLoadHookClassVisitorFactory::class.java, - InstrumentationScope.ALL - ) { - it.skipRAndBuildConfig = config.skipRAndBuildConfig - it.excludePackage = config.excludePackage + if (config.enable) { + variant.instrumentation.transformClassesWith( + SoLoadHookClassVisitorFactory::class.java, + InstrumentationScope.ALL + ) { + it.enable = config.enable + it.skipRAndBuildConfig = config.skipRAndBuildConfig + it.excludePackage = config.excludePackage + } + variant.instrumentation.setAsmFramesComputationMode(FramesComputationMode.COPY_FRAMES) } - variant.instrumentation.setAsmFramesComputationMode(FramesComputationMode.COPY_FRAMES) } } }