Skip to content

build: Update to ScreamingPluginBuilder 2.0.0 #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# https://help.github.com/articles/dealing-with-line-endings/
#
# Linux start script should use lf
/gradlew text eol=lf

# These are Windows script files and should use crlf
*.bat text eol=crlf

# Binary files should be left untouched
*.jar binary
32 changes: 19 additions & 13 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ jobs:
build:
runs-on: ubuntu-latest

env:
BUILD_NUMBER: ${{ steps.calculated_build_number.outputs.build_n }}
FORCE_JAVADOC: true

steps:
- uses: actions/checkout@v4
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set the Build number
id: calculated_build_number
env:
Expand All @@ -20,26 +27,25 @@ jobs:
with:
distribution: 'temurin'
java-version: 17
cache: 'gradle'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew
run: ./gradlew clean checkLicenses build :BedWars-API:javadocJar --stacktrace --warning-mode all
- name: Publish with Gradle
run: ./gradlew publish --stacktrace --warning-mode all
env:
NEXUS_URL_RELEASE: ${{ secrets.NEXUS_URL_RELEASE }}
NEXUS_URL_SNAPSHOT: ${{ secrets.NEXUS_URL_SNAPSHOT }}
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
JAVADOC_HOST: ${{ secrets.JAVADOC_HOST }}
JAVADOC_SECRET: ${{ secrets.JAVADOC_SECRET }}
JAVADOC_USER: ${{ secrets.JAVADOC_USER }}
OPTIMIZE_FOR_CI_CD: "1"
BUILD_NUMBER: ${{ steps.calculated_build_number.outputs.build_n }}
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL }}
REPOSILITE_BASE_URL: ${{ secrets.REPOSILITE_BASE_URL }}
GITHUB_ACTIONS_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
GITHUB_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
- name: Upload the final artifact
uses: actions/upload-artifact@v4
with:
path: plugin/universal/build/libs/BedWars*[!s].jar
path: |
plugin/*/build/libs/BedWars*.jar
!plugin/*/build/libs/BedWars*-unshaded.jar
protocol/build/libs/BedWars*.jar
!protocol/build/libs/BedWars*-unshaded.jar
!plugin/common/**/*
28 changes: 28 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: BedWars Test CI

on: [push, pull_request]

jobs:
build:
# Only run on PRs if the source branch is on a different repo. We do not need to run everything twice.
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Validate Gradle Wrapper
uses: gradle/actions/wrapper-validation@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 17
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
with:
add-job-summary-as-pr-comment: on-failure
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean checkLicenses build :BedWars-API:javadoc --stacktrace --warning-mode all
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@

# Gradle
/.gradle
/build
/*/build/
/plugin/*/build/
/plugin/universal/test-environment/
/plugin/*/test-environment/
gradle-app.setting
!gradle-wrapper.jar
.gradletasknamecache
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ static BedwarsAPI getInstance() {
return Internal.bedwarsAPI;
}

/**
* @hidden
*/
@ApiStatus.Internal
class Internal {
protected static BedwarsAPI bedwarsAPI;
Expand Down
94 changes: 0 additions & 94 deletions build.gradle

This file was deleted.

109 changes: 109 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import io.freefair.gradle.plugins.lombok.LombokPlugin
import org.screamingsandals.gradle.builder.*
import org.screamingsandals.gradle.slib.SLibPlugin
import org.screamingsandals.gradle.slib.SLibExtension

plugins {
alias(libs.plugins.screaming.plugin.builder) apply false
alias(libs.plugins.screaming.plugin.slib) apply false
alias(libs.plugins.lombok) apply false
}

defaultTasks("clean", "build")

subprojects {
apply<JavaPlugin>()
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)
}

configureJavac(JavaVersion.VERSION_11)

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

if (project.name != "BedWars-protocol") {
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") { // do not publish the common artifact, only API, protocol, platform artifacts and universal artifact
val buildSources = project.name == "BedWars-API" || project.name == "BedWars-protocol"
if (buildSources) {
configureSourcesJar(configureShadedSourcesInclude=(project.name == "BedWars-API"))
}
val buildJavadoc = buildSources && project.name == "BedWars-API"
if (buildJavadoc) {
configureJavadocTasks(useSourcesJarAsInput=true)
}
setupMavenPublishing(
addSourceJar=buildSources,
addJavadocJar=(buildJavadoc && (!version.toString().endsWith("-SNAPSHOT") || System.getenv("FORCE_JAVADOC") == "true")),
)
setupMavenRepositoriesFromProperties()
}

// 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
}

apply<SLibPlugin>()

extensions.configure<SLibExtension> {
version(rootProject.libs.versions.screaming.lib)

multiModulePlatforms("BedWars-%s", "bukkit")
multiModuleUniversalSubproject("BedWars") // custom name
// This also means we cannot create class Wrapper and package types in package org.screamingsandals.bedwars.api
multiModuleApiSubproject("BedWars-API", "org.screamingsandals.bedwars.api")
useApiConfigurationInsteadOfImplementation(true)

additionalContent {
module("cloud")
module("hologram")
module("placeholders")
module("sidebar")
module("healthindicator")
module("npc")
module("signs")
module("economy")
module("ai")
module("fakedeath")

lang()
singleModule("cloud-extras")

simpleInventories {
version(rootProject.libs.versions.simple.inventories)
}
}
}
}
11 changes: 8 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ parties-api = "3.2.6"
perworldinventory-old = "1.11.5"
perworldinventory-kt = "2.3.1"
multiverse = "4.0.0"
jetbrains-annotations = "26.0.2"

# plugins
screaming-plugin-builder = "1.0.86"
buildconfig = "3.0.2"
screaming-plugin-builder = "2.0.0-SNAPSHOT"
buildconfig = "5.6.6"
lombok = "8.13.1"

configurate = "4.1.2"
configurate-patched-gson = "4.1.2-sandals-patch"
Expand All @@ -36,8 +38,11 @@ perworldinventory-kt = { group = "me.ebonjaeger", name = "perworldinventory-kt",
multiverse = { group = "com.onarandombox.multiversecore", name = "Multiverse-Core", version.ref = "multiverse" }
configurate-gson = { group = "org.spongepowered", name = "configurate-gson", version.ref = "configurate-patched-gson" }
configurate-yaml = { group = "org.spongepowered", name = "configurate-yaml", version.ref = "configurate" }
jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version.ref = "jetbrains-annotations" }

[plugins]
screaming-plugin-builder = { id = "org.screamingsandals.plugin-builder", version.ref = "screaming-plugin-builder" }
screaming-plugin-slib = { id = "org.screamingsandals.plugin-slib", version.ref = "screaming-plugin-builder" }
buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" }
screaming-plugin-run = { id = "org.screamingsandals.plugin-run", version.ref = "screaming-plugin-builder" }
buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" }
lombok = { id = "io.freefair.lombok", version.ref = "lombok" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Loading