This repository has been archived by the owner on Mar 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
166 lines (135 loc) · 4.44 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
buildscript {
repositories {
mavenCentral()
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:1.2-SNAPSHOT'
}
}
apply plugin: 'forge'
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}"
compileJava.options.encoding = 'UTF-8'
idea {
module {
downloadSources = true
}
}
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 {
compile group: group, name: 'LunatriusCore', version: "${project.version_minecraft}-${project.version_lunatriuscore}", classifier: 'dev'
}
def commonManifest = {
if (project.hasProperty('extra_fmlat')) {
attributes 'FMLAT': project.extra_fmlat
}
}
jar {
classifier = project.hasProperty('extra_classifier') ? project.extra_classifier : 'universal'
manifest commonManifest
}
task devJar(dependsOn: 'classes', type: Jar) {
from sourceSets.main.output
classifier = 'dev'
manifest commonManifest
}
task sourceJar(dependsOn: 'classes', type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
manifest commonManifest
}
artifacts {
archives devJar
archives sourceJar
}
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: ['reobf', 'devJar', 'sourceJar']) {
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 != '.'
}
}