Migrate to using Nyx
This commit is contained in:
parent
524e1bcd1f
commit
c671c23df0
4 changed files with 129 additions and 88 deletions
|
@ -5,40 +5,6 @@ on:
|
|||
- pull_request
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: git.staropensource.de/infrastructure/actions-docker:java
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- name: Restore Gradle cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
- name: Compile
|
||||
run: ./gradlew --no-daemon -Pjava.skipToolchainSpecification=true jar
|
||||
- name: Save Gradle cache
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
- name: Upload JARs
|
||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: jars
|
||||
path: |
|
||||
**/build/libs/*.jar
|
||||
if-no-files-found: error
|
||||
test:
|
||||
runs-on: docker
|
||||
container:
|
||||
|
@ -66,6 +32,40 @@ jobs:
|
|||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
build-jars:
|
||||
runs-on: docker
|
||||
container:
|
||||
image: git.staropensource.de/infrastructure/actions-docker:java
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: https://code.forgejo.org/actions/checkout@v4
|
||||
- name: Restore Gradle cache
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
- name: Compile
|
||||
run: ./gradlew --no-daemon -Pjava.skipToolchainSpecification=true jar javadocJar sourcesJar
|
||||
- name: Save Gradle cache
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
gradle-${{ runner.os }}-
|
||||
- name: Upload JARs
|
||||
uses: https://code.forgejo.org/forgejo/upload-artifact@v4
|
||||
with:
|
||||
name: jars
|
||||
path: |
|
||||
**/build/libs/*.jar
|
||||
if-no-files-found: error
|
||||
build-apidoc:
|
||||
runs-on: docker
|
||||
container:
|
||||
|
|
141
build.gradle.kts
141
build.gradle.kts
|
@ -17,12 +17,10 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import ca.solostudios.nyx.util.reposiliteMaven
|
||||
import org.jetbrains.dokka.DokkaConfiguration
|
||||
import org.jetbrains.dokka.gradle.DokkaTask
|
||||
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||
import java.net.URI
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.LinkOption
|
||||
|
||||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
|
@ -47,7 +45,6 @@ import java.nio.file.LinkOption
|
|||
// Plugins
|
||||
plugins {
|
||||
id("java-library")
|
||||
id("maven-publish")
|
||||
|
||||
// Kotlin support
|
||||
id("org.jetbrains.kotlin.jvm") version("2.0.0")
|
||||
|
@ -57,23 +54,99 @@ plugins {
|
|||
|
||||
// Git properties
|
||||
id("com.gorylenko.gradle-git-properties") version("2.4.2")
|
||||
|
||||
// Nyx
|
||||
// Smol props to the creator of this plugin!
|
||||
// solonovamax helped me (JeremyStarTM) improve
|
||||
// this build script.
|
||||
id("ca.solo-studios.nyx") version("0.2.3")
|
||||
}
|
||||
|
||||
allprojects {
|
||||
// Plugins
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "java-library")
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "org.jetbrains.kotlin.jvm")
|
||||
apply(plugin = "org.jetbrains.dokka")
|
||||
apply(plugin = "com.gorylenko.gradle-git-properties")
|
||||
apply(plugin = "ca.solo-studios.nyx")
|
||||
|
||||
// Version
|
||||
version = "${property("versionRelease") as String}-${property("versionType") as String}${property("versionTyperelease") as String}"
|
||||
if (property("versionFork") != "")
|
||||
version = "${version as String}-${property("versionFork") as String}"
|
||||
if (property("versionCompanion") != "")
|
||||
version = "${version as String}+${property("versionCompanion") as String}"
|
||||
nyx {
|
||||
// Project information
|
||||
info {
|
||||
name = this@allprojects.name
|
||||
group = "de.staropensource.engine"
|
||||
module = this@allprojects.name
|
||||
version = buildString {
|
||||
append(property("versionRelease") as String)
|
||||
append("-")
|
||||
append(property("versionType") as String)
|
||||
append(property("versionTyperelease") as String)
|
||||
|
||||
if (property("versionFork") != "") {
|
||||
append(version)
|
||||
append("-")
|
||||
append(property("versionFork") as String)
|
||||
}
|
||||
|
||||
if (property("versionCompanion") != "") {
|
||||
append(version)
|
||||
append("-")
|
||||
append(property("versionCompanion") as String)
|
||||
}
|
||||
}
|
||||
description = this@allprojects.description ?: "The description of this sos!engine subsystem or subproject was not set"
|
||||
organizationName = "The StarOpenSource Project"
|
||||
organizationUrl = "hhttps://staropensource.de"
|
||||
developer {
|
||||
id = "staropensource"
|
||||
name = "The StarOpenSource Project"
|
||||
email = "support@staropensource.de"
|
||||
url = "https://staropensource.de"
|
||||
}
|
||||
repository.fromGitHostWithIssues("StarOpenSource", "Engine", "https://git.staropensource.de", "sos!git")
|
||||
license.useGPLv3()
|
||||
}
|
||||
|
||||
// Publishing
|
||||
// Does not yet work, see
|
||||
// https://github.com/solo-studios/nyx/issues/1
|
||||
/*
|
||||
publishing {
|
||||
withPublish()
|
||||
repositories {
|
||||
reposiliteMaven("https://mvn.staropensource.de/engine") {
|
||||
name = "staropensource-engine"
|
||||
credentials(PasswordCredentials::class)
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Compilation
|
||||
compile {
|
||||
withAllWarnings()
|
||||
withWarningsAsErrors()
|
||||
withDistributeLicense()
|
||||
encoding = "UTF-8"
|
||||
withZip64()
|
||||
withBuildDependsOnJar()
|
||||
withSuppressWarnings()
|
||||
jvmToolchain = (property("languageJava") as String).toInt()
|
||||
jvmTarget = (property("languageJava") as String).toInt()
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
withReproducibleBuilds()
|
||||
|
||||
// Kotlin-specific settings
|
||||
kotlin {
|
||||
apiVersion = property("languageKotlin") as String
|
||||
languageVersion = property("languageKotlin") as String
|
||||
compilerArgs = listOf(
|
||||
"-progressive"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Repositories
|
||||
repositories {
|
||||
|
@ -84,8 +157,8 @@ allprojects {
|
|||
// Dependencies
|
||||
dependencies {
|
||||
// Kotlin support
|
||||
kotlin(property("dependencyKotlin_StdIdentifier") as String)
|
||||
kotlin(property("dependencyKotlin_StdLibIdentifier") as String)
|
||||
//kotlin(property("dependencyKotlin_StdIdentifier") as String)
|
||||
//kotlin(property("dependencyKotlin_StdLibIdentifier") as String)
|
||||
implementation("${property("dependencyKotlin_ReflectIdentifier") as String}:${property("dependencyKotlinVersion") as String}")
|
||||
implementation("${property("dependencyKotlin_DateTimeIdentifier") as String}:${property("dependencyKotlin_DateTimeVersion") as String}")
|
||||
|
||||
|
@ -100,29 +173,6 @@ allprojects {
|
|||
testImplementation(project(":testing"))
|
||||
}
|
||||
|
||||
// Java
|
||||
java {
|
||||
// Java version
|
||||
sourceCompatibility = JavaVersion.toVersion(property("languageJava") as String)
|
||||
targetCompatibility = JavaVersion.toVersion(property("languageJava") as String)
|
||||
|
||||
if (!(hasProperty("java.skipToolchainSpecification") && property("java.skipToolchainSpecification") as String == "true"))
|
||||
toolchain {
|
||||
languageVersion = JavaLanguageVersion.of(property("languageJava") as String)
|
||||
}
|
||||
}
|
||||
|
||||
// Kotlin
|
||||
kotlin.compilerOptions {
|
||||
// Configuration
|
||||
progressiveMode = true
|
||||
allWarningsAsErrors = true
|
||||
verbose = true
|
||||
|
||||
// Set target metadata
|
||||
jvmTarget = JvmTarget.fromTarget(property("languageJava") as String)
|
||||
}
|
||||
|
||||
// Unit testing
|
||||
// -> Configure Gradle to use JUnit
|
||||
tasks.test {
|
||||
|
@ -139,21 +189,6 @@ allprojects {
|
|||
}
|
||||
|
||||
// Dokka
|
||||
// -> Register jar generation tasks
|
||||
// See https://kotlinlang.org/docs/dokka-gradle.html#build-javadoc-jar
|
||||
tasks.register<Jar>("dokkaHtmlJar") {
|
||||
dependsOn(tasks.dokkaHtml)
|
||||
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
|
||||
archiveClassifier.set("html-docs")
|
||||
}
|
||||
|
||||
tasks.register<Jar>("dokkaJavadocJar") {
|
||||
dependsOn(tasks.dokkaJavadoc)
|
||||
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
|
||||
archiveClassifier.set("javadoc")
|
||||
}
|
||||
|
||||
// -> Configure Dokka
|
||||
tasks.withType<DokkaTask>().configureEach {
|
||||
// Styling
|
||||
val dokkaBaseConfiguration = """
|
||||
|
@ -205,6 +240,7 @@ allprojects {
|
|||
dateFormat = "yyyy-MM-dd'T'HH:mm:ss.S'Z'"
|
||||
dateFormatTimeZone = "UTC"
|
||||
}
|
||||
|
||||
// -> Copy task
|
||||
tasks.register("copyGitProperties") {
|
||||
dependsOn(tasks.generateGitProperties)
|
||||
|
@ -226,7 +262,6 @@ allprojects {
|
|||
}
|
||||
|
||||
// Gradle properties
|
||||
// -> Copy task
|
||||
tasks.register("copyGradleProperties") {
|
||||
inputs.file("${project(":").projectDir.path}/gradle.properties")
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ versionCompanion=
|
|||
|
||||
# Language versions
|
||||
languageJava=21
|
||||
languageKotlin=2.1.0
|
||||
languageKotlin=2.0
|
||||
|
||||
# Dependencies
|
||||
dependencyKotlinVersion=2.1.0
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import java.net.URI
|
||||
|
||||
/*
|
||||
* STAROPENSOURCE ENGINE SOURCE FILE
|
||||
* Copyright (c) 2024 The StarOpenSource Engine Authors
|
||||
|
@ -23,6 +25,10 @@ pluginManagement {
|
|||
mavenLocal()
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = "solostudios-releases"
|
||||
setUrl("https://maven.solo-studios.ca/releases/")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue