-
Notifications
You must be signed in to change notification settings - Fork 5
/
build.gradle.kts
96 lines (87 loc) · 3.2 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
version = "0.4.0.1-SNAPSHOT"
group = "org.hisp.dhis.mobile"
plugins {
kotlin("multiplatform") apply false
id("com.android.application") apply false
id("com.android.library") apply false
id("org.jetbrains.compose") apply false
id("org.jlleitschuh.gradle.ktlint") version "11.5.1"
id("org.jetbrains.dokka") version "1.9.20"
id("io.github.gradle-nexus.publish-plugin") version "1.3.0"
alias(libs.plugins.compose.compiler)
}
/**
* Property from the Gradle command line. To remove the snapshot suffix from the version.
*/
if (project.hasProperty("removeSnapshotSuffix")) {
val mainVersion = (version as String).split("-SNAPSHOT")[0]
version = mainVersion
}
allprojects {
apply(plugin = "org.jlleitschuh.gradle.ktlint")
ktlint {
version.set("0.50.0")
verbose.set(true)
outputToConsole.set(true)
filter {
exclude("**/generated/**")
}
}
tasks.withType<KotlinCompile>().all {
kotlinOptions { freeCompilerArgs += "-Xexpect-actual-classes" }
}
}
subprojects {
apply(plugin = "org.jetbrains.dokka")
tasks.withType<KotlinCompilationTask<*>>().configureEach {
compilerOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors.set(true)
if (project.providers.gradleProperty("enableComposeCompilerReports").isPresent) {
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:reportsDestination=" +
layout.buildDirectory.asFile.get().absolutePath +
"/compose_metrics",
)
freeCompilerArgs.addAll(
"-P",
"plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=" +
layout.buildDirectory.asFile.get().absolutePath +
"/compose_metrics",
)
}
}
}
plugins.withId("app.cash.paparazzi") {
// Defer until afterEvaluate so that testImplementation is created by Android plugin.
afterEvaluate {
dependencies.constraints {
add("testImplementation", "com.google.guava:guava") {
attributes {
attribute(
TargetJvmEnvironment.TARGET_JVM_ENVIRONMENT_ATTRIBUTE,
objects.named(TargetJvmEnvironment::class.java, TargetJvmEnvironment.STANDARD_JVM),
)
}
because(
"LayoutLib and sdk-common depend on Guava's -jre published variant." +
"See https://github.com/cashapp/paparazzi/issues/906.",
)
}
}
}
}
}
val ossrhUsername: String? = System.getenv("OSSRH_USERNAME")
val ossrhPassword: String? = System.getenv("OSSRH_PASSWORD")
nexusPublishing {
this.repositories {
sonatype {
username.set(ossrhUsername)
password.set(ossrhPassword)
}
}
}