-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
183 lines (150 loc) · 4.82 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
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'
classpath 'org.ajoberstar:gradle-git:0.7.1'
}
}
String mcversion = "1.7.2"
String forgeversion = "10.12.0.1048"
version = '2.0.0'
apply plugin: 'forge'
archivesBaseName = "ServerTools-CORE"
minecraft {
version = mcversion + "-" + forgeversion
assetDir = "run/assets"
}
def actualVersion = version
import org.ajoberstar.grgit.*
if (System.getenv("BUILD_NUMBER") != null) {
version = "${minecraft.version}-$version." + System.getenv("BUILD_NUMBER")
actualVersion += "." + System.getenv("BUILD_NUMBER")
} else if (new File(projectDir, '.git').exists()) {
def repo = Grgit.open(project.file('.'))
version = "${minecraft.version}-$version-${repo.log().find().abbreviatedId}"
actualVersion += "-${repo.log().find().abbreviatedId}"
} else {
version = "${minecraft.version}-$version-DEV"
actualVersion += "-DEV"
}
jar {
manifest {
attributes 'FMLCorePlugin': 'com.matthewprenger.servertools.core.asm.STPlugin'
attributes 'FMLCorePluginContainsFMLMod': 'true'
}
}
subprojects {
apply plugin: 'java'
archivesBaseName = "ServerTools-" + name.toUpperCase()
version = rootProject.version
dependencies {
compile rootProject
}
rootProject.reobf {
reobf(jar) { spec ->
spec.classpath = sourceSets.main.compileClasspath
}
}
}
allprojects {
sourceCompatibility = '1.7'
targetCompatibility = '1.7'
group = "com.matthewprenger.servertools"
processResources {
from(sourceSets.main.resources.srcDirs) {
include '**/*.info'
include '**/*.properties'
expand([
'version': actualVersion,
'mcversion': mcversion
])
}
from(sourceSets.main.resources.srcDirs) {
exclude '**/*.info'
exclude '**/*.properties'
}
}
jar {
manifest {
attributes 'Implementation-Title': project.name
attributes 'Implementation-Version': actualVersion
}
}
task sourceJar(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from 'build/docs/javadoc'
classifier = 'javadoc'
}
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'deobf'
}
build.dependsOn sourceJar, javadocJar, deobfJar
artifacts {
archives sourceJar
archives javadocJar
archives deobfJar
}
apply plugin: 'maven'
uploadArchives {
uploadArchives.dependsOn 'build'
if (project.hasProperty("mavendir")) {
logger.info("Publishing to maven")
repositories.mavenDeployer {
repository(url: project.mavendir)
}
pom {
groupId = project.group
version = project.version
artifactId = project.archivesBaseName
project {
name = project.archivesBaseName
packaging 'jar'
description 'A minecraft server administration mod'
url 'http://servertools.matthewprenger.com/'
scm {
url 'https://github.com/matthewprenger/ServerTools'
connection 'scm:git:git://github.com/matthewprenger/ServerTools.git'
developerConnection 'scm:git:[email protected]:matthewprenger/ServerTools.git'
}
issueManagement {
system 'github'
url 'https://github.com/matthewprenger/ServerTools/issues'
}
licenses {
license {
name 'Apache License Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.html'
distribution 'repo'
}
}
developers {
developer {
id 'matthewprenger'
name 'Matthew Prenger'
roles { role 'developer' }
}
}
}
}
}
}
}
project.subprojects.each { p ->
p.tasks.withType(Jar)*.each { t ->
t.destinationDir = new File(rootProject.getBuildDir(), 'libs')
}
}