Skip to content

Commit

Permalink
Fixed most issues with 1.20.4+ (still wont compile but will run on th…
Browse files Browse the repository at this point in the history
…e platform)
  • Loading branch information
mosemister committed Jun 11, 2024
1 parent 7ee6714 commit 1373a8d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 30 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/GradleBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
testShips:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'
- name: Run all tests
run: ./gradlew test
Expand All @@ -34,7 +34,7 @@ jobs:
needs: [ testShips ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK 11
Expand All @@ -54,10 +54,10 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'
- name: Build Folia with Gradle
run: ./gradlew buildPaper
Expand All @@ -69,32 +69,32 @@ jobs:
needs: [ buildTranslateFolia, testShips ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: true
- name: Setup JDK 17
uses: actions/setup-java@v3
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'
- name: Build Folia with Gradle
run: ./gradlew buildPaper
- uses: actions/upload-artifact@v3
with:
name: "Standalone-Ships-Folia-And-Paper"
path: "standalone/ShipsFolia.jar"
build1-20-4Folia:
build1-20-6Folia:
needs: [ buildTranslateFolia ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Setup JDK 17
uses: actions/setup-java@v3
- name: Setup JDK 21
uses: actions/setup-java@v4
with:
java-version: '17'
java-version: '21'
distribution: 'adopt'
- name: Build Folia with Gradle
run: ./gradlew buildPaper -Pfolia-api-version=1.20.4 -Puse-paper=true
run: ./gradlew buildPaper -Pfolia-api-version=1.20.6 -Puse-paper=true

23 changes: 11 additions & 12 deletions .github/workflows/Test compile against.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
Expand All @@ -11,7 +10,7 @@ name: Build Bukkit with specific
on:
workflow_dispatch:
inputs:
version:
version:
type: string
description: MC version

Expand All @@ -25,13 +24,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew CoreToBukkit:plugin -P paper-api-version=${{ github.event.inputs.version }}
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Build with Gradle
run: ./gradlew CoreToBukkit:plugin -P paper-api-version=${{ github.event.inputs.version }}
15 changes: 14 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.regex.Pattern

plugins {
id 'java-library'
}
Expand All @@ -8,12 +10,23 @@ description 'Full'

apply from: 'buildGradle/build.gradle'

java.sourceCompatibility = JavaVersion.VERSION_17
var targetJavaVersion = isGreater(20, 5) ? 21 : 17
java.sourceCompatibility = JavaLanguageVersion.of(targetJavaVersion)
compileJava.options.encoding = 'UTF-8'
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}

dependencies {
api files(project.projectDir.path + '/ShipsForCore/build/libs/ShipsForCore-' + project.version + "-Beta.jar")
}

boolean isGreater(int major, int minor) {
var targetMinecraftVersion = project.hasProperty("folia-api-version") ? (String) project.property("folia-api-version") : "1.20.1"
var targetMajorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[1])
var targetMinorVersion = Integer.parseInt(targetMinecraftVersion.split(Pattern.quote('.'))[2])
if (targetMajorVersion < major) {
return true;
}
return targetMajorVersion == major && targetMinorVersion <= minor;
}
Binary file removed 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,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

0 comments on commit 1373a8d

Please sign in to comment.