Files
Opis/build.gradle.old
bombcar fb6d252c2b Update build script, integrate MobiusCore (#3)
* wip-buildupdate

* update buildscript

* version
2022-02-09 17:51:36 +01:00

180 lines
4.7 KiB
Plaintext

buildscript {
// Repositories and plugins used by this buildscript. For internal Gradle use only.
repositories {
mavenCentral()
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
name = "jitpack.io"
url = "https://jitpack.io"
}
}
dependencies {
classpath 'com.github.GTNewHorizons:ForgeGradle:1.2.4'
}
}
// Applies the custom Gradle plugin Forge uses, for Forge-specific tasks
apply plugin: 'forge'
// Gradle project metadata
version = "1.3.2-MAPLESS_1.7.10"
group = "mcp.mobius.opis"
repositories {
mavenLocal()
mavenCentral()
maven {
name = "gt"
url = "https://gregtech.overminddl1.com/"
}
maven {
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
}
minecraft {
// Forge version
version = "1.7.10-10.13.4.1614-1.7.10"
runDir = "debug"
// Replace MOD_VERSION token with one specified in Gradle
// From https://github.com/GoryMoon/MoarSigns/blob/master/build.gradle#L46
replaceIn "CoreContainer.java"
replaceIn "modOpis.java"
replace "@MOD_VERSION@", project.version
// Shading - https://forgegradle.readthedocs.org/en/latest/user-guide/shading/
// math3 is shaded in case another mod decides to use a differing version
srgExtra "PK: org/apache/commons/math3 opisapache/math3"
}
configurations {
deployerJars
shade
compile.extendsFrom shade
}
dependencies {
// Custom-built Netty for Opis
shade 'io.netty-opis:Netty-opis:4.0.23'
// Standard Maven repository dependencies
shade 'org.apache.commons:commons-math3:3.2'
shade 'org.jfree:jfreechart:1.0.17'
shade 'com.miglayout:miglayout-swing:4.2'
// Necessary for deployment
deployerJars "org.apache.maven.wagon:wagon-ssh:2.2"
}
// Includes MobiusCore submodule directory into the built jar as coremod
sourceSets.main {
java.srcDir project.projectDir.path + '/lib/MobiusCore/src/main/java'
resources.srcDir project.projectDir.path + '/lib/MobiusCore/src/main/resources'
}
compileJava {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
def commonManifest = {
// Allows Forge to find MobuisCore's coremod
attributes 'FMLCorePlugin': 'mcp.mobius.mobiuscore.asm.CoreDescription'
// Without this, Forge ignores Opis as it thinks there is only a coremod
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
jar {
// Attach FMLCorePlugin attribute
manifest commonManifest
}
// Extra task for building a "sources" jar, for uncompiled code + comments
task sourceJar(type: Jar) {
from sourceSets.main.java
// Attaches the name 'sources' to the jar
classifier = 'sources'
}
// Extra task for building a "dev" jar; built code pre-obsfucation
task devJar(type: Jar) {
from sourceSets.main.output
// Attaches the name 'dev' to the jar
classifier = 'dev'
// Attach FMLCorePlugin attribute
manifest commonManifest
}
// Fixes issues with debugging in IntelliJ
idea.module.inheritOutputDirs = true
// Fixes issues with µ character in source files
// From https://discuss.gradle.org/t/special-characters-in-java-string-literals-arent-interpreted-correctly/4665
tasks.withType(JavaCompile)
{
options.encoding = "UTF-8"
}
artifacts {
archives jar, sourceJar, devJar
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version': project.version, 'mcversion': project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
uploadArchives {
dependsOn 'reobf'
repositories.mavenDeployer {
configuration = configurations.deployerJars
repository(url: "scp://mobiusstrip.eu/home/mobius/web/maven") {
authentication(userName: "mobius")
}
pom {
groupId = project.group
version = project.version
artifactId = project.name
project {
name project.name
packaging 'jar'
description 'Opis '
url 'http://mobiusstrip.eu'
}
}
}
jar {
configurations.shade.each { dep ->
from(project.zipTree(dep)) exclude 'META-INF', 'META-INF/**'
}
}
}