Forgelin/build.gradle

129 lines
3.6 KiB
Groovy

buildscript {
repositories {
jcenter()
maven {
name "forge"
url "http://files.minecraftforge.net/maven/"
}
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
}
}
plugins {
id "maven"
id "com.github.johnrengelman.shadow" version "1.2.3"
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "kotlin"
version = mod_version
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
minecraft {
version = mc_version + "-" + forge_version
runDir = "run"
mappings = mcp_mappings
replaceIn "Forgelin.kt"
replace "@VERSION@", mod_version
useDepAts = true
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from (sourceSets.main.resources.srcDirs) {
include "mcmod.info"
expand "version": project.version, "mcversion": mc_version
}
from (sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
}
repositories {
jcenter()
}
dependencies {
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-stdlib-jre8", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-reflect", version: kotlin_version
compile group: "org.jetbrains.kotlin", name: "kotlin-runtime", version: kotlin_version
compile group: "org.jetbrains", name: "annotations", version: annotations_version
compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-core", version: coroutines_version
compile group: "org.jetbrains.kotlinx", name: "kotlinx-coroutines-jdk8", version: coroutines_version
}
jar {
manifest {
attributes "FMLCorePlugin": "net.shadowfacts.forgelin.preloader.ForgelinPlugin",
"FMLCorePluginContainsFMLMod": "true"
}
}
shadowJar {
classifier = ""
dependencies {
include(dependency("org.jetbrains.kotlin:kotlin-stdlib:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-reflect:${kotlin_version}"))
include(dependency("org.jetbrains.kotlin:kotlin-runtime:${kotlin_version}"))
include(dependency("org.jetbrains:annotations:${annotations_version}"))
include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-core:${coroutines_version}"))
include(dependency("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:${coroutines_version}"))
}
manifest {
attributes "FMLCorePlugin": "net.shadowfacts.forgelin.preloader.ForgelinPlugin",
"FMLCorePluginContainsFMLMod": "true"
}
}
tasks.build.dependsOn shadowJar
import net.minecraftforge.gradle.user.TaskSourceCopy
// Enables source replacements for Kotlin code
for (set in sourceSets) {
def taskName = "source${set.name.capitalize()}Kotlin"
def dir = new File(project.getBuildDir(), "sources/${set.name}/kotlin")
task(taskName, type: TaskSourceCopy) {
source = set.getKotlin()
output = dir
}
def compileTask = tasks[set.getCompileTaskName("kotlin")]
compileTask.source = dir
compileTask.dependsOn taskName
def dirPath = dir.toPath()
compileKotlin.include {
return it.file.toPath().startsWith(dirPath)
}
}
artifacts {
archives shadowJar
}
reobf {
shadowJar {
mappingType = "SEARGE"
}
}
tasks.reobfShadowJar.mustRunAfter shadowJar
tasks.build.dependsOn reobfShadowJar
uploadArchives {
repositories.mavenDeployer {
repository(url: "http://archiva.shadowfacts.net/repository/local/") {
authentication(userName: project.hasProperty("mavenUser") ? project.mavenUser : System.getenv("mavenUser"), password: project.hasProperty("mavenPassword") ? project.mavenPassword : System.getenv("mavenPassword"))
}
}
}