MatterLink/1.9.4/build.gradle

135 lines
4.0 KiB
Groovy
Raw Normal View History

2018-02-11 15:33:19 +00:00
buildscript {
repositories {
jcenter()
2018-07-11 21:29:02 +00:00
maven {
url = 'http://files.minecraftforge.net/maven'
}
2018-02-11 15:33:19 +00:00
mavenCentral()
2018-06-22 09:58:51 +00:00
maven {
url 'https://plugins.gradle.org/m2/'
}
2018-02-11 15:33:19 +00:00
}
dependencies {
2018-07-11 21:29:02 +00:00
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '2.2-SNAPSHOT'
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadowVersion
classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradleVersion
2018-02-11 15:33:19 +00:00
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
2018-07-11 21:29:02 +00:00
apply plugin: 'com.github.johnrengelman.shadow'
2018-06-22 09:58:51 +00:00
apply plugin: 'com.matthewprenger.cursegradle'
2018-02-11 15:33:19 +00:00
version = project.mc_version + '-' + project.modVersion
2018-02-11 15:33:19 +00:00
archivesBaseName = project.modName
2018-02-11 15:33:19 +00:00
sourceCompatibility = targetCompatibility = '1.8'
dependencies {
compile project(':core')
shadow (project(path: ':core', configuration: 'shadow')) { transitive = false }
compile group: 'net.shadowfacts', name: 'Forgelin', version: project.forgelinVersion
2018-02-11 15:33:19 +00:00
}
shadowJar {
classifier = ''
2018-08-14 19:53:01 +00:00
2018-02-11 15:33:19 +00:00
exclude 'dummyThing'
configurations = [project.configurations.shadow]
2018-02-11 15:33:19 +00:00
}
2018-07-03 12:02:32 +00:00
import net.minecraftforge.gradle.user.TaskSourceCopy
// Mad hacks to make source replacements work for Kotlin
// source: https://github.com/PaleoCrafter/VanillaImmersion/blob/ee82ecafb76659cf7d7822a722c8f63f43f41d01/build.gradle#L119
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
}
2018-07-11 21:29:02 +00:00
def compileTask = tasks[set.getCompileTaskName('kotlin')]
2018-07-03 12:02:32 +00:00
compileTask.source = dir
compileTask.dependsOn taskName
def dirPath = dir.toPath()
compileKotlin.include {
return it.file.toPath().startsWith(dirPath)
}
}
sourceJar.from sourceSets.main.kotlin
2018-02-11 15:33:19 +00:00
minecraft {
2018-07-11 21:29:02 +00:00
version = project.mc_version + '-' + project.forge_version
runDir = 'run'
2018-02-11 15:33:19 +00:00
mappings = project.mcp_mappings
2018-02-11 15:33:19 +00:00
2018-07-03 12:02:32 +00:00
replaceIn 'Constants.kt'
replace '@MODVERSION@', project.modVersion
2018-07-03 12:02:32 +00:00
replace '@MCVERSION@', project.mc_version
replace '@FORGELIN-VERSION@', project.forgelinVersion
2018-07-03 12:02:32 +00:00
replace '@FORGE-VERSION@', project.forge_version
2018-07-15 15:18:06 +00:00
replace '-1//@BUILD_NUMBER@', System.env.BUILD_NUMBER ?: -1
2018-02-11 15:33:19 +00:00
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property 'version', project.modVersion
2018-07-11 21:29:02 +00:00
inputs.property 'mcversion', project.minecraft.version
2018-02-11 15:33:19 +00:00
// replace stuff in mcmod.info, nothing else
2018-07-11 21:29:02 +00:00
from(project(':core').sourceSets.main.resources.srcDirs) {
2018-02-11 15:33:19 +00:00
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.modVersion, 'mcversion': project.minecraft.version
2018-02-11 15:33:19 +00:00
}
// copy everything else except the mcmod.info
2018-07-11 21:29:02 +00:00
from(project(':core').sourceSets.main.resources.srcDirs) {
2018-02-11 15:33:19 +00:00
exclude 'mcmod.info'
}
}
sourceJar {
classifier 'sources'
// copy all the minecraftforge specific classes
from sourceSets.main.allSource
// copy everything else except the mcmod.info
2018-07-11 21:29:02 +00:00
from(project(':core').sourceSets.main.allSource) {
2018-02-11 15:33:19 +00:00
exclude 'mcmod.info'
}
}
reobf {
shadowJar { mappingType = 'SEARGE' }
}
2018-02-19 21:33:19 +00:00
tasks.shadowJar.finalizedBy reobfShadowJar
curseforge {
if (project.hasProperty('CURSEFORGE_API_TOKEN') && project.hasProperty('release')) {
apiKey = CURSEFORGE_API_TOKEN
}
project {
id = project.curseId
releaseType = project.curseReleaseType
addGameVersion '1.10'
if (project.hasProperty('changelog_file')) {
println("changelog = $changelog_file")
2018-07-11 21:29:02 +00:00
changelogType = 'markdown'
changelog = file(changelog_file)
}
relations {
requiredLibrary 'shadowfacts-forgelin'
}
2018-02-19 20:06:08 +00:00
mainArtifact(shadowJar) {
displayName = "MatterLink $version"
}
}
}