-
Notifications
You must be signed in to change notification settings - Fork 13
Switch Community to gradle #77
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| plugins { | ||
| // Support convention plugins written in Kotlin. Convention plugins are build scripts in 'src/main' that automatically become available as plugins in the main build. | ||
| `kotlin-dsl` | ||
| } | ||
|
|
||
| repositories { | ||
| // Use the plugin portal to apply community plugins in convention plugins. | ||
| gradlePluginPortal() | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation("com.gradleup.shadow:shadow-gradle-plugin:8.3.0") | ||
| implementation("com.diffplug.spotless:spotless-plugin-gradle:7.0.0.BETA4") | ||
| implementation("de.skuzzle.restrictimports:restrict-imports-gradle-plugin:2.6.0") | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||
| plugins { | ||||||
| `java-library` | ||||||
| id("com.diffplug.spotless") | ||||||
| id("de.skuzzle.restrictimports") | ||||||
| } | ||||||
|
|
||||||
| java { | ||||||
| toolchain { | ||||||
| languageVersion = JavaLanguageVersion.of(21) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| repositories { | ||||||
| mavenLocal() | ||||||
| mavenCentral() | ||||||
| maven("https://repo.pgm.fyi/snapshots") // Sportpaper & other pgm-specific stuff | ||||||
| maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") // Spigot repo | ||||||
| maven("https://repo.aikar.co/content/groups/aikar/") // aikar repo | ||||||
| } | ||||||
|
|
||||||
| dependencies { | ||||||
| implementation("tc.oc.pgm:util:0.16-SNAPSHOT") { isTransitive = false } | ||||||
| implementation("com.zaxxer:HikariCP:2.4.1") { isTransitive = false } | ||||||
| implementation("fr.minuskube.inv:smart-invs:1.2.7") { isTransitive = false } | ||||||
|
|
||||||
| implementation("redis.clients:jedis:3.5.1") | ||||||
| implementation("co.aikar:idb-core:1.0.0-SNAPSHOT") | ||||||
| implementation("co.aikar:idb-bukkit:1.0.0-SNAPSHOT") | ||||||
| implementation("net.kyori:adventure-api:4.17.0") | ||||||
| implementation("net.kyori:adventure-text-serializer-plain:4.17.0") | ||||||
| implementation("net.kyori:adventure-platform-bukkit:4.3.4") | ||||||
|
|
||||||
| compileOnly("app.ashcon:sportpaper:1.8.8-R0.1-SNAPSHOT") | ||||||
| compileOnly("tc.oc.pgm:core:0.16-SNAPSHOT") | ||||||
| compileOnly("tc.oc.occ:AFK:1.0.0-SNAPSHOT") | ||||||
| compileOnly("tc.oc.occ:Environment:1.0.0-SNAPSHOT") | ||||||
| } | ||||||
|
|
||||||
| group = "dev.pgm" | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @applenick This would change the distribution name to lowercase, from |
||||||
| version = "0.2-SNAPSHOT" | ||||||
| description = "A plugin for managing a Minecraft community" | ||||||
|
|
||||||
| tasks { | ||||||
| withType<JavaCompile>() { | ||||||
| options.encoding = "UTF-8" | ||||||
| } | ||||||
| withType<Javadoc>() { | ||||||
| options.encoding = "UTF-8" | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| spotless { | ||||||
| ratchetFrom = "origin/dev" | ||||||
| java { | ||||||
| removeUnusedImports() | ||||||
| palantirJavaFormat("2.47.0").style("GOOGLE").formatJavadoc(true) | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| restrictImports { | ||||||
| group { | ||||||
| reason = "Use org.jetbrains.annotations to add annotations" | ||||||
| bannedImports = listOf("javax.annotation.**") | ||||||
| } | ||||||
| group { | ||||||
| reason = "Use tc.oc.pgm.util.Assert to add assertions" | ||||||
| bannedImports = listOf("com.google.common.base.Preconditions.**", "java.util.Objects.requireNonNull") | ||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import org.gradle.api.Project | ||
| import java.io.ByteArrayOutputStream | ||
|
|
||
|
|
||
| fun Project.latestCommitHash(): String { | ||
| return runGitCommand(listOf("rev-parse", "--short", "HEAD")) | ||
| } | ||
|
|
||
| fun Project.runGitCommand(args: List<String>): String { | ||
| val byteOut = ByteArrayOutputStream() | ||
| exec { | ||
| commandLine = listOf("git") + args | ||
| standardOutput = byteOut | ||
| } | ||
| return byteOut.toString(Charsets.UTF_8.name()).trim() | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
|
||
| plugins { | ||
| id("buildlogic.java-conventions") | ||
| `maven-publish` | ||
| id("com.gradleup.shadow") | ||
| } | ||
|
|
||
| tasks.named<ShadowJar>("shadowJar") { | ||
| archiveFileName = "Community.jar" | ||
| archiveClassifier.set("") | ||
| destinationDirectory = rootProject.projectDir.resolve("build/libs") | ||
|
|
||
| minimize() | ||
|
|
||
| dependencies { | ||
| exclude(dependency("org.jetbrains:annotations")) | ||
| } | ||
|
|
||
| exclude("META-INF/**") | ||
| } | ||
|
|
||
| publishing { | ||
| publications.create<MavenPublication>("community") { | ||
| groupId = project.group as String | ||
| artifactId = project.name | ||
| version = project.version as String | ||
|
|
||
| artifact(tasks["shadowJar"]) | ||
| } | ||
| repositories { | ||
| maven { | ||
| name = "pgm-repo-snapshots" | ||
| url = uri("https://repo.pgm.fyi/snapshots") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Publishing did not appear to be set up for the workflow previously; this likely does not work with the current workflow setup. PGM publishes GitHub packages which seems appropriate to do here until publishing to |
||
| credentials { | ||
| username = System.getenv("GITHUB_ACTOR") | ||
| password = System.getenv("GITHUB_TOKEN") | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| tasks { | ||
| processResources { | ||
| filesMatching(listOf("plugin.yml")) { | ||
| expand( | ||
| "name" to project.name, | ||
| "description" to project.description, | ||
| "mainClass" to "dev.pgm.community.Community", | ||
| "version" to project.version, | ||
| "commitHash" to project.latestCommitHash(), | ||
| "author" to "applenick", | ||
| "url" to "https://pgm.dev/") | ||
| } | ||
| } | ||
|
|
||
| named("build") { | ||
| dependsOn(shadowJar) | ||
| } | ||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the PR for Events (and Ingame), I needed to add
cloud-annotationsas an implementation to avoidclass file for org.apiguardian.api.API$Status not foundwarnings;not sure if that is the correct solution there but this is something I also notice hereedit:
compileOnlyis the correct solution.