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

Chore: Switch back to Kotlin Gradle and use TOML config #46

Merged
merged 38 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
8050b14
"disable" old gradle files
granny Apr 15, 2024
5ffe3e3
get webmap working
granny Apr 15, 2024
2dc201d
get core working
granny Apr 15, 2024
c291a3a
get bukkit working
granny Apr 15, 2024
57d9c4a
fix webmap jar processing
granny Apr 16, 2024
c08add9
get fabric working
granny Apr 20, 2024
d5fd28c
get uber jar working
granny Apr 20, 2024
ca2c887
add TODO.md
granny Apr 20, 2024
5dc6b41
missing EOF newlines
granny Apr 20, 2024
51080c7
add to TODO
granny Apr 20, 2024
9d33ec6
Merge branch 'v3' into chore/proper-gradle-implementation
granny May 2, 2024
2e3a410
fix imports
granny May 3, 2024
c155365
Merge branch 'v3' into chore/proper-gradle-implementation
granny May 11, 2024
0c66fd1
bump paperweight version
granny May 12, 2024
284b286
fix missing `jars/` directory in `META-INF`
granny May 12, 2024
1924101
Merge remote-tracking branch 'origin/v3' into chore/proper-gradle-imp…
granny May 13, 2024
c8c9c59
nest all the tasks under tasks container
granny May 13, 2024
a4adc38
final fabric jar has no classifier
granny May 13, 2024
9d5a9f5
Merge branch 'v3' into chore/proper-gradle-implementation
granny May 14, 2024
2e92d3b
flip dependencies between shadow and remapJar tasks
granny May 14, 2024
a48f52c
clean up bukkit gradle logic
granny May 14, 2024
f45eb2e
some main build file cleanup
granny May 14, 2024
b4ab46d
uncheck these in TODO
granny May 14, 2024
192a0c2
re-add minotaur plugin
granny May 14, 2024
dc2fe03
reorganize task dependency
granny May 14, 2024
2aab24d
use task directly instead of string
granny May 14, 2024
f9884cc
Merge branch 'refs/heads/v3' into chore/proper-gradle-implementation
granny May 15, 2024
98e2cdb
it's jank but it works
granny May 21, 2024
5f00e42
move commit hash attribute to core subproject
granny May 21, 2024
5800c7d
plugin aliases
granny May 22, 2024
01fc5d6
move versions to lib toml
granny May 22, 2024
0c25b1b
make it work on clean installations
granny May 22, 2024
29eb6d7
make sure modrinth gradle task works
granny May 22, 2024
1d486a8
Merge branch 'v3' into chore/proper-gradle-implementation
granny Jun 1, 2024
b326fe7
newline
granny Jun 1, 2024
8c84675
update todo list
granny Jun 14, 2024
4513071
TEMP suffix to SNAPSHOT
granny Jun 14, 2024
8878d94
remove old build gradle files
granny Jun 14, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:

return core.exportVariable("NEXT_BUILD_NUMBER", process.env.NEXT_BUILD_NUMBER);
- name: Build
run: ./gradlew build modrinth --stacktrace
run: ./gradlew modrinth --stacktrace
env:
MODRINTH_TOKEN: ${{ secrets.MODRINTH_TOKEN }}
COMMIT_MESSAGE: ${{ join(github.event.commits.*.message, '<br>') }}
Expand Down
15 changes: 15 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# TODO

## General

- [x] move versions to `gradle/libs.versions.toml`
- [ ] Share logic in [`buildSrc`](https://docs.gradle.org/current/userguide/sharing_build_logic_between_subprojects.html#sec:using_buildsrc)

## Individual project jars

- [ ] bukkit: should dev jar include missing core dependency?
- [ ] fabric: devlibs jar is missing core dependency

## uber-jar shenanigans
- [x] fix missing `jars/` directory in `META-INF`
- [x] fix incorrect `MANIFEST.MF`
171 changes: 0 additions & 171 deletions build.gradle

This file was deleted.

70 changes: 70 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
plugins {
id("java-library")
alias(libs.plugins.minotaur)
}

val buildNum = System.getenv("NEXT_BUILD_NUMBER") ?: "SNAPSHOT"
project.version = "${libs.versions.minecraft.get()}-$buildNum"

tasks {
jar {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE

subprojects {
dependsOn(project.tasks.build)
}

archiveClassifier = ""

// this is janky, but it works
val manifestFiles = subprojects.filter({ it.name != "webmap" && it.name != "core" }).map {
val regularFile = it.layout.buildDirectory.file("libs/${project.name}-${it.name}-${it.version}.jar")
if (regularFile.isPresent) {
zipTree(regularFile)
} else {
null
}
}.filterNotNull()

from(manifestFiles) {
exclude("META-INF/MANIFEST.MF")
}

// this is janky, but it works
doFirst {
manifestFiles.forEach {
it.matching { include("META-INF/MANIFEST.MF") }.files.forEach {
manifest.from(it)
}
}
}
}
}

modrinth {
autoAddDependsOn = false
token = System.getenv("MODRINTH_TOKEN")
projectId = "pl3xmap"
versionName = "${project.version}"
versionNumber = "${project.version}"
versionType = "beta"
uploadFile = rootProject.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}.jar").get()
//additionalFiles.addAll([
// rootProject.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}-javadoc.jar").get(),
// rootProject.layout.buildDirectory.file("libs/${rootProject.name}-${project.version}-sources.jar").get()
//])
gameVersions.addAll(listOf(libs.versions.minecraft.get()))
loaders.addAll(listOf("bukkit", "fabric", /*"forge",*/ "paper", "purpur", "quilt", "spigot", "folia"))
changelog = System.getenv("COMMIT_MESSAGE")
dependencies {
required.project("fabric-api")
//optional.project(
// "pl3xmap-banners",
// "pl3xmap-claims",
// "pl3xmap-mobs",
// "pl3xmap-signs",
// "pl3xmap-warps",
// "deathspots",
//)
}
}
7 changes: 7 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependencyResolutionManagement {
versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
41 changes: 0 additions & 41 deletions bukkit/build.gradle

This file was deleted.

80 changes: 80 additions & 0 deletions bukkit/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
plugins {
id("java")
alias(libs.plugins.paperweight.userdev)
alias(libs.plugins.shadow)
}

val buildNum = System.getenv("NEXT_BUILD_NUMBER") ?: "SNAPSHOT"
project.version = "${libs.versions.minecraft.get()}-$buildNum"
project.group = "net.pl3x.map.bukkit"

base {
archivesName = "${rootProject.name}-${project.name}"
}

repositories {
maven("https://oss.sonatype.org/content/repositories/snapshots/") {
name = "oss-sonatype-snapshots"
mavenContent {
snapshotsOnly()
}
}
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
name = "s01-sonatype-snapshots"
mavenContent {
snapshotsOnly()
}
}
mavenCentral()
maven("https://jitpack.io")
}

dependencies {
implementation(project(":core", configuration = "shadow"))

implementation(libs.cloudBrigadier)
implementation(libs.cloudPaper)

implementation(libs.adventurePlatformBukkit)

paperweight.paperDevBundle(libs.versions.bukkit)
}

tasks {
reobfJar {
dependsOn(shadowJar)
}

// needed for below jank
compileJava {
dependsOn(":core:jar")
}

shadowJar {
mergeServiceFiles()

// this is janky, but it works
manifest {
from(project(":core").tasks.named<Jar>("shadowJar").get().manifest)
}
}

build {
dependsOn(reobfJar)
}

processResources {
inputs.properties(mapOf(
"name" to rootProject.name,
"group" to project.group,
"version" to project.version,
"authors" to project.properties["authors"],
"description" to project.properties["description"],
"website" to project.properties["website"]
))

filesMatching("plugin.yml") {
expand(inputs.properties)
}
}
}
Loading
Loading