Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Create version catalog and update versions #153

Merged
merged 2 commits into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
cache: 'gradle'
- name: Change wrapper permission
Expand All @@ -35,10 +35,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
cache: 'gradle'
- name: Change wrapper permission
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish_npm_beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
cache: 'gradle'
- name: Change wrapper permission
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
cache: 'gradle'
- name: Change wrapper permission
Expand All @@ -30,10 +30,10 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin
cache: 'gradle'
- name: Change wrapper permission
Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/scripts/build-npm-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
set -x

OUTPUT_DIR=$1
GRADLE_PARAMS=$2

BUILD_DIR="build/packages/js"

rm -rf $OUTPUT_DIR && mkdir $OUTPUT_DIR
./gradlew clean

./gradlew packJsPackage $GRADLE_PARAMS
mv $BUILD_DIR/* $OUTPUT_DIR/

./gradlew packJsPackage -PuseCommonJs $GRADLE_PARAMS
rm $BUILD_DIR/package.json
mv $BUILD_DIR/* $OUTPUT_DIR/
6 changes: 3 additions & 3 deletions .github/workflows/scripts/publish-npm-beta.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
set -x

./gradlew packJsPackage
./gradlew packJsPackage -PuseCommonJs
OUTPUT_DIR="packageJs"
sh $(dirname "$0")/build-npm-package.sh $OUTPUT_DIR

cd build/packages/js || exit
cd $OUTPUT_DIR || exit

# Set authentication token for npmjs registry
npm set //registry.npmjs.org/:_authToken="$NPMJS_TOKEN"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scripts/publish-npm-prod.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
set -x

./gradlew packJsPackage -PremoveSnapshotSuffix
./gradlew packJsPackage -PremoveSnapshotSuffix -PuseCommonJs
OUTPUT_DIR="packageJs"
sh $(dirname "$0")/build-npm-package.sh $OUTPUT_DIR -PremoveSnapshotSuffix

cd build/packages/js || exit
cd $OUTPUT_DIR || exit

# Set authentication token for npmjs registry
npm set //registry.npmjs.org/:_authToken="$NPMJS_TOKEN"
Expand Down
70 changes: 32 additions & 38 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,40 +1,34 @@
target
# Compiled class file
*.class

# Log file
*.log
*.log.*
./taret
./target
./target/classes
target/**
*.settings
.metadata
build.sh
.springBeans
nbactions.xml
.classpath
.project
.mtj
.idea
.swp
*.iml
*.ipr
*.ids
*.iws
overlays/
./dhis-2/atlassian-ide-plugin.xml
./atlassian-ide-plugin.xml
./.git
./.gitattributes
./.gitignore
./.travis.yml
.DS_Store
dhis-2/projectFilesBackup
coverage
node_modules
**/rebel.xml
./build
./gradle
/build
.build.gradle
build/

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Gradle wrapper
!gradle/wrapper/gradle-wrapper.jar

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea/
.gradle/
./src/main/AndroidManifest.xml
.kotlin/
target/
build/
kotlin-js-store/
node_modules/
12 changes: 6 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repositories {
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots") }
}

version = "3.3.3-SNAPSHOT"
version = "3.3.4-SNAPSHOT"
group = "org.hisp.dhis.rules"

if (project.hasProperty("removeSnapshotSuffix")) {
Expand All @@ -18,8 +18,8 @@ if (project.hasProperty("removeSnapshotSuffix")) {
}

kotlin {
jvmToolchain(17)
jvm {
jvmToolchain(17)
withJava()
testRuns.named("test") {
executionTask.configure {
Expand Down Expand Up @@ -58,8 +58,8 @@ kotlin {
}
val commonMain by getting {
dependencies {
implementation("org.hisp.dhis.lib.expression:expression-parser:1.1.6")
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.1")
implementation(libs.dhis.expression.parser)
implementation(libs.kotlinx.datetime)
}
}
val commonTest by getting {
Expand All @@ -69,13 +69,13 @@ kotlin {
}
val jvmMain by getting {
dependencies {
api("org.slf4j:slf4j-api:1.7.36")
api(libs.slf4j.api)
}
}
val jvmTest by getting
val jsMain by getting {
dependencies {
api("org.jetbrains.kotlin-wrappers:kotlin-js:1.0.0-pre.722")
api(libs.kotlinWrappers.js)
}
}
val jsTest by getting
Expand Down
13 changes: 4 additions & 9 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ plugins {
`kotlin-dsl`
}

val kotlinVersion = "1.9.22"
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}")
implementation(libs.kotlin.plugin)
implementation(libs.dokka.plugin)
implementation(libs.nexusPublish.plugin)
implementation(libs.npmPublish.plugin)
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
25 changes: 25 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
[versions]
kotlin = "2.0.21"
dokka = "1.9.10"
nexusPublish = "2.0.0"
npmPublish = "3.5.2"
kotlinxDatetime = "0.6.1"
kotlinJsWrappers = "1.0.0-pre.830"
slf4jApi = "1.7.36"
expressionParser = "1.1.6"

[libraries]
kotlin-plugin = { group = "org.jetbrains.kotlin", name = "kotlin-gradle-plugin", version.ref = "kotlin" }
dokka-plugin = { group = "org.jetbrains.dokka", name = "dokka-gradle-plugin", version.ref = "dokka" }
nexusPublish-plugin = { group = "io.github.gradle-nexus", name = "publish-plugin", version.ref = "nexusPublish" }
npmPublish-plugin = { group = "dev.petuska.npm.publish", name = "dev.petuska.npm.publish.gradle.plugin", version.ref = "npmPublish" }

kotlinx-datetime = { group = "org.jetbrains.kotlinx", name = "kotlinx-datetime", version.ref = "kotlinxDatetime"}
kotlinWrappers-js = { group = "org.jetbrains.kotlin-wrappers", name = "kotlin-js", version.ref = "kotlinJsWrappers"}
slf4j-api = { group = "org.slf4j", name = "slf4j-api", version.ref= "slf4jApi"}

dhis-expression-parser = { group = "org.hisp.dhis.lib.expression", name = "expression-parser", version.ref = "expressionParser"}

[plugins]

[bundles]
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Loading
Loading