mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-05-19 16:20:46 +00:00
Completely redo how gradle works (#40)
* make getWorldEdit() never null. Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * Locate commands work like vanilla Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * Completely rework all the gradle stuff for the subprojects Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * Update gradle version Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * make :common an api in the bukkit build.gradle Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * Move git clone function to CommonConfig.kt + make processResources depend on downloadDefaultPacks Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * clean up common build.gradle.kts Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * remove sponge Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * rename fabric group from com.dfsek.terra.bukkit to com.dfsek.terra.fabric Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * idk why this was removed some how? It shows it's still in the main repo, but it was removed for me /shrug Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * Fix shading issues. Signed-off-by: solonovamax <solonovamax@12oclockpoint.com> * Fix issues with fabric-loom being stupid and requiring the plugin on the root project. Signed-off-by: solonovamax <solonovamax@12oclockpoint.com>
This commit is contained in:
@@ -138,3 +138,4 @@ build
|
|||||||
!lib/*.jar
|
!lib/*.jar
|
||||||
.idea/Terra.iml
|
.idea/Terra.iml
|
||||||
/run/
|
/run/
|
||||||
|
.idea/**.iml
|
||||||
+1
-152
@@ -1,138 +1,11 @@
|
|||||||
//import java.util.zip.ZipFile
|
import com.dfsek.terra.getGitHash
|
||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
|
||||||
import java.io.ByteArrayOutputStream
|
|
||||||
import java.net.URL
|
|
||||||
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
java
|
|
||||||
maven
|
|
||||||
idea
|
|
||||||
id("com.github.johnrengelman.shadow").version("6.1.0")
|
|
||||||
}
|
|
||||||
|
|
||||||
val versionObj = Version("2", "2", "0", true)
|
val versionObj = Version("2", "2", "0", true)
|
||||||
|
|
||||||
allprojects {
|
allprojects {
|
||||||
version = versionObj
|
version = versionObj
|
||||||
group = "com.dfsek.terra"
|
group = "com.dfsek.terra"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
|
||||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
|
||||||
maven { url = uri("http://maven.enginehub.org/repo/") }
|
|
||||||
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
|
||||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
|
||||||
maven { url = uri("https://maven.fabricmc.net/") }
|
|
||||||
gradlePluginPortal()
|
|
||||||
jcenter()
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
|
||||||
implementation("org.apache.commons:commons-rng-core:1.3")
|
|
||||||
implementation("net.jafama:jafama:2.3.2")
|
|
||||||
|
|
||||||
|
|
||||||
implementation("commons-io:commons-io:2.4")
|
|
||||||
implementation("org.apache.commons:commons-imaging:1.0-alpha2")
|
|
||||||
|
|
||||||
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT")
|
|
||||||
implementation("org.bstats:bstats-bukkit:1.7")
|
|
||||||
|
|
||||||
compileOnly("com.googlecode.json-simple:json-simple:1.1")
|
|
||||||
|
|
||||||
implementation("com.scireum:parsii:1.2.1")
|
|
||||||
|
|
||||||
implementation("net.jafama:jafama:2.3.2")
|
|
||||||
|
|
||||||
implementation("com.dfsek:Tectonic:1.0.3")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// JUnit.
|
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val compileJava: JavaCompile by tasks
|
|
||||||
val mainSourceSet: SourceSet = sourceSets["main"]
|
|
||||||
|
|
||||||
tasks.withType<ProcessResources> {
|
|
||||||
include("**/*.yml")
|
|
||||||
filter<org.apache.tools.ant.filters.ReplaceTokens>(
|
|
||||||
"tokens" to mapOf(
|
|
||||||
"VERSION" to project.version.toString()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
compileJava.apply {
|
|
||||||
options.encoding = "UTF-8"
|
|
||||||
doFirst {
|
|
||||||
options.compilerArgs = mutableListOf("-Xlint:all")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.test {
|
|
||||||
useJUnitPlatform()
|
|
||||||
|
|
||||||
maxHeapSize = "4G"
|
|
||||||
ignoreFailures = false
|
|
||||||
failFast = true
|
|
||||||
maxParallelForks = 12
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<ShadowJar>("shadowJar") {
|
|
||||||
// Tell shadow to download the packs
|
|
||||||
dependsOn(downloadDefaultPacks)
|
|
||||||
|
|
||||||
archiveClassifier.set("")
|
|
||||||
archiveBaseName.set("Terra")
|
|
||||||
setVersion(project.version)
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
|
||||||
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
|
||||||
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
|
||||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
relocate("com.dfsek.tectonic", "com.dfsek.terra.lib.tectonic")
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
minimize()
|
|
||||||
}
|
|
||||||
|
|
||||||
tasks.build {
|
|
||||||
dependsOn(tasks.shadowJar)
|
|
||||||
// dependsOn(testWithPaper)
|
|
||||||
// testWithPaper.mustRunAfter(tasks.shadowJar)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
val downloadDefaultPacks = tasks.create("downloadDefaultPacks") {
|
|
||||||
doFirst {
|
|
||||||
// Downloading latest paper jar.
|
|
||||||
// if (file("${buildDir}/resources/main/packs/default").exists() && file("${buildDir}/resources/main/packs/nether").exists())
|
|
||||||
// return@doFirst
|
|
||||||
// else
|
|
||||||
file("${buildDir}/resources/main/packs/").deleteRecursively()
|
|
||||||
|
|
||||||
val defaultPackUrl = URL("https://github.com/PolyhedralDev/TerraDefaultConfig/releases/download/latest/default.zip")
|
|
||||||
downloadPack(defaultPackUrl)
|
|
||||||
val netherPackUrl = URL("https://github.com/PolyhedralDev/TerraDefaultConfig/releases/download/latest/nether.zip")
|
|
||||||
downloadPack(netherPackUrl)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Version class that does version stuff.
|
* Version class that does version stuff.
|
||||||
*/
|
*/
|
||||||
@@ -145,28 +18,4 @@ class Version(val major: String, val minor: String, val revision: String, val pr
|
|||||||
else //Only use git hash if it's a prerelease.
|
else //Only use git hash if it's a prerelease.
|
||||||
"$major.$minor.$revision-BETA+${getGitHash()}"
|
"$major.$minor.$revision-BETA+${getGitHash()}"
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
fun getGitHash(): String {
|
|
||||||
val stdout = ByteArrayOutputStream()
|
|
||||||
exec {
|
|
||||||
commandLine = mutableListOf("git", "rev-parse", "--short", "HEAD")
|
|
||||||
standardOutput = stdout
|
|
||||||
}
|
|
||||||
return stdout.toString().trim()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun gitClone(name: String) {
|
|
||||||
val stdout = ByteArrayOutputStream()
|
|
||||||
exec {
|
|
||||||
commandLine = mutableListOf("git", "clone", name)
|
|
||||||
standardOutput = stdout
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun downloadPack(packUrl: URL) {
|
|
||||||
val fileName = packUrl.file.substring(packUrl.file.lastIndexOf("/"))
|
|
||||||
val file = file("${buildDir}/resources/main/packs/${fileName}")
|
|
||||||
file.parentFile.mkdirs()
|
|
||||||
file.outputStream().write(packUrl.readBytes())
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
plugins {
|
||||||
|
`kotlin-dsl`
|
||||||
|
kotlin("jvm") version embeddedKotlinVersion
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"implementation"("com.github.jengelman.gradle.plugins:shadow:+")
|
||||||
|
}
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package com.dfsek.terra
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.tasks.testing.Test
|
||||||
|
import org.gradle.kotlin.dsl.apply
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
|
||||||
|
fun Project.configureCommon() {
|
||||||
|
apply(plugin = "java-library")
|
||||||
|
apply(plugin = "maven-publish")
|
||||||
|
apply(plugin = "idea")
|
||||||
|
|
||||||
|
configureDependencies()
|
||||||
|
configureCompilation()
|
||||||
|
configureDistribution()
|
||||||
|
|
||||||
|
version = rootProject.version
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
tasks.withType<Test>().configureEach {
|
||||||
|
useJUnitPlatform()
|
||||||
|
|
||||||
|
maxHeapSize = "2G"
|
||||||
|
ignoreFailures = false
|
||||||
|
failFast = true
|
||||||
|
maxParallelForks = 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.getGitHash(): String {
|
||||||
|
val stdout = java.io.ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine = mutableListOf("git", "rev-parse", "--short", "HEAD")
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
return stdout.toString().trim()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun Project.gitClone(name: String) {
|
||||||
|
val stdout = ByteArrayOutputStream()
|
||||||
|
exec {
|
||||||
|
commandLine = mutableListOf("git", "clone", name)
|
||||||
|
standardOutput = stdout
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.dfsek.terra
|
||||||
|
|
||||||
|
import org.gradle.api.JavaVersion
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.JavaPluginConvention
|
||||||
|
import org.gradle.api.tasks.compile.JavaCompile
|
||||||
|
import org.gradle.api.tasks.javadoc.Javadoc
|
||||||
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
|
||||||
|
fun Project.configureCompilation() {
|
||||||
|
configure<JavaPluginConvention> {
|
||||||
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<JavaCompile> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
doFirst {
|
||||||
|
options.compilerArgs = mutableListOf("-Xlint:all")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Javadoc> {
|
||||||
|
options.encoding = "UTF-8"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.dfsek.terra
|
||||||
|
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.kotlin.dsl.dependencies
|
||||||
|
import org.gradle.kotlin.dsl.repositories
|
||||||
|
|
||||||
|
fun Project.configureDependencies() {
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
||||||
|
maven { url = uri("http://maven.enginehub.org/repo/") }
|
||||||
|
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
||||||
|
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
||||||
|
maven { url = uri("https://maven.fabricmc.net/") }
|
||||||
|
gradlePluginPortal()
|
||||||
|
jcenter()
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
"testImplementation"("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
||||||
|
"testRuntimeOnly"("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
||||||
|
"compileOnly"("org.jetbrains:annotations:20.1.0")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
package com.dfsek.terra
|
||||||
|
|
||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
|
import org.gradle.api.DefaultTask
|
||||||
|
import org.gradle.api.Project
|
||||||
|
import org.gradle.api.plugins.BasePluginConvention
|
||||||
|
import org.gradle.api.tasks.bundling.Jar
|
||||||
|
import org.gradle.api.tasks.javadoc.Javadoc
|
||||||
|
import org.gradle.kotlin.dsl.*
|
||||||
|
import java.io.File
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
|
fun Project.configureDistribution() {
|
||||||
|
apply(plugin = "java-library")
|
||||||
|
apply(plugin = "com.github.johnrengelman.shadow")
|
||||||
|
|
||||||
|
|
||||||
|
// configurations.create("shaded")
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
val shaded = create("shaded")
|
||||||
|
getByName("compile").extendsFrom(shaded)
|
||||||
|
// shaded.extendsFrom(getByName("compile"))
|
||||||
|
val shadedApi = create("shadedApi")
|
||||||
|
shaded.extendsFrom(shadedApi)
|
||||||
|
getByName("api").extendsFrom(shadedApi)
|
||||||
|
val shadedImplementation = create("shadedImplementation")
|
||||||
|
shaded.extendsFrom(shadedImplementation)
|
||||||
|
getByName("implementation").extendsFrom(shadedImplementation)
|
||||||
|
}
|
||||||
|
|
||||||
|
// tasks.withType<JavaCompile> {
|
||||||
|
// classpath +=
|
||||||
|
// }
|
||||||
|
|
||||||
|
val downloadDefaultPacks = tasks.create("downloadDefaultPacks") {
|
||||||
|
doFirst {
|
||||||
|
file("${buildDir}/resources/main/packs/").deleteRecursively()
|
||||||
|
|
||||||
|
val defaultPackUrl = URL("https://github.com/PolyhedralDev/TerraDefaultConfig/releases/download/latest/default.zip")
|
||||||
|
downloadPack(defaultPackUrl, project)
|
||||||
|
val netherPackUrl = URL("https://github.com/PolyhedralDev/TerraDefaultConfig/releases/download/latest/nether.zip")
|
||||||
|
downloadPack(netherPackUrl, project)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tasks["processResources"].dependsOn(downloadDefaultPacks)
|
||||||
|
|
||||||
|
tasks.register<Jar>("sourcesJar") {
|
||||||
|
archiveClassifier.set("sources")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.withType<Jar> {
|
||||||
|
from("../LICENSE", "../../LICENSE")
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.register<Jar>("javadocJar") {
|
||||||
|
dependsOn("javadoc")
|
||||||
|
archiveClassifier.set("javadoc")
|
||||||
|
from(tasks.getByName<Javadoc>("javadoc").destinationDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
// Tell shadow to download the packs
|
||||||
|
dependsOn(downloadDefaultPacks)
|
||||||
|
|
||||||
|
configurations = listOf(project.configurations["shaded"])
|
||||||
|
|
||||||
|
archiveClassifier.set("shaded")
|
||||||
|
setVersion(project.version)
|
||||||
|
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
||||||
|
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
||||||
|
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
||||||
|
minimize()
|
||||||
|
}
|
||||||
|
convention.getPlugin<BasePluginConvention>().archivesBaseName = project.name
|
||||||
|
|
||||||
|
tasks.named<DefaultTask>("build") {
|
||||||
|
dependsOn(tasks["shadowJar"])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun downloadPack(packUrl: URL, project: Project) {
|
||||||
|
val fileName = packUrl.file.substring(packUrl.file.lastIndexOf("/"))
|
||||||
|
val file = File("${project.buildDir}/resources/main/packs/${fileName}")
|
||||||
|
file.parentFile.mkdirs()
|
||||||
|
file.outputStream().write(packUrl.readBytes())
|
||||||
|
}
|
||||||
+13
-37
@@ -1,47 +1,23 @@
|
|||||||
|
import com.dfsek.terra.configureCommon
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
`java-library`
|
||||||
maven
|
|
||||||
idea
|
|
||||||
id("com.github.johnrengelman.shadow")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configureCommon()
|
||||||
|
|
||||||
group = "com.dfsek.terra.common"
|
group = "com.dfsek.terra.common"
|
||||||
|
|
||||||
repositories {
|
|
||||||
mavenCentral()
|
|
||||||
maven { url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") }
|
|
||||||
maven { url = uri("http://maven.enginehub.org/repo/") }
|
|
||||||
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
|
||||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.jetbrains:annotations:20.1.0")
|
"shadedApi"("org.apache.commons:commons-rng-core:1.3")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
"shadedApi"("commons-io:commons-io:2.4")
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
|
||||||
implementation("org.apache.commons:commons-rng-core:1.3")
|
|
||||||
implementation("commons-io:commons-io:2.4")
|
|
||||||
|
|
||||||
implementation("com.scireum:parsii:1.2.1")
|
"shadedApi"("com.scireum:parsii:1.2.1")
|
||||||
implementation("com.dfsek:Tectonic:1.0.3")
|
"shadedApi"("com.dfsek:Tectonic:1.0.3")
|
||||||
implementation("net.jafama:jafama:2.3.2")
|
"shadedApi"("net.jafama:jafama:2.3.2")
|
||||||
|
"shadedApi"("org.yaml:snakeyaml:1.27")
|
||||||
|
|
||||||
compileOnly("com.googlecode.json-simple:json-simple:1.1")
|
"compileOnly"("com.googlecode.json-simple:json-simple:1.1")
|
||||||
|
|
||||||
implementation("com.google.guava:guava:30.0-jre")
|
"shadedApi"("com.google.guava:guava:30.0-jre")
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
|
||||||
|
|
||||||
archiveClassifier.set("")
|
|
||||||
archiveBaseName.set("Terra")
|
|
||||||
setVersion(project.version)
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
|
||||||
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
|
||||||
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
|
||||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
relocate("com.dfsek.tectonic", "com.dfsek.terra.lib.tectonic")
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
minimize()
|
|
||||||
}
|
}
|
||||||
Vendored
BIN
Binary file not shown.
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import java.io.ByteArrayOutputStream
|
import com.dfsek.terra.configureCommon
|
||||||
|
import com.dfsek.terra.gitClone
|
||||||
|
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||||
import java.net.URL
|
import java.net.URL
|
||||||
import java.nio.channels.Channels
|
import java.nio.channels.Channels
|
||||||
import java.nio.file.Files
|
import java.nio.file.Files
|
||||||
@@ -6,11 +8,9 @@ import java.nio.file.Paths
|
|||||||
import java.nio.file.StandardCopyOption
|
import java.nio.file.StandardCopyOption
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
java
|
`java-library`
|
||||||
maven
|
|
||||||
idea
|
|
||||||
id("com.github.johnrengelman.shadow")
|
|
||||||
}
|
}
|
||||||
|
configureCommon()
|
||||||
|
|
||||||
group = "com.dfsek.terra.bukkit"
|
group = "com.dfsek.terra.bukkit"
|
||||||
|
|
||||||
@@ -23,27 +23,14 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
"shadedApi"(project(":common"))
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
|
||||||
implementation(project(":common"))
|
|
||||||
implementation("org.apache.commons:commons-rng-core:1.3")
|
|
||||||
|
|
||||||
compileOnly("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT")
|
"compileOnly"("org.spigotmc:spigot-api:1.16.2-R0.1-SNAPSHOT")
|
||||||
implementation("io.papermc:paperlib:1.0.5")
|
"shadedImplementation"("io.papermc:paperlib:1.0.5")
|
||||||
|
|
||||||
implementation("com.scireum:parsii:1.2.1")
|
"shadedImplementation"("org.bstats:bstats-bukkit:1.7")
|
||||||
implementation("com.dfsek:Tectonic:1.0.3")
|
|
||||||
implementation("net.jafama:jafama:2.3.2")
|
|
||||||
|
|
||||||
compileOnly("com.googlecode.json-simple:json-simple:1.1")
|
|
||||||
|
|
||||||
implementation("com.google.guava:guava:30.0-jre")
|
|
||||||
implementation("org.bstats:bstats-bukkit:1.7")
|
|
||||||
|
|
||||||
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT")
|
|
||||||
|
|
||||||
compileOnly("org.jetbrains:annotations:20.1.0")
|
|
||||||
|
|
||||||
|
"compileOnly"("com.sk89q.worldedit:worldedit-bukkit:7.2.0-SNAPSHOT")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<ProcessResources> {
|
tasks.withType<ProcessResources> {
|
||||||
@@ -58,7 +45,7 @@ tasks.withType<ProcessResources> {
|
|||||||
val testDir = "target/server/"
|
val testDir = "target/server/"
|
||||||
|
|
||||||
val setupServer = tasks.create("setupServer") {
|
val setupServer = tasks.create("setupServer") {
|
||||||
dependsOn(tasks.shadowJar)
|
dependsOn("shadowJar")
|
||||||
doFirst {
|
doFirst {
|
||||||
// clean
|
// clean
|
||||||
file("${testDir}/").deleteRecursively()
|
file("${testDir}/").deleteRecursively()
|
||||||
@@ -93,7 +80,7 @@ val setupServer = tasks.create("setupServer") {
|
|||||||
|
|
||||||
val testWithPaper = task<JavaExec>(name = "testWithPaper") {
|
val testWithPaper = task<JavaExec>(name = "testWithPaper") {
|
||||||
standardInput = System.`in`
|
standardInput = System.`in`
|
||||||
dependsOn(tasks.shadowJar)
|
dependsOn("shadowJar")
|
||||||
// Copy Terra into dir
|
// Copy Terra into dir
|
||||||
doFirst {
|
doFirst {
|
||||||
copy {
|
copy {
|
||||||
@@ -117,25 +104,7 @@ val testWithPaper = task<JavaExec>(name = "testWithPaper") {
|
|||||||
classpath = files("${testDir}/paper.jar")
|
classpath = files("${testDir}/paper.jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
tasks.named<ShadowJar>("shadowJar") {
|
||||||
|
|
||||||
archiveClassifier.set("")
|
|
||||||
archiveBaseName.set("Terra")
|
|
||||||
setVersion(project.version)
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
|
||||||
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats")
|
||||||
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
|
||||||
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib")
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
relocate("com.dfsek.tectonic", "com.dfsek.terra.lib.tectonic")
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
minimize()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun gitClone(name: String) {
|
|
||||||
val stdout = ByteArrayOutputStream()
|
|
||||||
exec {
|
|
||||||
commandLine = mutableListOf("git", "clone", name)
|
|
||||||
standardOutput = stdout
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,67 +1,47 @@
|
|||||||
plugins {
|
import com.dfsek.terra.configureCommon
|
||||||
java
|
import net.fabricmc.loom.LoomGradleExtension
|
||||||
maven
|
|
||||||
idea
|
|
||||||
id("fabric-loom").version("0.5-SNAPSHOT")
|
|
||||||
id("com.github.johnrengelman.shadow")
|
|
||||||
}
|
|
||||||
|
|
||||||
group = "com.dfsek.terra.bukkit"
|
buildscript {
|
||||||
|
repositories {
|
||||||
repositories {
|
mavenCentral()
|
||||||
mavenCentral()
|
maven {
|
||||||
maven { url = uri("http://maven.enginehub.org/repo/") }
|
name = "Fabric"
|
||||||
maven { url = uri("https://repo.codemc.org/repository/maven-public") }
|
url = uri("https://maven.fabricmc.net/")
|
||||||
maven { url = uri("https://papermc.io/repo/repository/maven-public/") }
|
}
|
||||||
jcenter()
|
|
||||||
maven {
|
|
||||||
name = "Fabric"
|
|
||||||
url = uri("https://maven.fabricmc.net/")
|
|
||||||
}
|
}
|
||||||
gradlePluginPortal()
|
// dependencies {
|
||||||
|
// classpath("net.fabricmc:fabric-loom:+")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id("fabric-loom").version("0.5.9")
|
||||||
|
`java-library`
|
||||||
|
}
|
||||||
|
//apply(plugin = "fabric-loom")
|
||||||
|
|
||||||
minecraft {
|
configureCommon()
|
||||||
|
|
||||||
|
group = "com.dfsek.terra.fabric"
|
||||||
|
|
||||||
|
|
||||||
|
configure<LoomGradleExtension> {
|
||||||
accessWidener("src/main/resources/terra.accesswidener")
|
accessWidener("src/main/resources/terra.accesswidener")
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0")
|
"shadedApi"(project(":common"))
|
||||||
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.7.0")
|
|
||||||
implementation(project(":common"))
|
|
||||||
implementation("org.apache.commons:commons-rng-core:1.3")
|
|
||||||
|
|
||||||
|
|
||||||
implementation("com.scireum:parsii:1.2.1")
|
|
||||||
implementation("com.dfsek:Tectonic:1.0.3")
|
|
||||||
implementation("net.jafama:jafama:2.3.2")
|
|
||||||
|
|
||||||
implementation("com.googlecode.json-simple:json-simple:1.1")
|
|
||||||
|
|
||||||
implementation("com.google.guava:guava:30.0-jre")
|
|
||||||
|
|
||||||
compileOnly("org.jetbrains:annotations:20.1.0")
|
|
||||||
|
|
||||||
implementation("org.yaml:snakeyaml:1.27")
|
|
||||||
|
|
||||||
// To change the versions see the gradle.properties file
|
// To change the versions see the gradle.properties file
|
||||||
minecraft("com.mojang:minecraft:1.16.4")
|
"minecraft"("com.mojang:minecraft:1.16.4")
|
||||||
mappings("net.fabricmc:yarn:1.16.4+build.6:v2")
|
"mappings"("net.fabricmc:yarn:1.16.4+build.6:v2")
|
||||||
modImplementation("net.fabricmc:fabric-loader:0.10.6+build.214")
|
"modImplementation"("net.fabricmc:fabric-loader:0.10.6+build.214")
|
||||||
|
|
||||||
// Fabric API. This is technically optional, but you probably want it anyway.
|
// Fabric API. This is technically optional, but you probably want it anyway.
|
||||||
modImplementation("net.fabricmc.fabric-api:fabric-api:0.25.1+build.416-1.16")
|
"modImplementation"("net.fabricmc.fabric-api:fabric-api:0.25.1+build.416-1.16")
|
||||||
}
|
|
||||||
|
|
||||||
tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar") {
|
"compileOnly"("net.fabricmc:sponge-mixin:+")
|
||||||
|
"annotationProcessor"("net.fabricmc:sponge-mixin:+")
|
||||||
archiveClassifier.set("")
|
"annotationProcessor"("net.fabricmc:fabric-loom:+")
|
||||||
archiveBaseName.set("Terra")
|
|
||||||
setVersion(project.version)
|
|
||||||
relocate("org.apache.commons", "com.dfsek.terra.lib.commons")
|
|
||||||
relocate("parsii", "com.dfsek.terra.lib.parsii")
|
|
||||||
relocate("net.jafama", "com.dfsek.terra.lib.jafama")
|
|
||||||
relocate("com.dfsek.tectonic", "com.dfsek.terra.lib.tectonic")
|
|
||||||
minimize()
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user