Skip to content
Merged
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
26 changes: 19 additions & 7 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,31 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Java ${{ matrix.java-version }}


- name: Set up Java 8
uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
java-package: jdk
cache: gradle

# for gradle build
- name: Set up Java 17
uses: actions/setup-java@v4
with:
java-version: ${{ matrix.java-version }}
java-version: 17
distribution: temurin
java-package: jdk
cache: maven
- name: Build with Maven
cache: gradle

- name: Build with Gradle
shell: bash
run: |
mvn clean install
- run: mkdir staging && cp target/*.jar staging
- run: echo "NOW=$(date +'%d-%m-%Y_%H-%M')" >> $GITHUB_ENV
./gradlew build -Pjava_version=${{ matrix.java-version }}
- run: mkdir staging && cp build/libs/*.jar staging
- run: echo "NOW=$(date +'%Y-%m-%d_%H-%M')" >> $GITHUB_ENV
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
Expand Down
24 changes: 15 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,23 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

# Step 2: Set up JDK 1.8
- name: Set up JDK 1.8
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 8

# Step 3: Get the version from pom.xml
- name: Get the version from pom.xml
# Step 2: Set up JDK 17 (for building with Gradle)
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17

# Step 3: Get the version from gradle.properties
- name: Get the version from gradle.properties
id: get_version
run: echo "PROJECT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
run: echo "PROJECT_VERSION=$(./gradlew -q properties | grep "^version:" | awk '{print $2}')" >> $GITHUB_ENV

# Step 4: Fail if snapshot version
- name: Fail if snapshot version
Expand Down Expand Up @@ -59,7 +65,7 @@ jobs:

echo "app_name=${APP_NAME}" >> src/main/resources/version.properties
echo "release_version=${{ env.RELEASE_VERSION }}" >> src/main/resources/version.properties
echo "maven_version=${{ env.PROJECT_VERSION }}" >> src/main/resources/version.properties
echo "gradle_version=${{ env.PROJECT_VERSION }}" >> src/main/resources/version.properties

# Build Type
if [[ "${{ github.ref }}" == "refs/heads/master" || "${{ github.ref }}" == "refs/heads/main" ]]; then
Expand All @@ -80,8 +86,8 @@ jobs:
echo "build_author=${{ github.actor }}" >> src/main/resources/version.properties

# Step 7: Build with Maven
- name: Build with Maven
run: mvn clean package
- name: Build with Gradle
run: ./gradlew build -Pjava_version=8

# Step 8: Create GitHub Release
- name: Create GitHub Release
Expand All @@ -91,6 +97,6 @@ jobs:
tag_name: ${{ env.RELEASE_VERSION }}
name: ${{ env.RELEASE_VERSION }}
files: |
target/*.jar
build/libs/*.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ build/
dependency-reduced-pom.xml
.DS_Store

run/
run/
/.gradle
/buildSrc/.gradle
105 changes: 105 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
// To import vars from gradle.properties, add an entry to buildSrc/src/main/kotlin/ProjectInfo.kt

java.toolchain.languageVersion = JavaLanguageVersion.of(javaVersion)
java.sourceCompatibility = JavaVersion.toVersion(javaVersion)
java.targetCompatibility = JavaVersion.toVersion(javaVersion)

repositories {
mavenCentral()
mavenLocal()
maven {
url = uri("https://repo.maven.apache.org/maven2/")
}
}

plugins {
id("java")
id("maven-publish")
id("idea")
id("eclipse")
id("net.kyori.blossom") version "2.1.0"
id("com.gradleup.shadow") version "9.2.2"
id("application")
}

dependencies {
implementation("com.googlecode.json-simple:json-simple:1.1.1")
implementation("net.sf.jopt-simple:jopt-simple:6.0-alpha-3")
implementation("jline:jline:0.9.94")
implementation("org.xerial:sqlite-jdbc:3.41.2.2")
implementation("com.mysql:mysql-connector-j:9.2.0")
implementation("org.avaje:ebean:2.7.3")
implementation("org.yaml:snakeyaml:1.7")
implementation("com.google.guava:guava-collections:r03")
implementation("org.jetbrains:annotations:20.0.0")

// Bukkit Mods
implementation("com.google.guava:guava:32.0.1-jre")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("com.google.code.gson:gson:2.9.0")
}

// For exposing statics to Java, see BuildParameters.java.peb inside the main/java-templates dir
sourceSets.main.configure {
blossom.javaSources {
property("server_software_name", serverSoftwareName)
property("version", version.toString())
property("description", description)
property("homepage_url", homepageUrl)
property("source_url", sourceUrl)
}
}

// Applies templating to files, you can access values by using ${name}
// Uses the values from buildSrc
//
// Uncomment when you want to process a resource.
//tasks.processResources {
// filesMatching(listOf()) {
// expand(project.properties)
// }
//}

tasks.withType<JavaCompile>() {
options.encoding = "UTF-8"
}

tasks.withType<Javadoc>() {
options.encoding = "UTF-8"
}

tasks.named<Jar>("jar").configure {
manifest {
from("src/main/resources/META-INF/MANIFEST.MF")
}

archiveClassifier = "original"
}

tasks.shadowJar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

archiveClassifier = ""

from(listOf(sourceSets.main.get().output))

exclude("junit/**")
}

tasks.assemble {
dependsOn(tasks.shadowJar)
}

// shadowjar creates handy task already, but if you don't like the name, just change this to "run" and set the classpath manually
tasks.named<JavaExec>("runShadow") {
// dependsOn(tasks.shadowJar)

var d = File("run");
if (!d.exists())
d.mkdirs()

workingDir = d

// classpath = files(tasks.shadowJar.get().archiveFile.get().asFile)
mainClass = "org.bukkit.craftbukkit.Main"
}
17 changes: 17 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
`kotlin-dsl`
}

repositories {
mavenCentral()
}

java {
toolchain {
languageVersion = JavaLanguageVersion.of(8)
}
}

kotlin {
jvmToolchain(8)
}
15 changes: 15 additions & 0 deletions buildSrc/src/main/kotlin/ProjectInfo.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import org.gradle.api.Project

// Exposes gradle.properties vars to build.gradle.kts

object ProjectInfo

val Project.serverSoftwareName: String get() = properties["server_software_name"].toString()
val Project.description: String get() = properties["description"].toString()
val Project.projectVersion: String get() = properties["version"].toString()

val Project.homepageUrl: String get() = properties["homepage_url"].toString()
val Project.issueUrl: String get() = properties["issue_url"].toString()
val Project.sourceUrl: String get() = properties["source_url"].toString()

val Project.javaVersion: String get() = properties["java_version"].toString()
13 changes: 13 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
org.gradle.configuration-cache=true
org.gradle.parallel=true
org.gradle.caching=true

server_software_name=Project Poseidon UberBukkit
description=Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
version=2.0.2

homepageUrl=
issueUrl=https://github.com/moresteck/uberbukkit/issues
sourceUrl=https://github.com/moresteck/uberbukkit

java_version=8
Empty file added gradle/libs.versions.toml
Empty file.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading