forked from GTNewHorizons/Opis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
179 lines (150 loc) · 4.74 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
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/**'
}
}
}