1+ // Copyright 2025, miuix-kotlin-multiplatform contributors
2+ // SPDX-License-Identifier: Apache-2.0
3+
14@file:Suppress(" UnstableApiUsage" )
25
36import com.android.build.gradle.internal.api.BaseVariantOutputImpl
@@ -10,6 +13,7 @@ plugins {
1013 alias(libs.plugins.compose.compiler)
1114 alias(libs.plugins.jetbrains.compose)
1215 alias(libs.plugins.kotlin.multiplatform)
16+ alias(libs.plugins.spotless)
1317}
1418
1519val appName = " Miuix"
@@ -30,28 +34,31 @@ kotlin {
3034 listOf (
3135 iosX64(),
3236 iosArm64(),
33- iosSimulatorArm64()
37+ iosSimulatorArm64(),
3438 ).forEach {
3539 it.binaries.framework {
3640 baseName = " shared"
3741 isStatic = true
38- freeCompilerArgs + = listOf (
39- " -linker-option" , " -framework" , " -linker-option" , " Metal" ,
40- " -linker-option" , " -framework" , " -linker-option" , " CoreText" ,
41- " -linker-option" , " -framework" , " -linker-option" , " CoreGraphics"
42- )
42+ freeCompilerArgs + =
43+ listOf (
44+ " -linker-option" , " -framework" , " -linker-option" , " Metal" ,
45+ " -linker-option" , " -framework" , " -linker-option" , " CoreText" ,
46+ " -linker-option" , " -framework" , " -linker-option" ,
47+ " CoreGraphics" ,
48+ )
4349 }
4450 }
4551
4652 listOf (
4753 macosX64(),
48- macosArm64()
54+ macosArm64(),
4955 ).forEach { macosTarget ->
5056 macosTarget.binaries.executable {
5157 entryPoint = " main"
52- freeCompilerArgs + = listOf (
53- " -linker-option" , " -framework" , " -linker-option" , " Metal"
54- )
58+ freeCompilerArgs + =
59+ listOf (
60+ " -linker-option" , " -framework" , " -linker-option" , " Metal" ,
61+ )
5562 }
5663 }
5764
@@ -190,14 +197,24 @@ compose.desktop {
190197 }
191198}
192199
200+ spotless {
201+ kotlin {
202+ target(" src/**/*.kt" )
203+ licenseHeaderFile(rootProject.file(" /spotless/copyright.txt" ), " (^(?![\\ / ]\\ **).*$)" )
204+ }
205+
206+ kotlinGradle {
207+ target(" *.kts" )
208+ licenseHeaderFile(rootProject.file(" /spotless/copyright.txt" ), " (^(?![\\ / ]\\ **).*$)" )
209+ }
210+ }
211+
193212fun getGitCommitCount (): Int {
194213 val process = Runtime .getRuntime().exec(arrayOf(" git" , " rev-list" , " --count" , " HEAD" ))
195214 return process.inputStream.bufferedReader().use { it.readText().trim().toInt() }
196215}
197216
198- fun getVersionCode (): Int {
199- return getGitCommitCount()
200- }
217+ fun getVersionCode (): Int = getGitCommitCount()
201218
202219val generateVersionInfo by tasks.registering {
203220 doLast {
@@ -216,7 +233,7 @@ val generateVersionInfo by tasks.registering {
216233 const val JDK_VERSION = "${System .getProperty(" java.version" )} "
217234
218235 }
219- """ .trimIndent()
236+ """ .trimIndent(),
220237 )
221238 }
222239}
0 commit comments