forked from ReplayMod/ReplayStudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
119 lines (101 loc) · 3.33 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
buildscript {
repositories {
jcenter()
mavenCentral()
maven {
url 'https://oss.sonatype.org/content/groups/staging'
}
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'ch.raffael.gradlePlugins.preshadow:gradle-preshadow-plugin:1.0'
classpath 'com.github.jengelman.gradle.plugins:shadow:1.2.3'
classpath 'com.github.johni0702:gradle-reproducible-builds-plugin:3dbf20d'
}
}
defaultTasks 'clean', 'build', 'shadowJar', 'install'
apply plugin: 'java'
apply plugin: 'application'
apply plugin: 'eclipse'
apply plugin: 'idea'
apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'maven'
apply plugin: 'ch.raffael.preshadow'
apply plugin: 'de.johni0702.reproducible-builds'
def gitCommitHash() {
try {
def out = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = out
}
return out.toString().trim()
} catch (e) {
return "unknown"
}
}
group = 'com.replaymod.replaystudio'
description = 'ReplayStudio'
version = gitCommitHash()
mainClassName = 'com.replaymod.replaystudio.launcher.Launcher'
ext.projectName = 'ReplayStudio'
ext.packaging = 'jar'
ext.author = 'johni0702'
ext.authorUrl = 'https://github.com/johni0702'
sourceCompatibility = 1.8
targetCompatibility = 1.8
compileJava {
options.encoding = 'UTF-8'
}
repositories {
mavenCentral()
maven {
url 'https://jitpack.io'
}
maven {
url 'https://repo.viaversion.com'
}
maven {
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url 'https://jitpack.io'
}
}
dependencies {
preshadow 'com.github.replaymod.viaversion:viaversion-common:bc943b6'
// ViaVersion will use the relocated netty of PacketLib
// un-shaded from ViaVersion
compile 'com.google.guava:guava:17.0'
compile 'com.google.code.gson:gson:2.3.1'
compile 'com.github.steveice10:opennbt:d50274d' // 1.2
preshadow 'com.github.steveice10:packetlib:614d56cdc0' // 1.3
compile 'org.apache.commons:commons-lang3:3.3.2'
compile 'org.apache.commons:commons-collections4:4.0'
compile 'commons-cli:commons-cli:1.2'
compileOnly "org.projectlombok:lombok:1.16.6"
testCompile 'junit:junit:4.11'
testCompile 'com.google.guava:guava-testlib:18.0'
testCompile 'pl.pragmatists:JUnitParams:1.0.4'
}
preshadowJar {
relocate 'io.netty', 'com.github.steveice10.netty'
relocate 'us.myles.ViaVersion', 'com.replaymod.replaystudio.us.myles.ViaVersion'
// un-shading from ViaVersion (see dependencies)
exclude 'com/google/gson/**' // gson
exclude 'com/google/common/**' // guava
exclude 'com/google/thirdparty/publicsuffix/**' // also part of guava
// don't need this one, ViaVersion uses it to parse configs (which we never need to do)
exclude 'org/yaml/snakeyaml/**' // snakeyaml
}
shadowJar {
archiveName = "${baseName}-${version}.full.${extension}"
append('META-INF/NOTICE.txt')
from(tasks.findByName('preshadowJar').outputs.files.collect {it.isDirectory() ? it : zipTree(it)})
}
build.dependsOn shadowJar
jar.manifest.mainAttributes(
'Main-Class': mainClassName,
'Implementation-Title': description,
'Implementation-Version': gitCommitHash()
)