OpenComputers/build.gradle
payonel 1f310e2d8c Merge branch 'master-MC1.10' into master-MC1.11
# Conflicts:
#	build.gradle
2019-06-11 03:39:21 -07:00

180 lines
4.6 KiB
Groovy

// For those who want the bleeding edge
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "https://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
plugins {
id "com.matthewprenger.cursegradle" version "1.0.9"
}
apply plugin: 'scala'
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'maven-publish'
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7
file "build.properties" withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
version = config.mod.version
group = config.mod.group
archivesBaseName = config.mod.name
def getGitRef() {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
} catch (Throwable e) {
return "unknown"
}
}
if (System.getenv("PROMOTED_NUMBER") != null)
version += ".${System.getenv("PROMOTED_NUMBER")}"
else if (System.getenv("BUILD_NUMBER") != null)
version += ".${System.getenv("BUILD_NUMBER")}"
else
version += "+" + getGitRef()
ext.simpleVersion = version
version = "MC${config.minecraft.version}-${project.version}"
minecraft {
version = "${config.minecraft.version}-${config.forge.version}"
runDir = "run"
mappings = config.minecraft.mappings
replace "@VERSION@", project.simpleVersion
replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\""
}
repositories {
maven { url "https://maven.cil.li/" }
}
configurations {
embedded
compile.extendsFrom provided, embedded
}
dependencies {
deobfCompile "li.cil.tis3d:TIS-3D:MC${config.minecraft.version}-${config.tis3d.version}"
deobfCompile "MCMultiPart2:MCMultiPart-exp:${config.mcmp.version}"
deobfCompile "mezz.jei:jei_${config.minecraft.version}:${config.jei.version}"
deobfCompile "net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}"
deobfCompile "net.industrial-craft:industrialcraft-2:${config.ic2.version}"
embedded files('libs/OpenComputers-JNLua.jar', 'libs/OpenComputers-LuaJ.jar')
testCompile "org.mockito:mockito-all:1.10.19"
}
processResources {
inputs.property "version", project.simpleVersion
inputs.property "mcversion", project.minecraft.version
inputs.property "fversion", config.forge.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.simpleVersion, 'mcversion':project.minecraft.version, 'fversion':config.forge.version
}
from(sourceSets.main.resources.srcDirs) {
include 'application.conf'
filter { line ->
line.replaceAll("@VERSION@", project.simpleVersion)
}
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
exclude 'application.conf'
}
// Move access transformer to META-INF
rename '(.+_at.cfg)', 'META-INF/$1'
}
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
jar {
configurations.embedded.each { dep ->
from(project.zipTree(dep)) {
exclude 'META-INF', 'META-INF/**'
}
}
manifest {
attributes FMLCorePlugin: "li.cil.oc.common.launch.TransformerLoader"
attributes FMLCorePluginContainsFMLMod: "true"
attributes FMLAT: "oc_at.cfg"
}
}
javadoc {
include 'li/cil/oc/api/**'
}
task apiJar(type: Jar) {
from sourceSets.main.allSource
from sourceSets.main.output
classifier = 'api'
include 'li/cil/oc/api/**'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier 'javadoc'
}
artifacts {
archives apiJar
archives javadocJar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact apiJar
artifact javadocJar
}
}
repositories {
maven {
url System.getenv("MAVEN_PATH")
}
}
}
curseforge {
apiKey = project.hasProperty("curseForgeApiKey") ? project.curseForgeApiKey : ""
project {
id = config.curse.project.id
releaseType = config.curse.project.releaseType
changelogType = "markdown"
changelog = file("changelog.md")
addGameVersion config.minecraft.version
addGameVersion "Java 8"
}
}