diff --git a/.github/workflows/build-master.yml b/.github/workflows/build-master.yml index 673e8db1d..08855e636 100644 --- a/.github/workflows/build-master.yml +++ b/.github/workflows/build-master.yml @@ -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/**/* diff --git a/build.gradle.kts b/build.gradle.kts index e54f4bb20..84509ca2e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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 @@ -17,43 +16,60 @@ subprojects { apply() apply() + 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 { + 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 { - sourceCompatibility = JavaVersion.VERSION_11 - } + configureJavac(JavaVersion.VERSION_11) - tasks.withType { - 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 } @@ -88,25 +104,4 @@ subprojects { } } } - - configurations.all { - // Check for updates every build - resolutionStrategy.cacheChangingModulesFor(0, "seconds") - } - - tasks.withType { - 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") - } - } } diff --git a/settings.gradle.kts b/settings.gradle.kts index 78cd3cb6e..6acddc351 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -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") } @@ -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() + } + } +} \ No newline at end of file