-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
195 lines (172 loc) · 5.91 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
buildscript {
repositories {
jcenter()
maven { url = "https://maven.daporkchop.net/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
plugins {
// Add the shadowjar plugin for fat jars, kotlin plugin for kotlin
// and the maven-publish plugin to publish shadowjar to jitpack/maven
id 'com.github.johnrengelman.shadow' version '4.0.4'
id 'org.jetbrains.kotlin.jvm' version '1.3.72'
id 'maven-publish'
}
apply plugin: 'net.minecraftforge.gradle.forge'
//determine the version
if (project.hasProperty('CustomReleaseVersion')) {
version = project.property('CustomReleaseVersion')
} else {
version = "1.0.0+" + ('git rev-parse HEAD'.execute().text.substring(0, 10))
}
group = "org.valkyrienskies.addon"
archivesBaseName = "vs-control"
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
minecraft {
version = "1.12.2-14.23.5.2847"
runDir = "run"
// the mappings can be changed at any time, and must be in the following format.
// snapshot_YYYYMMDD snapshot are built nightly.
// stable_# stables are built at the discretion of the MCP team.
// Use non-default mappings at your own risk. they may not always work.
// simply re-run your setup task after changing the mappings to update your workspace.
mappings = "stable_39"
// makeObfSourceJar = false // an Srg named sources jar is made by default. uncomment this to disable.
}
repositories {
maven {
name = "DaPorkchop_"
url = "https://maven.daporkchop.net/"
}
maven {
name = "Dogforce Games"
url = "http://dogforce-games.com/maven/"
}
maven { url 'https://jitpack.io' }
mavenCentral()
}
// Create shade configuration to indicate to shadow
// which dependencies should be shaded
configurations {
shade
compile.extendsFrom shade
}
dependencies {
// The mod depends on Valkyrien Skies
// I'm being lazy so I'll just use jitpack for now
deobfCompile("org.valkyrienskies:Valkyrien-Skies:a0f34224656094fb04cca27f21b701912aefaac5:all") {
transitive = false
}
deobfCompile("org.valkyrienskies:Valkyrien-Skies-World:e41aa0fb70f6b3ebd75742b149cf1ec1f1fd5122") {
transitive = false
}
// GraphLib is used by node tile entities to create a graph of nodes
shade "gigaherz.graph:GraphLib:1.4.0"
shade "org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.3.72"
// lombok
compileOnly "org.projectlombok:lombok:1.18.10"
annotationProcessor "org.projectlombok:lombok:1.18.10"
}
jar {
classifier = "unshaded"
manifest.attributes(
"FMLAT": "vs_control_at.cfg"
)
}
shadowJar {
classifier = null // No -all classifier
// All 'shade' dependencies should be put in the fat jar
configurations = [project.configurations.shade]
// Relocate all kotlin related libraries so as not to interfere with
// other mods that might use kotlin
relocate 'kotlin', 'org.valkyrienskies.addons.control.deps.kotlin'
relocate 'jetbrains', 'org.valkyrienskies.addons.control.deps.jetbrains'
relocate 'org.jetbrains', 'org.valkyrienskies.addons.control.deps.org.jetbrains'
relocate 'intellij', 'org.valkyrienskies.addons.control.deps.intellij'
relocate 'org.intellij', 'org.valkyrienskies.addons.control.deps.org.intellij'
mergeServiceFiles() // https://github.com/johnrengelman/shadow/issues/304
}
reobf {
jar {
mappingType = "SEARGE"
classpath = sourceSets.main.compileClasspath
}
shadowJar{
mappingType = "SEARGE"
classpath = sourceSets.main.compileClasspath
}
}
tasks.jar.finalizedBy(reobfJar)
tasks.shadowJar.finalizedBy(reobfShadowJar)
publishing {
repositories {
def ghpUser = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
def ghpPassword = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
if (ghpUser != null && ghpPassword != null) {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/ValkyrienSkies/Valkyrien-Skies-Control")
credentials {
username = ghpUser
password = ghpPassword
}
}
}
if (project.hasProperty("daporkchopMavenUsername") && project.hasProperty("daporkchopMavenPassword")) {
maven {
credentials {
username = "$daporkchopMavenUsername"
password = "$daporkchopMavenPassword"
}
name = "DaPorkchop_"
url = "https://maven.daporkchop.net/release/"
}
}
}
publications {
maven(MavenPublication) {
groupId = "org.valkyrienskies.addon"
artifactId = "vs-control"
version = project.version
artifact jar {
classifier null
}
artifact shadowJar {
classifier "all"
}
artifact sourceJar {
classifier "sources"
}
}
}
}
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 except the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}