Common Gradle modules for SVV Saga projects.
All plugins and modules will be published both to GitHub Packages and to Google Artifact Registry. The list of packages can be found at GCP Artifact Registry ( requires login with any Google account).
This is done through the "Publish packages" GitHub action found in .github/workflows/publish-packages.yml
.
We follow semantic versioning when publishing new versions.
A new version will automatically be published when a push or PR merge is done with a commit msg tag.
- If any commit in the push has a commit message containing
#major
, a major version will be published. - If any commit in the push has a commit message containing
#minor
, a minor version will be published. - If any commit in the push has a commit message containing
#patch
, a patch version will be published. - Otherwise, no new tag is created.
The saga-build
-plugin will add repositories for the shared modules and dependencies.
In settings.gradle.kts
:
pluginManagement {
repositories {
mavenCentral()
gradlePluginPortal()
maven {
url = uri("https://europe-maven.pkg.dev/saga-artifacts/maven-public")
}
}
}
In build.gradle.kts
:
plugins {
id("saga-build") version "28.0.0"
}
dependencies {
implementation("no.vegvesen.saga.modules:shared:27.0.0")
}
In build.gradle.kts
:
repositories {
mavenCentral()
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://packages.confluent.io/maven") // Needed by beam-runners-google-cloud-dataflow-java
maven("https://jitpack.io")
maven {
url = uri("https://europe-maven.pkg.dev/saga-artifacts/maven-public")
}
}
dependencies {
implementation("no.vegvesen.saga.modules:shared:27.0.0")
}
To use our version catalog, add this to
your settings.gradle.kts
:
dependencyResolutionManagement {
repositories {
maven {
url = uri("https://europe-maven.pkg.dev/saga-artifacts/maven-public")
}
}
versionCatalogs {
create("saga") {
from("no.vegvesen.saga.modules:modules:27.0.0")
}
}
}
Then you can add dependencies using the strongly typed saga
extension:
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(saga.shared)
}
When updating, you only have to update the single version of the version catalog, not every dependency.
To refer to catalogs in the subprojects
and allprojects
block, you must prefix the usage with rootProject
:
subprojects {
dependencies {
implementation(rootProject.saga.shared)
testImplementation(rootProject.saga.testing)
}
}
See gradle/gradle#16634 for more info.
- Run
setup.sh
to install precommit hooks for ensuring secrets are not checked in, and other checks. - After opening a folder or subfolder in IntelliJ IDEA, run
setup-ktlint.sh
to configure IntelliJ with the ktlint code style.
- Run "publishToMavenLocal" Gradle target in "modules" or "plugins/saga-build/" (for plugins) directory. This will build
snapshot versions of modules to local maven repository given by
version
line in build.gradle.kts ( e.g.1.3.0-SNAPSHOT
) - From another project where code is to be tested, add temporary
mavenLocal()
torepositories
section in build.gradle.kts and set version to the snapshot version:
// Temporary just to test new snapshot releases
repositories {
mavenLocal()
}
mavenLocal()
also works with version of Gradle version catalog in settings.gradle.kts:
val modulesVersion = "1.3.0-SNAPSHOT" // Temporary while testing
dependencyResolutionManagement {
repositories {
mavenLocal() // NOTE: only use for testing local snapshot versions during development
maven {
url = uri("https://europe-maven.pkg.dev/saga-artifacts/maven-public")
}
}
versionCatalogs {
create("saga") {
from("no.vegvesen.saga.modules:modules:$modulesVersion")
}
}
}
This is useful when wanting to test modules before merging and releasing a new version.
It looks like it is currently not possible to combine includeBuild (composite build) with snapshot version of version catalog.
To run integration tests, you must set the SAGA_INT_TEST_PROJECT_ID
environment variable to a GCP project ID used for
integration testing.