-
Notifications
You must be signed in to change notification settings - Fork 148
/
build.gradle
194 lines (158 loc) · 5.3 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
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
name = 'gradle plugins'
url "https://plugins.gradle.org/m2/"
}
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'gradle.plugin.com.matthewprenger:CurseGradle:1.0.9'
}
}
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'com.matthewprenger.cursegradle'
ext.build = System.getenv().BUILD_NUMBER ?: 'git'
ext.modversion = "${project.version_major}.${project.version_minor}.${project.version_micro}.${build}"
group = 'com.github.lunatrius'
version = "${project.version_minecraft}-${modversion}"
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
compileJava {
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
options.encoding = 'UTF-8'
}
minecraft {
version = "${project.version_minecraft}-${project.version_forge}"
if (project.hasProperty('version_mappings'))
mappings = project.version_mappings
if (!project.hasProperty('run_location'))
runDir = 'run'
else
runDir = run_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft)
replaceIn 'reference/Reference.java'
replace '${version}', modversion
replace '${mcversion}', project.version_minecraft
replace '${forgeversion}', project.version_forge
}
processResources {
// this will ensure that this task is redone when the versions change.
inputs.property 'version', project.version
inputs.property 'mcversion', project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand([
'modid' : project.name,
'version' : modversion,
'mcversion' : project.version_minecraft,
'forgeversion' : project.version_forge,
'minforgeversion': project.hasProperty('version_minforge') ? project.version_minforge : project.version_forge,
'coreversion' : project.version_lunatriuscore
])
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
repositories {
ivy {
name = 'lunatrius\' ivy repo'
url 'http://mc.lunatri.us/files'
}
}
dependencies {
deobfCompile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'universal'
}
def commonManifest = {
if (project.hasProperty('extra_fmlat')) {
attributes 'FMLAT': project.extra_fmlat
}
}
jar {
from sourceSets.api.output
classifier = project.hasProperty('extra_classifier') ? project.extra_classifier : 'universal'
manifest commonManifest
}
sourceJar {
from sourceSets.api.allSource
}
task apiJar(dependsOn: 'classes', type: Jar) {
from sourceSets.api.output
classifier = 'api'
manifest commonManifest
}
artifacts {
archives sourceJar
archives apiJar
}
if (!project.hasProperty('keystore_location'))
ext.keystore_location = '.'
if (!project.hasProperty('keystore_alias'))
ext.keystore_alias = ''
if (!project.hasProperty('keystore_password'))
ext.keystore_password = ''
task signJars(dependsOn: ['reobfJar', 'sourceJar', 'apiJar']) {
inputs.dir jar.destinationDir
inputs.file keystore_location
inputs.property 'keystore_alias', keystore_alias
inputs.property 'keystore_password', keystore_password
outputs.dir jar.destinationDir
onlyIf {
return keystore_location != '.'
}
doLast {
jar.destinationDir.eachFile { file ->
if (!file.getPath().endsWith('.jar'))
return;
logger.lifecycle "signing ${file}"
ant.signjar(
destDir: file.getParentFile(),
jar: file,
keystore: keystore_location,
alias: keystore_alias,
storepass: keystore_password
)
}
}
}
if (!project.hasProperty('release_location'))
ext.release_location = '.'
else
ext.release_location = release_location.replace('{modid}', project.name).replace('{mcversion}', project.version_minecraft).replace('{version}', version)
task release(dependsOn: 'signJars', type: Copy) {
from project.tasks.jar.destinationDir
into project.file(project.release_location)
eachFile { file ->
logger.lifecycle "copying ${file}"
}
onlyIf {
return project.release_location != '.'
}
}
if (project.hasProperty('api_key_curseforge') && project.hasProperty('extra_curseforge_id')) {
tasks.curseforge.dependsOn signJars
curseforge {
apiKey = project.api_key_curseforge
project {
id = project.extra_curseforge_id
changelog = ''
releaseType = project.hasProperty('extra_curseforge_releasetype') ? project.extra_curseforge_releasetype : 'release'
addArtifact sourceJar
addArtifact apiJar
relations {
requiredLibrary 'lunatriuscore'
}
}
}
}