diff --git a/README.md b/README.md index ab3981da..bfb1e679 100644 --- a/README.md +++ b/README.md @@ -63,7 +63,7 @@ //必须项 👇 plugins { ... - id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.5.7" + id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.5.8" } ``` @@ -77,7 +77,7 @@ plugins { buildscript { dependencies { //必须项 👇 - classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.5.7' + classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.5.8' } } ``` @@ -88,7 +88,7 @@ buildscript { plugins { //必须项 👇 - id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.5.7" apply false + id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.5.8" apply false } ``` @@ -135,17 +135,17 @@ plugins { dependencies { //必须项 👇 - implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.5.7' - implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.5.7' + implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.5.8' + implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.5.8' //必须项 👇如果您项目内已经有了这项不用加也可以 implementation 'androidx.appcompat:appcompat:1.3.0' // 至少在1.3.0及以上 //非必须项 👇,如果你想自定义切面需要用到,⚠️支持Java和Kotlin代码写的切面 - ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.5.7' + ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.5.8' //非必须项 👇,如果你想自定义切面需要用到,⚠️只适用于Java代码写的切面 - annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.5.7' + annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.5.8' //⚠️上边的 android-aop-ksp 和 android-aop-processor 二选一 } ``` @@ -183,6 +183,23 @@ android { **另外设置此处之后由于 Android Studio 可能有缓存,建议重启 AS 并 clean 下项目再继续开发** +#### 五、开发中可设置代码织入方式(此步为可选配置项) + +- **1、请为所有子 module 模块设置上述[步骤一](#%E4%B8%80%E5%BC%95%E5%85%A5%E6%8F%92%E4%BB%B6%E4%B8%8B%E8%BE%B9%E4%B8%A4%E7%A7%8D%E6%96%B9%E5%BC%8F%E4%BA%8C%E9%80%89%E4%B8%80%E5%BF%85%E9%A1%BB),例如:** +```gradle +plugins { + ... + id 'android.aop'//最好放在最后一行 +} +``` +- **2、在根目录的 `gradle.properties` 添加如下设置** + +``` +androidAop.debugMode=true //设置为 true 默认走您项目当前的打包方式 ,false 则为全量打包方式 +``` + +**⚠️⚠️⚠️请注意设置为 true 时部分功能将失效,只会为设置的 module 织入 aop 代码,三方jar包 不会织入代码** + ### 本库内置了一些功能注解可供你直接使用 | 注解名称 | 参数说明 | 功能说明 | diff --git a/README_EN.md b/README_EN.md index 14c3d47f..ca77c8ca 100644 --- a/README_EN.md +++ b/README_EN.md @@ -60,7 +60,7 @@ Add directly to ```build.gradle``` of **app** //Required items 👇 plugins { ... - id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.5.7" + id "io.github.FlyJingFish.AndroidAop.android-aop" version "1.5.8" } ``` @@ -85,7 +85,7 @@ plugins { buildscript { dependencies { //Required items 👇 - classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.5.7' + classpath 'io.github.FlyJingFish.AndroidAop:android-aop-plugin:1.5.8' } } ``` @@ -137,12 +137,12 @@ plugins { dependencies { //Required items 👇 - implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.5.7' - implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.5.7' + implementation 'io.github.FlyJingFish.AndroidAop:android-aop-core:1.5.8' + implementation 'io.github.FlyJingFish.AndroidAop:android-aop-annotation:1.5.8' //Optional 👇, if you want to customize aspects, you need to use them, ⚠️supports aspects written in Java and Kotlin code - ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.5.7' + ksp 'io.github.FlyJingFish.AndroidAop:android-aop-ksp:1.5.8' //Optional 👇, if you want to customize aspects, you need to use them, ⚠️only applies to aspects written in Java code - annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.5.7' + annotationProcessor 'io.github.FlyJingFish.AndroidAop:android-aop-processor:1.5.8' //⚠️Choose one of the above android-aop-ksp and android-aop-processor } ``` @@ -179,6 +179,24 @@ android { **⚠️⚠️⚠️After setting include and exclude, all aspects are only valid within the rules you set. Please remember your settings! ** **In addition, since Android Studio may have cache after setting this, it is recommended to restart AS and clean the project before continuing development** + +#### 5. The code weaving method can be set during development (this step is an optional configuration item) + +- **1. Please set the above [Step 1](#%E4%B8%80%E5%BC%95%E5%85%A5%E6%8F%92%E4%BB%B6% for all sub-module modules E4%B8%8B%E8%BE%B9%E4%B8%A4%E7%A7%8D%E6%96%B9%E5%BC%8F%E4%BA%8C%E9%80%89%E4% B8%80%E5%BF%85%E9%A1%BB), for example: ** +```gradle +plugins { + ... + id 'android.aop'//It is best to put it on the last line +} +``` +- **2. Add the following settings to `gradle.properties` in the root directory** + +``` +androidAop.debugMode=true //Set to true to default to the current packaging method of your project, false to use the full packaging method +``` + +**⚠️⚠️⚠️Please note that when set to true, some functions will be disabled. Only the aop code will be woven into the set module, and the code will not be woven into the third-party jar package** + ### This library has some built-in functional annotations for you to use directly. | Annotation name | Parameter description | Function description | diff --git a/android-aop-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/AndroidAopPlugin.kt b/android-aop-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/AndroidAopPlugin.kt index 7cbd72e1..be4eb6a4 100644 --- a/android-aop-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/AndroidAopPlugin.kt +++ b/android-aop-plugin/src/main/kotlin/com/flyjingfish/android_aop_plugin/AndroidAopPlugin.kt @@ -33,6 +33,9 @@ class AndroidAopPlugin : Plugin { val debugModeStr :String = project.properties["androidAop.debugMode"].toString() val debugMode = debugModeStr == "true" if (debugMode){ + if (!isApp) { + logger.warn("Plugin ['android.aop'] 应该被用于 com.android.application 所在 module 下,打正式包时请注意将 androidAop.debugMode 设置为 false") + } val isDynamicLibrary = project.plugins.hasPlugin(DynamicFeaturePlugin::class.java) val android = project.extensions.findByName(ANDROID_EXTENSION_NAME) as BaseExtension @@ -120,7 +123,6 @@ class AndroidAopPlugin : Plugin { } }else{ if (!isApp) { - logger.warn("Plugin ['android.aop'] can only be used under the application, not under the module library invalid!") return } val androidComponents = project.extensions.getByType(AndroidComponentsExtension::class.java) diff --git a/gradle.properties b/gradle.properties index b51d5da8..de13ae23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -41,7 +41,7 @@ DEVELOPER_ID=FlyJingFish DEVELOPER_NAME=FlyJingFish DEVELOPER_EMAIL=749617782@qq.com -TestVersion = 1.5.7 +TestVersion = 1.5.8 SonatypeTestCode = 1395 TestType = 0 # 0 mavenLocal 1 SonatypeCache 2 mavenCentral diff --git a/version.properties b/version.properties index bd520fd7..3657503c 100644 --- a/version.properties +++ b/version.properties @@ -1,2 +1,2 @@ -#Mon Apr 22 17:10:24 CST 2024 -PROJ_VERSION=1.5.7 +#Wed Apr 24 13:12:24 CST 2024 +PROJ_VERSION=1.5.8