-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bef3f68
commit 9cd5390
Showing
96 changed files
with
1,205 additions
and
424 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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
plugins { | ||
kotlin("multiplatform") | ||
id("maven-publish-conventions") | ||
id("npm-publish-conventions") | ||
} | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") } | ||
} | ||
|
||
group = "org.hisp.dhis.rules" | ||
version = "3.0.0-SNAPSHOT" | ||
|
||
val isReleaseVersion = project.hasProperty("removeSnapshot") | ||
if (isReleaseVersion) { | ||
version = (version as String).replace("-SNAPSHOT", "") | ||
} | ||
|
||
kotlin { | ||
jvm { | ||
jvmToolchain(17) | ||
withJava() | ||
testRuns.named("test") { | ||
executionTask.configure { | ||
useJUnit() | ||
} | ||
} | ||
} | ||
js { | ||
nodejs() | ||
useEsModules() | ||
binaries.library() | ||
generateTypeScriptDefinitions() | ||
} | ||
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 { | ||
val commonMain by getting { | ||
dependencies { | ||
implementation("org.hisp.dhis.lib.expression:expression-parser:1.1.0-SNAPSHOT") | ||
} | ||
} | ||
val commonTest by getting { | ||
dependencies { | ||
implementation(kotlin("test")) | ||
} | ||
} | ||
val jvmMain by getting | ||
val jvmTest by getting { | ||
dependencies { | ||
implementation("io.mockk:mockk:1.13.8") | ||
} | ||
} | ||
val jsMain by getting | ||
val jsTest by getting | ||
val nativeMain by getting | ||
val nativeTest by getting | ||
} | ||
} |
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,20 @@ | ||
plugins { | ||
`kotlin-dsl` | ||
} | ||
|
||
val kotlinVersion = "1.9.21" | ||
val dokkaVersion = "1.9.10" | ||
val nexusPluginVersion = "1.3.0" | ||
val npmPluginVersion = "3.4.1" | ||
|
||
repositories { | ||
mavenCentral() | ||
gradlePluginPortal() | ||
} | ||
|
||
dependencies { | ||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}") | ||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}") | ||
implementation("io.github.gradle-nexus:publish-plugin:${nexusPluginVersion}") | ||
implementation("dev.petuska:npm-publish-gradle-plugin:${npmPluginVersion}") | ||
} |
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,35 @@ | ||
object Props { | ||
const val DESCRIPTION = "Rule Engine" | ||
|
||
const val REPOSITORY_TYPE = "git" | ||
const val REPOSITORY_SYSTEM = "GitHub" | ||
const val REPOSITORY_URL = "https://github.com/dhis2/dhis2-rule-engine.git" | ||
|
||
const val ORGANIZATION_NAME = "UiO" | ||
const val ORGANIZATION_URL = "https://dhis2.org" | ||
|
||
const val LICENSE_NAME = "BSD-3-Clause" | ||
const val LICENSE_URL = "https://opensource.org/license/bsd-3-clause/" | ||
|
||
val DEVELOPERS = listOf( | ||
Developer( | ||
name = "Enrico Colasante", | ||
email = "[email protected]", | ||
organization = "UiO", | ||
organizationUrl = "https://www.uio.no/" | ||
), | ||
Developer( | ||
name = "Zubair Asghar", | ||
email = "[email protected]", | ||
organization = "UiO", | ||
organizationUrl = "https://www.uio.no/" | ||
), | ||
) | ||
} | ||
|
||
data class Developer( | ||
val name: String, | ||
val email: String, | ||
val organization: String, | ||
val organizationUrl: String, | ||
) |
76 changes: 76 additions & 0 deletions
76
buildSrc/src/main/kotlin/maven-publish-conventions.gradle.kts
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,76 @@ | ||
plugins { | ||
`maven-publish` | ||
signing | ||
id("io.github.gradle-nexus.publish-plugin") | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
val ossrhUsername: String? = System.getenv("OSSRH_USERNAME") | ||
val ossrhPassword: String? = System.getenv("OSSRH_PASSWORD") | ||
val signingPrivateKey: String? = System.getenv("SIGNING_PRIVATE_KEY") | ||
val signingPassword: String? = System.getenv("SIGNING_PASSWORD") | ||
|
||
val isReleaseVersion = (version as String).contains("SNAPSHOT") | ||
|
||
val dokkaHtml = tasks.findByName("dokkaHtml")!! | ||
|
||
val dokkaHtmlJar = tasks.register<Jar>("dokkaHtmlJar") { | ||
dependsOn(dokkaHtml) | ||
from(dokkaHtml.outputs) | ||
archiveClassifier.set("docs") | ||
} | ||
|
||
publishing { | ||
publications.withType<MavenPublication> { | ||
artifact(dokkaHtmlJar) | ||
|
||
pom { | ||
name.set("rule-engine") | ||
description.set(Props.DESCRIPTION) | ||
|
||
organization { | ||
name.set(Props.ORGANIZATION_NAME) | ||
url.set(Props.ORGANIZATION_URL) | ||
} | ||
developers { | ||
Props.DEVELOPERS.map { | ||
developer { | ||
name.set(it.name) | ||
email.set(it.email) | ||
organization.set(it.organization) | ||
organizationUrl.set(it.organizationUrl) | ||
} | ||
} | ||
} | ||
licenses { | ||
license { | ||
name.set(Props.LICENSE_NAME) | ||
url.set(Props.LICENSE_URL) | ||
} | ||
} | ||
scm { | ||
url.set("lp:dhis2") | ||
} | ||
issueManagement { | ||
system.set(Props.REPOSITORY_SYSTEM) | ||
url.set(Props.REPOSITORY_URL) | ||
} | ||
url.set(Props.REPOSITORY_URL) | ||
} | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
this.repositories { | ||
sonatype { | ||
username.set(ossrhUsername) | ||
password.set(ossrhPassword) | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
isRequired = isReleaseVersion | ||
useInMemoryPgpKeys(signingPrivateKey, signingPassword) | ||
sign(publishing.publications) | ||
} |
52 changes: 52 additions & 0 deletions
52
buildSrc/src/main/kotlin/npm-publish-conventions.gradle.kts
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,52 @@ | ||
import dev.petuska.npm.publish.extension.domain.NpmAccess | ||
|
||
plugins { | ||
id("dev.petuska.npm.publish") | ||
} | ||
|
||
val npmjsToken: String? = System.getenv("NPMJS_TOKEN") | ||
|
||
project.afterEvaluate { | ||
npmPublish { | ||
access.set(NpmAccess.PUBLIC) | ||
packages { | ||
named("js") { | ||
scope.set("dhis2") | ||
readme.set(File("./README.md")) | ||
packageJson { | ||
"module" by "${project.name}.mjs" | ||
"main" by "" | ||
"exports" by { | ||
"import" by "./${project.name}.mjs" | ||
} | ||
"contributors" by Props.DEVELOPERS.map { developer -> | ||
"${developer.name} <${developer.email}>" | ||
} | ||
"description" by Props.DESCRIPTION | ||
"license" by Props.LICENSE_NAME | ||
"repository" by { | ||
"type" by Props.REPOSITORY_TYPE | ||
"url" by Props.REPOSITORY_URL | ||
} | ||
"publishConfig" by { | ||
"access" by "public" | ||
} | ||
} | ||
} | ||
} | ||
registries { | ||
npmjs { | ||
authToken.set(npmjsToken) | ||
} | ||
} | ||
} | ||
|
||
tasks.named("assembleJsPackage") { | ||
doLast { | ||
val file = file("${layout.buildDirectory.get()}/packages/js/package.json") | ||
val mainRegex = "\n \"main\": \"\"," | ||
val removedMain = file.readText().replace(mainRegex, "") | ||
file.writeText(removedMain) | ||
} | ||
} | ||
} |
Binary file not shown.
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,7 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.