Restructure how Loom is included in build env

This commit is contained in:
Kenzie Togami 2019-09-22 13:42:26 -07:00
parent e77393a51e
commit 445b7706fc
No known key found for this signature in database
GPG Key ID: 5D200B325E157A81
4 changed files with 39 additions and 19 deletions

View File

@ -1,3 +1,5 @@
import java.util.Properties
plugins { plugins {
`kotlin-dsl` `kotlin-dsl`
kotlin("jvm") version embeddedKotlinVersion kotlin("jvm") version embeddedKotlinVersion
@ -10,6 +12,14 @@ repositories {
name = "Forge Maven" name = "Forge Maven"
url = uri("https://files.minecraftforge.net/maven") url = uri("https://files.minecraftforge.net/maven")
} }
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "sponge"
url = uri("https://repo.spongepowered.org/maven")
}
} }
configurations.all { configurations.all {
@ -23,6 +33,14 @@ configurations.all {
} }
} }
val properties = Properties().also { props ->
project.projectDir.resolveSibling("gradle.properties").bufferedReader().use {
props.load(it)
}
}
val loomVersion: String = properties.getProperty("loom.version")
val mixinVersion: String = properties.getProperty("mixin.version")
dependencies { dependencies {
implementation(gradleApi()) implementation(gradleApi())
implementation("gradle.plugin.net.minecrell:licenser:0.4.1") implementation("gradle.plugin.net.minecrell:licenser:0.4.1")
@ -33,4 +51,6 @@ dependencies {
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7") implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.9.7")
implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0") implementation("gradle.plugin.org.spongepowered:spongegradle:0.9.0")
implementation("net.minecraftforge.gradle:ForgeGradle:3.0.141") implementation("net.minecraftforge.gradle:ForgeGradle:3.0.141")
implementation("net.fabricmc:fabric-loom:$loomVersion")
implementation("net.fabricmc:sponge-mixin:$mixinVersion")
} }

View File

@ -1,3 +1,5 @@
import org.gradle.api.Project
object Versions { object Versions {
const val TEXT = "3.0.1" const val TEXT = "3.0.1"
const val TEXT_EXTRAS = "3.0.2" const val TEXT_EXTRAS = "3.0.2"
@ -6,3 +8,12 @@ object Versions {
const val JUNIT = "5.5.0" const val JUNIT = "5.5.0"
const val MOCKITO = "3.0.0" const val MOCKITO = "3.0.0"
} }
// Properties that need a project reference to resolve:
class ProjectVersions(project: Project) {
val loom = project.rootProject.property("loom.version")
val mixin = project.rootProject.property("mixin.version")
}
val Project.versions
get() = ProjectVersions(this)

View File

@ -2,3 +2,6 @@ group=com.sk89q.worldedit
version=7.1.0-SNAPSHOT version=7.1.0-SNAPSHOT
org.gradle.jvmargs=-Xmx1G org.gradle.jvmargs=-Xmx1G
loom.version=0.2.5-20190906.190953-30
mixin.version=0.7.11.38

View File

@ -1,25 +1,6 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import net.fabricmc.loom.task.RemapJarTask import net.fabricmc.loom.task.RemapJarTask
buildscript {
repositories {
jcenter()
maven {
name = "Fabric"
url = uri("https://maven.fabricmc.net/")
}
maven {
name = "sponge"
url = uri("https://repo.spongepowered.org/maven")
}
}
dependencies {
"classpath"("net.fabricmc:fabric-loom:0.2.5-SNAPSHOT")
"classpath"("org.spongepowered:mixin:0.7.11-SNAPSHOT")
}
}
applyPlatformAndCoreConfiguration() applyPlatformAndCoreConfiguration()
applyShadowConfiguration() applyShadowConfiguration()
@ -53,6 +34,11 @@ dependencies {
"modImplementation"(it) "modImplementation"(it)
} }
// Hook these up manually, because Fabric doesn't seem to quite do it properly.
"compileClasspath"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"annotationProcessor"("net.fabricmc:sponge-mixin:${project.versions.mixin}")
"annotationProcessor"("net.fabricmc:fabric-loom:${project.versions.loom}")
"testCompile"("org.mockito:mockito-core:1.9.0-rc1") "testCompile"("org.mockito:mockito-core:1.9.0-rc1")
} }