mirror of
https://github.com/ViaVersion/ViaProxy.git
synced 2025-07-09 05:04:00 -04:00
Split monolithic gradle files into modular gradle snippets
This commit is contained in:
parent
d3fc38e0b4
commit
1750350c82
13 changed files with 179 additions and 109 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -12,6 +12,7 @@ hs_err_pid*
|
|||
/.idea/*
|
||||
!/.idea/copyright/
|
||||
/.gradle/
|
||||
/build/
|
||||
/out/
|
||||
/buildSrc/.gradle/
|
||||
build/
|
||||
out/
|
||||
/run/
|
||||
|
|
111
build.gradle
111
build.gradle
|
@ -1,31 +1,18 @@
|
|||
plugins {
|
||||
id "java"
|
||||
id "application"
|
||||
id "maven-publish"
|
||||
id "idea"
|
||||
id "base.base-conventions"
|
||||
id "base.application-conventions"
|
||||
id "base.fill-build-constants"
|
||||
id "viaproxy.publishing-conventions"
|
||||
id "net.raphimc.class-token-replacer" version "1.1.4"
|
||||
id "xyz.wagyourtail.jvmdowngrader" version "1.2.2"
|
||||
}
|
||||
|
||||
base {
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
|
||||
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"
|
||||
|
||||
group = project.maven_group ?: rootProject.maven_group
|
||||
archivesName = project.maven_name ?: rootProject.maven_name
|
||||
version = project.maven_version ?: rootProject.maven_version
|
||||
}
|
||||
|
||||
configurations {
|
||||
include
|
||||
includeJ8
|
||||
|
||||
implementation.extendsFrom include
|
||||
api.extendsFrom include
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven {
|
||||
name = "ViaVersion"
|
||||
url = "https://repo.viaversion.com"
|
||||
|
@ -113,102 +100,20 @@ dependencies {
|
|||
includeJ8 "xyz.wagyourtail.jvmdowngrader:jvmdowngrader-java-api:1.2.2:downgraded-8"
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
classTokenReplacer {
|
||||
property("\${version}", project.version)
|
||||
property("\${impl_version}", "git-${project.name}-${project.version}:${project.latestCommitHash().get()}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
application {
|
||||
mainClass = "net.raphimc.viaproxy.ViaProxy"
|
||||
}
|
||||
|
||||
jar {
|
||||
dependsOn configurations.include
|
||||
from {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
configurations.include.collect {
|
||||
zipTree(it)
|
||||
}
|
||||
} {
|
||||
exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA"
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes(
|
||||
"Main-Class": application.mainClass,
|
||||
"Multi-Release": "true",
|
||||
"Launcher-Agent-Class": application.mainClass
|
||||
)
|
||||
}
|
||||
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${project.name ?: rootProject.name}" }
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Via"
|
||||
url = "https://repo.viaversion.com/"
|
||||
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
publications {
|
||||
maven(MavenPublication) {
|
||||
groupId = project.maven_group
|
||||
artifactId = project.maven_name
|
||||
version = project.maven_version
|
||||
|
||||
from components.java
|
||||
|
||||
pom {
|
||||
name = "ViaProxy"
|
||||
description = "Standalone proxy which allows players to join EVERY Minecraft server version (Classic, Alpha, Beta, Release, Bedrock)"
|
||||
url = "https://github.com/ViaVersion/ViaProxy"
|
||||
licenses {
|
||||
license {
|
||||
name = "GPL-3.0 License"
|
||||
url = "https://github.com/ViaVersion/ViaProxy/blob/main/LICENSE"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "RK_01"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection = "scm:git:git://github.com/ViaVersion/ViaProxy.git"
|
||||
developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaProxy.git"
|
||||
url = "https://github.com/ViaVersion/ViaProxy.git"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
["run"].each {
|
||||
excludeDirs << file("$it")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
downgradeJar {
|
||||
dependsOn configurations.includeJ8
|
||||
dependsOn(configurations.includeJ8)
|
||||
from {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
configurations.includeJ8.collect {
|
||||
|
@ -225,8 +130,4 @@ downgradeJar {
|
|||
}
|
||||
build.finalizedBy("downgradeJar")
|
||||
|
||||
Provider<String> latestCommitHash() {
|
||||
return providers.exec {
|
||||
commandLine = ["git", "rev-parse", "--short", "HEAD"]
|
||||
}.standardOutput.getAsText().map(String::trim)
|
||||
}
|
||||
tasks.javadoc.enabled = false
|
||||
|
|
7
buildSrc/build.gradle
Normal file
7
buildSrc/build.gradle
Normal file
|
@ -0,0 +1,7 @@
|
|||
plugins {
|
||||
id "groovy-gradle-plugin"
|
||||
}
|
||||
|
||||
repositories {
|
||||
gradlePluginPortal()
|
||||
}
|
15
buildSrc/src/main/groovy/base.application-conventions.gradle
Normal file
15
buildSrc/src/main/groovy/base.application-conventions.gradle
Normal file
|
@ -0,0 +1,15 @@
|
|||
plugins {
|
||||
id "application"
|
||||
id "base.include-configuration"
|
||||
id "base.exclude-run-folder"
|
||||
}
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes(
|
||||
"Main-Class": application.mainClass,
|
||||
"Multi-Release": "true",
|
||||
"Enable-Native-Access": "ALL-UNNAMED"
|
||||
)
|
||||
}
|
||||
}
|
26
buildSrc/src/main/groovy/base.base-conventions.gradle
Normal file
26
buildSrc/src/main/groovy/base.base-conventions.gradle
Normal file
|
@ -0,0 +1,26 @@
|
|||
base {
|
||||
java.toolchain.languageVersion = JavaLanguageVersion.of(project.java_version)
|
||||
|
||||
group = project.maven_group
|
||||
archivesName = project.maven_name
|
||||
version = project.maven_version
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
jar {
|
||||
var projectName = project.name
|
||||
from("LICENSE") {
|
||||
rename { "${it}_${projectName}" }
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
it.options.encoding = "UTF-8"
|
||||
}
|
||||
|
||||
tasks.withType(Javadoc).configureEach {
|
||||
it.options.encoding = "UTF-8"
|
||||
}
|
11
buildSrc/src/main/groovy/base.exclude-run-folder.gradle
Normal file
11
buildSrc/src/main/groovy/base.exclude-run-folder.gradle
Normal file
|
@ -0,0 +1,11 @@
|
|||
plugins {
|
||||
id "idea"
|
||||
}
|
||||
|
||||
idea {
|
||||
module {
|
||||
["run"].each {
|
||||
excludeDirs << file("$it")
|
||||
}
|
||||
}
|
||||
}
|
16
buildSrc/src/main/groovy/base.fill-build-constants.gradle
Normal file
16
buildSrc/src/main/groovy/base.fill-build-constants.gradle
Normal file
|
@ -0,0 +1,16 @@
|
|||
plugins {
|
||||
id "net.raphimc.class-token-replacer"
|
||||
}
|
||||
|
||||
sourceSets.configureEach {
|
||||
it.classTokenReplacer {
|
||||
property("\${version}", project.version)
|
||||
property("\${commit_hash}", latestCommitHash().get())
|
||||
}
|
||||
}
|
||||
|
||||
Provider<String> latestCommitHash() {
|
||||
return providers.exec {
|
||||
commandLine = ["git", "rev-parse", "--short", "HEAD"]
|
||||
}.standardOutput.getAsText().map(String::trim)
|
||||
}
|
18
buildSrc/src/main/groovy/base.include-configuration.gradle
Normal file
18
buildSrc/src/main/groovy/base.include-configuration.gradle
Normal file
|
@ -0,0 +1,18 @@
|
|||
configurations {
|
||||
include
|
||||
|
||||
implementation.extendsFrom(include)
|
||||
api.extendsFrom(include)
|
||||
}
|
||||
|
||||
jar {
|
||||
dependsOn(configurations.include)
|
||||
from {
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
configurations.include.collect {
|
||||
zipTree(it)
|
||||
}
|
||||
} {
|
||||
exclude("META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA")
|
||||
}
|
||||
}
|
30
buildSrc/src/main/groovy/base.publishing-conventions.gradle
Normal file
30
buildSrc/src/main/groovy/base.publishing-conventions.gradle
Normal file
|
@ -0,0 +1,30 @@
|
|||
plugins {
|
||||
id "maven-publish"
|
||||
id "signing"
|
||||
}
|
||||
|
||||
java {
|
||||
withSourcesJar()
|
||||
withJavadocJar()
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava(MavenPublication) {
|
||||
from(components.java)
|
||||
|
||||
groupId = project.maven_group
|
||||
artifactId = project.maven_name
|
||||
version = project.maven_version
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
setRequired(false)
|
||||
sign(publishing.publications.mavenJava)
|
||||
}
|
||||
|
||||
tasks.withType(PublishToMavenRepository).configureEach {
|
||||
it.dependsOn(tasks.withType(Sign))
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
publishing {
|
||||
repositories {
|
||||
maven {
|
||||
name = "Via"
|
||||
url = "https://repo.viaversion.com/"
|
||||
|
||||
credentials(PasswordCredentials)
|
||||
authentication {
|
||||
basic(BasicAuthentication)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
plugins {
|
||||
id "base.publishing-conventions"
|
||||
id "via.viaversion-maven-publishing"
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
mavenJava {
|
||||
pom {
|
||||
name = "ViaProxy"
|
||||
description = "Standalone proxy which allows players to join EVERY Minecraft server version (Classic, Alpha, Beta, Release, Bedrock)"
|
||||
url = "https://github.com/ViaVersion/ViaProxy"
|
||||
licenses {
|
||||
license {
|
||||
name = "GPL-3.0 License"
|
||||
url = "https://github.com/ViaVersion/ViaProxy/blob/main/LICENSE"
|
||||
}
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
id = "RK_01"
|
||||
}
|
||||
}
|
||||
scm {
|
||||
connection = "scm:git:git://github.com/ViaVersion/ViaProxy.git"
|
||||
developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaProxy.git"
|
||||
url = "https://github.com/ViaVersion/ViaProxy.git"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
org.gradle.daemon=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.configureondemand=true
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
|
||||
java_version=17
|
||||
maven_group=net.raphimc
|
||||
maven_name=ViaProxy
|
||||
maven_version=3.4.2-SNAPSHOT
|
||||
|
|
|
@ -72,7 +72,7 @@ import java.util.function.Consumer;
|
|||
public class ViaProxy {
|
||||
|
||||
public static final String VERSION = "${version}";
|
||||
public static final String IMPL_VERSION = "${impl_version}";
|
||||
public static final String IMPL_VERSION = "git-ViaProxy-${version}:${commit_hash}";
|
||||
|
||||
public static final LambdaManager EVENT_MANAGER = LambdaManager.threadSafe(new LambdaMetaFactoryGenerator(JavaBypass.TRUSTED_LOOKUP));
|
||||
private static /*final*/ File CWD;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue