Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.

Commit

Permalink
Support 1.20, generate classes better (#7)
Browse files Browse the repository at this point in the history
* 1.19.4 update, bump ido and update publish workflows

* Include generated classes on every compile

* Bump idofront/mc version
  • Loading branch information
0ffz authored Jun 20, 2023
1 parent 2e96306 commit 815b90e
Show file tree
Hide file tree
Showing 12 changed files with 121 additions and 183 deletions.
34 changes: 10 additions & 24 deletions .github/workflows/gradle-ci.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,24 @@
name: Java CI with Gradle

on:
push:
paths-ignore:
- '**.md'
- '.github/CODEOWNERS'
pull_request:

concurrency:
cancel-in-progress: true
group: ci-${{ github.ref }}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: actions/checkout@v3

- name: Set up JDK 17
uses: actions/setup-java@v2
- name: Set up JDK
uses: actions/setup-java@v3
with:
distribution: adopt
distribution: temurin
java-version: 17
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew

# We build twice to include generated files lol
- name: Build
- name: Run build
run: gradle build

- name: Build another time :)
run: gradle build

- name: Upload build
uses: actions/upload-artifact@v1
with:
name: build
path: build/libs
44 changes: 8 additions & 36 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
name: Publish GitHub Packages
name: Publish Packages

on:
push:
branches:
- master
- develop
paths-ignore:
- '**.md'

Expand All @@ -14,39 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
- uses: MineInAbyss/publish-action@master
with:
distribution: temurin
java-version: 17

- name: Set env variable from latest maven version
run: >
echo "RELEASE_VERSION=$( \
curl https://repo.mineinabyss.com/releases/com/mineinabyss/protocolburrito/maven-metadata.xml | \
grep -oP '(?!<latest>)[\d\.]*(?=</latest>)' \
)" >> $GITHUB_ENV
# We build twice to include generated files lol
- name: Run gradle build to generate files
run: gradle build

- name: Run gradle build and publish
run: gradle build publish -PmineinabyssMavenUsername=${{ secrets.MAVEN_PUBLISH_USERNAME }} -PmineinabyssMavenPassword=${{ secrets.MAVEN_PUBLISH_PASSWORD }}

- name: Get version from gradle
shell: bash
id: extract_version
run: |
version=`gradle properties --no-daemon --console=plain -q | grep "^version:" | awk '{printf $2}'`
echo "::set-output name=version::$version"
- name: Create GitHub Release
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
prerelease: false
automatic_release_tag: v${{ steps.extract_version.outputs.version }}
files: |
protocolburrito-plugin/build/libs/protocolburrito-plugin*[0-9].jar
maven-metadata-url: https://repo.mineinabyss.com/releases/com/mineinabyss/protocolburrito/maven-metadata.xml
maven-username: ${{ secrets.MAVEN_PUBLISH_USERNAME }}
maven-password: ${{ secrets.MAVEN_PUBLISH_PASSWORD }}
release-files: |
${{ github.workspace }}/publish/*.jar
31 changes: 18 additions & 13 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
val serverVersion: String by project
import io.papermc.paperweight.util.registering

plugins {
kotlin("jvm")
id("com.mineinabyss.conventions.kotlin")
id("com.mineinabyss.conventions.kotlin.jvm")
id("com.mineinabyss.conventions.nms")
id("com.mineinabyss.conventions.publication")
id("com.mineinabyss.conventions.autoversion")
id("com.github.johnrengelman.shadow") version "7.0.0"
}

repositories {
Expand All @@ -26,33 +24,40 @@ allprojects {
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

val libs = rootProject.libs

dependencies {
compileOnly(kotlin("stdlib-jdk8"))
compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT") {
compileOnly(libs.minecraft.plugin.protocollib) {
// this dep wasn't being resolved.
exclude(group = "com.comphenix.executors")
}
}
}

dependencies {
compileOnly("org.spigotmc:spigot-api:$serverVersion")
api(project(":protocolburrito-api"))
}

sourceSets["main"].java.srcDir(file("$rootDir/protocolburrito-generator/build/generated/burrito/main"))
sourceSets["main"].java.srcDir(file("$buildDir/generated/burrito/main"))

tasks {
assemble {
dependsOn(reobfJar)
}
build {
dependsOn(project(":protocolburrito-plugin").tasks.build)
}

shadowJar {
archiveClassifier.set("")
val generateBurrito by registering<JavaExec> {
mainClass.set("com.mineinabyss.protocolburrito.generation.MainKt")
classpath = project("protocolburrito-generator").sourceSets["main"].runtimeClasspath
outputs.dir("$buildDir/generated/burrito/main")
}
sourcesJar {
dependsOn(generateBurrito)
}
compileKotlin {
dependsOn(generateBurrito)
}
//
// sourcesJar {
// from(sourceSets.main.get().allSource)
// }
}
6 changes: 2 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
version=0.6
version=0.7
group=com.mineinabyss
kotlinVersion=1.7.10
serverVersion=1.19.2-R0.1-SNAPSHOT
idofrontVersion=0.14.7
idofrontVersion=0.18.14
publishComponentName=java
2 changes: 1 addition & 1 deletion gradle/burritoLibs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
[libraries]
kotlinpoet = "com.squareup:kotlinpoet:1.10.1"
reflections = "org.reflections:reflections:0.9.12"
minecraft-plugin-protocollib = "com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT"
minecraft-plugin-protocollib = "com.comphenix.protocol:ProtocolLib:5.0.0"
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.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
3 changes: 1 addition & 2 deletions protocolburrito-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
plugins {
id("com.mineinabyss.conventions.kotlin")
id("com.mineinabyss.conventions.kotlin.jvm")
id("com.mineinabyss.conventions.papermc")
id("com.mineinabyss.conventions.publication")
id("com.mineinabyss.conventions.autoversion")
}

dependencies {
Expand Down
13 changes: 1 addition & 12 deletions protocolburrito-generator/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import io.papermc.paperweight.util.registering

val serverVersion: String by project

plugins {
kotlin("jvm")
id("com.mineinabyss.conventions.nms")
id("com.mineinabyss.conventions.autoversion")
}

repositories {
Expand All @@ -16,27 +13,19 @@ repositories {

dependencies {
implementation(kotlin("reflect"))
implementation("io.papermc.paper:paper-server:userdev-$serverVersion")
implementation("io.papermc.paper:paper-server:userdev-${libs.versions.minecraft.get()}")
implementation(burritoLibs.minecraft.plugin.protocollib)
implementation(burritoLibs.kotlinpoet)
implementation(burritoLibs.reflections)
implementation(project(":protocolburrito-api"))
implementation(kotlin("reflect"))
}

configurations {
remove(findByName("reobf"))
}

tasks {
val generateBurrito by registering<JavaExec>() {
main = "com.mineinabyss.protocolburrito.generation.MainKt"
classpath = files(configurations.runtimeClasspath, jar)
}
reobfJar {
onlyIf { false }
}
build {
dependsOn(generateBurrito)
}
}
Loading

0 comments on commit 815b90e

Please sign in to comment.