Migrate to convention build scripts, update to Kotlin 2.1
All checks were successful
PRs & Pushes / test (push) Successful in 5m40s
PRs & Pushes / build-jars (push) Successful in 5m39s
PRs & Pushes / build-apidoc (push) Successful in 6m0s

This commit is contained in:
JeremyStar™ 2025-01-14 02:42:12 +01:00
parent 64f7b5be54
commit 2d7f46e9db
Signed by: JeremyStarTM
GPG key ID: E366BAEF67E4704D
11 changed files with 475 additions and 365 deletions

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors * Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3. * Licensed under the GNU General Public License v3.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -17,6 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Plugins
plugins {
id("engine.generic")
id("engine.generic.properties")
}
// Dependencies // Dependencies
dependencies { dependencies {
// sos!engine // sos!engine

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors * Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3. * Licensed under the GNU General Public License v3.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -17,6 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Plugins
plugins {
id("engine.generic")
id("engine.generic.properties")
}
// Dependencies // Dependencies
dependencies { dependencies {
// OSHI // OSHI

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors * Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3. * Licensed under the GNU General Public License v3.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -17,261 +17,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * 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 java.net.URI
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors
* Licensed under the GNU Affero General Public License v3
* with an exception allowing classpath linking.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Plugins // Plugins
plugins { plugins {
id("java-library") id("engine.generic")
id("maven-publish")
// Kotlin support
id("org.jetbrains.kotlin.jvm") version("2.0.0")
// Dokka
id("org.jetbrains.dokka") version("1.9.20")
// 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-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")
nyx {
// Project information
info {
group = "de.staropensource.engine"
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
publishing {
withPublish()
repositories {
reposiliteMaven("https://mvn.staropensource.de/engine") {
name = "staropensource-engine"
credentials(PasswordCredentials::class)
}
}
}
// Compilation
compile {
withAllWarnings()
withWarningsAsErrors()
withDistributeLicense()
encoding = "UTF-8"
withZip64()
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 {
mavenLocal()
mavenCentral()
}
// Dependencies
dependencies {
// Kotlin support
implementation("${property("dependencyKotlin_ReflectIdentifier") as String}:${property("dependencyKotlinVersion") as String}")
implementation("${property("dependencyKotlin_CoroutinesIdentifier") as String}:${property("dependencyKotlin_CoroutinesVersion") as String}")
implementation("${property("dependencyKotlin_DateTimeIdentifier") as String}:${property("dependencyKotlin_DateTimeVersion") as String}")
// Unit testing
// -> Kotlin
testImplementation(kotlin("test"))
// -> JUnit
testImplementation(platform("${property("testDependencyJUnit_BOMIdentifier")}:${property("testDependencyJUnitVersion")}"))
testImplementation("${property("testDependencyJUnit_JupiterIdentifier")}")
testRuntimeOnly("${property("testDependencyJUnit_PlatformIdentifier")}")
// -> sos!engine
testImplementation(project(":testing"))
}
// Unit testing
// -> Configure Gradle to use JUnit
tasks.test {
useJUnitPlatform()
testLogging {
events(
"passed",
"skipped",
"failed"
)
}
maxParallelForks = 1
}
// Dokka
tasks.withType<DokkaTask>().configureEach {
// Styling
val dokkaBaseConfiguration = """
{
"_customAssets": ["${file("assets/my-image.png")}"],
"_customStyleSheets": ["${file("assets/my-styles.css")}"],
"footerMessage": "&copy; 2024 The StarOpenSource Engine Authors. Licensed under the GNU Affero General Public License v3",
"_separateInheritedMembers": false,
"_templatesDir": "${file("dokka/templates")}",
"_mergeImplicitExpectActualDeclarations": false
}
"""
pluginsMapConfiguration = mapOf(
"org.jetbrains.dokka.base.DokkaBase" to dokkaBaseConfiguration
)
// Configuration
moduleName = rootProject.name
moduleVersion = "v${this@allprojects.version as String}"
failOnWarning = true
suppressObviousFunctions = true
suppressInheritedMembers = true
dokkaSourceSets.configureEach {
// Metadata
displayName = this@allprojects.name
documentedVisibilities = setOf(DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED)
reportUndocumented = false
skipEmptyPackages = false
skipDeprecated = false
jdkVersion = 21
// Source link
sourceLink {
localDirectory = this@allprojects.projectDir.resolve("src")
remoteUrl = URI("https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/" + this@allprojects.name.replace(":", "/") + "/src").toURL()
remoteLineSuffix = "#L"
}
}
}
// Git properties
// -> Configure
gitProperties {
dotGitDirectory = file("${rootProject.rootDir}/.git")
failOnNoGitDirectory = false // Allow continuing if .git directory is missing (tarball)
extProperty = "git"
dateFormat = "yyyy-MM-dd'T'HH:mm:ss.S'Z'"
dateFormatTimeZone = "UTC"
}
// -> Copy task
tasks.register("copyGitProperties") {
dependsOn(tasks.generateGitProperties)
inputs.file("${this@allprojects.projectDir}/build/resources/main/git.properties")
doLast {
if (rootProject == this@allprojects)
return@doLast
file(inputs.files.first())
.copyTo(
file("${this@allprojects.projectDir}/src/main/resources/sosengine-${this@allprojects.name.replace(":", "-")}-git.properties"),
overwrite = true
)
}
}
tasks.processResources {
dependsOn(tasks["copyGitProperties"])
}
// Gradle properties
// -> Copy task
tasks.register("copyGradleProperties") {
inputs.file("${rootProject.projectDir.path}/gradle.properties")
doLast {
if (rootProject == project)
return@doLast
file(inputs.files.first())
.copyTo(
file("${this@allprojects.projectDir}/src/main/resources/sosengine-${this@allprojects.name.replace(":", "-")}-gradle.properties"),
overwrite = true
)
}
}
tasks.processResources {
dependsOn(tasks["copyGradleProperties"])
}
} }

55
buildSrc/build.gradle.kts Normal file
View file

@ -0,0 +1,55 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Plugins
plugins {
`kotlin-dsl`
}
// Repositories
repositories {
mavenLocal()
mavenCentral()
maven {
name = "solostudios-releases"
setUrl("https://maven.solo-studios.ca/releases/")
}
gradlePluginPortal()
}
// Dependencies
dependencies {
// Kotlin support
implementation("org.jetbrains.kotlin.jvm:org.jetbrains.kotlin.jvm.gradle.plugin:2.1.0")
// Dokka
implementation("org.jetbrains.dokka:org.jetbrains.dokka.gradle.plugin:1.9.20")
// Git properties
implementation("com.gorylenko.gradle-git-properties:com.gorylenko.gradle-git-properties.gradle.plugin:2.4.2")
// Nyx
implementation("ca.solo-studios.nyx:ca.solo-studios.nyx.gradle.plugin:0.2.3")
// Native Image
implementation("org.mikeneck.graalvm-native-image:org.mikeneck.graalvm-native-image.gradle.plugin:v1.4.0")
// Shadow
implementation("com.gradleup.shadow:com.gradleup.shadow.gradle.plugin:8.3.5")
}

View file

@ -0,0 +1,92 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Plugins
plugins {
application
// Native image
id("org.mikeneck.graalvm-native-image")
}
// Fix stdin
tasks.withType(JavaExec::class) {
standardInput = System.`in`
}
// Configure application
application {
// JVM arguments
application.applicationDefaultJvmArgs = buildList {
// Unlock more VM options
add("-XX:+UnlockDiagnosticVMOptions")
add("-XX:+UnlockExperimentalVMOptions")
// VM settings
// -> Log garbage collection
if (
hasProperty("jvm.logGC")
&& property("jvm.logGC") as String == "true"
)
add("-Xlog:gc")
// -> Log JIT & AOT
if (
hasProperty("jvm.logJITandAOT")
&& property("jvm.logJITandAOT") as String == "true"
) {
add("-XX:+PrintCompilation")
add("-XX:+PrintInlining")
}
// -> Select garbage collector
if (hasProperty("jvm.garbageCollector"))
when (property("jvm.garbageCollector")) {
"epsilon" -> add("-XX:+UseEpsilonGC")
"serial" -> add("-XX:+UseSerialGC")
"g1" -> add("-XX:+UseG1GC")
}
// -> Manually added settings
if (hasProperty("jvm.args"))
addAll((property("jvm.args") as String).split(" "))
}
}
// GraalVM native-image
nativeImage {
outputs.upToDateWhen { true }
// for some reason using Gradle properties does not work
graalVmHome = System.getProperty("graalHome", System.getProperty("java.home"))
executableName = "sosfurz-${name}"
outputDirectory = file("build/bin")
arguments {
add("-H:+UnlockExperimentalVMOptions")
add("--color=always")
add("-march=native")
add("-O3")
add("--no-fallback")
add("--report-unsupported-elements-at-runtime")
add("--enable-http")
add("--enable-https")
add("-H:IncludeResources=.*properties\$")
}
}

View file

@ -0,0 +1,214 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* 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 java.net.URI
// Utility
/**
* Local variable for the [getName] method
* for the `.properties` copying process.
*/
val projectName = name
/**
* Local implementation of [property]
* for the `runTask` plugin configuration.
*/
private fun propertyLocal(propertyName: String): Any? = property(propertyName)
// Plugins
plugins {
`java-library`
`maven-publish`
// Kotlin support
id("org.jetbrains.kotlin.jvm")
// Dokka
id("org.jetbrains.dokka")
// Nyx
// Smol props to the creator of this plugin!
// solonovamax helped me (JeremyStarTM)
// heavily improve these build scripts
// thanks to their extended knowledge of
// the Gradle build system.
id("ca.solo-studios.nyx")
}
nyx {
// Project information
info {
group = "de.staropensource.engine"
version = buildString {
append(propertyLocal("versionRelease") as String)
append("-")
append(propertyLocal("versionType") as String)
append(propertyLocal("versionTyperelease") as String)
if (propertyLocal("versionFork") != "") {
append(version)
append("-")
append(propertyLocal("versionFork") as String)
}
if (propertyLocal("versionCompanion") != "") {
append(version)
append("-")
append(propertyLocal("versionCompanion") as String)
}
}
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
publishing {
withPublish()
repositories {
reposiliteMaven("https://mvn.staropensource.de/engine") {
name = "staropensource-engine"
credentials(PasswordCredentials::class)
}
}
}
// Compilation
compile {
withAllWarnings()
withWarningsAsErrors()
withDistributeLicense()
encoding = "UTF-8"
withZip64()
withSuppressWarnings()
jvmToolchain = (propertyLocal("languageJava") as String).toInt()
jvmTarget = (propertyLocal("languageJava") as String).toInt()
withSourcesJar()
withJavadocJar()
withReproducibleBuilds()
// Kotlin-specific settings
kotlin {
apiVersion = propertyLocal("languageKotlin") as String
languageVersion = propertyLocal("languageKotlin") as String
compilerArgs = listOf(
"-progressive"
)
}
}
}
// Repositories
repositories {
mavenLocal()
mavenCentral()
}
// Dependencies
dependencies {
// Kotlin support
implementation("${propertyLocal("dependencyKotlin_ReflectIdentifier") as String}:${propertyLocal("dependencyKotlinVersion") as String}")
implementation("${propertyLocal("dependencyKotlin_CoroutinesIdentifier") as String}:${propertyLocal("dependencyKotlin_CoroutinesVersion") as String}")
implementation("${propertyLocal("dependencyKotlin_DateTimeIdentifier") as String}:${propertyLocal("dependencyKotlin_DateTimeVersion") as String}")
// SLF4J
runtimeOnly("${propertyLocal("dependencySLF4J_NOPProviderIdentifier") as String}:${propertyLocal("dependencySLF4JVersion") as String}")
// Unit testing
// -> Kotlin
testImplementation(kotlin("test"))
// -> JUnit
testImplementation(platform("${propertyLocal("testDependencyJUnit_BOMIdentifier")}:${propertyLocal("testDependencyJUnitVersion")}"))
testImplementation("${propertyLocal("testDependencyJUnit_JupiterIdentifier")}")
testRuntimeOnly("${propertyLocal("testDependencyJUnit_PlatformIdentifier")}")
// -> SLF4J
testRuntimeOnly("${propertyLocal("dependencySLF4J_NOPProviderIdentifier") as String}:${propertyLocal("dependencySLF4JVersion") as String}")
// -> sos!engine
testImplementation(project(":testing"))
}
// Unit testing
// -> Configure Gradle to use JUnit
tasks.test {
useJUnitPlatform()
testLogging {
events(
"passed",
"skipped",
"failed"
)
}
maxParallelForks = 1
}
// Dokka
tasks.withType<DokkaTask>().configureEach {
// Styling
val dokkaBaseConfiguration = """
{
"_customAssets": ["${file("assets/my-image.png")}"],
"_customStyleSheets": ["${file("assets/my-styles.css")}"],
"footerMessage": "&copy; 2024 The StarOpenSource Engine Authors. Licensed under the GNU General Public License v3",
"_separateInheritedMembers": false,
"_templatesDir": "${file("dokka/templates")}",
"_mergeImplicitExpectActualDeclarations": false
}
"""
pluginsMapConfiguration = mapOf(
"org.jetbrains.dokka.base.DokkaBase" to dokkaBaseConfiguration
)
// Configuration
moduleName = rootProject.name
moduleVersion = "v${version as String}"
failOnWarning = true
suppressObviousFunctions = true
suppressInheritedMembers = true
dokkaSourceSets.configureEach {
// Metadata
displayName = projectName
documentedVisibilities = setOf(DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED)
reportUndocumented = false
skipEmptyPackages = false
skipDeprecated = false
jdkVersion = 21
// Source link
sourceLink {
localDirectory = projectDir.resolve("src")
remoteUrl = URI("https://git.staropensource.de/StarOpenSource/Engine/src/branch/develop/" + projectName.replace(":", "/") + "/src").toURL()
remoteLineSuffix = "#L"
}
}
}

View file

@ -0,0 +1,77 @@
/*
* STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
// Utility
/**
* Local variable for the [getName] method
* for the `.properties` copying process.
*/
val projectName = name
// Plugins
plugins {
`java-library`
// Git properties
id("com.gorylenko.gradle-git-properties")
}
// Git properties
// -> Configure
gitProperties {
dotGitDirectory = file("${rootProject.rootDir}/.git")
failOnNoGitDirectory = false // Allow continuing if .git directory is missing (tarball)
extProperty = "git"
dateFormat = "yyyy-MM-dd'T'HH:mm:ss.S'Z'"
dateFormatTimeZone = "UTC"
}
// -> Copy task
tasks.register("copyGitProperties") {
dependsOn(tasks.generateGitProperties)
inputs.file("${projectDir}/build/resources/main/git.properties")
doLast {
file(inputs.files.first())
.copyTo(
file("${projectDir}/src/main/resources/sosengine-${projectName.replace(":", "-")}-git.properties"),
overwrite = true
)
}
}
tasks.processResources {
dependsOn(tasks["copyGitProperties"])
}
// Gradle properties
// -> Copy task
tasks.register("copyGradleProperties") {
inputs.file("${rootDir.path}/gradle.properties")
doLast {
file(inputs.files.first())
.copyTo(
file("${projectDir}/src/main/resources/sosengine-${projectName.replace(":", "-")}-gradle.properties"),
overwrite = true
)
}
}
tasks.processResources {
dependsOn(tasks["copyGradleProperties"])
}

View file

@ -1,6 +1,5 @@
#
# STAROPENSOURCE ENGINE SOURCE FILE # STAROPENSOURCE ENGINE SOURCE FILE
# Copyright (c) 2024 The StarOpenSource Engine Authors # Copyright (c) 2025 The StarOpenSource Engine Authors
# Licensed under the GNU General Public License v3. # Licensed under the GNU General Public License v3.
# #
# This program is free software: you can redistribute it and/or modify # This program is free software: you can redistribute it and/or modify
@ -15,7 +14,6 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
#
### IMPORTANT NOTICE ### IMPORTANT NOTICE
### We handle dependencies in here instead ### We handle dependencies in here instead
@ -48,10 +46,10 @@ versionCompanion=
# Language versions # Language versions
languageJava=21 languageJava=21
languageKotlin=2.0 languageKotlin=2.1
# Dependencies # Dependencies
dependencyKotlinVersion=2.0.21 dependencyKotlinVersion=2.1.0
dependencyKotlin_ReflectIdentifier=org.jetbrains.kotlin:kotlin-reflect dependencyKotlin_ReflectIdentifier=org.jetbrains.kotlin:kotlin-reflect
dependencyKotlin_CoroutinesIdentifier=org.jetbrains.kotlinx:kotlinx-coroutines-core dependencyKotlin_CoroutinesIdentifier=org.jetbrains.kotlinx:kotlinx-coroutines-core
dependencyKotlin_CoroutinesVersion=1.10.1 dependencyKotlin_CoroutinesVersion=1.10.1
@ -59,6 +57,8 @@ dependencyKotlin_DateTimeIdentifier=org.jetbrains.kotlinx:kotlinx-datetime
dependencyKotlin_DateTimeVersion=0.6.1 dependencyKotlin_DateTimeVersion=0.6.1
dependencyOshiIdentifier=com.github.oshi:oshi-core-java11 dependencyOshiIdentifier=com.github.oshi:oshi-core-java11
dependencyOshiVersion=6.6.5 dependencyOshiVersion=6.6.5
dependencySLF4JVersion=2.0.16
dependencySLF4J_NOPProviderIdentifier=org.slf4j:slf4j-nop
# Test dependencies # Test dependencies
testDependencyJUnitVersion=5.11.3 testDependencyJUnitVersion=5.11.3

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors * Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3. * Licensed under the GNU General Public License v3.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -17,19 +17,6 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Plugin management
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven {
name = "solostudios-releases"
setUrl("https://maven.solo-studios.ca/releases/")
}
}
}
// Project settings // Project settings
rootProject.name = "sos!engine" rootProject.name = "sos!engine"

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors * Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3. * Licensed under the GNU General Public License v3.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -19,9 +19,9 @@
// Plugins // Plugins
plugins { plugins {
id("application") id("engine.generic")
id("org.mikeneck.graalvm-native-image") version("v1.4.0") id("engine.generic.properties")
id("com.gradleup.shadow") version ("8.3.5") id("engine.application")
} }
// Dependencies // Dependencies
@ -31,86 +31,7 @@ dependencies {
implementation(project(":ansi")) implementation(project(":ansi"))
} }
// Configure JAR // Set main class
tasks.withType<Jar> { tasks.withType<Jar> { manifest.attributes["Main-Class"] = "de.staropensource.engine.testapp.Main" }
manifest { application.mainClass = "de.staropensource.engine.testapp.Main"
attributes["Main-Class"] = "de.staropensource.engine.testapp.Main" nativeImage { buildType { it.executable.setMain("de.staropensource.engine.testapp.Main") } }
}
}
// Configure application
application {
mainClass = "de.staropensource.engine.testapp.Main"
// JVM arguments
applicationDefaultJvmArgs = buildList {
// Unlock more VM options
add("-XX:+UnlockDiagnosticVMOptions")
add("-XX:+UnlockExperimentalVMOptions")
// VM settings
// -> Log garbage collection
if (
hasProperty("jvm.logGC")
&& property("jvm.logGC") as String == "true"
)
add("-Xlog:gc")
// -> Log JIT & AOT
if (
hasProperty("jvm.logJITandAOT")
&& property("jvm.logJITandAOT") as String == "true"
) {
add("-XX:+PrintCompilation")
add("-XX:+PrintInlining")
}
// -> Select garbage collector
if (hasProperty("jvm.garbageCollector"))
when (property("jvm.garbageCollector")) {
"epsilon" -> add("-XX:+UseEpsilonGC")
"serial" -> add("-XX:+UseSerialGC")
"g1" -> add("-XX:+UseG1GC")
}
// -> Manually added settings
if (hasProperty("jvm.args"))
addAll((property("jvm.args") as String).split(" "))
// Jansi
add("-Djansi.mode=force")
}
}
// Fix stdin
tasks.withType(JavaExec::class) {
standardInput = System.`in`
}
// GraalVM native-image
nativeImage {
outputs.upToDateWhen { true }
// for some reason using Gradle properties does not work
graalVmHome = System.getProperty("graalHome", System.getProperty("java.home"))
executableName = "sosengine-testapp"
outputDirectory = file("build/bin")
buildType { build ->
build.executable {
main = "de.staropensource.engine.testapp.Main"
}
}
arguments {
add("-H:+UnlockExperimentalVMOptions")
add("--color=always")
add("-march=native")
add("-O3")
add("--no-fallback")
add("--report-unsupported-elements-at-runtime")
add("--enable-http")
add("--enable-https")
add("-H:IncludeResources=.*properties\$")
}
}

View file

@ -1,6 +1,6 @@
/* /*
* STAROPENSOURCE ENGINE SOURCE FILE * STAROPENSOURCE ENGINE SOURCE FILE
* Copyright (c) 2024 The StarOpenSource Engine Authors * Copyright (c) 2025 The StarOpenSource Engine Authors
* Licensed under the GNU General Public License v3. * Licensed under the GNU General Public License v3.
* *
* This program is free software: you can redistribute it and/or modify * This program is free software: you can redistribute it and/or modify
@ -17,6 +17,12 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
// Plugins
plugins {
id("engine.generic")
id("engine.generic.properties")
}
// Dependencies // Dependencies
dependencies { dependencies {
// sos!engine // sos!engine