Bump to 1.1.1, update build script, stop shading lombok

This commit is contained in:
William278 2023-03-10 12:47:04 +00:00
parent a7d512e6fe
commit 2730778ef9
9 changed files with 76 additions and 63 deletions

View File

@ -35,7 +35,7 @@ jobs:
modrinth-id: Q10irTG0
modrinth-featured: false
modrinth-token: ${{ secrets.MODRINTH_TOKEN }}
files-primary: build/libs/Velocitab-*-all.jar
path: target/Velocitab-*.jar
name: Velocitab v${{ env.version_name }}
version: ${{ env.version_name }}
version-type: alpha
@ -57,4 +57,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: Velocitab Plugin
path: build/libs/Velocitab-*-all.jar
path: target/Velocitab-*.jar

View File

@ -44,10 +44,10 @@ You can include placeholders in the header, footer and player name format of the
## Building
To build Velocitab, simply run the following in the root of the repository:
```
```bash
./gradlew clean build
```
The build will be output as `/build/lib/Velocitab-X.XX-all.jar`.
The build will be output as `/target/Velocitab-x.xx.jar`.
### License
Velocitab is licensed under the Apache 2.0 license.

View File

@ -1,11 +1,17 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.0'
id 'org.ajoberstar.grgit' version '5.0.0'
id 'java'
}
group = 'net.william278'
version = "1.1-${versionMetadata()}"
group 'net.william278'
version "$ext.plugin_version-${versionMetadata()}"
ext {
set 'version', version.toString()
}
repositories {
mavenCentral()
@ -21,17 +27,28 @@ dependencies {
compileOnly 'dev.simplix:protocolize-api:2.2.5'
compileOnly 'io.netty:netty-codec-http:4.1.89.Final'
compileOnly 'net.william278:PAPIProxyBridge:1.0'
compileOnly 'org.projectlombok:lombok:1.18.26'
implementation 'org.apache.commons:commons-text:1.10.0'
implementation 'net.william278:Annotaml:2.0.1'
implementation 'dev.dejvokep:boosted-yaml:1.3.1'
implementation 'de.themoep:minedown-adventure:1.7.2-SNAPSHOT'
implementation 'org.projectlombok:lombok:1.18.26'
annotationProcessor 'com.velocitypowered:velocity-api:3.1.1'
annotationProcessor 'org.projectlombok:lombok:1.18.26'
}
processResources {
filesMatching(['**/*.json', '**/*.yml']) {
filter ReplaceTokens as Class, beginToken: '${', endToken: '}',
tokens: rootProject.ext.properties
}
}
logger.lifecycle("Building PAPIProxyBridge ${version} by William278")
version rootProject.version
archivesBaseName = "${rootProject.name}"
shadowJar {
relocate 'org.apache.commons.text', 'net.william278.velocitab.libraries.commons.text'
relocate 'org.apache.commons.lang3', 'net.william278.velocitab.libraries.commons.lang3'
@ -45,41 +62,22 @@ shadowJar {
//noinspection GroovyAssignabilityCheck
exclude dependency(':slf4j-api')
}
}
def targetJavaVersion = 16
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
destinationDirectory.set(file("$rootDir/target"))
archiveClassifier.set('')
}
jar.dependsOn shadowJar
tasks.withType(JavaCompile).configureEach {
options.release = targetJavaVersion
}
def templateSource = file('src/main/templates')
def templateDest = layout.buildDirectory.dir('generated/sources/templates')
def generateTemplates = tasks.register('generateTemplates', Copy) { task ->
def props = [
'version': project.version
]
task.inputs.properties props
task.from templateSource
task.into templateDest
task.expand props
}
sourceSets.main.java.srcDir(generateTemplates.map { it.outputs })
clean.delete "$rootDir/target"
@SuppressWarnings('GrMethodMayBeStatic')
def versionMetadata() {
// Get if there is a tag for this commit
def tag = grgit.tag.list().find { it.commit.id == grgit.head().id }
if (tag != null) {
return ''
}
// Otherwise, get the last commit hash and if it's a clean head
if (grgit == null) {
return System.getenv("GITHUB_RUN_NUMBER") ? 'build.' + System.getenv("GITHUB_RUN_NUMBER") : 'unknown'
}

View File

@ -1,4 +1,7 @@
javaVersion=16
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
org.gradle.daemon=true
org.gradle.daemon=true
plugin_version=1.1.1
plugin_archive=velocitab

View File

@ -1 +1,7 @@
rootProject.name = 'Velocitab'
pluginManagement {
repositories {
gradlePluginPortal()
}
}
rootProject.name = 'Velocitab'

View File

@ -3,7 +3,6 @@ package net.william278.velocitab;
import com.google.inject.Inject;
import com.velocitypowered.api.event.Subscribe;
import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
import com.velocitypowered.api.plugin.Dependency;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.plugin.annotation.DataDirectory;
import com.velocitypowered.api.proxy.Player;
@ -27,17 +26,7 @@ import java.util.Arrays;
import java.util.Optional;
@Plugin(
id = "velocitab",
name = "Velocitab",
version = BuildConstants.VERSION,
description = "Simple velocity TAB menu plugin",
url = "https://william278.net/",
authors = {"William278"},
dependencies = {
@Dependency(id = "protocolize"),
@Dependency(id = "luckperms", optional = true),
@Dependency(id = "papiproxybridge", optional = true)
}
id = "velocitab"
)
public class Velocitab {
@ -63,7 +52,7 @@ public class Velocitab {
loadHooks();
prepareScoreboardManager();
prepareTabList();
logger.info("Successfully enabled Velocitab v" + BuildConstants.VERSION);
logger.info("Successfully enabled Velocitab");
}
@NotNull

View File

@ -5,7 +5,6 @@ import lombok.Getter;
import net.william278.annotaml.YamlComment;
import net.william278.annotaml.YamlFile;
import net.william278.annotaml.YamlKey;
import net.william278.velocitab.BuildConstants;
import net.william278.velocitab.Velocitab;
import org.apache.commons.text.StringEscapeUtils;
import org.jetbrains.annotations.NotNull;
@ -23,7 +22,7 @@ public class Settings {
@YamlKey("headers")
private Map<String, String> headers = Map.of("default", "&rainbow&Running Velocitab v" + BuildConstants.VERSION + " by William278");
private Map<String, String> headers = Map.of("default", "&rainbow&Running Velocitab by William278");
@YamlKey("footers")
private Map<String, String> footers = Map.of("default", "[There are currently %players_online%/%max_players_online% players online](gray)");
@YamlKey("formats")
@ -57,7 +56,7 @@ public class Settings {
@NotNull
public String getHeader(String serverGroup) {
return StringEscapeUtils.unescapeJava(
headers.getOrDefault(serverGroup, "&rainbow&Running Velocitab v" + BuildConstants.VERSION + " by William278"));
headers.getOrDefault(serverGroup, "&rainbow&Running Velocitab by William278"));
}
@NotNull

View File

@ -0,0 +1,25 @@
{
"id": "velocitab",
"name": "Velocitab",
"version": "${version}",
"description": "A super-simple (sorted!) Velocity TAB menu plugin",
"url": "https://william278.net",
"authors": [
"William278"
],
"dependencies": [
{
"id": "protocolize",
"optional": false
},
{
"id": "luckperms",
"optional": true
},
{
"id": "papiproxybridge",
"optional": true
}
],
"main": "net.william278.papiproxybridge.VelocityPAPIProxyBridge"
}

View File

@ -1,7 +0,0 @@
package net.william278.velocitab;
// The constants are replaced before compilation
public class BuildConstants {
public static final String VERSION = "${version}";
}