Updated NuVotifier and Dependencies
* Updated Gradle to version 7.4.0 * Updated Java to version 17 * Moved to Gradle build scripts * Fixed publishing maven artifacts * Removed universal file (better depend on the specific implementations)
This commit is contained in:
1 parent
d269e9da6b
commit
6e64890c04
30 files changed
+655
-331
No files matched your search
@@ -1,3 +0,0 @@
|
||||
dependencies {
|
||||
implementation 'com.google.code.gson:gson:2.8.0'
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
|
||||
dependencies {
|
||||
"implementation"("com.google.code.gson:gson:${Versions.GSON}")
|
||||
}
|
||||
@@ -1,60 +0,0 @@
|
||||
|
||||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id "com.github.spotbugs" version "4.7.1" apply false
|
||||
id "net.kyori.blossom" version "1.3.0" apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group 'com.vexsoftware'
|
||||
version '3.0.0-SNAPSHOT'
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
apply plugin: "com.github.spotbugs"
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
|
||||
}
|
||||
maven {
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
}
|
||||
maven {
|
||||
url "https://repo.spongepowered.org/maven"
|
||||
}
|
||||
maven {
|
||||
url "https://repo.velocitypowered.com/snapshots/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:5.4.2"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.4.2"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-params:5.4.2"
|
||||
testImplementation "org.mockito:mockito-core:2.+"
|
||||
}
|
||||
|
||||
processResources {
|
||||
filter(ReplaceTokens, tokens: ["app.version": this.project.version])
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.withType(com.github.spotbugs.snom.SpotBugsTask) {
|
||||
reports {
|
||||
html {
|
||||
enabled = true
|
||||
destination = file("$buildDir/reports/spotbugs/main/spotbugs.html")
|
||||
stylesheet = 'fancy-hist.xsl'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
import org.ajoberstar.grgit.Grgit
|
||||
|
||||
plugins {
|
||||
id("net.kyori.blossom") version "1.2.0" apply false
|
||||
}
|
||||
|
||||
logger.lifecycle("""
|
||||
*******************************************
|
||||
You are building NuVotifier!
|
||||
If you encounter trouble:
|
||||
1) Try running 'build' in a separate Gradle run
|
||||
2) Use gradlew and not gradle
|
||||
3) If you still need help, you should reconsider building NuVotifier!
|
||||
|
||||
Output files will be in [subproject]/build/libs
|
||||
*******************************************
|
||||
""")
|
||||
|
||||
|
||||
applyRootArtifactoryConfig()
|
||||
|
||||
if (!project.hasProperty("gitCommitHash")) {
|
||||
apply(plugin = "org.ajoberstar.grgit")
|
||||
ext["gitCommitHash"] = try {
|
||||
Grgit.open(mapOf("currentDir" to project.rootDir))?.head()?.abbreviatedId
|
||||
} catch (e: Exception) {
|
||||
logger.warn("Error getting commit hash", e)
|
||||
|
||||
"no.git.id"
|
||||
}
|
||||
}
|
||||
/*
|
||||
subprojects {
|
||||
apply plugin: 'java'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots"
|
||||
}
|
||||
maven {
|
||||
url "https://oss.sonatype.org/content/repositories/snapshots"
|
||||
}
|
||||
maven {
|
||||
url "https://repo.spongepowered.org/maven"
|
||||
}
|
||||
maven {
|
||||
url "https://repo.velocitypowered.com/snapshots/"
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-api:5.8.2"
|
||||
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.8.2"
|
||||
testImplementation "org.junit.jupiter:junit-jupiter-params:5.8.2"
|
||||
testImplementation "org.mockito:mockito-core:4.4.0"
|
||||
}
|
||||
|
||||
processResources {
|
||||
filter(ReplaceTokens, tokens: ["app.version": this.project.version])
|
||||
}
|
||||
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,21 @@
|
||||
plugins {
|
||||
`kotlin-dsl`
|
||||
kotlin("jvm") version embeddedKotlinVersion
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
gradlePluginPortal()
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = uri("https://repo.spongepowered.org/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(gradleApi())
|
||||
implementation("org.ajoberstar.grgit:grgit-gradle:4.1.1")
|
||||
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
|
||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.27.1")
|
||||
implementation("org.spongepowered:spongegradle-plugin-development:2.0.0")
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention
|
||||
import org.jfrog.gradle.plugin.artifactory.task.ArtifactoryTask
|
||||
|
||||
private const val ARTIFACTORY_CONTEXT_URL = "artifactory_contextUrl"
|
||||
private const val ARTIFACTORY_USER = "artifactory_user"
|
||||
private const val ARTIFACTORY_PASSWORD = "artifactory_password"
|
||||
|
||||
fun Project.applyRootArtifactoryConfig() {
|
||||
if (!project.hasProperty(ARTIFACTORY_CONTEXT_URL)) ext[ARTIFACTORY_CONTEXT_URL] = "http://localhost"
|
||||
if (!project.hasProperty(ARTIFACTORY_USER)) ext[ARTIFACTORY_USER] = "guest"
|
||||
if (!project.hasProperty(ARTIFACTORY_PASSWORD)) ext[ARTIFACTORY_PASSWORD] = ""
|
||||
|
||||
apply(plugin = "com.jfrog.artifactory")
|
||||
configure<ArtifactoryPluginConvention> {
|
||||
setContextUrl("${project.property(ARTIFACTORY_CONTEXT_URL)}")
|
||||
clientConfig.publisher.run {
|
||||
repoKey = when {
|
||||
"${project.version}".contains("SNAPSHOT") -> "private"
|
||||
else -> "public"
|
||||
}
|
||||
username = "${project.property(ARTIFACTORY_USER)}"
|
||||
password = "${project.property(ARTIFACTORY_PASSWORD)}"
|
||||
isMaven = true
|
||||
isIvy = false
|
||||
}
|
||||
}
|
||||
tasks.named<ArtifactoryTask>("artifactoryPublish") {
|
||||
isSkip = true
|
||||
}
|
||||
}
|
||||
|
||||
fun Project.applyCommonArtifactoryConfig() {
|
||||
tasks.named<ArtifactoryTask>("artifactoryPublish") {
|
||||
publications("maven")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.repositories
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
fun Project.applyCommonConfiguration() {
|
||||
group = rootProject.group
|
||||
version = rootProject.version
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") }
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
resolutionStrategy {
|
||||
cacheChangingModulesFor(5, "MINUTES")
|
||||
}
|
||||
}
|
||||
|
||||
plugins.withId("java") {
|
||||
the<JavaPluginExtension>().toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(17))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.compile.JavaCompile
|
||||
import org.gradle.api.tasks.javadoc.Javadoc
|
||||
import org.gradle.api.tasks.testing.Test
|
||||
import org.gradle.external.javadoc.StandardJavadocDocletOptions
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.dependencies
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.withType
|
||||
|
||||
fun Project.applyCommonJavaConfiguration(sourcesJar: Boolean, javaRelease: Int = 8, banSlf4j: Boolean = true) {
|
||||
applyCommonConfiguration()
|
||||
apply(plugin = "eclipse")
|
||||
apply(plugin = "idea")
|
||||
|
||||
tasks
|
||||
.withType<JavaCompile>()
|
||||
.matching { it.name == "compileJava" || it.name == "compileTestJava" }
|
||||
.configureEach {
|
||||
val disabledLint = listOf(
|
||||
"processing", "path", "fallthrough", "serial"
|
||||
)
|
||||
options.release.set(javaRelease)
|
||||
options.compilerArgs.addAll(listOf("-Xlint:all") + disabledLint.map { "-Xlint:-$it" })
|
||||
options.isDeprecation = true
|
||||
options.encoding = "UTF-8"
|
||||
options.compilerArgs.add("-parameters")
|
||||
}
|
||||
|
||||
tasks.withType<Test>().configureEach {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compileOnly"("com.google.code.findbugs:jsr305:${Versions.FINDBUGS}")
|
||||
"testImplementation"("org.junit.jupiter:junit-jupiter-api:${Versions.JUNIT}")
|
||||
"testImplementation"("org.junit.jupiter:junit-jupiter-params:${Versions.JUNIT}")
|
||||
"testImplementation"("org.mockito:mockito-core:${Versions.MOCKITO}")
|
||||
"testImplementation"("org.mockito:mockito-junit-jupiter:${Versions.MOCKITO}")
|
||||
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:${Versions.JUNIT}")
|
||||
}
|
||||
|
||||
// Java 8 turns on doclint which we fail
|
||||
tasks.withType<Javadoc>().configureEach {
|
||||
options.encoding = "UTF-8"
|
||||
(options as StandardJavadocDocletOptions).apply {
|
||||
addStringOption("Xdoclint:none", "-quiet")
|
||||
tags(
|
||||
"apiNote:a:API Note:",
|
||||
"implSpec:a:Implementation Requirements:",
|
||||
"implNote:a:Implementation Note:"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
configure<JavaPluginExtension> {
|
||||
disableAutoTargetJvm()
|
||||
withJavadocJar()
|
||||
if (sourcesJar) {
|
||||
withSourcesJar()
|
||||
}
|
||||
}
|
||||
|
||||
if (banSlf4j) {
|
||||
configurations["compileClasspath"].apply {
|
||||
resolutionStrategy.componentSelection {
|
||||
withModule("org.slf4j:slf4j-api") {
|
||||
reject("No SLF4J allowed on compile classpath")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.plugins.ExtraPropertiesExtension
|
||||
import org.gradle.api.plugins.JavaPluginExtension
|
||||
import org.gradle.api.tasks.SourceSetContainer
|
||||
import org.gradle.kotlin.dsl.getByType
|
||||
import org.gradle.kotlin.dsl.the
|
||||
|
||||
val Project.ext: ExtraPropertiesExtension
|
||||
get() = extensions.getByType()
|
||||
|
||||
val Project.sourceSets: SourceSetContainer
|
||||
get() = the<JavaPluginExtension>().sourceSets
|
||||
@@ -0,0 +1,64 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.gradle.api.Project
|
||||
import org.gradle.api.component.AdhocComponentWithVariants
|
||||
import org.gradle.api.publish.PublishingExtension
|
||||
import org.gradle.api.publish.maven.MavenPublication
|
||||
import org.gradle.kotlin.dsl.apply
|
||||
import org.gradle.kotlin.dsl.configure
|
||||
import org.gradle.kotlin.dsl.get
|
||||
import org.gradle.kotlin.dsl.named
|
||||
import org.gradle.kotlin.dsl.register
|
||||
|
||||
fun Project.applyPlatformAndCoreConfiguration(javaRelease: Int = 17) {
|
||||
applyCommonConfiguration()
|
||||
apply(plugin = "java")
|
||||
apply(plugin = "maven-publish")
|
||||
apply(plugin = "com.jfrog.artifactory")
|
||||
applyCommonJavaConfiguration(
|
||||
sourcesJar = true,
|
||||
javaRelease = javaRelease,
|
||||
banSlf4j = false
|
||||
)
|
||||
|
||||
ext["internalVersion"] = "$version+${rootProject.ext["gitCommitHash"]}"
|
||||
|
||||
configure<PublishingExtension> {
|
||||
publications {
|
||||
register<MavenPublication>("maven") {
|
||||
from(components["java"])
|
||||
versionMapping {
|
||||
usage("java-api") {
|
||||
fromResolutionOf("runtimeClasspath")
|
||||
}
|
||||
usage("java-runtime") {
|
||||
fromResolutionResult()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
applyCommonArtifactoryConfig()
|
||||
}
|
||||
|
||||
fun Project.applyShadowConfiguration() {
|
||||
apply(plugin = "com.github.johnrengelman.shadow")
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
archiveClassifier.set("dist")
|
||||
dependencies {
|
||||
include(project(":nuvotifier-api"))
|
||||
include(project(":nuvotifier-common"))
|
||||
|
||||
exclude("com.google.code.findbugs:jsr305")
|
||||
}
|
||||
exclude("GradleStart**")
|
||||
exclude(".cache")
|
||||
exclude("LICENSE*")
|
||||
exclude("META-INF/maven/**")
|
||||
}
|
||||
val javaComponent = components["java"] as AdhocComponentWithVariants
|
||||
// I don't think we want this published (it's the shadow jar)
|
||||
javaComponent.withVariantsFromConfiguration(configurations["shadowRuntimeElements"]) {
|
||||
skip()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
object Versions {
|
||||
const val JUNIT = "5.8.1"
|
||||
const val MOCKITO = "4.3.1"
|
||||
const val FINDBUGS = "3.0.2"
|
||||
const val NETTYIO = "4.1.72.Final"
|
||||
const val GSON = "2.9.0"
|
||||
const val VELOCITY = "1.1.0-SNAPSHOT"
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
dependencies {
|
||||
compileOnly group: "org.spigotmc", name: "spigot-api", version: "1.8.8-R0.1-SNAPSHOT"
|
||||
implementation project(":nuvotifier-api")
|
||||
implementation project(":nuvotifier-common")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
applyShadowConfiguration()
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "paper"
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileClasspath.get().extendsFrom(create("shadeOnly"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compileOnly"("io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT")
|
||||
"api"(project(":nuvotifier-api"))
|
||||
"api"(project(":nuvotifier-common"))
|
||||
}
|
||||
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
val internalVersion = project.ext["internalVersion"]
|
||||
inputs.property("internalVersion", internalVersion)
|
||||
filesMatching("plugin.yml") {
|
||||
expand("internalVersion" to internalVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
val projectVersion = project.version
|
||||
inputs.property("projectVersion", projectVersion)
|
||||
manifest {
|
||||
attributes("Implementation-Version" to projectVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
configurations = listOf(project.configurations["shadeOnly"], project.configurations["runtimeClasspath"])
|
||||
|
||||
dependencies {
|
||||
include(dependency(":nuvotifier-api"))
|
||||
include(dependency(":nuvotifier-common"))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
name: Votifier
|
||||
main: com.vexsoftware.votifier.NuVotifierBukkit
|
||||
version: @app.version@
|
||||
version: "${internalVersion}"
|
||||
description: A plugin that gets notified when votes are made for the server on toplists.
|
||||
authors: [Ichbinjoe, blakeman8192, Kramer, tuxed]
|
||||
api-version: 1.13
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
dependencies {
|
||||
compileOnly group: "net.md-5", name: "bungeecord-api", version: "1.8-SNAPSHOT"
|
||||
implementation project(":nuvotifier-api")
|
||||
implementation project(":nuvotifier-common")
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
applyShadowConfiguration()
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "bungeecord"
|
||||
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileClasspath.get().extendsFrom(create("shadeOnly"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
"compileOnly"("net.md-5:bungeecord-api:1.18-R0.1-SNAPSHOT")
|
||||
"api"(project(":nuvotifier-api"))
|
||||
"api"(project(":nuvotifier-common"))
|
||||
}
|
||||
|
||||
|
||||
tasks.named<Copy>("processResources") {
|
||||
val internalVersion = project.ext["internalVersion"]
|
||||
inputs.property("internalVersion", internalVersion)
|
||||
filesMatching("plugin.yml") {
|
||||
expand("internalVersion" to internalVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
val projectVersion = project.version
|
||||
inputs.property("projectVersion", projectVersion)
|
||||
manifest {
|
||||
attributes("Implementation-Version" to projectVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
configurations = listOf(project.configurations["shadeOnly"], project.configurations["runtimeClasspath"])
|
||||
|
||||
dependencies {
|
||||
include(dependency(":nuvotifier-api"))
|
||||
include(dependency(":nuvotifier-common"))
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
dependencies {
|
||||
implementation project(":nuvotifier-api")
|
||||
implementation group: "io.netty", name: "netty-handler", version: "4.1.49.Final"
|
||||
implementation group: "io.netty", name: "netty-transport-native-epoll", version: "4.1.49.Final", classifier: "linux-x86_64"
|
||||
implementation 'com.google.code.gson:gson:2.8.0'
|
||||
testImplementation group: "org.json", name: "json", version: "20180130" // retain this for testing reasons
|
||||
testImplementation 'com.google.guava:guava:28.1-jre'
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
|
||||
dependencies {
|
||||
"api"(project(":nuvotifier-api"))
|
||||
"implementation"("io.netty:netty-handler:${Versions.NETTYIO}")
|
||||
"implementation"("io.netty:netty-transport-native-epoll:${Versions.NETTYIO}:linux-x86_64")
|
||||
"implementation"("com.google.code.gson:gson:${Versions.GSON}")
|
||||
"testImplementation"("org.json:json:20180130") // retain this for testing reasons
|
||||
"testImplementation"("com.google.guava:guava:28.1-jre")
|
||||
}
|
||||
+1
-1
@@ -51,6 +51,6 @@ public interface VoteCache {
|
||||
* @return A collection of all votes which were previously in the cache under the player
|
||||
*/
|
||||
default Collection<Vote> evictPlayer(String player) {
|
||||
return Collections.EMPTY_LIST;
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -37,20 +37,20 @@ public class ArgsToVoteTest {
|
||||
});
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "servicename", "address", "timestamp" })
|
||||
void handlesAdditionalKeywordArguments(String key) throws Exception {
|
||||
Vote vote = ArgsToVote.parse(new String[] { "username=abc123", key + "=dummy" });
|
||||
|
||||
// Find the getter on the Vote object
|
||||
for (Method method : Vote.class.getDeclaredMethods()) {
|
||||
if (method.getName().toLowerCase(Locale.ENGLISH).equals("get" + key) && method.getParameterCount() == 0) {
|
||||
assertEquals("dummy", method.invoke(vote));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fail("Unable to find appropriate getter - this is a bug");
|
||||
@Test
|
||||
void handleServiceNameGetter() {
|
||||
Vote vote = ArgsToVote.parse(new String[] { "username=abc123", "servicename=dummy" });
|
||||
assertEquals("dummy", vote.getServiceName());
|
||||
}
|
||||
@Test
|
||||
void handleAddressGetter() {
|
||||
Vote vote = ArgsToVote.parse(new String[] { "username=abc123", "address=dummy" });
|
||||
assertEquals("dummy", vote.getAddress());
|
||||
}
|
||||
@Test
|
||||
void handleTimestampGetter() {
|
||||
Vote vote = ArgsToVote.parse(new String[] { "username=abc123", "timestamp=dummy" });
|
||||
assertEquals("dummy", vote.getTimeStamp());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -59,49 +59,6 @@ public class ArgsToVoteTest {
|
||||
assertEquals("dummy_user", vote.getUsername());
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@ValueSource(strings = { "servicename", "address", "timestamp" })
|
||||
void handlesMixedUsernameAndKeywordArgument(String key) throws Exception {
|
||||
Vote vote = ArgsToVote.parse(new String[] { "abc123", key + "=dummy" });
|
||||
|
||||
assertEquals("abc123", vote.getUsername());
|
||||
|
||||
// Find the getter on the Vote object
|
||||
for (Method method : Vote.class.getDeclaredMethods()) {
|
||||
if (method.getName().toLowerCase(Locale.ENGLISH).equals("get" + key) && method.getParameterCount() == 0) {
|
||||
assertEquals("dummy", method.invoke(vote));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fail("Unable to find appropriate getter - this is a bug");
|
||||
}
|
||||
|
||||
@ParameterizedTest
|
||||
@MethodSource("powerSetArgs")
|
||||
void handlesMixedKeywordArguments(Set<String> keys) throws Exception {
|
||||
String[] args = new String[keys.size() + 1];
|
||||
args[0] = "abc123";
|
||||
for (int i = 0; i < keys.size(); i++) {
|
||||
args[i + 1] = ImmutableList.copyOf(keys).get(i) + "=dummy";
|
||||
}
|
||||
Vote vote = ArgsToVote.parse(args);
|
||||
|
||||
assertEquals("abc123", vote.getUsername());
|
||||
|
||||
// Find the getters on the Vote object
|
||||
outer: for (String key : keys) {
|
||||
for (Method method : Vote.class.getDeclaredMethods()) {
|
||||
if (method.getName().toLowerCase(Locale.ENGLISH).equals("get" + key) && method.getParameterCount() == 0) {
|
||||
assertEquals("dummy", method.invoke(vote));
|
||||
continue outer;
|
||||
}
|
||||
}
|
||||
|
||||
fail("Unable to find appropriate getter - this is a bug");
|
||||
}
|
||||
}
|
||||
|
||||
private static Stream<Set<String>> powerSetArgs() {
|
||||
return Sets.powerSet(ImmutableSet.of("servicename", "address", "timestamp")).stream();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
group=com.vexsoftware
|
||||
version=3.0.0-SNAPSHOT
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip
|
||||
@@ -1,52 +0,0 @@
|
||||
// This file contains special build instructions specifically for the ParallelBlock CI in order to instruct it how to
|
||||
// build the project. Usually, this shouldn't be interacted with by a human.
|
||||
|
||||
import com.mashape.unirest.http.*
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.mashape.unirest:unirest-java:1.4.9'
|
||||
}
|
||||
}
|
||||
|
||||
subprojects {
|
||||
apply plugin: "maven-publish"
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name 'ibj'
|
||||
if (project.version.endsWith("-SNAPSHOT"))
|
||||
url "$System.env.SNAPSHOT_REPO"
|
||||
else
|
||||
url "$System.env.RELEASE_REPO"
|
||||
credentials {
|
||||
username "$System.env.REPO_USR"
|
||||
password "$System.env.REPO_PSW"
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
versioned(MavenPublication) {
|
||||
from components.java
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (System.env.LATEST_BUILD) {
|
||||
task publishLatestToIbjBlockRaw {
|
||||
inputs.files(configurations.archives.artifacts.files)
|
||||
outputs.upToDateWhen {false}
|
||||
doLast {
|
||||
configurations.archives.artifacts.each {
|
||||
def resp = Unirest.put("$System.env.RAW_UPLOAD_PATH/${it.name}.${it.extension}")
|
||||
.basicAuth("$System.env.REPO_USR", "$System.env.REPO_PSW")
|
||||
.body(it.file.bytes).asString()
|
||||
assert resp.status >= 200 && resp.status <= 299
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
rootProject.name = 'nuvotifier'
|
||||
|
||||
include 'api'
|
||||
findProject(':api')?.name = 'nuvotifier-api'
|
||||
|
||||
include 'common'
|
||||
findProject(':common')?.name = 'nuvotifier-common'
|
||||
|
||||
include 'bukkit'
|
||||
findProject(':bukkit')?.name = 'nuvotifier-bukkit'
|
||||
include 'bungeecord'
|
||||
findProject(':bungeecord')?.name = 'nuvotifier-bungeecord'
|
||||
include 'sponge'
|
||||
findProject(':sponge')?.name = 'nuvotifier-sponge'
|
||||
|
||||
include 'universal'
|
||||
findProject(':universal')?.name = 'nuvotifier-universal'
|
||||
include 'velocity'
|
||||
findProject(':velocity')?.name = 'nuvotifier-velocity'
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
rootProject.name = "nuvotifier"
|
||||
|
||||
include("nuvotifier-api")
|
||||
project(":nuvotifier-api").projectDir = file("api")
|
||||
|
||||
|
||||
include("nuvotifier-common")
|
||||
project(":nuvotifier-common").projectDir = file("common")
|
||||
|
||||
include("nuvotifier-bukkit")
|
||||
project(":nuvotifier-bukkit").projectDir = file("bukkit")
|
||||
include("nuvotifier-bungeecord")
|
||||
project(":nuvotifier-bungeecord").projectDir = file("bungeecord")
|
||||
include("nuvotifier-sponge")
|
||||
project(":nuvotifier-sponge").projectDir = file("sponge")
|
||||
include("nuvotifier-velocity")
|
||||
project(":nuvotifier-velocity").projectDir = file("velocity")
|
||||
@@ -1,12 +0,0 @@
|
||||
apply plugin: "net.kyori.blossom"
|
||||
|
||||
blossom {
|
||||
replaceToken '@version@', project.version.toString()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly group: "org.spongepowered", name: "spongeapi", version: "7.1.0"
|
||||
annotationProcessor group: "org.spongepowered", name: "spongeapi", version: "7.1.0"
|
||||
implementation project(":nuvotifier-api")
|
||||
implementation project(":nuvotifier-common")
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.spongepowered.gradle.plugin.config.PluginLoaders
|
||||
import org.spongepowered.plugin.metadata.model.PluginDependency
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
id("org.spongepowered.gradle.plugin")
|
||||
id("net.kyori.blossom")
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
applyShadowConfiguration()
|
||||
|
||||
blossom {
|
||||
replaceToken("@version@", project.ext["internalVersion"])
|
||||
}
|
||||
|
||||
sponge {
|
||||
apiVersion("7.2.0")
|
||||
loader {
|
||||
name(PluginLoaders.JAVA_PLAIN)
|
||||
version("1.0")
|
||||
}
|
||||
|
||||
license("GNU General Public License v3.0")
|
||||
|
||||
plugin("banmanager") {
|
||||
displayName("BanManager")
|
||||
entrypoint("me.confuser.banmanager.sponge.BMSpongePlugin")
|
||||
description("A database driven punishment system")
|
||||
links {
|
||||
homepage("https://banmanagement.com/")
|
||||
source("https://github.com/BanManagment/BanManager")
|
||||
issues("https://github.com/BanManagment/BanManager")
|
||||
}
|
||||
contributor("confuser") {
|
||||
description("Lead Developer")
|
||||
}
|
||||
dependency("spongeapi") {
|
||||
loadOrder(PluginDependency.LoadOrder.AFTER)
|
||||
optional(false)
|
||||
version("7.2.0")
|
||||
}
|
||||
dependency("magibridge") {
|
||||
loadOrder(PluginDependency.LoadOrder.AFTER)
|
||||
optional(true)
|
||||
version("api-7-SNAPSHOT")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "sponge"
|
||||
url = uri("https://repo.spongepowered.org/maven/")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileClasspath.get().extendsFrom(create("shadeOnly"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("org.spongepowered:spongeapi:7.2.0")
|
||||
|
||||
"api"(project(":nuvotifier-api"))
|
||||
"api"(project(":nuvotifier-common"))
|
||||
}
|
||||
|
||||
val javaTarget = 8 // Sponge targets a minimum of Java 8
|
||||
java {
|
||||
sourceCompatibility = JavaVersion.toVersion(javaTarget)
|
||||
targetCompatibility = JavaVersion.toVersion(javaTarget)
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
val projectVersion = project.version
|
||||
inputs.property("projectVersion", projectVersion)
|
||||
manifest {
|
||||
attributes("Implementation-Version" to projectVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
configurations = listOf(project.configurations["shadeOnly"], project.configurations["runtimeClasspath"])
|
||||
|
||||
dependencies {
|
||||
include(dependency(":nuvotifier-api"))
|
||||
include(dependency(":nuvotifier-common"))
|
||||
}
|
||||
|
||||
exclude("GradleStart**")
|
||||
exclude(".cache");
|
||||
exclude("LICENSE*")
|
||||
exclude("META-INF/services/**")
|
||||
exclude("META-INF/maven/**")
|
||||
exclude("META-INF/versions/**")
|
||||
exclude("org/intellij/**")
|
||||
exclude("org/jetbrains/**")
|
||||
exclude("**/module-info.class")
|
||||
exclude("*.yml")
|
||||
}
|
||||
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
@@ -1,93 +0,0 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.relocation.SimpleRelocator
|
||||
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import java.nio.file.StandardCopyOption
|
||||
import java.util.regex.Pattern
|
||||
import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer
|
||||
import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext
|
||||
import shadow.org.apache.tools.zip.ZipEntry
|
||||
import shadow.org.apache.tools.zip.ZipOutputStream
|
||||
import org.gradle.api.file.FileTreeElement
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
class NettyEpollTransformer implements Transformer {
|
||||
private java.nio.file.Path extractedNettyNative
|
||||
|
||||
boolean canTransformResource(FileTreeElement element) {
|
||||
return element.name.endsWith("libnetty_transport_native_epoll_x86_64.so")
|
||||
}
|
||||
|
||||
void transform(TransformerContext context) {
|
||||
this.extractedNettyNative = Files.createTempFile("nuvotifer_build", ".so")
|
||||
Files.copy(context.is, this.extractedNettyNative, StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
|
||||
boolean hasTransformedResource() { this.extractedNettyNative != null }
|
||||
|
||||
void modifyOutputStream(ZipOutputStream jos, boolean preserveFileTimestamps) {
|
||||
ZipEntry entry = new ZipEntry("META-INF/native/libcom_vexsoftware_votifier_netty_transport_native_epoll_x86_64.so")
|
||||
entry.time = TransformerContext.getEntryTimestamp(preserveFileTimestamps, entry.time)
|
||||
jos.putNextEntry(entry)
|
||||
Files.copy(this.extractedNettyNative, jos)
|
||||
Files.delete(this.extractedNettyNative)
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'com.github.johnrengelman.shadow'
|
||||
|
||||
dependencies {
|
||||
implementation project(":nuvotifier-api")
|
||||
implementation project(":nuvotifier-common")
|
||||
implementation project(":nuvotifier-bukkit")
|
||||
implementation project(":nuvotifier-bungeecord")
|
||||
implementation project(":nuvotifier-sponge")
|
||||
implementation project(":nuvotifier-velocity")
|
||||
}
|
||||
|
||||
shadowJar {
|
||||
archiveBaseName = 'nuvotifier'
|
||||
relocate "io.netty", "com.vexsoftware.votifier.io.netty"
|
||||
relocate "org.json", "com.vexsoftware.votifier.json"
|
||||
relocate new SimpleRelocator("com.google.code", "com.vexsoftware.votifier.google.code", new ArrayList<String>(), Collections.singletonList("com.vexsoftware.votifier.sponge"))
|
||||
relocate "com.google.gson", "com.vexsoftware.votifier.google.gson"
|
||||
relocate "org.apache.commons.io", "com.vexsoftware.votifier.commons.io"
|
||||
|
||||
transform(NettyEpollTransformer.class)
|
||||
}
|
||||
|
||||
artifacts {
|
||||
tasks.shadowJar.outputs.files.each {
|
||||
archives(it) {
|
||||
builtBy shadowJar
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def artifactPattern = Pattern.compile(/(.*)-([0-9]+\.)*[0-9]+(-SNAPSHOT)?-all\.jar/)
|
||||
|
||||
task('linkLatest') {
|
||||
dependsOn tasks.shadowJar
|
||||
doLast {
|
||||
tasks.shadowJar.outputs.files.each {
|
||||
System.println(it.absolutePath)
|
||||
def noVerMatcher = artifactPattern.matcher(it.absolutePath)
|
||||
if (!noVerMatcher.matches())
|
||||
throw new IllegalStateException("path does not match")
|
||||
|
||||
def noVer = Paths.get(noVerMatcher.group(1) + ".jar")
|
||||
def versnd = it.toPath()
|
||||
Files.copy(versnd, noVer, StandardCopyOption.REPLACE_EXISTING)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
build.dependsOn linkLatest
|
||||
@@ -1,12 +0,0 @@
|
||||
apply plugin: "net.kyori.blossom"
|
||||
|
||||
blossom {
|
||||
replaceToken '@version@', project.version
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "com.velocitypowered:velocity-api:1.1.0-SNAPSHOT"
|
||||
annotationProcessor "com.velocitypowered:velocity-api:1.1.0-SNAPSHOT"
|
||||
implementation project(":nuvotifier-api")
|
||||
implementation project(":nuvotifier-common")
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
|
||||
plugins {
|
||||
`java-library`
|
||||
id("net.kyori.blossom")
|
||||
}
|
||||
|
||||
applyPlatformAndCoreConfiguration()
|
||||
applyShadowConfiguration()
|
||||
|
||||
blossom {
|
||||
replaceToken("@version@", project.ext["internalVersion"])
|
||||
}
|
||||
|
||||
repositories {
|
||||
maven {
|
||||
name = "velocity"
|
||||
url = uri("https://nexus.velocitypowered.com/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
configurations {
|
||||
compileClasspath.get().extendsFrom(create("shadeOnly"))
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly("com.velocitypowered:velocity-api:${Versions.VELOCITY}")
|
||||
annotationProcessor("com.velocitypowered:velocity-api:${Versions.VELOCITY}")
|
||||
|
||||
"api"(project(":nuvotifier-api"))
|
||||
"api"(project(":nuvotifier-common"))
|
||||
}
|
||||
|
||||
tasks.named<Jar>("jar") {
|
||||
val projectVersion = project.version
|
||||
inputs.property("projectVersion", projectVersion)
|
||||
manifest {
|
||||
attributes("Implementation-Version" to projectVersion)
|
||||
}
|
||||
}
|
||||
|
||||
tasks.named<ShadowJar>("shadowJar") {
|
||||
configurations = listOf(project.configurations["shadeOnly"], project.configurations["runtimeClasspath"])
|
||||
|
||||
dependencies {
|
||||
include(dependency(":nuvotifier-api"))
|
||||
include(dependency(":nuvotifier-common"))
|
||||
}
|
||||
|
||||
exclude("GradleStart**")
|
||||
exclude(".cache");
|
||||
exclude("LICENSE*")
|
||||
exclude("META-INF/services/**")
|
||||
exclude("META-INF/maven/**")
|
||||
exclude("META-INF/versions/**")
|
||||
exclude("org/intellij/**")
|
||||
exclude("org/jetbrains/**")
|
||||
exclude("**/module-info.class")
|
||||
exclude("*.yml")
|
||||
}
|
||||
|
||||
tasks.named("assemble").configure {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
Reference in new issue
Block a user