OpenComputers/build.gradle
Vexatos e452b1fb5e Switched to Gradle 5 version on Minecraft 1.7.10
Using a fork of ForgeGradle for that which updates it to that version.
2019-12-30 19:54:45 -08:00

333 lines
11 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: 'idea'
apply plugin: 'maven-publish'
file "build.properties" withReader {
def prop = new Properties()
prop.load(it)
ext.config = new ConfigSlurper().parse prop
}
version = "${config.oc.version}"
group = "li.cil.oc"
archivesBaseName = "OpenComputers"
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}"
runClient {
jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader'
}
runServer {
jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader'
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
repositories {
maven {
name = "mightypirates"
url = "https://maven.cil.li/"
}
}
configurations {
provided
embedded
compile.extendsFrom embedded
}
dependencies {
deobfCompile "MCMultiPart:MCMultiPart-experimental:${config.mcmp.version}:universal"
deobfCompile "net.industrial-craft:industrialcraft-2:${config.ic2.version}"
deobfCompile "mezz.jei:jei_1.10.2:${config.jei.version}"
deobfCompile "net.darkhax.tesla:Tesla:${config.tesla.version}"
deobfCompile "li.cil.tis3d:TIS-3D:${config.tis3d.version}"
/*
deobfCompile "mcp.mobius.waila:Waila:${config.waila.version}"*/
//provided "codechicken:CodeChickenCore:${config.minecraft.version}-${config.ccc.version}:deobf"
provided "codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:universal"
//provided "codechicken:NotEnoughItems:${config.minecraft.version}-${config.nei.version}:deobf"
provided ("codechicken:EnderStorage:${config.minecraft.version}-${config.es.version}:deobf") {
exclude module: "CodeChickenCore"
exclude module: "CodeChickenLib"
}
/*
provided "appeng:RotaryCraft:${config.rotc.version}:api"
provided ("appeng:appliedenergistics2:${config.ae2.version}:dev") {
exclude module: 'buildcraft'
}*/
provided files("libs/appliedenergistics2-rv4-alpha-11-api.jar")
/*
provided "codechicken:ForgeMultipart:${config.minecraft.version}-${config.fmp.version}:dev"*/
provided ("codechicken:WR-CBE:${config.minecraft.version}-${config.wrcbe.version}:universal") {
exclude module: 'NotEnoughItems'
exclude module: "CodeChickenLib"
}/*
provided "com.bluepowermod:BluePower:${config.bluepower.version}:deobf"
provided "com.gregoriust.gregtech:gregtech_${config.minecraft.version}:${config.gt.version}:dev"*/
provided "igwmod:IGW-Mod-1.9.4:${config.igwmod.version}:userdev"
provided ("net.sengir.forestry:forestry_${config.minecraft.version}:${config.forestry.version}"){
exclude module: "jei_1.10.2"
}/*
provided "dev.modwarriors.notenoughkeys:NotEnoughKeys:${config.minecraft.version}-${config.nek.version}:deobf-dev"
provided "qmunity:QmunityLib:${config.qmunitylib.version}:deobf"
provided "tmech:TMechworks:${config.minecraft.version}-${config.tmech.version}:deobf"*/
provided ("mrtjp:ProjectRed:${config.projred.version}:all") {
exclude module: 'NotEnoughItems'
exclude module: "CodeChickenLib"
}
//provided "coloredlightscore:ColoredLightsCore:${config.coloredlights.version}:api"
deobfCompile "com.enderio.core:EnderCore:${config.ec.version}"
deobfCompile("com.enderio:EnderIO:${config.eio.version}") {
exclude module: "appliedenergistics2"
exclude module: "buildcraft"
exclude module: "Waila"
exclude module: "forestry_1.10.2"
exclude module: "OpenComputers"
exclude module: "CodeChickenLib"
exclude module: "CodeChickenCore"
exclude module: "EquivalentExchange3"
exclude module: "jei_1.10.2"
exclude module: "Tesla"
}
provided "dan200.computercraft:ComputerCraft:${config.cc.version}"
provided "cofhcore:CoFHCore-1.10.2:release:universal"
/*
provided name: 'buildcraft', version: config.bc.version, classifier: "dev", ext: 'jar'
provided name: 'GalacticraftCoreAll', version: config.gc.version, ext: 'jar'
*/
provided name: 'Mekanism', version: config.mekanism.version, ext: 'jar'
/*
provided name: 'redlogic', version: config.redlogic.version, ext: 'jar'
provided name: 'CoFHLib', version: config.cofhlib.version, ext: 'jar'
provided name: 'CoFHCore', version: config.cofhcore.version, ext: 'jar'
provided name: 'MineFactoryReloaded', version: config.mfr.version, ext: 'jar'
provided name: 'Railcraft', version: config.rc.version, ext: 'jar'
provided name: 'BloodMagic', version: config.bloodmagic.version, ext: 'jar'
*/
provided name: 'ExtraCells', version: config.extracells.version, ext: 'jar'
/*
provided name: 'ThaumicEnergistics', version: config.thaumicenergistics.version, ext: 'jar'
provided "cyano.poweradvantage:PowerAdvantage-API:${config.poweradvantage.version}"
*/
compile 'com.google.code.findbugs:jsr305:1.3.9' // Annotations used by google libs.
embedded files('libs/OpenComputers-JNLua.jar', 'libs/OpenComputers-LuaJ.jar')
testCompile "org.mockito:mockito-all:1.10.19"
testCompile "org.scalactic:scalactic_2.11:2.2.6"
testCompile "org.scalatest:scalatest_2.11:2.2.6"
}
// Add the "provided" dependencies to the compile (but NOT runtime) classpath.
sourceSets.main.compileClasspath += [configurations.provided]
idea.module.scopes.PROVIDED.plus += [configurations.provided]
// eclipse.classpath.plusConfigurations += [configurations.provided]
sourceSets {
api {
java {
exclude 'thaumcraft/api/**'
}
}
main {
scala {
exclude 'li/cil/oc/integration/agricraft/**'
//exclude 'li/cil/oc/integration/appeng/**'
exclude 'li/cil/oc/integration/bloodmagic/**'
exclude 'li/cil/oc/integration/bluepower/**'
exclude 'li/cil/oc/integration/buildcraft/**'
exclude 'li/cil/oc/integration/cofh/**'
//exclude 'li/cil/oc/integration/computercraft/**'
exclude 'li/cil/oc/integration/dsu/**'
//exclude 'li/cil/oc/integration/ec/**'
//exclude 'li/cil/oc/integration/enderio/**'
//exclude 'li/cil/oc/integration/enderstorage/**'
exclude 'li/cil/oc/integration/fmp/**'
exclude 'li/cil/oc/integration/gc/**'
exclude 'li/cil/oc/integration/gregtech/**'
//exclude 'li/cil/oc/integration/mekanism/**'
exclude 'li/cil/oc/integration/mfr/**'
exclude 'li/cil/oc/integration/mystcraft/**'
exclude 'li/cil/oc/integration/nei/**'
exclude 'li/cil/oc/integration/nek/**'
exclude 'li/cil/oc/integration/poweradvantage/**'
//exclude 'li/cil/oc/integration/projectred/**'
exclude 'li/cil/oc/integration/railcraft/**'
exclude 'li/cil/oc/integration/redlogic/**'
exclude 'li/cil/oc/integration/rotarycraft/**'
exclude 'li/cil/oc/integration/stargatetech2/**'
exclude 'li/cil/oc/integration/tcon/**'
exclude 'li/cil/oc/integration/thaumcraft/**'
exclude 'li/cil/oc/integration/thermalexpansion/**'
exclude 'li/cil/oc/integration/thaumicenergistics/**'
exclude 'li/cil/oc/integration/tmechworks/**'
exclude 'li/cil/oc/integration/waila/**'
//exclude 'li/cil/oc/integration/wrcbe/**'
exclude 'li/cil/oc/integration/wrsve/**'
}
}
}
minecraft {
version = "${config.minecraft.version}-${config.forge.version}"
runDir = "run"
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
mappings = "${config.minecraft.mappings}"
replace "@VERSION@", project.simpleVersion
replace "/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version},${config.minecraft.version}+)\""
}
processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.simpleVersion, 'mcversion': config.minecraft.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'
}
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.output
from sourceSets.main.java
classifier = 'api'
include 'li/cil/oc/api/**'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from 'build/docs/javadoc'
classifier 'javadoc'
}
task sourcesJar(type: Jar) {
from sourceSets.main.java
from sourceSets.main.scala
classifier = 'sources'
}
artifacts {
archives apiJar
archives javadocJar
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
artifact apiJar
artifact javadocJar
artifact sourcesJar
}
}
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"
}
}
// this is needed for IntelliJ so we don't have to copy over the assets manually every time
idea {
module {
outputDir = file('build/classes/main')
}
}