Skip to content
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

refactor: Bump 3 in kotlin #181

Draft
wants to merge 12 commits into
base: main
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
24 changes: 16 additions & 8 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main

permissions:
contents: read

jobs:
build:
if: startsWith(github.event.head_commit.message, '[CI skip]') == false
Expand All @@ -16,25 +19,30 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
java-version: 21
distribution: temurin

- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v2
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}"
restore-keys: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}"

- name: Setup gradle
uses: gradle/actions/setup-gradle@v4

- name: Build with Gradle
uses: gradle/gradle-build-action@v3
with:
arguments: build
run: ./gradlew clean shadowJar

- name: Get build artifact ready
run: mkdir staging && cp build/libs/*.jar staging

- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
with:
name: dev-build
name: preview-build
path: staging
28 changes: 20 additions & 8 deletions .github/workflows/sonarcloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,43 @@ on:
types: [opened, synchronize, reopened]
branches:
- main

permissions:
contents: read

jobs:
build:
name: Build and analyze
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up JDK 17

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 17
distribution: 'temurin'
java-version: 21
distribution: temurin

- name: Cache SonarCloud packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Gradle packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
key: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}"
restore-keys: "${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}"

- name: Setup gradle
uses: gradle/actions/setup-gradle@v4

- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
Expand Down
69 changes: 0 additions & 69 deletions build.gradle

This file was deleted.

76 changes: 76 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("jvm") version "2.0.20"
id("com.gradleup.shadow") version "8.3.0"
id("net.minecrell.plugin-yml.bukkit") version "0.6.0"
id("org.sonarqube") version "5.0.0.4638"
}

group = "io.github.slimefunguguproject"
version = "UNOFFICIAL"
description = "Bump"

repositories {
mavenLocal()
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
maven("https://jitpack.io")
maven("https://repo.alessiodp.com/releases/")
}

dependencies {
compileOnly(kotlin("stdlib"))
compileOnly(kotlin("reflect"))
compileOnly("io.papermc.paper:paper-api:1.20.6-R0.1-SNAPSHOT")
compileOnly("com.github.Slimefun:Slimefun4:e02a0f61d1")
implementation("net.guizhanss:GuizhanLib-api:1.8.1")
implementation("dev.sefiraat:SefiLib:0.2.6") {
exclude("io.github.baked-libs", "dough-api")
}
implementation("org.bstats:bstats-bukkit:3.0.3")
implementation("net.byteflux:libby-bukkit:1.3.1")
}

java {
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

tasks.compileKotlin {
compilerOptions {
javaParameters = true
jvmTarget = JvmTarget.JVM_21
}
}

tasks.shadowJar {
fun doRelocate(from: String, to: String? = null) {
val last = from.split(".").last()
relocate(from, "io.github.slimefunguguproject.bump.libs.${to ?: last}")
}
doRelocate("net.guizhanss.guizhanlib")
doRelocate("dev.sefiraat.sefilib")
doRelocate("org.bstats")
doRelocate("net.byteflux.libby")
doRelocate("io.papermc.lib", "paperlib")
minimize()
archiveClassifier = ""
}

bukkit {
main = "io.github.slimefunguguproject.bump.Bump"
apiVersion = "1.18"
authors = listOf("bxx2004", "LobbyTech-MC", "zimzaza4", "haiman233", "ybw0014")
depend = listOf("Slimefun")
softDepend = listOf("GuizhanLibPlugin", "SlimefunTranslation")
}

sonar {
properties {
property("sonar.projectKey", "SlimefunGuguProject_Bump")
property("sonar.organization", "slimefunguguproject")
property("sonar.host.url", "https://sonarcloud.io")
}
}
1 change: 0 additions & 1 deletion gradle.properties

This file was deleted.

2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
1 change: 0 additions & 1 deletion settings.gradle

This file was deleted.

2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = "Bump"
System.setProperty("sonar.gradle.skipCompile", "true")

This file was deleted.

Loading