-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: BT (calcastor/mame) <[email protected]>
- Loading branch information
Showing
15 changed files
with
440 additions
and
237 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
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 = "Events.jar" | ||
destinationDirectory = rootProject.projectDir.resolve("build/libs") | ||
|
||
minimize() | ||
|
||
dependencies { | ||
exclude(dependency("org.jetbrains:annotations")) | ||
} | ||
|
||
exclude("META-INF/**") | ||
} | ||
|
||
publishing { | ||
publications.create<MavenPublication>("Events") { | ||
groupId = project.group as String | ||
artifactId = project.name | ||
version = project.version as String | ||
|
||
artifact(tasks["shadowJar"]) | ||
} | ||
} | ||
|
||
tasks { | ||
processResources { | ||
filesMatching(listOf("plugin.yml")) { | ||
expand( | ||
"name" to project.name, | ||
"description" to project.description, | ||
"mainClass" to "dev.pgm.events.EventsPlugin", | ||
"version" to project.version, | ||
"commitHash" to project.latestCommitHash(), | ||
"url" to "https://pgm.dev/" | ||
) | ||
} | ||
} | ||
|
||
named("jar") { | ||
enabled = false | ||
} | ||
|
||
named("build") { | ||
dependsOn(shadowJar) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") | ||
} |
61 changes: 61 additions & 0 deletions
61
buildSrc/src/main/kotlin/buildlogic.java-conventions.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
plugins { | ||
`java-library` | ||
id("com.diffplug.spotless") | ||
id("de.skuzzle.restrictimports") | ||
} | ||
|
||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(21) | ||
} | ||
} | ||
|
||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
maven("https://oss.sonatype.org/content/repositories/snapshots/") // Snapshots | ||
maven("https://repo.pgm.fyi/snapshots/") // PGM-specific depdencies | ||
maven("https://repo.papermc.io/repository/maven-public/") // Needed for bungeecord-chat | ||
} | ||
|
||
dependencies { | ||
implementation("org.incendo:cloud-annotations:2.0.0") | ||
implementation("org.jetbrains:annotations:22.0.0") | ||
|
||
compileOnly("net.md-5:bungeecord-chat:1.20-R0.2-deprecated+build.18") | ||
compileOnly("dev.pgm.paper:paper-api:1.8_1.21.1-SNAPSHOT") | ||
compileOnly("tc.oc.pgm:core:0.16-SNAPSHOT") | ||
} | ||
|
||
group = "dev.pgm" | ||
version = "1.0.0-SNAPSHOT" | ||
description = "Manage PvP tournament events" | ||
|
||
tasks { | ||
withType<JavaCompile>() { | ||
options.encoding = "UTF-8" | ||
} | ||
withType<Javadoc>() { | ||
options.encoding = "UTF-8" | ||
} | ||
} | ||
|
||
spotless { | ||
ratchetFrom = "origin/master" | ||
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") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.10-bin.zip | ||
networkTimeout=10000 | ||
validateDistributionUrl=true | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Oops, something went wrong.