-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
119 lines (109 loc) · 3.47 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
119 lines (109 loc) · 3.47 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
plugins {
kotlin("multiplatform")
id("maven-publish-conventions")
id("npm-publish-conventions")
alias(libs.plugins.api.compatibility)
alias(libs.plugins.kover)
alias(libs.plugins.sonarqube)
}
repositories {
mavenCentral()
maven { url = uri("https://central.sonatype.com/repository/maven-snapshots/") }
}
version = "3.8.2-SNAPSHOT"
group = "org.hisp.dhis.rules"
if (project.hasProperty("removeSnapshotSuffix")) {
val mainVersion = (version as String).split("-SNAPSHOT")[0]
version = mainVersion
}
kotlin {
jvmToolchain(17)
jvm {
withJava()
testRuns.named("test") {
executionTask.configure {
useJUnit()
}
}
}
js {
nodejs()
if (project.hasProperty("useCommonJs")) {
useCommonJs()
} else {
useEsModules()
generateTypeScriptDefinitions()
}
binaries.library()
compilerOptions {
freeCompilerArgs.add("-Xes-long-as-bigint")
freeCompilerArgs.add("-XXLanguage:+JsAllowLongInExportedDeclarations")
}
}
val hostOs = System.getProperty("os.name")
val isArm64 = System.getProperty("os.arch") == "aarch64"
val isMingwX64 = hostOs.startsWith("Windows")
val nativeTarget = when {
hostOs == "Mac OS X" && isArm64 -> macosArm64("native")
hostOs == "Mac OS X" && !isArm64 -> macosX64("native")
hostOs == "Linux" && isArm64 -> linuxArm64("native")
hostOs == "Linux" && !isArm64 -> linuxX64("native")
isMingwX64 -> mingwX64("native")
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
}
sourceSets {
all {
languageSettings.apply {
optIn("kotlin.js.ExperimentalJsExport")
optIn("kotlin.time.ExperimentalTime")
}
}
val commonMain by getting {
dependencies {
implementation(libs.dhis.expression.parser)
implementation(libs.kotlinx.datetime)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
}
}
val jvmMain by getting {
dependencies {
api(libs.slf4j.api)
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
api(libs.kotlinWrappers.js)
}
}
val jsTest by getting
val nativeMain by getting
val nativeTest by getting
}
}
sonarqube {
properties {
val branch = System.getenv("GIT_BRANCH")
val targetBranch = System.getenv("GIT_BRANCH_DEST")
val pullRequestId = System.getenv("PULL_REQUEST")
property("sonar.host.url", "https://sonarcloud.io")
property("sonar.organization", "dhis2")
property("sonar.projectKey", "dhis2_dhis2-rule-engine")
property("sonar.projectName", "dhis2-rule-engine")
property("sonar.coverage.jacoco.xmlReportPaths", "${layout.buildDirectory.get()}/reports/kover/report.xml")
if (pullRequestId.isNullOrEmpty()) {
property("sonar.branch.name", branch)
} else {
property("sonar.pullrequest.base", targetBranch)
property("sonar.pullrequest.branch", branch)
property("sonar.pullrequest.key", pullRequestId)
}
}
}
tasks.named("sonar").configure {
dependsOn(":koverXmlReport")
}