127 lines
4.1 KiB
Groovy
127 lines
4.1 KiB
Groovy
|
buildscript {
|
||
|
repositories {
|
||
|
jcenter()
|
||
|
maven {
|
||
|
url = 'http://files.minecraftforge.net/maven'
|
||
|
}
|
||
|
mavenCentral()
|
||
|
maven {
|
||
|
url = 'https://plugins.gradle.org/m2/'
|
||
|
}
|
||
|
}
|
||
|
dependencies {
|
||
|
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '1.2-SNAPSHOT'
|
||
|
classpath group: 'com.github.jengelman.gradle.plugins', name: 'shadow', version: shadowVersion
|
||
|
classpath group: 'gradle.plugin.com.matthewprenger', name: 'CurseGradle', version: cursegradleVersion
|
||
|
classpath group: 'com.vanniktech', name: 'gradle-dependency-graph-generator-plugin', version: '0.5.0'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
apply plugin: 'forge'
|
||
|
//apply plugin: 'com.github.johnrengelman.shadow'
|
||
|
apply plugin: 'com.matthewprenger.cursegradle'
|
||
|
apply plugin: "com.vanniktech.dependency.graph.generator"
|
||
|
|
||
|
|
||
|
version = project.mc_version + '-' + project.modVersion
|
||
|
|
||
|
archivesBaseName = project.modName
|
||
|
|
||
|
sourceCompatibility = targetCompatibility = '1.8'
|
||
|
|
||
|
configurations {
|
||
|
shade
|
||
|
compile.extendsFrom shade
|
||
|
}
|
||
|
|
||
|
dependencies {
|
||
|
shade (project(':core')) { transitive = false }
|
||
|
shade (project(':Jankson')) { transitive = false }
|
||
|
|
||
|
shade group: 'org.jetbrains.kotlin', name: 'kotlin-stdlib-jdk8', version: kotlinVersion
|
||
|
|
||
|
shade group: 'com.github.kittinunf.fuel', name: 'fuel', version: fuelVersion
|
||
|
shade group: 'com.github.kittinunf.result', name: 'result', version: resultVersion
|
||
|
}
|
||
|
|
||
|
|
||
|
minecraft {
|
||
|
version = project.mc_version + '-' + project.forge_version + '-' + project.mc_version
|
||
|
runDir = 'run'
|
||
|
|
||
|
mappings = project.mcp_mappings
|
||
|
|
||
|
// srgExtra 'PK: kotlin matterlink/repack/kotlin'
|
||
|
// srgExtra 'PK: org/jetbrains/annotations matterlink/repack/org/jetbrains/annotations'
|
||
|
// srgExtra 'PK: org/intellij matterlink/repack/org/intellij'
|
||
|
// srgExtra 'PK: blue/endless/ matterlink/repack/blue/endless/'
|
||
|
|
||
|
}
|
||
|
|
||
|
compileKotlin.doFirst {
|
||
|
def target = 'src/main/kotlin/matterlink/gen'
|
||
|
copy {
|
||
|
from('src/templates/kotlin/matterlink/Constants.kt')
|
||
|
into(target)
|
||
|
}
|
||
|
ant.replaceregexp(match: '@MODVERSION@', replace: project.modVersion, flags: 'g', byline: true) {
|
||
|
fileset(dir: target, includes: 'Constants.kt')
|
||
|
}
|
||
|
ant.replaceregexp(match: '@MCVERSION@', replace: project.mc_version, flags: 'g', byline: true) {
|
||
|
fileset(dir: target, includes: 'Constants.kt')
|
||
|
}
|
||
|
ant.replaceregexp(match: '@FORGELIN-VERSION@', replace: project.forgelinVersion, flags: 'g', byline: true) {
|
||
|
fileset(dir: target, includes: 'Constants.kt')
|
||
|
}
|
||
|
ant.replaceregexp(match: '@FORGE-VERSION@', replace: project.forge_version, flags: 'g', byline: true) {
|
||
|
fileset(dir: target, includes: 'Constants.kt')
|
||
|
}
|
||
|
ant.replaceregexp(match: '@BUILD_NUMBER@', replace: System.env.BUILD_NUMBER ?: -1, flags: 'g', byline: true) {
|
||
|
fileset(dir: target, includes: 'Constants.kt')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
processResources {
|
||
|
// this will ensure that this task is redone when the versions change.
|
||
|
inputs.property 'version', project.modVersion
|
||
|
inputs.property 'mcversion', project.minecraft.version
|
||
|
|
||
|
// replace stuff in mcmod.info, nothing else
|
||
|
from(project(':core').sourceSets.main.resources.srcDirs) {
|
||
|
include 'mcmod.info'
|
||
|
|
||
|
// replace version and mcversion
|
||
|
expand 'version': project.modVersion, 'mcversion': project.minecraft.version
|
||
|
}
|
||
|
|
||
|
// copy everything else except the mcmod.info
|
||
|
from(project(':core').sourceSets.main.resources.srcDirs) {
|
||
|
exclude 'mcmod.info'
|
||
|
}
|
||
|
}
|
||
|
|
||
|
jar {
|
||
|
configurations.shade.each { dep ->
|
||
|
from(project.zipTree(dep)) {
|
||
|
exclude 'META-INF', 'META-INF/**'
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
curseforge {
|
||
|
if (project.hasProperty('CURSEFORGE_API_TOKEN') && project.hasProperty('release')) {
|
||
|
apiKey = CURSEFORGE_API_TOKEN
|
||
|
}
|
||
|
project {
|
||
|
id = project.curseId
|
||
|
releaseType = project.curseReleaseType
|
||
|
if (project.hasProperty('changelog_file')) {
|
||
|
println("changelog = $changelog_file")
|
||
|
changelogType = 'markdown'
|
||
|
changelog = file(changelog_file)
|
||
|
}
|
||
|
mainArtifact(jar) {
|
||
|
displayName = "MatterLink $version"
|
||
|
}
|
||
|
}
|
||
|
}
|