update loom, allocate more ram

This commit is contained in:
creeper123123321 2022-01-26 17:22:09 -03:00
parent b463b48312
commit f8547729d3
3 changed files with 42 additions and 60 deletions

View File

@ -1,23 +1,30 @@
// todo migrate this code to kotlin // todo migrate this code to kotlin
import com.google.gson.JsonParser import com.google.gson.JsonParser
import net.fabricmc.loom.task.RemapJarTask
import java.nio.file.Files import java.nio.file.Files
import java.util.stream.Collectors
import java.util.stream.IntStream
buildscript {
dependencies {
classpath("com.github.TinfoilMC:CurseGradle:6e2f47d")
}
}
// Stolen https://github.com/FabricMC/fabric/blob/1.17/build.gradle // Stolen https://github.com/FabricMC/fabric/blob/1.17/build.gradle
plugins { plugins {
id "java" id "java"
id "maven-publish" id "maven-publish"
id "org.ajoberstar.grgit" version "3.1.1" id "org.ajoberstar.grgit" version "3.1.1"
id "com.matthewprenger.cursegradle" version "1.4.0" id "fabric-loom" version "0.11-SNAPSHOT" apply false
id "fabric-loom" version "0.10-SNAPSHOT" apply false id "com.github.ben-manes.versions" version "0.41.0"
} }
def ENV = System.getenv() apply plugin: "me.hypherionmc.cursegradle"
def vvVer = "4.1.2-SNAPSHOT"
def yamlVer = "1.30"
def ENV = System.getenv()
group = "com.viaversion.fabric"
description = "Client-side and server-side ViaVersion implementation for Fabric" description = "Client-side and server-side ViaVersion implementation for Fabric"
version = "0.4.5+" + ENV.GITHUB_RUN_NUMBER + "-" + getBranch() version = "0.4.5+" + ENV.GITHUB_RUN_NUMBER + "-" + getBranch()
logger.lifecycle("Building ViaFabric: $version") logger.lifecycle("Building ViaFabric: $version")
@ -45,8 +52,12 @@ allprojects {
it.options.release.set(8) it.options.release.set(8)
} }
group = "com.viaversion.fabric"
version = rootProject.version version = rootProject.version
group = rootProject.group
java {
withSourcesJar()
}
repositories { repositories {
mavenCentral() mavenCentral()
@ -59,10 +70,10 @@ allprojects {
dependencies { dependencies {
// transitive = false because Guava is conflicting on runClient // transitive = false because Guava is conflicting on runClient
implementation("com.viaversion:viaversion:$vvVer") { transitive = false } implementation("com.viaversion:viaversion:${rootProject.viaver_version}") { transitive = false }
implementation("org.yaml:snakeyaml:$yamlVer") implementation("org.yaml:snakeyaml:${rootProject.yaml_version}")
modImplementation("net.fabricmc:fabric-loader:0.12.12") modImplementation("net.fabricmc:fabric-loader:${rootProject.loader_version}")
} }
processResources { processResources {
@ -70,11 +81,6 @@ allprojects {
it.expand(rootProject.properties) it.expand(rootProject.properties)
} }
} }
task sourcesJar(type: Jar, dependsOn: classes) {
archiveClassifier.set("sources")
from sourceSets.main.allSource
}
} }
subprojects { subprojects {
@ -82,14 +88,6 @@ subprojects {
implementation rootProject implementation rootProject
} }
task remapMavenJar(type: Copy, dependsOn: remapJar) {
afterEvaluate {
from("${project.buildDir}/libs/$archivesBaseName-${version}.jar")
into("${project.buildDir}/libs/")
rename { String fn -> "$archivesBaseName-${version}-maven.jar" }
}
}
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
@ -101,37 +99,10 @@ subprojects {
} }
} }
task remapMavenJar(type: RemapJarTask, dependsOn: jar) {
afterEvaluate {
input = jar.archiveFile
archiveFileName = "${archivesBaseName}-${version}-maven.jar"
addNestedDependencies.set(false)
}
}
build.dependsOn remapMavenJar
publishing { publishing {
publications { publications {
mavenJava(MavenPublication) { mavenJava(MavenPublication) {
artifact(remapMavenJar) { from components.java
builtBy remapMavenJar
}
artifact(sourcesJar) {
builtBy remapSourcesJar
}
pom.withXml {
def depsNode = asNode().appendNode("dependencies")
subprojects.each {
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", it.group)
depNode.appendNode("artifactId", it.name)
depNode.appendNode("version", it.version)
depNode.appendNode("scope", "compile")
}
}
} }
} }
@ -161,8 +132,8 @@ dependencies {
minecraft("com.mojang:minecraft:1.14.4") minecraft("com.mojang:minecraft:1.14.4")
mappings("net.fabricmc:yarn:1.14.4+build.18:v2") mappings("net.fabricmc:yarn:1.14.4+build.18:v2")
include("com.viaversion:viaversion:$vvVer") include("com.viaversion:viaversion:${rootProject.viaver_version}")
include("org.yaml:snakeyaml:$yamlVer") include("org.yaml:snakeyaml:${rootProject.yaml_version}")
include("com.github.TinfoilMC:ClientCommands:1.1.0") include("com.github.TinfoilMC:ClientCommands:1.1.0")
subprojects.each { subprojects.each {
@ -186,6 +157,12 @@ processResources {
} }
} }
List<String> versionToAdd = new ArrayList<>(Arrays.asList("Fabric", "1.18.1", "1.17.1",
"1.16.5", "1.15.2", "1.14.4", "1.8.9"))
versionToAdd.addAll(IntStream.rangeClosed(8, 18)
.mapToObj { n -> (String) "Java $n" }
.collect(Collectors.toList()))
curseforge { curseforge {
if (ENV.CURSEFORGE_API_KEY) { if (ENV.CURSEFORGE_API_KEY) {
apiKey = ENV.CURSEFORGE_API_KEY apiKey = ENV.CURSEFORGE_API_KEY
@ -195,15 +172,14 @@ curseforge {
id = "391298" id = "391298"
changelog = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits" changelog = "A changelog can be found at https://github.com/ViaVersion/ViaFabric/commits"
releaseType = "alpha" releaseType = "alpha"
Arrays.<String> asList("1.18.1", "1.17.1", "1.16.5", "1.15.2", "1.14.4", "1.8.9",
"Java 8", "Java 9", "Java 10", "Java 11", "Java 12", "Java 13", "Java 14", "Java 15", "Java 16", "Java 17", "Fabric") versionToAdd.forEach { ver -> addGameVersion(ver) }
.forEach { ver -> addGameVersion(ver) }
mainArtifact(remapJar) { mainArtifact(remapJar) {
displayName = "[${getBranch()}] ViaFabric " + rootProject.version displayName = "[${getBranch()}] ViaFabric " + rootProject.version
relations { relations {
optionalDependency("fabric-api") optionalDependency("fabric-api")
//optionalDependency("legacy-fabric-api") optionalDependency("legacy-fabric-api")
embeddedLibrary("cotton-client-commands") embeddedLibrary("cotton-client-commands")
} }
} }
@ -215,6 +191,7 @@ curseforge {
options { options {
forgeGradleIntegration = false forgeGradleIntegration = false
detectFabricApi = false
} }
} }

View File

@ -1,2 +1,6 @@
# rip my ram # rip my ram
org.gradle.jvmargs=-Xms32M -Xmx1G org.gradle.jvmargs=-Xms32M -Xmx3G
loader_version=0.12.12
viaver_version=4.1.2-SNAPSHOT
yaml_version=1.30

View File

@ -1,7 +1,8 @@
pluginManagement { pluginManagement {
repositories { repositories {
maven { url = 'https://maven.fabricmc.net/' }
gradlePluginPortal() gradlePluginPortal()
maven { url = 'https://maven.fabricmc.net/' }
maven { url = "https://jitpack.io" }
} }
} }