From dc9024a362de058fd50c0eebcf9d7f246abff011 Mon Sep 17 00:00:00 2001 From: ZhangKe Date: Fri, 20 Sep 2024 14:21:43 +0800 Subject: [PATCH] add pro rules to consumer-sules.pro --- build.gradle.kts | 2 +- krouter-annotation/build.gradle.kts | 8 ++++++++ krouter-annotation/consumer-rules.pro | 6 ++---- krouter-runtime/build.gradle.kts | 8 ++++++++ krouter-runtime/consumer-rules.pro | 6 ++++-- 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 573e744..ef5ebb5 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -64,7 +64,7 @@ object ProjectVersion { private const val MONIR = "0" // backwards compatible bug fixes - private const val PATH = "0" + private const val PATH = "1" const val VERSION = "$MAJOR.$MONIR.$PATH" } diff --git a/krouter-annotation/build.gradle.kts b/krouter-annotation/build.gradle.kts index 9aafc3d..2e19f12 100644 --- a/krouter-annotation/build.gradle.kts +++ b/krouter-annotation/build.gradle.kts @@ -2,10 +2,18 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension plugins { id("org.jetbrains.kotlin.multiplatform") + id("com.android.library") alias(libs.plugins.dokka) id("com.vanniktech.maven.publish") } +android { + namespace = "com.zhangke.krouter.annotation" + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + kotlin { applyDefaultHierarchyTemplate() jvm() diff --git a/krouter-annotation/consumer-rules.pro b/krouter-annotation/consumer-rules.pro index 29c8e33..35d8b41 100644 --- a/krouter-annotation/consumer-rules.pro +++ b/krouter-annotation/consumer-rules.pro @@ -1,5 +1,3 @@ -# Keep everything in the com.zhangke.krouter package --keep class com.zhangke.krouter.** { *; } +-keep class com.zhangke.krouter.annotation.** { *; } -# Keep the class members (methods and fields) of the classes in the package --keepclassmembers class com.zhangke.krouter.** { *; } +-keepclassmembers class com.zhangke.krouter.annotation.** { *; } diff --git a/krouter-runtime/build.gradle.kts b/krouter-runtime/build.gradle.kts index 4bf9577..9ec37e6 100644 --- a/krouter-runtime/build.gradle.kts +++ b/krouter-runtime/build.gradle.kts @@ -3,10 +3,18 @@ import org.jetbrains.kotlin.config.LanguageFeature plugins { id("org.jetbrains.kotlin.multiplatform") + id("com.android.library") id("com.vanniktech.maven.publish") alias(libs.plugins.dokka) } +android { + namespace = "com.zhangke.krouter" + defaultConfig { + consumerProguardFiles("consumer-rules.pro") + } +} + kotlin { jvm() iosX64() diff --git a/krouter-runtime/consumer-rules.pro b/krouter-runtime/consumer-rules.pro index 29c8e33..d2f644b 100644 --- a/krouter-runtime/consumer-rules.pro +++ b/krouter-runtime/consumer-rules.pro @@ -1,5 +1,7 @@ -# Keep everything in the com.zhangke.krouter package +-keep class com.zhangke.krouter.generated.** { *; } + +-keepclassmembers class com.zhangke.krouter.generated.** { *; } + -keep class com.zhangke.krouter.** { *; } -# Keep the class members (methods and fields) of the classes in the package -keepclassmembers class com.zhangke.krouter.** { *; }