-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
78 lines (62 loc) · 1.8 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
apply plugin: 'java'
apply plugin: "eclipse"
apply plugin: "idea"
apply plugin: "maven"
group 'org.epoxide.commons.libgdx'
archivesBaseName = "EpoxideCommons-libGDX"
version = getVersionFromJava(file("src/main/java/org/epoxide/commons/libgdx/Constants.java"))
repositories{
mavenLocal()
mavenCentral()
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
maven { url "http://maven.epoxide.org" }
}
dependencies {
compile "com.badlogicgames.gdx:gdx:1.9.5"
compile "org.epoxide.commons:EpoxideCommons:0.0.10"
}
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";
}
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")
}
}
}