Skip to content

Commit

Permalink
refactor: rely on gradle.properties
Browse files Browse the repository at this point in the history
  • Loading branch information
jenspots committed Nov 11, 2024
1 parent c029153 commit aa7d6f0
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 144 deletions.
59 changes: 40 additions & 19 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,31 +1,52 @@
plugins {
kotlin("jvm") version "2.0.21"
kotlin("jvm")
id("co.uzzu.dotenv.gradle")
id("maven-publish")
id("co.uzzu.dotenv.gradle") version "4.0.0"
id("org.jetbrains.dokka") version "1.9.20"
id("org.jetbrains.dokka")
}

/** Generating KDoc requires all subprojects to use Dokka as well. */
subprojects { apply(plugin = "org.jetbrains.dokka") }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

group = "technology.idlab"
allprojects {
/** The current version number of the RDF-Connect Orchestrator. */
val projectVersion: String by project
version = projectVersion

version = "0.0.2"
/** The group name of the project. */
val projectGroup: String by project
group = projectGroup

kotlin { jvmToolchain(22) }
// Make the GH Packages repository available.
repositories {
mavenCentral()

/**
* A list of all the repositories we use in the project. This includes the maven central repository
* and the GitHub package repository.
*/
repositories {
mavenCentral()
maven {
url = uri("https://maven.pkg.github.com/rdf-connect/orchestrator")
credentials {
username = env.fetchOrNull("GITHUB_ACTOR") ?: System.getenv("GITHUB_ACTOR")
password = env.fetchOrNull("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN")
}
}
}
}

subprojects {
// Shared plugins.
apply(plugin = "org.jetbrains.kotlin.jvm")
apply(plugin = "maven-publish")
apply(plugin = "org.jetbrains.dokka")

// Configure testing framework.
tasks.test {
useJUnitPlatform()

maxParallelForks = 1

maven {
url = uri("https://maven.pkg.github.com/rdf-connect/orchestrator")
credentials {
username = env.fetchOrNull("GITHUB_ACTOR") ?: System.getenv("GITHUB_ACTOR")
password = env.fetchOrNull("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN")
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
}
}
}
11 changes: 11 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,13 @@
kotlin.code.style=official

# Project information.
projectVersion=0.0.2
projectGroup = "technology.idlab

# Dependency versions.
kotlinVersion=2.0.21
jdkVersion=22
dotEnvVersion=4.0.0
dokkaVersion=1.9.20
shadowVersion=8.3.3
protobufVersion=0.9.4
15 changes: 4 additions & 11 deletions rdfc-cli/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
plugins {
application
kotlin("jvm") version "2.0.21"
id("com.gradleup.shadow") version "8.3.3"
id("com.gradleup.shadow")
}

group = "technology.idlab"

version = "0.0.2"

/** Specify the entrypoint for the application. */
application { mainClass.set("technology.idlab.rdfc.cli.MainKt") }

kotlin { jvmToolchain(22) }

repositories { mavenCentral() }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

dependencies {
// Local dependencies
Expand All @@ -29,8 +24,6 @@ dependencies {
testImplementation(kotlin("test"))
}

tasks.test { useJUnitPlatform() }

tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
// Name of the resulting archive.
archiveFileName.set("rdfc.jar")
Expand Down
37 changes: 3 additions & 34 deletions rdfc-core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
plugins {
kotlin("jvm") version "2.0.21"
id("maven-publish")
}

group = "technology.idlab"

version = "0.0.2"

kotlin { jvmToolchain(22) }

repositories { mavenCentral() }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

dependencies {
// HTTP dependency
Expand All @@ -27,29 +18,7 @@ dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()

maxParallelForks = 1

testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
}
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/rdf-connect/orchestrator")
credentials {
username = env.fetchOrNull("GITHUB_ACTOR") ?: System.getenv("GITHUB_ACTOR")
password = env.fetchOrNull("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN")
}
}
}

publications {
create<MavenPublication>("gpr") {
from(components["java"])
Expand Down
14 changes: 3 additions & 11 deletions rdfc-intermediate/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
plugins { kotlin("jvm") version "2.0.21" }

group = "technology.idlab"

version = "0.0.2"

kotlin { jvmToolchain(22) }

repositories { mavenCentral() }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

dependencies {
// Local dependencies
Expand All @@ -18,5 +12,3 @@ dependencies {
// KTest
testImplementation(kotlin("test"))
}

tasks.test { useJUnitPlatform() }
26 changes: 4 additions & 22 deletions rdfc-orchestrator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
plugins {
kotlin("jvm") version "2.0.21"
id("com.google.protobuf") version "0.9.4"
}

group = "technology.idlab"

version = "0.0.2"
plugins { id("com.google.protobuf") }

kotlin { jvmToolchain(22) }

repositories { mavenCentral() }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

dependencies {
// Kotlin extensions.
Expand Down Expand Up @@ -50,17 +43,6 @@ dependencies {
testImplementation("org.jetbrains.kotlin:kotlin-test")
}

tasks.test {
useJUnitPlatform()

maxParallelForks = 1

testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
}
}

/** We define these explicitly due to the reliance on Protobuf and gRPC. */
sourceSets { main { proto { srcDir("../proto") } } }

Expand Down
14 changes: 3 additions & 11 deletions rdfc-parser/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
plugins { kotlin("jvm") version "2.0.21" }

group = "technology.idlab"

version = "0.0.2"

kotlin { jvmToolchain(22) }

repositories { mavenCentral() }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

dependencies {
// Local dependencies
Expand All @@ -24,5 +18,3 @@ dependencies {
// KTest
testImplementation(kotlin("test"))
}

tasks.test { useJUnitPlatform() }
37 changes: 3 additions & 34 deletions rdfc-processor/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
plugins {
kotlin("jvm") version "2.0.21"
id("maven-publish")
}

group = "technology.idlab"

version = "0.0.2"

kotlin { jvmToolchain(22) }

repositories { mavenCentral() }
/** The target JDK. */
val jdkVersion: String by project
kotlin { jvmToolchain(jdkVersion.toInt()) }

dependencies {
// Local dependencies
Expand All @@ -22,29 +13,7 @@ dependencies {
testImplementation(kotlin("test"))
}

tasks.test {
useJUnitPlatform()

maxParallelForks = 1

testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
}
}

publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/rdf-connect/orchestrator")
credentials {
username = env.fetchOrNull("GITHUB_ACTOR") ?: System.getenv("GITHUB_ACTOR")
password = env.fetchOrNull("GITHUB_TOKEN") ?: System.getenv("GITHUB_TOKEN")
}
}
}

publications {
create<MavenPublication>("gpr") {
from(components["java"])
Expand Down
19 changes: 17 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
plugins { id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0" }

rootProject.name = "technology.idlab.rdfc"

include("rdfc-core")
Expand All @@ -13,3 +11,20 @@ include("rdfc-cli")
include("rdfc-parser")

include("rdfc-intermediate")

pluginManagement {
val kotlinVersion: String by settings
val dotEnvVersion: String by settings
val dokkaVersion: String by settings
val shadowVersion: String by settings
val protobufVersion: String by settings

plugins {
kotlin("jvm") version kotlinVersion
id("co.uzzu.dotenv.gradle") version dotEnvVersion
id("org.jetbrains.dokka") version dokkaVersion
id("org.gradle.toolchains.foojay-resolver-convention") version "0.5.0"
id("com.gradleup.shadow") version shadowVersion
id("com.google.protobuf") version protobufVersion
}
}

0 comments on commit aa7d6f0

Please sign in to comment.