diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e57aedc..9ac5b22 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -4,12 +4,6 @@ plugins { id("com.android.application") } -androidComponents { - onVariants { - extra["apk${it.name}"] = it.artifacts.get(SingleArtifact.APK) - } -} - dependencies { compileOnly(project(":hideapi")) diff --git a/build.gradle.kts b/build.gradle.kts index b60e098..281a231 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,11 +1,11 @@ +import com.android.build.gradle.AppExtension import com.android.build.gradle.BaseExtension -import java.io.FileNotFoundException import java.util.* plugins { val agp = "7.1.2" val zygote = "2.6" - val refine = "3.1.0" + val refine = "3.1.1" id("com.android.application") version agp apply false id("com.android.library") version agp apply false @@ -14,67 +14,58 @@ plugins { } subprojects { - val configureBaseExtension: BaseExtension.(isApp: Boolean) -> Unit = { isApp: Boolean -> - compileSdkVersion(31) + plugins.withId("com.android.base") { + extensions.configure { + val isApp = this is AppExtension - defaultConfig { - if (isApp) { - applicationId = "com.github.kr328.clipboard" - } + println("Configure $name: isApp = $isApp") - minSdk = 29 - targetSdk = 31 + compileSdkVersion(31) - versionName = "v23" - versionCode = 23 + defaultConfig { + if (isApp) { + applicationId = "com.github.kr328.clipboard" + } - if (!isApp) { - consumerProguardFiles("consumer-rules.pro") - } - } + minSdk = 29 + targetSdk = 31 - signingConfigs { - val file = rootProject.file("signing.properties") - if (!file.exists()) { - throw GradleScriptException( - "signing.properties required", - FileNotFoundException("signing.properties not found") - ) - } + versionName = "v23" + versionCode = 23 - create("release") { - val prop = Properties().apply { - file.reader().use(this::load) + if (!isApp) { + consumerProguardFiles("consumer-rules.pro") } - - storeFile = rootProject.file(prop.getProperty("keystore.path")) - storePassword = prop.getProperty("keystore.password") - keyAlias = prop.getProperty("key.alias") - keyPassword = prop.getProperty("key.password") } - } - buildTypes { - named("release") { - isMinifyEnabled = isApp - isShrinkResources = isApp - signingConfig = signingConfigs.getByName("release") - proguardFiles( - getDefaultProguardFile("proguard-android-optimize.txt"), - "proguard-rules.pro" - ) + if (isApp) { + signingConfigs { + create("release") { + val prop = Properties().apply { + rootProject.file("signing.properties").reader().use(this::load) + } + + storeFile = rootProject.file(prop.getProperty("keystore.path")) + storePassword = prop.getProperty("keystore.password") + keyAlias = prop.getProperty("key.alias") + keyPassword = prop.getProperty("key.password") + } + } } - } - } - plugins.withId("com.android.application") { - extensions.configure { - configureBaseExtension(true) - } - } - plugins.withId("com.android.library") { - extensions.configure { - configureBaseExtension(false) + buildTypes { + named("release") { + isMinifyEnabled = isApp + isShrinkResources = isApp + proguardFiles( + getDefaultProguardFile("proguard-android-optimize.txt"), + "proguard-rules.pro" + ) + if (isApp) { + signingConfig = signingConfigs.getByName("release") + } + } + } } } } diff --git a/module/build.gradle.kts b/module/build.gradle.kts index f92f2dd..387393d 100644 --- a/module/build.gradle.kts +++ b/module/build.gradle.kts @@ -75,4 +75,6 @@ dependencies { implementation(libs.refine.runtime) implementation(libs.magic.library) -} \ No newline at end of file +} + +evaluationDependsOn(":app") \ No newline at end of file