Setup gradle

This commit is contained in:
KennyTV 2021-02-18 14:34:33 +01:00
parent 5c1c7940a3
commit 3fc2a3e395
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
180 changed files with 610 additions and 758 deletions

190
.gitignore vendored
View File

@ -1,108 +1,33 @@
# Created by .ignore support plugin (hsz.mobi) ### Java files ###
### Maven template *.class
target/
*/target
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
### NetBeans template
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
.nb-gradle/
### Eclipse template
.metadata # Package Files
bin/ #*.jar
tmp/ *.war
*.tmp *.ear
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
.recommenders
# Eclipse Core # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
.project hs_err_pid*
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# PyDev specific (Python IDE for Eclipse) ### Intellij ###
*.pydevproject # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
# Ignore project files
# CDT-specific (C/C++ Development Tooling)
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific (PHP Development Tools)
.buildpath
# sbteclipse plugin
.target
# Tern plugin
.tern-project
# TeXlipse plugin
.texlipse
# STS (Spring Tool Suite)
.springBeans
# Code Recommenders
.recommenders/
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea/workspace.xml
.idea/tasks.xml
.idea/dictionaries
.idea/vcs.xml
.idea/
*.iml *.iml
.idea/jsLibraryMappings.xml
# Sensitive or high-churn files: # Ignore IDEA directory
.idea/dataSources.ids .idea/*
.idea/dataSources.xml
.idea/dataSources.local.xml
.idea/sqlDataSources.xml
.idea/dynamic.xml
.idea/uiDesigner.xml
# Gradle: # Include the project's dictionary
.idea/gradle.xml !.idea/dictionaries/
.idea/libraries !.idea/dictionaries/*
# Mongo Explorer plugin: # File-based project format:
.idea/mongoSettings.xml *.ipr
## File-based project format:
*.iws *.iws
## Plugin-specific files: ### Plugin-specific files: ###
# IntelliJ # IntelliJ
/out/ /out/
@ -116,18 +41,73 @@ atlassian-ide-plugin.xml
com_crashlytics_export_strings.xml com_crashlytics_export_strings.xml
crashlytics.properties crashlytics.properties
crashlytics-build.properties crashlytics-build.properties
fabric.properties
### Java template
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml ### Eclipse ###
hs_err_pid* *.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Maven ###
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/
### Git ###
# Don't exclude the .gitignore itself
!.gitignore

View File

@ -1,151 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016 Matsv
~
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w06a</version>
</parent>
<artifactId>viabackwards-all</artifactId>
<name>ViaBackwards</name>
<build>
<finalName>${project.name}-${project.version}</finalName>
<defaultGoal>clean install</defaultGoal>
<plugins>
<!-- Write git commit hash into build properties -->
<plugin>
<groupId>net.md-5</groupId>
<artifactId>scriptus</artifactId>
<version>0.3.2</version>
<configuration>
<format>git-ViaBackwards-${project.parent.version}:%s</format>
</configuration>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>describe</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<archive>
<manifestEntries>
<!--suppress MavenModelInspection -->
<Implementation-Version>${describe}</Implementation-Version>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>false</showWarnings>
<showDeprecation>false</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
<minimizeJar>false</minimizeJar>
<relocations>
<relocation>
<pattern>com.google.gson</pattern>
<shadedPattern>us.myles.viaversion.libs.gson</shadedPattern>
</relocation>
<relocation>
<pattern>net.md_5.bungee</pattern>
<shadedPattern>us.myles.viaversion.libs.bungeecordchat</shadedPattern>
<includes>
<include>net.md_5.bungee.api.chat.**</include>
<include>net.md_5.bungee.api.ChatColor</include>
<include>net.md_5.bungee.api.ChatMessageType</include>
<include>net.md_5.bungee.chat.**</include>
</includes>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-core</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-bukkit</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-bungee</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-fabric</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-sponge</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-velocity</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

71
build.gradle.kts Normal file
View File

@ -0,0 +1,71 @@
import net.kyori.indra.IndraPlugin
import net.kyori.indra.IndraPublishingPlugin
import net.kyori.indra.sonatypeSnapshots
plugins {
`java-library`
`maven-publish`
id("net.kyori.indra")
}
group = "com.viaversion"
version = "3.3.0-21w07a"
description = "Allow older clients to join newer server versions."
subprojects {
apply<JavaLibraryPlugin>()
apply<MavenPublishPlugin>()
apply<IndraPlugin>()
apply<IndraPublishingPlugin>()
tasks {
// Variable replacements
processResources {
filesMatching(listOf("plugin.yml", "mcmod.info", "fabric.mod.json", "bungee.yml")) {
expand("version" to project.version,
"description" to project.description,
"url" to "https://github.com/ViaVersion/ViaBackwards")
}
}
withType<JavaCompile> {
options.compilerArgs.addAll(listOf("-nowarn", "-Xlint:-unchecked", "-Xlint:-deprecation"))
}
}
val platforms = listOf(
"bukkit",
"bungee",
"sponge",
"velocity",
"fabric"
).map { "viabackwards-$it" }
if (platforms.contains(project.name)) {
configureShadowJar()
}
repositories {
sonatypeSnapshots()
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots")
maven("https://nexus.velocitypowered.com/repository/velocity-artifacts-snapshots/")
maven("https://repo.spongepowered.org/maven")
maven("https://repo.viaversion.com")
maven("https://repo.maven.apache.org/maven2/")
}
indra {
javaVersions {
target.set(8)
testWith(8, 11, 15)
}
github("ViaVersion", "ViaBackwards") {
issues = true
}
mitLicense()
}
}
tasks {
withType<Jar> {
onlyIf { false }
}
}

13
buildSrc/build.gradle.kts Normal file
View File

@ -0,0 +1,13 @@
plugins {
`kotlin-dsl`
}
repositories {
gradlePluginPortal()
}
dependencies {
implementation("net.kyori", "indra-common", "1.3.1")
implementation("net.kyori", "indra-publishing-gradle-plugin", "1.3.1")
implementation("com.github.jengelman.gradle.plugins", "shadow", "6.1.0")
}

View File

@ -0,0 +1,15 @@
object Versions {
// ViaVersion
const val viaversion = "3.3.0-21w07a"
// Common
const val netty = "4.0.20.Final"
const val gson = "2.8.6"
const val jetbrainsAnnotations = "19.0.0"
// Platforms
const val spigot = "1.16.5-R0.1-SNAPSHOT"
const val bungee = "1.15-SNAPSHOT"
const val sponge = "5.0.0-SNAPSHOT"
const val velocityApi = "1.1.0-SNAPSHOT"
}

View File

@ -0,0 +1,34 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.ShadowPlugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.invoke
import org.gradle.kotlin.dsl.withType
import java.io.ByteArrayOutputStream
fun Project.configureShadowJar() {
apply<ShadowPlugin>()
tasks {
withType<ShadowJar> {
archiveClassifier.set("")
archiveFileName.set("ViaBackwards-${project.name.substringAfter("viabackwards-").capitalize()}-${project.version}.jar")
destinationDirectory.set(rootProject.projectDir.resolve("build/libs"))
configureRelocations()
}
getByName("build") {
dependsOn(withType<ShadowJar>())
}
}
}
private fun ShadowJar.configureRelocations() {
}
fun Project.latestCommitHash(): String {
val byteOut = ByteArrayOutputStream()
exec {
commandLine = listOf("git", "rev-parse", "--short", "HEAD")
standardOutput = byteOut
}
return byteOut.toString(Charsets.UTF_8.name()).trim()
}

7
bukkit/build.gradle.kts Normal file
View File

@ -0,0 +1,7 @@
dependencies {
implementation(project(":viabackwards-common"))
compileOnly("org.spigotmc", "spigot-api", Versions.spigot) {
exclude("com.google.code.gson", "gson")
exclude("javax.persistence", "persistence-api")
}
}

View File

@ -1,58 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016 Matsv
~
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w06a</version>
</parent>
<artifactId>viabackwards-bukkit</artifactId>
<repositories>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.16.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-core</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@ -1,11 +1,11 @@
name: ViaBackwards name: ViaBackwards
version: ${project.version} version: ${version}
description: Allow older Minecraft versions to connect to a newer server version. description: Allow older Minecraft versions to connect to a newer server version.
main: nl.matsv.viabackwards.BukkitPlugin main: nl.matsv.viabackwards.BukkitPlugin
api-version: 1.13 api-version: 1.13
authors: [Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1] authors: [Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1]
website: ${project.url} website: ${url}
load: STARTUP load: STARTUP
depend: [ViaVersion] depend: [ViaVersion]

4
bungee/build.gradle.kts Normal file
View File

@ -0,0 +1,4 @@
dependencies {
implementation(project(":viabackwards-common"))
compileOnly("net.md-5", "bungeecord-api", Versions.bungee)
}

View File

@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2016 Matsv
~
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>viabackwards-parent</artifactId>
<groupId>nl.matsv</groupId>
<version>3.3.0-21w06a</version>
</parent>
<artifactId>viabackwards-bungee</artifactId>
<repositories>
<!-- Bungee repo -->
<repository>
<id>bungeecord-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
</repositories>
<dependencies>
<!-- BungeeCord API -->
<dependency>
<groupId>net.md-5</groupId>
<artifactId>bungeecord-api</artifactId>
<version>1.15-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Core Module -->
<dependency>
<groupId>nl.matsv</groupId>
<artifactId>viabackwards-core</artifactId>
<version>${project.parent.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<targetPath>.</targetPath>
<filtering>true</filtering>
<directory>src/main/resources/</directory>
<includes>
<include>*</include>
</includes>
</resource>
</resources>
</build>
</project>

View File

@ -1,5 +1,5 @@
name: ViaBackwards name: ViaBackwards
main: nl.matsv.viabackwards.BungeePlugin main: nl.matsv.viabackwards.BungeePlugin
author: "Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1" author: "Matsv, KennyTV, Gerrygames, creeper123123321, ForceUpdate1"
version: ${project.version} version: ${version}
depends: [ViaVersion] depends: [ViaVersion]

14
common/build.gradle.kts Normal file
View File

@ -0,0 +1,14 @@
plugins {
id("net.kyori.blossom") version "1.1.0"
}
blossom {
replaceToken("\$VERSION", project.version)
replaceToken("\$IMPL_VERSION", "git-ViaBackwards-${project.version}:${rootProject.latestCommitHash()}")
}
dependencies {
compileOnly("io.netty", "netty-all", Versions.netty)
compileOnlyApi("us.myles", "viaversion", Versions.viaversion)
compileOnlyApi("org.jetbrains", "annotations", Versions.jetbrainsAnnotations)
}

View File

@ -48,6 +48,7 @@ import static us.myles.ViaVersion.api.protocol.ProtocolRegistry.registerProtocol
public interface ViaBackwardsPlatform { public interface ViaBackwardsPlatform {
String MINIMUM_VV_VERSION = "3.3.0"; String MINIMUM_VV_VERSION = "3.3.0";
String IMPL_VERSION = "$IMPL_VERSION";
/** /**
* Initialize ViaBackwards. * Initialize ViaBackwards.
@ -60,8 +61,7 @@ public interface ViaBackwardsPlatform {
if (isOutdated()) return; if (isOutdated()) return;
String version = ViaBackwards.class.getPackage().getImplementationVersion(); Via.getManager().getSubPlatforms().add(IMPL_VERSION);
Via.getManager().getSubPlatforms().add(version != null ? version : "UNKNOWN");
getLogger().info("Loading translations..."); getLogger().info("Loading translations...");
TranslatableRewriter.loadTranslatables(); TranslatableRewriter.loadTranslatables();

Some files were not shown because too many files have changed in this diff Show More