-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
173 lines (141 loc) · 4.27 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
buildscript {
repositories {
jcenter()
maven { url = "http://files.minecraftforge.net/maven" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
}
}
plugins {
id "org.sonarqube" version "2.6"
}
allprojects {
group = mod_group
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: 'signing'
sourceCompatibility = targetCompatibility = '1.8'
}
version = dissolution_version
archivesBaseName = "Dissolution"
allprojects {
minecraft {
version = project.forge_version
runDir = "run"
replace '@VERSION@', project.version
if (project.hasProperty('keyStore')) {
replace '@FINGERPRINT@', project.findProperty('signSHA1')
}
mappings = project.mcp_version
makeObfSourceJar = false // Disable Srg named sources jar
}
apply from: new File(rootProject.projectDir, 'dependencies.gradle')
apply from: new File(rootProject.projectDir, 'update_json.gradle')
build.finalizedBy updateJson
jar {
from sourceSets.main.output
manifest {
attributes([
'Maven-Artifact': "${project.group}:${archivesBaseName}:${project.version}",
'Timestamp' : System.currentTimeMillis()
])
}
}
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, that's not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude "mcmod.info"
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
task signJar(type: SignJar, dependsOn: reobfJar) {
onlyIf {
project.hasProperty('keyStore')
}
keyStore = project.properties.keyStore
alias = project.properties.keyStoreAlias
storePass = project.properties.keyStorePass
keyPass = project.properties.keyStoreKeyPass
}
compileJava {
options.encoding = 'UTF-8'
}
build.dependsOn signJar
}
apply plugin: 'maven'
// Define additional jar creating tasks to be used as dependencies
task sourcesJar(type: Jar) {
classifier = 'sources'
}
task apiJar(type: Jar) {
classifier = 'api'
}
configurations {
contained
contained.transitive = false
}
dependencies {
contained "com.github.Pyrofab:Ladylib:${ladylib_version}"
contained "com.jamieswhiteshirt:clothesline-hooks:${mc_version}-${clothesline_hook_version}"
contained files(apiJar.archivePath) {
builtBy apiJar
}
}
//Builds the main jar
jar {
from(configurations.contained.files) {
include '*'
into 'META-INF/libraries'
}
manifest {
attributes([
'ContainedDeps': configurations.contained.files.collect { it.name }.join(" ")
])
}
archiveName = "${archivesBaseName}-${mc_version}-${dissolution_version}${version_nickname}.jar"
manifest {
attributes 'FMLAT': 'dissolution_at.cfg'
}
}
//Builds an api jar
apiJar {
from sourceSets.api.output
from sourceSets.api.allJava
manifest {
attributes([
'Maven-Artifact': "${project.group}:${archivesBaseName}:${classifier}:${project.version}",
'Timestamp' : System.currentTimeMillis()
])
}
}
//Builds a source jar
sourcesJar {
from sourceSets.api.allSource
from sourceSets.main.allSource
}
updateJson {
beta = true
curseforgeURL = "https://minecraft.curseforge.com/projects/dissolution"
}
signJar {
inputFile = jar.archivePath
outputFile = jar.archivePath
}
artifacts {
archives(apiJar) {
type 'jar'
builtBy apiJar
classifier 'api'
}
archives sourceJar
}
install.dependsOn(signJar)