-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
100 lines (86 loc) · 2.46 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
plugins {
id 'java'
id 'maven'
}
group = 'org.minimallycorrect.libloader'
version = '0.1-SNAPSHOT'
ext.inceptionYear = '2017'
ext.packaging = 'jar'
ext.url = 'https://github.com/MinimallyCorrect/LibLoader'
ext.description = 'Lib Loader'
ext.organization = 'minimallycorrect.org'
String calcVersion() {
def vs = version.toString()
def snapshot = false
if (vs.endsWith("-SNAPSHOT")) {
snapshot = true
vs = vs.replace("-SNAPSHOT", "")
}
vs = vs + '.' + (System.currentTimeMillis()/100000.0)
if (snapshot) {
vs = vs + "-SNAPSHOT"
}
return vs
}
// version file
def versionFile = file(buildDir.toString() + '/LibLoader.version')
versionFile.getParentFile().mkdirs()
versionFile.text = calcVersion()
// ci information
ext.buildNumber = System.getenv("BUILD_NUMBER") ?: 0
ext.ciSystem = System.getenv("JENKINS_URL") ? 'Jenkins' : 'unknown'
ext.commit = System.getenv("GIT_COMMIT") ?: 'unknown'
repositories {
jcenter()
maven { url "https://libraries.minecraft.net/" }
}
dependencies {
testCompile 'junit:junit:4.12'
compileOnly "org.projectlombok:lombok:1.16.16"
compileOnly 'net.minecraft:launchwrapper:1.12'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.1'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.1'
}
tasks.withType(JavaCompile) {
sourceCompatibility = 8
targetCompatibility = 8
options.with {
encoding = 'UTF-8'
compilerArgs << "-Xlint:all" << "-Xlint:-classfile" << "-Xlint:-processing"
}
}
tasks.withType(Jar) {
baseName = project.name
manifest.mainAttributes(
"Built-By": System.properties['user.name'],
"Created-By": System.properties['java.vm.version'] + " (" + System.properties['java.vm.vendor'] + ")",
"Implementation-Title": name,
"Implementation-Version": version + "+" + ciSystem + "-b" + buildNumber + ".git-" + commit,
"Implementation-Vendor": url
)
}
task innerJar(type: Jar, dependsOn: classes)
innerJar {
inputs.property("versionfile", versionFile.text)
classifier 'inner'
from sourceSets.main.output
exclude 'net'
exclude 'generated'
from versionFile
manifest.mainAttributes(
"FMLCorePlugin": "org.minimallycorrect.libloader.LibLoader"
)
}
jar.dependsOn(innerJar)
jar {
inputs.property("versionfile", versionFile.text)
exclude 'net'
exclude 'org/minimallycorrect/libloader/LibLoaderChained*'
exclude 'generated'
from versionFile
from innerJar.archivePath
rename (file(innerJar.archivePath).name, "LibLoader.jar")
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5'
}