Skip to content

Commit

Permalink
build: workflow changes, adjustment to build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Misat11 committed Dec 23, 2024
1 parent 9bb4248 commit d1f9bff
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 65 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ jobs:
uses: actions/upload-artifact@v4
with:
path: |
plugin/*/build/libs/BedWars*[!s].jar
protocol/build/libs/BedWars*[!s].jar
plugin/*/build/libs/BedWars*.jar
!plugin/*/build/libs/BedWars*-unshaded.jar
protocol/build/libs/BedWars*.jar
!protocol/build/libs/BedWars*-unshaded.jar
!plugin/common/**/*
83 changes: 39 additions & 44 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import io.freefair.gradle.plugins.lombok.LombokPlugin
import org.screamingsandals.gradle.builder.*
import org.screamingsandals.gradle.slib.SLibPlugin
Expand All @@ -17,43 +16,60 @@ subprojects {
apply<BuilderPlugin>()
apply<LombokPlugin>()

repositories {
mavenCentral()
maven("https://repo.screamingsandals.org/public/")
maven("https://repo.papermc.io/repository/maven-snapshots/")
maven("https://repo.onarandombox.com/content/groups/public")
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://repo.alessiodp.com/releases/")
}

dependencies {
"compileOnly"(rootProject.libs.jetbrains.annotations)
}

tasks.withType<Jar> {
archiveClassifier.set(System.getenv("BUILD_NUMBER") ?: "dev")
}

if (project.name != "BedWars-protocol") {
configureShadowPlugin()
configureShadowPlugin {
relocate("com.zaxxer", "org.screamingsandals.bedwars.lib.HikariCP")
relocate("org.bstats", "org.screamingsandals.bedwars.lib.ext.bstats")
relocate("org.spongepowered.configurate", "org.screamingsandals.bedwars.lib.ext.configurate")
relocate("org.yaml.snakeyaml", "org.screamingsandals.bedwars.lib.ext.snakeyaml")
relocate("io.leangen.geantyref", "org.screamingsandals.bedwars.lib.ext.geantyref")
relocate("cloud.commandframework", "org.screamingsandals.bedwars.lib.ext.cloud")
relocate("me.lucko.commodore", "org.screamingsandals.bedwars.lib.ext.commodore")
}
}

configureLicenser()
if (project.name != "BedWars-common") {
configureSourceJarTasks()
if (project.name != "BedWars-common") { // do not publish the common artifact, only API, protocol, platform artifacts and universal artifact
// TODO: figure out how to relocate api-utils in Javadoc and sourceJar of BedWars-API (to the package defined in SLibExtension)
val buildSources = project.name == "BedWars-API" || project.name == "BedWars-protocol"
if (buildSources) {
configureSourcesJar()
}
val buildJavadoc = !version.toString().endsWith("-SNAPSHOT") && project.name == "BedWars-API"
if (buildJavadoc) {
configureJavadocTasks()
}
setupMavenPublishing(addSourceJar=(project.name == "BedWars-API" || project.name == "BedWars-protocol"), addJavadocJar=buildJavadoc)
setupMavenPublishing(addSourceJar=buildSources, addJavadocJar=buildJavadoc)
setupMavenRepositoriesFromProperties()
}

repositories {
mavenCentral()
maven { url = uri("https://repo.screamingsandals.org/public/") }
maven { url = uri("https://repo.papermc.io/repository/maven-snapshots/") }
maven { url = uri("https://repo.onarandombox.com/content/groups/public") }
maven { url = uri("https://repo.codemc.org/repository/maven-public/") }
maven { url = uri("https://repo.alessiodp.com/releases/") }
}

dependencies {
"compileOnly"(rootProject.libs.jetbrains.annotations)
}

extensions.configure<JavaPluginExtension> {
sourceCompatibility = JavaVersion.VERSION_11
}
configureJavac(JavaVersion.VERSION_11)

tasks.withType<JavaCompile> {
options.compilerArgs.add("-Xlint:deprecation")
// TODO: check if this is needed (and probably remove it later)
configurations.all {
// Check for updates every build
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}

if (project.name == "BedWars-protocol") {
// Not an slib project
return@subprojects
}

Expand Down Expand Up @@ -88,25 +104,4 @@ subprojects {
}
}
}

configurations.all {
// Check for updates every build
resolutionStrategy.cacheChangingModulesFor(0, "seconds")
}

tasks.withType<ShadowJar> {
relocate("com.zaxxer", "org.screamingsandals.bedwars.lib.HikariCP")
relocate("org.bstats", "org.screamingsandals.bedwars.lib.ext.bstats")
relocate("org.spongepowered.configurate", "org.screamingsandals.bedwars.lib.ext.configurate")
relocate("org.yaml.snakeyaml", "org.screamingsandals.bedwars.lib.ext.snakeyaml")
relocate("io.leangen.geantyref", "org.screamingsandals.bedwars.lib.ext.geantyref")
relocate("cloud.commandframework", "org.screamingsandals.bedwars.lib.ext.cloud")
relocate("me.lucko.commodore", "org.screamingsandals.bedwars.lib.ext.commodore")

if (System.getenv("BUILD_NUMBER") != null) {
archiveClassifier.set(System.getenv("BUILD_NUMBER"))
} else {
archiveClassifier.set("dev")
}
}
}
38 changes: 19 additions & 19 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
pluginManagement {
repositories {
mavenCentral()
mavenLocal()
gradlePluginPortal()
maven {
url = uri("https://repo.screamingsandals.org/public/")
}
maven {
// TODO: remove repository when (if) uploaded to gradle plugin portal
url = uri("https://maven.neoforged.net/releases")
// maven("https://repo.screamingsandals.org/public/")
// TODO: remove repository when (if) uploaded to gradle plugin portal
maven("https://maven.neoforged.net/releases") {
content {
includeGroup("net.neoforged.licenser")
}
Expand All @@ -16,16 +14,18 @@ pluginManagement {
}

rootProject.name = "BedWars-parent"
include(":BedWars-API")
project(":BedWars-API").projectDir = file("api")
include(":BedWars")
project(":BedWars").let {
it.projectDir = file("plugin/universal")
it.projectDir.mkdirs()
}
include(":BedWars-protocol")
project(":BedWars-protocol").projectDir = file("protocol")
include(":BedWars-common")
project(":BedWars-common").projectDir = file("plugin/common")
include(":BedWars-bukkit")
project(":BedWars-bukkit").projectDir = file("plugin/bukkit")
setupProject("BedWars-API", "api")
setupProject("BedWars-protocol", "protocol")
setupProject("BedWars-common", "plugin/common")
setupProject("BedWars-bukkit", "plugin/bukkit")
setupProject("BedWars", "plugin/universal", mkdir=true)

fun setupProject(name: String, folder: String, mkdir: Boolean = false) {
include(name)
project(":$name").let {
it.projectDir = file(folder)
if (mkdir) {
it.projectDir.mkdirs()
}
}
}

0 comments on commit d1f9bff

Please sign in to comment.