mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-21 11:24:55 -04:00
324 lines
9.6 KiB
Groovy
324 lines
9.6 KiB
Groovy
plugins {
|
|
id 'scala'
|
|
id 'maven-publish'
|
|
id 'net.minecraftforge.gradle' version '5.1.64'
|
|
id 'wtf.gofancy.fancygradle' version '1.1.+'
|
|
id "com.matthewprenger.cursegradle" version "1.4.0"
|
|
id 'com.modrinth.minotaur' version '2.8.7'
|
|
}
|
|
|
|
fancyGradle {
|
|
patches {
|
|
resources
|
|
coremods
|
|
codeChickenLib
|
|
asm
|
|
}
|
|
}
|
|
|
|
sourceCompatibility = JavaVersion.VERSION_1_8
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
|
|
|
file "build.properties" withReader {
|
|
def prop = new Properties()
|
|
prop.load(it)
|
|
ext.config = new ConfigSlurper().parse prop
|
|
}
|
|
|
|
version = "${mod_version}"
|
|
if (version.endsWith("-snapshot")) {
|
|
version += "-" + (new Date().format('yyyyMMdd'))
|
|
}
|
|
|
|
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"
|
|
}
|
|
}
|
|
|
|
version += "+" + getGitRef()
|
|
|
|
ext.simpleVersion = version
|
|
version = "MC${config.minecraft.version}-${project.version}"
|
|
|
|
minecraft {
|
|
mappings channel: "${config.minecraft.mappings_channel}", version: "${config.minecraft.mappings_version}"
|
|
|
|
runs {
|
|
client {
|
|
workingDirectory project.file('run')
|
|
jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader'
|
|
|
|
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
mods {
|
|
opencomputers {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
server {
|
|
jvmArgs '-Dfml.coreMods.load=li.cil.oc.common.launch.TransformerLoader'
|
|
|
|
property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP'
|
|
property 'forge.logging.console.level', 'debug'
|
|
|
|
mods {
|
|
opencomputers {
|
|
source sourceSets.main
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
accessTransformer = file('src/main/resources/oc_at.cfg')
|
|
}
|
|
|
|
task replaceSourceTokensScala(type: Sync) {
|
|
from sourceSets.main.scala
|
|
filter { line -> line
|
|
.replaceAll('@VERSION@', "${mod_version}")
|
|
.replaceAll("/*@MCVERSIONDEP@*/", ", acceptedMinecraftVersions = \"[${config.minecraft.version}]\"") }
|
|
into "$buildDir/srcReplaced/scala"
|
|
}
|
|
|
|
/* Do not pull this in on IDEA, as it changes the compiler's source path, making navigating to errors harder */
|
|
if (!System.getProperty('idea.active')) {
|
|
compileScala {
|
|
source = replaceSourceTokensScala.outputs
|
|
}
|
|
}
|
|
|
|
compileScala {
|
|
configure(scalaCompileOptions.forkOptions) {
|
|
memoryMaximumSize = '1g'
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
maven {
|
|
name "MightyPirates"
|
|
url "https://maven.cil.li/"
|
|
metadataSources {
|
|
mavenPom()
|
|
artifact()
|
|
}
|
|
}
|
|
maven {
|
|
name "SquidDev" /* CC: Tweaked */
|
|
url "https://squiddev.cc/maven/"
|
|
}
|
|
maven {
|
|
name "CurseForge"
|
|
url "https://minecraft.curseforge.com/api/maven/"
|
|
metadataSources {
|
|
mavenPom()
|
|
artifact()
|
|
}
|
|
}
|
|
maven {
|
|
url "https://cursemaven.com"
|
|
content {
|
|
includeGroup "curse.maven"
|
|
}
|
|
}
|
|
ivy {
|
|
name 'asie dependency mirror'
|
|
artifactPattern "https://asie.pl/javadeps/[module]-[revision](-[classifier]).[ext]"
|
|
metadataSources {
|
|
artifact()
|
|
}
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
embedded
|
|
|
|
compileOnly.extendsFrom provided
|
|
implementation.extendsFrom embedded
|
|
}
|
|
|
|
dependencies {
|
|
minecraft "net.minecraftforge:forge:${config.minecraft.version}-${config.forge.version}"
|
|
|
|
compileOnly fg.deobf("li.cil.tis3d:TIS-3D:${config.tis3d.version}") {
|
|
exclude module: "jei_1.12"
|
|
}
|
|
compileOnly fg.deobf("com.mod-buildcraft:buildcraft-api:${config.buildcraft.version}")
|
|
compileOnly fg.deobf("MCMultiPart2:MCMultiPart-exp:${config.mcmp.version}")
|
|
provided fg.deobf("net.sengir.forestry:forestry_1.12.2:${config.forestry.version}") {
|
|
exclude module: "jei_1.12"
|
|
}
|
|
compileOnly fg.deobf("net.industrial-craft:industrialcraft-2:${config.ic2.version}")
|
|
compileOnly fg.deobf("mcp.mobius.waila:Hwyla:${config.hwyla.version}:api")
|
|
/* compileOnly fg.deobf("dan200.computercraft:ComputerCraft:${config.cc.version}") */
|
|
compileOnly fg.deobf("org.squiddev:cc-tweaked-1.12.2:${config.cctweaked.version}")
|
|
compileOnly fg.deobf("charset:Charset:${config.charset.version}:api")
|
|
compileOnly fg.deobf("curse.maven:cofh-core-69162:2920433") /* CoFHCore */
|
|
compileOnly fg.deobf("curse.maven:ender-io-64578:3328811") /* Ender IO */
|
|
compileOnly fg.deobf("curse.maven:railcraft-51195:2687757") /* Railcraft */
|
|
|
|
provided fg.deobf("appeng:appliedenergistics2:${config.ae2.version}") {
|
|
transitive = false
|
|
}
|
|
provided fg.deobf("extracells:ExtraCells:${config.extracells.version}:api")
|
|
|
|
provided fg.deobf("mekanism:Mekanism:${config.mekanism.version}:api") {
|
|
transitive = false
|
|
}
|
|
|
|
provided fg.deobf("codechicken:ForgeMultipart:${config.minecraft.version}-${config.forgemultipart.version}:universal") {
|
|
exclude module: "jei_1.12"
|
|
exclude module: "CodeChickenLib"
|
|
}
|
|
|
|
provided fg.deobf("codechicken:ChickenASM:${config.casm.version}")
|
|
|
|
provided fg.deobf("mezz.jei:jei_${config.minecraft.version}:${config.jei.version}")
|
|
provided fg.deobf("codechicken:CodeChickenLib:${config.minecraft.version}-${config.ccl.version}:universal")
|
|
provided fg.deobf("codechicken:WR-CBE:${config.minecraft.version}-${config.wrcbe.version}:universal")
|
|
|
|
provided fg.deobf("mrtjp:ProjectRed:${config.projred.version}:Base") {
|
|
exclude module: "NotEnoughItems"
|
|
exclude module: "CodeChickenLib"
|
|
exclude module: "jei_1.12"
|
|
exclude module: "ForgeMultipart"
|
|
}
|
|
|
|
provided fg.deobf("mrtjp:ProjectRed:${config.projred.version}:integration") {
|
|
exclude module: "NotEnoughItems"
|
|
exclude module: "CodeChickenLib"
|
|
exclude module: "jei_1.12"
|
|
exclude module: "ForgeMultipart"
|
|
}
|
|
|
|
provided fg.deobf("mrtjp:MrTJPCore:${config.mrtjpcore.version}:universal") {
|
|
exclude module: "NotEnoughItems"
|
|
exclude module: "CodeChickenLib"
|
|
exclude module: "jei_1.12"
|
|
exclude module: "ForgeMultipart"
|
|
}
|
|
|
|
embedded name: 'OC-LuaJ', version: '20220907.1', ext: 'jar'
|
|
embedded name: 'OC-JNLua', version: '20230530.0', ext: 'jar'
|
|
embedded name: 'OC-JNLua-Natives', version: '20220928.1', ext: 'jar'
|
|
|
|
testImplementation("junit:junit:4.13")
|
|
testImplementation("org.mockito:mockito-all:1.10.19")
|
|
testImplementation("org.scalactic:scalactic_2.11:2.2.6")
|
|
testImplementation("org.scalatest:scalatest_2.11:2.2.6")
|
|
|
|
provided fg.deobf("codechicken:EnderStorage:${config.minecraft.version}-${config.enderstorage.version}:universal")
|
|
}
|
|
|
|
processResources {
|
|
inputs.property "version", "${mod_version}"
|
|
inputs.property "mcversion", config.minecraft.version
|
|
inputs.property "fversion", config.forge.version
|
|
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
|
filesMatching(['mcmod.info']) {
|
|
expand 'version':"${mod_version}", 'mcversion':config.minecraft.version, 'fversion':config.forge.version
|
|
}
|
|
filesMatching(['application.conf']) {
|
|
filter { line ->
|
|
line.replaceAll("@VERSION@", "${mod_version}")
|
|
}
|
|
}
|
|
|
|
// 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.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) {
|
|
groupId = project.group
|
|
artifactId = project.name
|
|
version = mod_version
|
|
artifact jar
|
|
artifact apiJar
|
|
artifact javadocJar
|
|
}
|
|
}
|
|
repositories {
|
|
maven {
|
|
name = "GitHubPackages"
|
|
url = System.getenv("GITHUB_MAVEN_URL") ?: ""
|
|
credentials {
|
|
username = System.getenv("GITHUB_ACTOR")
|
|
password = System.getenv("GITHUB_TOKEN")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
curseforge {
|
|
apiKey = System.getenv('CURSEFORGE_API_KEY') ?: ""
|
|
project {
|
|
id = config.curse.project.id
|
|
releaseType = System.getenv('CURSEFORGE_RELEASE_TYPE') ?: "alpha"
|
|
changelogType = "markdown"
|
|
changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
|
|
addGameVersion config.minecraft.version
|
|
addGameVersion "Java 8"
|
|
addGameVersion "Forge"
|
|
}
|
|
}
|
|
|
|
modrinth {
|
|
token = System.getenv("MODRINTH_API_KEY") ?: ""
|
|
projectId = config.modrinth.project.id
|
|
changelog = System.getenv("CHANGELOG") ?: "Changelog not available."
|
|
versionNumber = mod_version
|
|
versionName = "${rootProject.name}-${version}"
|
|
versionType = System.getenv('MODRINTH_RELEASE_TYPE') ?: "alpha"
|
|
uploadFile = jar
|
|
gameVersions = [config.minecraft.version]
|
|
loaders = ["forge"]
|
|
}
|