-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[commonize] #496 Commonize
:app:image-viewer
- Loading branch information
Showing
4 changed files
with
7 additions
and
79 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,103 +1,30 @@ | ||
@file:Suppress("UnstableApiUsage") | ||
@file:OptIn(ExperimentalKotlinGradlePluginApi::class) | ||
|
||
import org.jetbrains.kotlin.gradle.ExperimentalKotlinGradlePluginApi | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask | ||
|
||
plugins { | ||
kotlin("multiplatform") | ||
id("com.android.library") | ||
kotlin("plugin.compose") | ||
id("org.jetbrains.compose") | ||
// 注意! 前几个插件顺序非常重要, 调整后可能导致 compose multiplatform resources 生成错误 | ||
`flatten-source-sets` | ||
`ani-mpp-lib-targets` | ||
`ani-compose-hmpp` | ||
|
||
kotlin("plugin.serialization") | ||
id("org.jetbrains.kotlinx.atomicfu") | ||
} | ||
|
||
extra.set("ani.jvm.target", 17) | ||
|
||
kotlin { | ||
androidTarget() | ||
jvm("desktop") | ||
|
||
compilerOptions { | ||
freeCompilerArgs.add("-Xexpect-actual-classes") | ||
} | ||
|
||
sourceSets { | ||
// Workaround for MPP compose bug, don't change | ||
removeIf { it.name == "androidAndroidTestRelease" } | ||
removeIf { it.name == "androidTestFixtures" } | ||
removeIf { it.name == "androidTestFixturesDebug" } | ||
removeIf { it.name == "androidTestFixturesRelease" } | ||
} | ||
} | ||
|
||
compose.resources { | ||
packageOfResClass = "me.him188.ani.app.image.viewer" | ||
generateResClass = always | ||
} | ||
|
||
composeCompiler { | ||
enableStrongSkippingMode = true | ||
} | ||
|
||
|
||
kotlin { | ||
sourceSets.commonMain.dependencies { | ||
api(libs.kotlinx.coroutines.core) | ||
api(libs.kotlinx.serialization.json) | ||
implementation(libs.atomicfu) // room runtime | ||
|
||
// Compose | ||
api(compose.foundation) | ||
api(compose.animation) | ||
api(compose.ui) | ||
api(compose.material3) | ||
api(compose.materialIconsExtended) | ||
api(compose.runtime) | ||
implementation(compose.components.resources) | ||
} | ||
|
||
sourceSets.androidMain.dependencies { | ||
api(libs.kotlinx.coroutines.android) | ||
|
||
api(libs.androidx.compose.ui.tooling.preview) | ||
api(libs.androidx.compose.material3) | ||
} | ||
|
||
} | ||
|
||
// compose bug | ||
tasks.named("generateComposeResClass") { | ||
dependsOn("generateResourceAccessorsForAndroidUnitTest") | ||
} | ||
tasks.withType(KotlinCompilationTask::class) { | ||
dependsOn("generateComposeResClass") | ||
dependsOn("generateResourceAccessorsForAndroidRelease") | ||
dependsOn("generateResourceAccessorsForAndroidUnitTest") | ||
dependsOn("generateResourceAccessorsForAndroidUnitTestRelease") | ||
dependsOn("generateResourceAccessorsForAndroidUnitTestDebug") | ||
dependsOn("generateResourceAccessorsForAndroidDebug") | ||
} | ||
|
||
android { | ||
namespace = "me.him188.ani" | ||
compileSdk = getIntProperty("android.compile.sdk") | ||
defaultConfig { | ||
minSdk = getIntProperty("android.min.sdk") | ||
} | ||
buildTypes.getByName("release") { | ||
isMinifyEnabled = false // shared 不能 minify, 否则构建 app 会失败 | ||
isShrinkResources = false | ||
proguardFiles( | ||
getDefaultProguardFile("proguard-android-optimize.txt"), | ||
*sharedAndroidProguardRules(), | ||
) | ||
} | ||
buildFeatures { | ||
compose = true | ||
} | ||
namespace = "me.him188.ani.image.viewer" | ||
} |
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 @@ | ||
kotlin.mpp.applyDefaultHierarchyTemplate=false |
This file was deleted.
Oops, something went wrong.
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