Skip to content

Commit 09e76c7

Browse files
committed
build: switched to plugin builder 2.0.0 and gradle 9.3.1
1 parent 9a10ff9 commit 09e76c7

File tree

16 files changed

+306
-202
lines changed

16 files changed

+306
-202
lines changed

.gitattributes

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#
2+
# https://help.github.com/articles/dealing-with-line-endings/
3+
#
4+
# Linux start script should use lf
5+
/gradlew text eol=lf
6+
7+
# These are Windows script files and should use crlf
8+
*.bat text eol=crlf
9+
10+
# Binary files should be left untouched
11+
*.jar binary

.github/FUNDING.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

.github/workflows/build-0-2-x.yml

Lines changed: 18 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -9,89 +9,44 @@ jobs:
99
build:
1010
runs-on: ubuntu-latest
1111

12+
env:
13+
FORCE_JAVADOC: true
14+
GIT_COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"
15+
1216
steps:
13-
- uses: actions/checkout@v4
17+
- name: Checkout Repository
18+
uses: actions/checkout@v6
1419
- name: Validate Gradle Wrapper
15-
uses: gradle/actions/wrapper-validation@v4
20+
uses: gradle/actions/wrapper-validation@v5
1621
- name: Set the Build number
1722
id: calculated_build_number
1823
env:
1924
NUM: ${{ github.run_number }}
2025
run: echo "build_n=$(($NUM+40))" >> $GITHUB_OUTPUT
2126
- name: Set up JDK 17
22-
uses: actions/setup-java@v4
27+
uses: actions/setup-java@v5
2328
with:
2429
distribution: 'temurin'
2530
java-version: 17
26-
cache: 'gradle'
31+
- name: Setup Gradle
32+
uses: gradle/actions/setup-gradle@v5
2733
- name: Grant execute permission for gradlew
2834
run: chmod +x gradlew
2935
- name: Build with Gradle
30-
run: ./gradlew
36+
run: ./gradlew clean checkLicenses build :BedWars-API:javadocJar --stacktrace --warning-mode all
37+
env:
38+
BUILD_NUMBER: ${{ steps.calculated_build_number.outputs.build_n }}
39+
- name: Publish with Gradle
40+
run: ./gradlew publish --stacktrace --warning-mode all
3141
env:
3242
NEXUS_URL_RELEASE: ${{ secrets.NEXUS_URL_RELEASE }}
3343
NEXUS_URL_SNAPSHOT: ${{ secrets.NEXUS_URL_SNAPSHOT }}
3444
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
3545
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
36-
OPTIMIZE_FOR_CI_CD: "1"
3746
BUILD_NUMBER: ${{ steps.calculated_build_number.outputs.build_n }}
38-
WEBHOOK_URL: ${{ secrets.WEBHOOK_URL_0_2_X }}
39-
REPOSILITE_BASE_URL: ${{ secrets.REPOSILITE_BASE_URL }}
40-
GITHUB_ACTIONS_URL: "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
4147
- name: Upload the final artifact
4248
uses: actions/upload-artifact@v4
4349
with:
44-
path: plugin/build/libs/BedWars*[!s].jar
45-
javadoc:
46-
name: Deploy Javadoc
47-
runs-on: ubuntu-latest
48-
needs: build
49-
50-
steps:
51-
- uses: actions/checkout@v4
52-
- name: Extract and Check Version
53-
id: version-check
54-
run: |
55-
version=$(grep '^version=' gradle.properties | cut -d'=' -f2)
56-
echo "VERSION=$version" >> $GITHUB_ENV
57-
if [[ "$version" == *-SNAPSHOT ]]; then
58-
echo "skip=true" >> $GITHUB_ENV
59-
else
60-
echo "skip=false" >> $GITHUB_ENV
61-
fi
62-
echo "Detected version: $version (Skip deployment: $skip)"
63-
- name: Set up JDK 17
64-
if: env.skip == 'false'
65-
uses: actions/setup-java@v4
66-
with:
67-
distribution: 'temurin'
68-
java-version: 17
69-
cache: 'gradle'
70-
- name: Generate Javadoc
71-
if: env.skip == 'false'
72-
run: ./gradlew :BedWars-API:javadoc
73-
env:
74-
OPTIMIZE_FOR_CI_CD: "1"
75-
- name: Deploy to GitHub Pages
76-
if: env.skip == 'false'
77-
env:
78-
VERSION: ${{ env.VERSION }}
79-
run: |
80-
git config user.name github-actions[bot]
81-
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
82-
git fetch origin gh-pages
83-
git worktree add gh-pages gh-pages
84-
cd gh-pages || exit 1
85-
86-
TARGET_DIR="javadoc/$VERSION"
87-
if [ -d "$TARGET_DIR" ]; then
88-
echo "Clearing existing directory: $TARGET_DIR"
89-
rm -rf "$TARGET_DIR"
90-
fi
91-
92-
mkdir -p "$TARGET_DIR"
93-
cp -r ../api/build/docs/javadoc/* "$TARGET_DIR"
94-
95-
git add .
96-
git commit -m "Update Javadoc for version $VERSION" || echo "No changes to commit"
97-
git push origin gh-pages
50+
path: |
51+
plugin/build/libs/BedWars*.jar
52+
!plugin/build/libs/BedWars*-unshaded.jar

.github/workflows/check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: BedWars Test CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
# Only run on PRs if the source branch is on a different repo. We do not need to run everything twice.
8+
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout Repository
13+
uses: actions/checkout@v6
14+
- name: Validate Gradle Wrapper
15+
uses: gradle/actions/wrapper-validation@v5
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v5
18+
with:
19+
distribution: 'temurin'
20+
java-version: 17
21+
- name: Setup Gradle
22+
uses: gradle/actions/setup-gradle@v5
23+
with:
24+
add-job-summary-as-pr-comment: on-failure
25+
- name: Grant execute permission for gradlew
26+
run: chmod +x gradlew
27+
- name: Build with Gradle
28+
run: ./gradlew clean checkLicenses build :BedWars-API:javadoc --stacktrace --warning-mode all

README.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This branch includes bugfixes for Minecraft: Java Edition 1.17, 1.18, 1.19, 1.20
77
Complete rewrite of the BedWarsRel plugin.
88
This project is now under complete rewrite and we don't have much time, so be patient :)
99

10-
Supported versions: \[1.8.8 - 1.21.11\]. Recommended version: \[1.21.8\]
10+
Supported versions: \[1.8.8 - 1.21.11\]. Recommended version: \[1.21.11\]
1111

1212
## Support
1313
If you need any help, you can contact us on [Discord](https://discord.gg/4xB54Ts). Please make sure to look into older messages. There are many question already answered. It is really anoying to repeat the same thing over and over.
@@ -35,3 +35,23 @@ If you have found any bug, feel free to report is into [Issues](https://github.c
3535
- Player statistics
3636
- In fact everything is customizable
3737
- And many more useful features..
38+
39+
## Compiling
40+
41+
This project uses **Gradle** and requires **JDK 17** or newer (the compiled JARs require JDK 8 or newer to run). To build it, clone the repository and run:
42+
43+
```bash
44+
./gradlew clean build
45+
```
46+
47+
On Windows, use:
48+
49+
```bat
50+
gradlew.bat clean build
51+
```
52+
53+
The compiled JAR file will be located in the `plugin/build/libs` directory.
54+
55+
## License
56+
57+
This project is licensed under the **GNU Lesser General Public License v3.0** License - see the [LICENSE](LICENSE) file for details.

build.gradle

Lines changed: 0 additions & 54 deletions
This file was deleted.

build.gradle.kts

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import io.freefair.gradle.plugins.lombok.LombokPlugin
2+
import org.screamingsandals.gradle.builder.*
3+
4+
plugins {
5+
alias(libs.plugins.screaming.plugin.builder) apply false
6+
alias(libs.plugins.lombok) apply false
7+
}
8+
9+
defaultTasks("clean", "build")
10+
11+
subprojects {
12+
apply<JavaPlugin>()
13+
apply<BuilderPlugin>()
14+
apply<LombokPlugin>()
15+
16+
repositories {
17+
mavenCentral()
18+
maven("https://repo.screamingsandals.org/public/")
19+
maven("https://repo.papermc.io/repository/maven-snapshots/")
20+
maven("https://repo.extendedclip.com/content/repositories/placeholderapi/")
21+
maven("https://repo.onarandombox.com/content/groups/public")
22+
maven("https://repo.citizensnpcs.co")
23+
maven("https://repo.codemc.org/repository/maven-public/")
24+
maven("https://repo.alessiodp.com/releases/")
25+
maven("https://repo.viaversion.com")
26+
maven("https://jitpack.io")
27+
}
28+
29+
dependencies {
30+
"compileOnly"(rootProject.libs.jetbrains.annotations)
31+
"compileOnly"(rootProject.libs.paper)
32+
}
33+
34+
configureJavac(JavaVersion.VERSION_1_8)
35+
36+
val buildNumber = providers.environmentVariable("BUILD_NUMBER").orElse("dev")
37+
38+
tasks.withType<Jar> {
39+
archiveClassifier.set(buildNumber)
40+
}
41+
42+
configureShadowPlugin {
43+
relocate("com.zaxxer", "org.screamingsandals.bedwars.lib.HikariCP")
44+
relocate("org.screamingsandals.simpleinventories", "org.screamingsandals.bedwars.lib.sgui")
45+
relocate("org.bstats", "org.screamingsandals.bedwars.lib.bstats")
46+
relocate("me.kcra.takenaka", "org.screamingsandals.bedwars.lib.takenaka")
47+
relocate("gs.mclo", "org.screamingsandals.bedwars.lib.mclogs")
48+
}
49+
50+
configureLicenser()
51+
52+
if (project.name == "BedWars-API" || project.name == "BedWars") {
53+
configureSourcesJar()
54+
val buildJavadoc = project.name == "BedWars-API"
55+
if (buildJavadoc) {
56+
configureJavadocTasks()
57+
}
58+
setupMavenPublishing(
59+
addSourceJar=true,
60+
addJavadocJar=(buildJavadoc && (!version.toString().endsWith("-SNAPSHOT") || System.getenv("FORCE_JAVADOC") == "true")),
61+
) {
62+
pom {
63+
name.set("BedWars")
64+
description.set("Flexible BedWars minigame plugin for Minecraft: Java Edition")
65+
url.set("https://github.com/ScreamingSandals/BedWars")
66+
licenses {
67+
license {
68+
name.set("GNU Lesser General Public License v3.0")
69+
url.set("https://github.com/ScreamingSandals/BedWars/blob/ver/0.2.x/LICENSE")
70+
}
71+
}
72+
73+
properties.put("build.number", buildNumber)
74+
}
75+
}
76+
setupMavenRepositoriesFromProperties()
77+
}
78+
}

gradle/wrapper/gradle-wrapper.jar

2.66 KB
Binary file not shown.
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists
6-
org.gradle.caching=true
7-
org.gradle.parallel=true
8-
org.gradle.vfs.watch=true
98

109
systemProp.file.encoding=utf-8

0 commit comments

Comments
 (0)