Skip to content

Commit

Permalink
Cleanup build files
Browse files Browse the repository at this point in the history
Delete not needed gradle.properties and moves the universal submodule to the root project
  • Loading branch information
FlorianMichael committed Jul 21, 2024
1 parent 3149006 commit fbe30d9
Show file tree
Hide file tree
Showing 18 changed files with 170 additions and 174 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
github: FlorianMichael
custom: ['https://florianmichael.de/donate', 'https://viaversion.com/donate', 'https://creeper123123321.github.io/#donate']
custom: ['https://florianmichael.de/donate', 'https://creeper123123321.github.io/#donate']
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Other Links
Building
-
After cloning this repository, build the project with Gradle by running `./gradlew build` and take the created jar out
of the `universal/build/libs` directory.
of the `build/libs` directory.

You need JDK 17 or newer to build ViaRewind.

Expand Down
74 changes: 74 additions & 0 deletions build-logic/src/main/groovy/vr.base-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
plugins {
id "java-library"
id "maven-publish"
id "idea"
}

repositories {
mavenCentral()
maven {
name = "ViaVersion"
url "https://repo.viaversion.com"
}
}

base {
java.toolchain.languageVersion = JavaLanguageVersion.of(17)
compileJava.options.encoding = compileTestJava.options.encoding = javadoc.options.encoding = "UTF-8"

group = rootProject.maven_group
version = rootProject.maven_version
description = rootProject.maven_description
}

dependencies {
compileOnly "com.viaversion:viaversion:${project.viaversion_version}"
compileOnly "com.viaversion:viabackwards:${project.viabackwards_version}"
}

publishing {
repositories {
maven {
name = "Via"
url = "https://repo.viaversion.com/"

credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
}
}
publications {
main(MavenPublication) {
artifactId = project.name
groupId = project.maven_group
version = project.maven_version

from components.java

pom {
name = "ViaRewind"
description = project.description
url = "https://github.com/ViaVersion/ViaRewind"
licenses {
license {
name = "GPL-3.0 License"
url = "https://github.com/ViaVersion/ViaRewind/blob/main/LICENSE"
}
}
developers {
developer {
id = "FlorianMichael"
name = "EnZaXD"
email = "florian.michael07@gmail.com"
}
}
scm {
connection = "scm:git:git://github.com/ViaVersion/ViaRewind.git"
developerConnection = "scm:git:ssh://github.com/ViaVersion/ViaRewind.git"
url = "github.com/ViaVersion/ViaRewind"
}
}
}
}
}
89 changes: 0 additions & 89 deletions build-logic/src/main/groovy/vr.java-conventions.gradle

This file was deleted.

7 changes: 7 additions & 0 deletions build-logic/src/main/groovy/vr.platform-conventions.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
plugins {
id "vr.base-conventions"
}

dependencies {
compileOnly project(":viarewind-common")
}
76 changes: 35 additions & 41 deletions universal/build.gradle → build.gradle
Original file line number Diff line number Diff line change
@@ -1,59 +1,53 @@
plugins {
id "com.github.johnrengelman.shadow" version "8.1.1"
id "vr.base-conventions"

id "io.papermc.hangar-publish-plugin" version "0.1.2"
id "com.modrinth.minotaur" version "2.+"
id "java-library"
id "maven-publish"
}

dependencies {
api project(":viarewind-common")
api project(":viarewind-bukkit")
api project(":viarewind-fabric")
api project(":viarewind-velocity")
base {
archivesName = "ViaRewind"
}

java {
withSourcesJar()
withJavadocJar()
configurations {
publishInclude
}

shadowJar {
manifest {
attributes["paperweight-mappings-namespace"] = "mojang"
}
archiveClassifier.set("")
archiveBaseName.set("ViaRewind-" + project.maven_version)
configurations {
api
}
dependencies {
publishInclude project(":viarewind-common")
publishInclude project(":viarewind-bukkit")
publishInclude project(":viarewind-fabric")
publishInclude project(":viarewind-velocity")
}

publishing {
repositories {
maven {
name = "Via"
url = "https://repo.viaversion.com/"

credentials(PasswordCredentials)
authentication {
basic(BasicAuthentication)
}
jar {
dependsOn configurations.publishInclude
from {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
configurations.publishInclude.collect {
zipTree(it)
}
} {
exclude "META-INF/*.RSA", "META-INF/*.SF", "META-INF/*.DSA"
}
manifest {
attributes(
"paperweight-mappings-namespace": "mojang"
)
}
publications {
shadow(MavenPublication) { publication ->
artifactId = project.maven_name
groupId = project.maven_group
version = project.maven_version
from("LICENSE") {
rename { "${it}_${project.name ?: rootProject.name}" }
}
}

from project.shadow.component(publication)
idea {
module {
["run"].each {
excludeDirs << file("$it")
}
}
}

build.dependsOn shadowJar

// -----------------------------------------------------
// Publishing

Expand Down Expand Up @@ -103,7 +97,7 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch
versionNumber.set(suffixedVersion)
versionName.set(suffixedVersion)
changelog.set(changelogContent)
uploadFile.set(shadowJar.archiveFile)
uploadFile.set(jar.archiveFile)
gameVersions.set(mcVersions)
loaders.add("fabric")
loaders.add("paper")
Expand All @@ -127,7 +121,7 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch
apiKey = System.getenv("HANGAR_TOKEN")
platforms {
PAPER {
jar = shadowJar.archiveFile
jar = project.jar.archiveFile
platformVersions = [property('mcVersionRange') as String]
dependencies {
hangar("ViaVersion") {
Expand All @@ -139,7 +133,7 @@ if (!isRelease || isMainBranch) { // Only publish releases from the main branch
}
}
VELOCITY {
jar = shadowJar.archiveFile
jar = project.jar.archiveFile
platformVersions = [property("velocityVersion") as String]
dependencies {
hangar("ViaVersion") {
Expand Down
21 changes: 18 additions & 3 deletions bukkit/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
plugins {
id "vr.java-conventions"
id "vr.platform-conventions"
}

dependencies {
api project(":viarewind-common")
repositories {
maven {
name = "SpigotMC"
url "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
name = "SpongePowered"
url "https://repo.spongepowered.org/repository/maven-public/"
}
}

dependencies {
compileOnly(annotationProcessor("org.spigotmc:spigot-api:1.12.2-R0.1-SNAPSHOT"))
}

processResources {
filesMatching("plugin.yml") {
expand("version": project.version, "description": project.description)
}
}
1 change: 0 additions & 1 deletion bukkit/gradle.properties

This file was deleted.

17 changes: 4 additions & 13 deletions common/build.gradle
Original file line number Diff line number Diff line change
@@ -1,28 +1,19 @@
plugins {
id "vr.java-conventions"
}
id "vr.base-conventions"

plugins {
id "net.raphimc.class-token-replacer" version "1.0.0"
}

dependencies {
compileOnly "io.netty:netty-all:${project.netty_version}"
compileOnly "com.google.guava:guava:${project.guava_version}"
}

sourceSets {
main {
classTokenReplacer {
property("\${version}", rootProject.maven_version)
property("\${impl_version}", "git-ViaRewind-${rootProject.maven_version}:${project.latestCommitHash()}")
property("\${impl_version}", "git-ViaRewind-${rootProject.maven_version}:${rootProject.latestCommitHash()}")
}
}
}

String latestCommitHash() {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}
1 change: 0 additions & 1 deletion common/gradle.properties

This file was deleted.

17 changes: 14 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
plugins {
id "vr.java-conventions"
id "vr.platform-conventions"
}

dependencies {
api project(":viarewind-common")
repositories {
maven {
name = "FabricMC"
url "https://maven.fabricmc.net/"
}
}

dependencies {
compileOnly(annotationProcessor("net.fabricmc:fabric-loader:0.11.3"))
compileOnly(annotationProcessor("org.apache.logging.log4j:log4j-api:2.17.1"))
}

processResources {
filesMatching("fabric.mod.json") {
expand("version": project.version, "description": project.description)
}
}
1 change: 0 additions & 1 deletion fabric/gradle.properties

This file was deleted.

Loading

0 comments on commit fbe30d9

Please sign in to comment.