This repository has been archived by the owner on May 19, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
79 lines (63 loc) · 1.73 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
buildscript {
repositories {
jcenter()
}
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'maven'
group 'net.darkhax.opennbt'
archivesBaseName ="OpenNBT"
version = getVersionFromJava(file("src/main/java/net/darkhax/opennbt/NBTHelper.java"))
String getVersionFromJava(File file) {
String major = "0";
String minor = "0";
String build = System.getenv("BUILD_NUMBER") ?: "0";
def outfile = "";
def ln = System.getProperty("line.separator")
String prefix = "public static final String VERSION = \"";
file.eachLine { String s ->
String v = s.trim();
if (v.startsWith(prefix)) {
v = v.substring(prefix.length(), v.length() - 2);
String[] pts = v.split("\\.");
major = pts[0];
minor = pts[1];
s = s.replaceAll(".0\";", ".${build}\";");
}
outfile += (s + ln);
}
file.write(outfile);
return "$major.$minor.$build";
}
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
from sourceSets.main.allSource
classifier = 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
task buildJar(type: Jar) {
from sourceSets.main.output
}
artifacts {
archives buildJar
archives sourcesJar
archives javadocJar
}
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///var/www/html/maven")
}
}
}