-
Notifications
You must be signed in to change notification settings - Fork 48
/
build.gradle
212 lines (176 loc) · 5.78 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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
buildscript {
repositories {
maven {
name = 'forge'
url = 'http://files.minecraftforge.net/maven'
}
maven {
url = 'https://plugins.gradle.org/m2/'
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.1'
}
}
plugins {
id 'com.github.johnrengelman.shadow' version '2.0.1'
id 'org.spongepowered.plugin' version '0.8.1'
id 'net.minecrell.vanillagradle.server' version '2.2-4'
id 'maven'
}
// Environment variables for the build set by the build server
ext.buildNumber = System.env.BUILD_NUMBER ?: '0'
defaultTasks 'clean', 'build'
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
archivesBaseName = project.name.toLowerCase()
minecraft {
version = project.minecraftVersion
mappings = project.mcpMappings
}
version = "$minecraft.version-$version.$buildNumber"
project.ext.getGitHash = {
def command = Runtime.getRuntime().exec("git rev-parse --short HEAD")
def result = command.waitFor()
return (result == 0) ? command.inputStream.text.trim() : "nogit"
}
repositories {
mavenLocal()
maven {
name = 'nucleus'
url = 'http://repo.drnaylor.co.uk/artifactory/list/minecraft'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/repositories/releases'
}
maven {
name = 'worldedit'
url = 'http://maven.sk89q.com/artifactory/repo'
}
maven {
name = 'jitpack'
url = 'https://jitpack.io'
}
}
sourceSets {
api
}
dependencies {
apiCompile "org.spongepowered:spongeapi:$apiVersion"
compileOnly sourceSets.api.output
compileOnly ("org.spongepowered:spongecommon:$commonVersion:dev") {
exclude module: 'testplugins'
}
compileOnly "com.sk89q.worldedit:worldedit-core:6.1.4-SNAPSHOT"
compileOnly "com.googlecode.json-simple:json-simple:1.1"
compile "com.squareup.okhttp3:okhttp:3.9.1"
compile "com.squareup.okio:okio:1.13.0"
compileOnly ("io.github.nucleuspowered:nucleus-api:1.9.1-S7.1"){
exclude module: 'spongeapi'
}
compile "com.github.bloodmc:mcclans-api:develop-SNAPSHOT"
}
jar {
from sourceSets.api.output
manifest.attributes('FMLAT': 'griefprevention_at.cfg')
manifest.attributes('Implementation-Title': 'GriefPrevention')
manifest.attributes('Implementation-Version': "$version")
manifest.attributes('Git-Hash': project.ext.getGitHash())
classifier = 'original'
}
task apiJar(type: Jar) {
classifier = 'api'
from sourceSets.api.output
}
sourceJar {
from sourceSets.api.allSource
}
javadoc {
source = sourceSets.api.java
}
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives apiJar
archives javadocJar
archives shadowJar
}
shadowJar {
mainSpec.sourcePaths.clear()
dependsOn reobfJar
classifier = ''
dependencies {
include dependency("com.squareup.okhttp3:okhttp:3.9.1")
include dependency("com.squareup.okio:okio:1.13.0")
}
relocate "okhttp3", "me.ryanhamshire.griefprevention.shade.okhttp3"
relocate "okio", "me.ryanhamshire.griefprevention.shade.okio"
exclude "dummyThing"
afterEvaluate {
from zipTree(reobfJar.jar)
}
}
uploadArchives {
repositories {
mavenDeployer {
// This is set by the build server when deploying to the repo
if (project.hasProperty('spongeRepo')) {
repository(url: project.spongeRepo) {
if (project.hasProperty('spongeUsername') && project.hasProperty('spongePassword')) {
authentication(userName: project.spongeUsername, password: project.spongePassword)
}
}
}
pom {
artifactId = project.archivesBaseName
project {
name = project.archivesBaseName
description = project.description
packaging = 'jar'
url = project.url
scm {
url = "https://github.com/$project.organization/$project.name"
connection = "scm:git:https://github.com/$project.organization/${project.name}.git"
developerConnection = "scm:git:git@github.com:$project.organization/${project.name}.git"
}
issueManagement {
system = 'GitHub Issues'
url = "https://github.com/$project.organization/$project.name/issues"
}
licenses {
license {
name = 'MIT License'
url = 'http://opensource.org/licenses/MIT'
distribution = 'repo'
}
}
}
}
}
}
}
// Configure changelog task only if we're on Forge's Jenkins server
if (project.hasProperty('forgeJenkinsPass')) {
task changelog(type: JenkinsChangelog) {
outputs.upToDateWhen { false } // Refresh changelog for every build
serverRoot = 'http://jenkins.minecraftforge.net/'
jobName = 'griefprevention'
targetBuild = project.buildNumber
authName = 'console_script'
authPassword = project.forgeJenkinsPass
output = "build/distributions/${project.name}-${project.version}-changelog.txt"
}
artifacts {
archives changelog.output
}
uploadArchives.dependsOn 'changelog'
}