This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.gradle
219 lines (186 loc) · 8.04 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
212
213
214
215
216
217
218
219
buildscript {
repositories { jcenter() }
dependencies { classpath 'com.github.ben-manes:gradle-versions-plugin:0.17.0' }
}
apply plugin: 'com.github.ben-manes.versions'
ext {
productName = 'MPL'
encoding = 'UTF-8'
}
allprojects {
group = 'de.adrodoc55.mpl'
version = getGitVersion()
}
String getGitVersion() {
try {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe', '--dirty=-SNAPSHOT'
standardOutput = stdout
}
return stdout.toString().trim().substring(1)
} catch (Exception e) {
return "UNKNOWN-VERSION"
}
}
boolean isReleaseVersion() {
version ==~ /\d+\.\d+\.\d+/
}
if (!project.hasProperty('sonatype.username') || !project.hasProperty('sonatype.password')) {
logger.warn "[warning] sonatype username or password not set"
}
// ----------------------------------------------------------------------------------------------------
// _ _ _ _
// | | (_)| |__ _ __ __ _ _ __ (_) ___ ___
// | | | || '_ \ | '__|/ _` || '__|| | / _ \/ __|
// | |___ | || |_) || | | (_| || | | || __/\__ \
// |_____||_||_.__/ |_| \__,_||_| |_| \___||___/
//
// ----------------------------------------------------------------------------------------------------
ext {
libs = [
antlr4: 'org.antlr:antlr4:4.5.3',
antlr4_runtime: 'org.antlr:antlr4-runtime:4.5.3',
assertj: 'org.assertj:assertj-core:3.5.2',
beanfabrics: 'org.beanfabrics:beanfabrics-swing:1.4.3',
efxclipse: 'at.bestsolution.efxclipse.rt:org.eclipse.fx.code.editor.fx:3.0.0',
guava: 'com.google.guava:guava:19.0',
jcommander: 'com.beust:jcommander:1.58',
jsr305: 'com.google.code.findbugs:jsr305:3.0.1',
junit: 'junit:junit:4.12',
lombok: 'org.projectlombok:lombok:1.16.22',
nbt: 'com.evilco.mc:nbt:1.0.2',
pojobuilder: 'net.karneim:pojobuilder:4.2.2',
spock: 'org.spockframework:spock-core:1.0-groovy-2.4'
]
}
// ----------------------------------------------------------------------------------------------------
apply plugin: 'eclipse'
task wrapper (type: Wrapper) { gradleVersion = '4.7' }
allprojects {
repositories {
mavenCentral()
maven { url 'http://basket.cindyscats.com/content/repositories/releases' }
maven { url 'http://maven.bestsolution.at/efxclipse-releases' }
}
pluginManager.withPlugin('eclipse') {
apply from: rootProject.file('snippets/eclipse/configure-eclipse.gradle')
}
tasks.withType(JavaCompile) { options.encoding = encoding }
tasks.withType(Test) {
beforeTest { TestDescriptor descriptor ->
logger.lifecycle('Running test: ' + descriptor.name + '(' + descriptor.className + ')')
}
}
pluginManager.withPlugin('java') {
// ----------------------------------------------------------------------------------------------------
// _
// | | __ _ _ __
// _ | | / _` || '__|
// | |_| || (_| || |
// \___/ \__,_||_|
//
// ----------------------------------------------------------------------------------------------------
artifacts {
tasks.withType(Jar) { Task task ->
from rootProject.file('LICENCE.md')
from rootProject.file('README.md')
archives task
}
}
// ----------------------------------------------------------------------------------------------------
// ____ _
// / ___| ___ _ _ _ __ ___ ___ ___ | | __ _ _ __
// \___ \ / _ \ | | | || '__|/ __|/ _ \/ __| _ | | / _` || '__|
// ___) || (_) || |_| || | | (__| __/\__ \ | |_| || (_| || |
// |____/ \___/ \__,_||_| \___|\___||___/ \___/ \__,_||_|
//
// ----------------------------------------------------------------------------------------------------
task sourcesJar(type: Jar) {
sourceSets.all { from it.allSource }
includeEmptyDirs = false
duplicatesStrategy = 'exclude'
classifier 'sources'
}
assemble.dependsOn sourcesJar
// ----------------------------------------------------------------------------------------------------
// _ _ _
// | | __ _ __ __ __ _ __| | ___ ___ | | __ _ _ __
// _ | | / _` |\ \ / // _` | / _` | / _ \ / __| _ | | / _` || '__|
// | |_| || (_| | \ V /| (_| || (_| || (_) || (__ | |_| || (_| || |
// \___/ \__,_| \_/ \__,_| \__,_| \___/ \___| \___/ \__,_||_|
//
// ----------------------------------------------------------------------------------------------------
javadoc {
options.addStringOption('Xdoclint:all,-syntax', '-quiet')
}
task javadocJar(type: Jar) {
from javadoc
includeEmptyDirs = false
duplicatesStrategy = 'exclude'
classifier = 'javadoc'
}
// ----------------------------------------------------------------------------------------------------
// ____ _ _
// / ___| (_) __ _ _ __ (_) _ __ __ _
// \___ \ | | / _` || '_ \ | || '_ \ / _` |
// ___) || || (_| || | | || || | | || (_| |
// |____/ |_| \__, ||_| |_||_||_| |_| \__, |
// |___/ |___/
// ----------------------------------------------------------------------------------------------------
apply plugin: 'signing'
signing {
required { gradle.taskGraph.hasTask(uploadArchives) }
sign configurations.archives
}
// ----------------------------------------------------------------------------------------------------
// ____ _ _ _ _
// | _ \ _ _ | |__ | |(_) ___ | |__
// | |_) || | | || '_ \ | || |/ __|| '_ \
// | __/ | |_| || |_) || || |\__ \| | | |
// |_| \__,_||_.__/ |_||_||___/|_| |_|
//
// ----------------------------------------------------------------------------------------------------
apply plugin: 'maven'
gradle.taskGraph.whenReady {
if (!isReleaseVersion() && gradle.taskGraph.hasTask(uploadArchives)) {
throw new GradleException("Trying to upload Snapshot Version: ${version}")
}
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
// repository(url: "file://localhost/Users/Adrian/.m2/repository")
repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2") {
if (project.hasProperty('sonatype.username') && project.hasProperty('sonatype.password')) {
authentication(userName: project.'sonatype.username', password: project.'sonatype.password')
}
}
pom.project {
name "Minecraft Programming Language (MPL)"
description "MPL is a language that makes it easier to write applications for Minecraft 1.9 or higher. The final result of compiling an MPL application are command blocks that can be imported into your world in various ways. MPL comes with it's own editor that supports syntax- and error-highlighting and has a built in compiler."
url "https://github.com/Adrodoc55/MPL"
licenses {
license {
name "GNU General Public License 3.0"
url "http://www.gnu.org/licenses/gpl.txt"
}
}
developers {
developer {
name "Adrodoc55"
email "[email protected]"
}
}
scm {
connection "scm:git:[email protected]:Adrodoc55/MPL.git"
developerConnection "scm:git:[email protected]:Adrodoc55/MPL.git"
url "[email protected]:Adrodoc55/MPL.git"
}
}
}
}
}
}
}