Skip to content

Commit

Permalink
build: bye Groovy, welcome Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
Misat11 committed Dec 21, 2024
1 parent 1cd5c67 commit b0c7166
Show file tree
Hide file tree
Showing 15 changed files with 257 additions and 228 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/build-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ jobs:
runs-on: ubuntu-latest

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 +23,19 @@ 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 shadowJar 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*[!s].jar
26 changes: 26 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean checkLicenses build shadowJar --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.
110 changes: 0 additions & 110 deletions build.gradle

This file was deleted.

113 changes: 113 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import io.freefair.gradle.plugins.lombok.LombokPlugin
import org.screamingsandals.gradle.builder.BuilderPlugin
import org.screamingsandals.gradle.builder.MavenUtilities
import org.screamingsandals.gradle.builder.Utilities
import org.screamingsandals.gradle.builder.JavadocUtilities
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", "shadowJar")

subprojects {
apply<JavaPlugin>()
apply<BuilderPlugin>()
apply<LombokPlugin>()

var mavenPublication: MavenPublication? = null
Utilities.configureLicenser(project)
if (project.name != "BedWars-common") {
Utilities.configureSourceJarTasks(project)
mavenPublication = MavenUtilities.setupPublishing(project).publication
if (!version.toString().endsWith("-SNAPSHOT") && project.name == "BedWars-API") {
JavadocUtilities.configureJavadocTasks(project)
}
MavenUtilities.setupMavenRepositoriesFromProperties(project)
}

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
}

tasks.withType<JavaCompile> {
options.compilerArgs.add("-Xlint:deprecation")
}

if (project.name == "BedWars-protocol") {
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)
}
}
}

Utilities.configureShadowPlugin(project, mavenPublication)

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")
}
}
}
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ multiverse = "4.0.0"
jetbrains-annotations = "26.0.1"

# plugins
screaming-plugin-builder = "1.1.0-SNAPSHOT"
buildconfig = "3.0.2"
screaming-plugin-builder = "2.0.0-SNAPSHOT"
buildconfig = "5.5.1"
lombok = "8.11"

configurate = "4.1.2"
Expand All @@ -43,5 +43,6 @@ jetbrains-annotations = { group = "org.jetbrains", name = "annotations", version
[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" }
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" }
21 changes: 0 additions & 21 deletions plugin/bukkit/build.gradle

This file was deleted.

Loading

0 comments on commit b0c7166

Please sign in to comment.