-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
134 lines (108 loc) · 3.06 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
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
}
}
apply plugin: "maven"
apply plugin: 'net.minecraftforge.gradle.forge'
sourceCompatibility = 1.8
targetCompatibility = 1.8
group = "xyz.epoxide.sipo"
archivesBaseName = "SIPO"
version = getVersionFromJava(file("src/main/java/xyz/epoxide/sipo/libs/Constants.java"))
minecraft {
version = "1.10.2-12.18.2.2151"
runDir = "run"
mappings = "snapshot_20160518"
useDepAts = true
}
repositories {
maven {
name = "ChickenBones"
url = "http://chickenbones.net/maven"
}
}
dependencies {
compile "codechicken:ChickenChunks:1.10.2-2.1.5.46:deobf"
}
processResources {
inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version': project.version, 'mcversion': project.minecraft.version
}
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}
jar {
manifest {
attributes "FMLCorePlugin": "xyz.epoxide.sipo.asm.SIPOLoadingPlugin", "FMLCorePluginContainsFMLMod": "true"
}
}
String getVersionFromJava(File file) {
String release = "0";
String update = "0"
String patch = "0"
String build = System.getenv("BUILD_NUMBER") ? System.getenv("BUILD_NUMBER") : "0";
def outfile = "";
def ln = System.getProperty("line.separator")
String prefix = "public static final String VERSION_NUMBER = \"";
file.eachLine {
String s ->
String v = s.trim();
if (v.startsWith(prefix)) {
v = v.substring(prefix.length(), v.length() - 2);
String[] pts = v.split("\\.");
release = pts[0];
update = pts[1];
patch = pts[2];
s = s.replaceAll(".0\";", ".${build}\";");
}
outfile += (s + ln);
}
file.write(outfile);
return "1.10.2-$release.$update.$patch.$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 deobfJar(type: Jar) {
from sourceSets.main.output
classifier = "deobf"
}
//Adds the deobf, source and javadoc jars to the build artifacts.
artifacts {
archives deobfJar
archives sourcesJar
archives javadocJar
}
//Uploads the artifacts to the maven server.
uploadArchives {
repositories {
mavenDeployer {
repository(url: "file:///var/www/html/maven")
}
}
}
//Prevents incomplete JavaDocs from preventing a build on Java 8.
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
}
}