Skip to content

Commit 2ec426b

Browse files
committed
build: Improve build scripts
1 parent 41840d7 commit 2ec426b

File tree

5 files changed

+27
-17
lines changed

5 files changed

+27
-17
lines changed

build.gradle.kts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeCompilerGradlePluginExtension
2+
import org.jetbrains.kotlin.compose.compiler.gradle.ComposeFeatureFlag
23
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
34
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
45
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
@@ -82,9 +83,9 @@ fun Project.jvmTargetConfig() {
8283
fun Project.composeConfig() {
8384
plugins.withId("org.jetbrains.kotlin.plugin.compose") {
8485
extensions.configure<ComposeCompilerGradlePluginExtension> {
85-
enableIntrinsicRemember = true
86-
enableNonSkippingGroupOptimization = true
87-
enableStrongSkippingMode = true
86+
featureFlags.addAll(
87+
ComposeFeatureFlag.OptimizeNonSkippingGroups
88+
)
8889
stabilityConfigurationFile = rootDir.resolve("sketch-core/compose_compiler_config.conf")
8990

9091
/**

buildSrc/src/main/kotlin/multiplatform.kt

+14-10
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17+
18+
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
19+
@file:Suppress("unused")
20+
1721
import org.gradle.api.NamedDomainObjectContainer
1822
import org.gradle.api.NamedDomainObjectProvider
1923
import org.gradle.api.Project
@@ -132,11 +136,11 @@ fun Project.applyKotlinJsImplicitDependencyWorkaround() {
132136
dependsOn(named("jsProductionExecutableCompileSync"))
133137
dependsOn(named("jsTestTestDevelopmentExecutableCompileSync"))
134138

135-
dependsOn(getByPath(":sketch-singleton:jsDevelopmentLibraryCompileSync"))
136-
dependsOn(getByPath(":sketch-singleton:jsDevelopmentExecutableCompileSync"))
137-
dependsOn(getByPath(":sketch-singleton:jsProductionLibraryCompileSync"))
138-
dependsOn(getByPath(":sketch-singleton:jsProductionExecutableCompileSync"))
139-
dependsOn(getByPath(":sketch-singleton:jsTestTestDevelopmentExecutableCompileSync"))
139+
dependsOn(getByPath(":sketch-core:jsDevelopmentLibraryCompileSync"))
140+
dependsOn(getByPath(":sketch-core:jsDevelopmentExecutableCompileSync"))
141+
dependsOn(getByPath(":sketch-core:jsProductionLibraryCompileSync"))
142+
dependsOn(getByPath(":sketch-core:jsProductionExecutableCompileSync"))
143+
dependsOn(getByPath(":sketch-core:jsTestTestDevelopmentExecutableCompileSync"))
140144
}
141145
named("jsBrowserProductionWebpack").configure(configureJs)
142146
named("jsBrowserProductionLibraryDistribution").configure(configureJs)
@@ -154,11 +158,11 @@ fun Project.applyKotlinWasmJsImplicitDependencyWorkaround() {
154158
dependsOn(named("wasmJsProductionExecutableCompileSync"))
155159
dependsOn(named("wasmJsTestTestDevelopmentExecutableCompileSync"))
156160

157-
dependsOn(getByPath(":sketch-singleton:wasmJsDevelopmentLibraryCompileSync"))
158-
dependsOn(getByPath(":sketch-singleton:wasmJsDevelopmentExecutableCompileSync"))
159-
dependsOn(getByPath(":sketch-singleton:wasmJsProductionLibraryCompileSync"))
160-
dependsOn(getByPath(":sketch-singleton:wasmJsProductionExecutableCompileSync"))
161-
dependsOn(getByPath(":sketch-singleton:wasmJsTestTestDevelopmentExecutableCompileSync"))
161+
dependsOn(getByPath(":sketch-core:wasmJsDevelopmentLibraryCompileSync"))
162+
dependsOn(getByPath(":sketch-core:wasmJsDevelopmentExecutableCompileSync"))
163+
dependsOn(getByPath(":sketch-core:wasmJsProductionLibraryCompileSync"))
164+
dependsOn(getByPath(":sketch-core:wasmJsProductionExecutableCompileSync"))
165+
dependsOn(getByPath(":sketch-core:wasmJsTestTestDevelopmentExecutableCompileSync"))
162166
}
163167
named("wasmJsBrowserProductionWebpack").configure(configureWasmJs)
164168
named("wasmJsBrowserProductionLibraryDistribution").configure(configureWasmJs)

gradle/wrapper/gradle-wrapper.properties

+1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
#distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
67
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip

libs.versions.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ androidx-lifecycle = "2.8.2"
1313
androidx-navigation = "2.7.7"
1414
androidx-recyclerview = "1.3.2"
1515
androidx-swiperefreshlayout = "1.1.0"
16-
androidx-test-runner = "1.6.1"
17-
androidx-test-rules = "1.6.1"
1816
androidx-test-ext-junit = "1.2.1"
17+
androidx-test-rules = "1.6.1"
18+
androidx-test-runner = "1.6.1"
1919

2020
androidgifdrawable = "1.2.15"
2121
androidsvg = "1.4"

sample/build.gradle.kts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
@file:OptIn(org.jetbrains.kotlin.gradle.ExperimentalWasmDsl::class)
2+
13
import org.jetbrains.compose.desktop.application.dsl.TargetFormat
2-
import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
34

45
plugins {
56
id("com.android.application")
@@ -40,7 +41,6 @@ kotlin {
4041
binaries.executable()
4142
}
4243

43-
@OptIn(ExperimentalWasmDsl::class)
4444
wasmJs {
4545
moduleName = "composeApp"
4646
browser {
@@ -199,6 +199,10 @@ androidApplication(
199199
nameSpace = appId.replace("sketch4", "sketch"),
200200
applicationId = appId
201201
) {
202+
defaultConfig {
203+
buildConfigField("String", "VERSION_NAME", "\"${property("versionName").toString()}\"")
204+
buildConfigField("int", "VERSION_CODE", property("versionCode").toString())
205+
}
202206
signingConfigs {
203207
create("sample") {
204208
storeFile = project.file("sample.keystore")

0 commit comments

Comments
 (0)