Skip to content

Commit

Permalink
Migrate to monumenta maven
Browse files Browse the repository at this point in the history
  • Loading branch information
Floweynt authored Jul 19, 2024
1 parent 4fd738a commit 1306c19
Show file tree
Hide file tree
Showing 44 changed files with 121 additions and 221 deletions.
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,25 @@ Minimum Java version: Java 17
Recommended Minecraft Version: 1.16.5+ (older versions may work too, but are not supported)

## Maven dependency
Maven:
```xml
<repositories>
<repository>
<id>libraryofsouls</id>
<url>https://raw.githubusercontent.com/TeamMonumenta/library-of-souls/master/mvn-repo/</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.playmonumenta</groupId>
<artifactId>libraryofsouls</artifactId>
<version>5.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repository>
<id>monumenta</id>
<name>Monumenta Maven Repo</name>
<url>https://maven.playmonumenta.com/releases</url>
</repository>
```
Gradle (kotlin):
```kts
maven {
name = "monumenta"
url = uri("https://maven.playmonumenta.com/releases")
}
```
Gradle (groovy):
```groovy
maven {
name "monumenta"
url "https://maven.playmonumenta.com/releases"
}
```

195 changes: 100 additions & 95 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,63 +1,42 @@
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.ltgt.gradle.errorprone.errorprone
import net.ltgt.gradle.errorprone.CheckSeverity
import net.ltgt.gradle.errorprone.errorprone
import net.minecrell.pluginyml.bukkit.BukkitPluginDescription

plugins {
java
`maven-publish`
id("com.palantir.git-version") version "0.12.2"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("net.minecrell.plugin-yml.bukkit") version "0.5.1" // Generates plugin.yml
id("net.ltgt.errorprone") version "2.0.2"
id("net.ltgt.nullaway") version "1.3.0"
id("com.playmonumenta.deployment") version "1.0"
checkstyle
pmd
java
`maven-publish`
id("com.palantir.git-version") version "0.12.2"
id("com.github.johnrengelman.shadow") version "7.1.2"
id("net.minecrell.plugin-yml.bukkit") version "0.5.1" // Generates plugin.yml
id("net.ltgt.errorprone") version "2.0.2"
id("net.ltgt.nullaway") version "1.3.0"
id("com.playmonumenta.deployment") version "1.+"
checkstyle
pmd
}

repositories {
mavenLocal()
maven {
url = uri("https://repo.papermc.io/repository/maven-public/")
}

maven {
url = uri("https://jitpack.io")
}

maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}

maven {
url = uri("https://raw.githubusercontent.com/TeamMonumenta/monumenta-redis-sync/master/mvn-repo/")
}

maven {
url = uri("https://raw.githubusercontent.com/TeamMonumenta/NBTEditor/master/mvn-repo/")
}

// NBT API, pulled in by CommandAPI
maven {
url = uri("https://repo.codemc.org/repository/maven-public/")
}

maven {
url = uri("https://repo.maven.apache.org/maven2/")
}

maven("https://repo.codemc.org/repository/maven-public/")
mavenLocal()
maven("https://repo.papermc.io/repository/maven-public/")
maven("https://jitpack.io")
maven("https://oss.sonatype.org/content/repositories/snapshots/")
maven("https://maven.playmonumenta.com/releases")
// NBT API, pulled in by CommandAPI
maven("https://repo.codemc.org/repository/maven-public/")
maven("https://repo.maven.apache.org/maven2/")
maven("https://repo.codemc.org/repository/maven-public/")
}

dependencies {
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
compileOnly("dev.jorel:commandapi-bukkit-core:9.4.1")
compileOnly("com.playmonumenta:nbteditor:4.0")
compileOnly("com.playmonumenta:redissync:3.0")
compileOnly("com.google.code.gson:gson:2.8.5")
errorprone("com.google.errorprone:error_prone_core:2.10.0")
errorprone("com.uber.nullaway:nullaway:0.9.5")
compileOnly("io.papermc.paper:paper-api:1.19.4-R0.1-SNAPSHOT")
compileOnly("dev.jorel:commandapi-bukkit-core:9.4.1")
compileOnly("de.tr7zw:item-nbt-api-plugin:2.12.0-SNAPSHOT")
compileOnly("com.playmonumenta:redissync:4.1:all")
compileOnly("com.playmonumenta:nbteditor:4.1:all")
compileOnly("com.google.code.gson:gson:2.8.5")
errorprone("com.google.errorprone:error_prone_core:2.10.0")
errorprone("com.uber.nullaway:nullaway:0.9.5")
}

group = "com.playmonumenta"
Expand All @@ -69,60 +48,86 @@ java.targetCompatibility = JavaVersion.VERSION_17

// Configure plugin.yml generation
bukkit {
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
main = "com.playmonumenta.libraryofsouls.LibraryOfSouls"
apiVersion = "1.18"
name = "LibraryOfSouls"
authors = listOf("The Monumenta Team")
depend = listOf("CommandAPI", "NBTEditor")
softDepend = listOf("MonumentaRedisSync")
load = BukkitPluginDescription.PluginLoadOrder.POSTWORLD
main = "com.playmonumenta.libraryofsouls.LibraryOfSouls"
apiVersion = "1.18"
name = "LibraryOfSouls"
authors = listOf("The Monumenta Team")
depend = listOf("CommandAPI", "NBTEditor")
softDepend = listOf("MonumentaRedisSync")
}

pmd {
isConsoleOutput = true
toolVersion = "6.41.0"
ruleSets = listOf("$rootDir/pmd-ruleset.xml")
setIgnoreFailures(true)
isConsoleOutput = true
toolVersion = "6.41.0"
ruleSets = listOf("$rootDir/pmd-ruleset.xml")
setIgnoreFailures(true)
}

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications.create<MavenPublication>("maven") {
project.shadow.component(this)
}
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/TeamMonumenta/library-of-souls")
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
publications {
create<MavenPublication>("maven") {
from(components["java"])
}
}
repositories {
maven {
name = "MonumentaMaven"
url = when (version.toString().endsWith("SNAPSHOT")) {
true -> uri("https://maven.playmonumenta.com/snapshots")
false -> uri("https://maven.playmonumenta.com/releases")
}

credentials {
username = System.getenv("USERNAME")
password = System.getenv("TOKEN")
}
}
}
}

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xmaxwarns")
options.compilerArgs.add("10000")
options.compilerArgs.add("-Xlint:deprecation")

options.errorprone {
option("NullAway:AnnotatedPackages", "com.playmonumenta")

allErrorsAsWarnings.set(true)

/*** Disabled checks ***/
// These we almost certainly don't want
check("InlineMeSuggester", CheckSeverity.OFF) // We won't keep deprecated stuff around long enough for this to matter
check("CatchAndPrintStackTrace", CheckSeverity.OFF) // This is the primary way a lot of exceptions are handled
check("FutureReturnValueIgnored", CheckSeverity.OFF) // This one is dumb and doesn't let you check return values with .whenComplete()
check("ImmutableEnumChecker", CheckSeverity.OFF) // Would like to turn this on but we'd have to annotate a bunch of base classes
check("LockNotBeforeTry", CheckSeverity.OFF) // Very few locks in our code, those that we have are simple and refactoring like this would be ugly
check("StaticAssignmentInConstructor", CheckSeverity.OFF) // We have tons of these on purpose
check("StringSplitter", CheckSeverity.OFF) // We have a lot of string splits too which are fine for this use
check("MutablePublicArray", CheckSeverity.OFF) // These are bad practice but annoying to refactor and low risk of actual bugs
}
options.encoding = "UTF-8"
options.compilerArgs.add("-Xmaxwarns")
options.compilerArgs.add("10000")
options.compilerArgs.add("-Xlint:deprecation")

options.errorprone {
option("NullAway:AnnotatedPackages", "com.playmonumenta")

allErrorsAsWarnings.set(true)

/*** Disabled checks ***/
// These we almost certainly don't want
check(
"InlineMeSuggester",
CheckSeverity.OFF
) // We won't keep deprecated stuff around long enough for this to matter
check("CatchAndPrintStackTrace", CheckSeverity.OFF) // This is the primary way a lot of exceptions are handled
check(
"FutureReturnValueIgnored",
CheckSeverity.OFF
) // This one is dumb and doesn't let you check return values with .whenComplete()
check(
"ImmutableEnumChecker",
CheckSeverity.OFF
) // Would like to turn this on but we'd have to annotate a bunch of base classes
check(
"LockNotBeforeTry",
CheckSeverity.OFF
) // Very few locks in our code, those that we have are simple and refactoring like this would be ugly
check("StaticAssignmentInConstructor", CheckSeverity.OFF) // We have tons of these on purpose
check("StringSplitter", CheckSeverity.OFF) // We have a lot of string splits too which are fine for this use
check(
"MutablePublicArray",
CheckSeverity.OFF
) // These are bad practice but annoying to refactor and low risk of actual bugs
}
}

ssh.easySetup(tasks.named<ShadowJar>("shadowJar").get(), "LibraryOfSouls")
16 changes: 0 additions & 16 deletions buildSrc/build.gradle.kts

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 1306c19

Please sign in to comment.