From 5d3394bb36b34af45c7dec257b0e845906a2d07b Mon Sep 17 00:00:00 2001 From: Draycia Date: Wed, 9 Sep 2020 20:04:01 -0700 Subject: [PATCH] Add Kyori/Adventure checkstyle --- .checkstyle/checkstyle.xml | 179 +++++++++++++++++++++++++++++++++++ .checkstyle/suppressions.xml | 32 +++++++ .editorconfig | 30 ++++++ build.gradle | 164 ++++++++++++++++---------------- 4 files changed, 326 insertions(+), 79 deletions(-) create mode 100644 .checkstyle/checkstyle.xml create mode 100644 .checkstyle/suppressions.xml create mode 100644 .editorconfig diff --git a/.checkstyle/checkstyle.xml b/.checkstyle/checkstyle.xml new file mode 100644 index 00000000..e688b303 --- /dev/null +++ b/.checkstyle/checkstyle.xml @@ -0,0 +1,179 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.checkstyle/suppressions.xml b/.checkstyle/suppressions.xml new file mode 100644 index 00000000..94a5067b --- /dev/null +++ b/.checkstyle/suppressions.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..7521b1d2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,30 @@ +# MIT License +# +# Copyright (c) 2017-2020 KyoriPowered +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. + +root = true + +[*] +charset = utf-8 +indent_size = 2 +indent_style = space +insert_final_newline = true +max_line_length = off diff --git a/build.gradle b/build.gradle index 14fc5d70..886086f2 100644 --- a/build.gradle +++ b/build.gradle @@ -1,12 +1,14 @@ plugins { - id 'java' - id 'java-library' - id 'maven' - id 'maven-publish' - id 'com.github.johnrengelman.shadow' version '6.0.0' - id 'net.minecrell.plugin-yml.bukkit' version '0.3.0' - id 'com.palantir.git-version' version '0.12.3' - id 'org.checkerframework' version '0.5.9' + id 'checkstyle' + id 'java' + id 'java-library' + id 'maven' + id 'maven-publish' + id 'com.github.johnrengelman.shadow' version '6.0.0' + id 'net.minecrell.plugin-yml.bukkit' version '0.3.0' + id 'com.palantir.git-version' version '0.12.3' + id 'org.checkerframework' version '0.5.9' + id 'com.github.sherter.google-java-format' version '0.8' } // Gets the git commit hash of the latest commit, used for version string @@ -17,90 +19,94 @@ group = 'net.draycia' description = 'CarbonChat' version = project.property('projectVersion') + '-' + gitHash -repositories { - mavenLocal() - mavenCentral() +checkstyle { + def configRoot = new File(rootProject.projectDir, '.checkstyle') + toolVersion = '8.34' + configDirectory = configRoot + configProperties = [basedir: configRoot.getAbsolutePath()] +} - maven {url = 'https://maven.enginehub.org/repo/'} - maven {url = 'https://repo.maven.apache.org/maven2'} - maven {url = 'https://papermc.io/repo/repository/maven-public/'} - maven {url = 'https://oss.sonatype.org/content/groups/public/'} - maven {url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/'} - maven {url = 'https://jitpack.io'} - maven {url = 'https://dl.bintray.com/ichbinjoe/public/'} - maven {url = 'https://repo.codemc.org/repository/maven-public/'} - maven {url = 'https://repo.minebench.de/'} - maven {url = "https://repo.aikar.co/content/groups/aikar/"} - maven {url = 'https://raw.githubusercontent.com/JorelAli/CommandAPI/mvn-repo/'} +repositories { + mavenLocal() + mavenCentral() + + maven { url = 'https://maven.enginehub.org/repo/' } + maven { url = 'https://repo.maven.apache.org/maven2' } + maven { url = 'https://papermc.io/repo/repository/maven-public/' } + maven { url = 'https://oss.sonatype.org/content/groups/public/' } + maven { url = 'https://repo.extendedclip.com/content/repositories/placeholderapi/' } + maven { url = 'https://jitpack.io' } + maven { url = 'https://dl.bintray.com/ichbinjoe/public/' } + maven { url = 'https://repo.codemc.org/repository/maven-public/' } + maven { url = 'https://repo.minebench.de/' } + maven { url = "https://repo.aikar.co/content/groups/aikar/" } + maven { url = 'https://raw.githubusercontent.com/JorelAli/CommandAPI/mvn-repo/' } } dependencies { - // Components - compile 'net.kyori:adventure-api:4.0.0-SNAPSHOT' - compile 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT' - compile 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT' - compile 'net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT' - compile 'de.themoep:minedown-adventure:1.6.1-SNAPSHOT' + // Components + compile 'net.kyori:adventure-api:4.0.0-SNAPSHOT' + compile 'net.kyori:adventure-nbt:4.0.0-SNAPSHOT' + compile 'net.kyori:adventure-platform-bukkit:4.0.0-SNAPSHOT' + compile 'net.kyori:adventure-text-minimessage:3.0.0-SNAPSHOT' + compile 'de.themoep:minedown-adventure:1.6.1-SNAPSHOT' - // Databases - compile 'co.aikar:idb-bukkit:1.0.0-SNAPSHOT' - compile 'com.zaxxer:HikariCP:2.4.1' + // Databases + compile 'co.aikar:idb-bukkit:1.0.0-SNAPSHOT' + compile 'com.zaxxer:HikariCP:2.4.1' - // Messaging - compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT' - compile 'io.lettuce:lettuce-core:6.0.0.M1' + // Messaging + compile 'io.github.leonardosnt:bungeechannelapi:1.0.0-SNAPSHOT' + compile 'io.lettuce:lettuce-core:6.0.0.M1' - // Commands - compile "dev.jorel:commandapi-shade:4.1" + // Commands + compile "dev.jorel:commandapi-shade:4.1" - // Plugins - compileOnly('com.gmail.nossr50.mcMMO:mcMMO:2.1.143') { - exclude group: 'org.jetbrains', module: 'annotations' - } - compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0' - compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT') { - exclude group: 'org.spigotmc', module: 'spigot-api' // Honestly? - } - compileOnly 'me.clip:placeholderapi:2.10.9' - compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11' - compileOnly 'com.github.MilkBowl:VaultAPI:1.7' - compileOnly 'com.vexsoftware:nuvotifier-universal:2.6.0' - compileOnly 'net.luckperms:api:5.1' + // Plugins + compileOnly('com.gmail.nossr50.mcMMO:mcMMO:2.1.143') { + exclude group: 'org.jetbrains', module: 'annotations' + } + compileOnly 'com.github.TownyAdvanced:Towny:0.96.2.0' + compileOnly('com.sk89q.worldguard:worldguard-bukkit:7.0.4-SNAPSHOT') { + exclude group: 'org.spigotmc', module: 'spigot-api' // Honestly? + } + compileOnly 'me.clip:placeholderapi:2.10.9' + compileOnly 'com.github.TownyAdvanced:Towny:0.96.1.11' + compileOnly 'com.github.MilkBowl:VaultAPI:1.7' + compileOnly 'com.vexsoftware:nuvotifier-universal:2.6.0' + compileOnly 'net.luckperms:api:5.1' - // Server - compileOnly 'com.destroystokyo.paper:paper-api:1.16.2-R0.1-SNAPSHOT' + // Server + compileOnly 'com.destroystokyo.paper:paper-api:1.16.2-R0.1-SNAPSHOT' } // Generates plugin.yml automatically bukkit { - name = project.description - version = project.version - main = 'net.draycia.carbon.CarbonChat' - apiVersion = '1.13' - author = 'Draycia' - depend = ['PlaceholderAPI', 'Vault'] - softDepend = ['LuckPerms', 'Towny', 'mcMMO', 'WorldGuard'] - loadBefore = ["Essentials"] - permissions { - 'carbonchat.channels.global.see' { - setDefault("TRUE") - } - - 'carbonchat.channels.global.use' { - setDefault("TRUE") - } + name = project.description + version = project.version + main = 'net.draycia.carbon.CarbonChat' + apiVersion = '1.13' + author = 'Draycia' + depend = ['PlaceholderAPI', 'Vault'] + softDepend = ['LuckPerms', 'Towny', 'mcMMO', 'WorldGuard'] + loadBefore = ["Essentials"] + permissions { + 'carbonchat.channels.global.see' { + setDefault("TRUE") } + + 'carbonchat.channels.global.use' { + setDefault("TRUE") + } + } } sourceCompatibility = '1.8' // Set output directory and encoding tasks.withType(JavaCompile) { - options.encoding = 'UTF-8' -} - -tasks.withType(Jar) { - getDestinationDirectory().set(file("$rootDir/build")) + options.encoding = 'UTF-8' + options.compilerArgs += ['-Xlint:all'] } // Automatically shadowJar when building @@ -108,25 +114,25 @@ tasks.build.dependsOn tasks.shadowJar // Output a single jar shadowJar { - minimize() - archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar") + minimize() + archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar") } jar { - archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar") + archiveFileName.set(project.description + "-" + project.property('projectVersion') + ".jar") } // Automatically relocate all shaded dependencies import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation task relocateShadowJar(type: ConfigureShadowRelocation) { - target = tasks.shadowJar - prefix = "net.draycia.carbon.libs" // Default value is "shadow" + target = tasks.shadowJar + prefix = "net.draycia.carbon.libs" // Default value is "shadow" } tasks.shadowJar.dependsOn tasks.relocateShadowJar // Cleanup custom output directory on clean task clean.doFirst { - delete "$rootDir/build/bundled" -} \ No newline at end of file + delete "$rootDir/build/bundled" +}