generated from runelite/example-plugin
-
-
Notifications
You must be signed in to change notification settings - Fork 24
/
build.gradle
98 lines (83 loc) · 3.12 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
plugins {
id 'java'
}
repositories {
mavenLocal()
maven {
url = 'https://repo.runelite.net'
}
mavenCentral()
}
def runeLiteVersion = 'latest.release'
dependencies {
implementation files('lib/jaco-mp3-player-0.9.5.jar')
compileOnly group: 'net.runelite', name:'client', version: runeLiteVersion
compileOnly 'org.projectlombok:lombok:1.18.20'
annotationProcessor 'org.projectlombok:lombok:1.18.20'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.mockito:mockito-core:3.4.0'
testImplementation 'com.google.inject.extensions:guice-testlib:4.1.0'
testImplementation group: 'net.runelite', name:'client', version: runeLiteVersion
testImplementation group: 'net.runelite', name:'jshell', version: runeLiteVersion
}
group = 'com.adamk33n3r.runelite.watchdog'
def versionProps = new Properties()
def versionPropsFile = file("src/main/resources/${group.replace('.', '/')}/version.properties")
if (versionPropsFile.exists())
versionProps.load(versionPropsFile.newReader())
def major = (versionProps['VERSION_MAJOR'] as String ?: '0').toInteger()
def minor = (versionProps['VERSION_MINOR'] as String ?: '0').toInteger()
def patch = (versionProps['VERSION_PATCH'] as String ?: '0').toInteger()
def build = (versionProps['VERSION_BUILD'] as String ?: '0').toInteger()
def phase = (versionProps['VERSION_PHASE'] as String ?: '')
version = major+'.'+minor+'.'+patch
if (!phase.empty)
version = version+'-'+phase
version = version+'+'+build
sourceCompatibility = '1.8'
targetCompatibility = '1.8'
compileJava.doFirst {
def runTasks = gradle.startParameter.taskNames
if ("build" !in runTasks || "runelitePluginHubPackage" in runTasks) return
build += 1
versionProps['VERSION_BUILD'] = build.toString()
versionProps.store(versionPropsFile.newWriter(), null)
version = major+'.'+minor+'.'+patch
if (!phase.empty)
version = version+'-'+phase
version = version+'+'+build
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.release.set(11)
}
tasks.register("shadowJar", Jar) {
dependsOn configurations.testRuntimeClasspath
manifest {
attributes 'Main-Class': 'com.adamk33n3r.runelite.watchdog.WatchdogPluginLauncher'
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
from sourceSets.main.output
from sourceSets.test.output
from({
configurations.testRuntimeClasspath.collect {
// Ignore test framework stuff, especially bytebuddy because it's like 4MB
if (it.path.contains("mockito") ||
it.path.contains("guice-testlib") ||
it.path.contains("junit") ||
it.path.contains("bytebuddy")) {
return null
}
it.isDirectory() ? it : zipTree(it)
}
})
exclude("META-INF/INDEX.LIST")
exclude("META-INF/*.SF")
exclude("META-INF/*.DSA")
exclude("META-INF/*.RSA")
exclude "**/module-info.class"
group = BasePlugin.BUILD_GROUP
archiveClassifier = "shadow"
archiveFileName = rootProject.name + "-" + project.version + "-all.jar"
destinationDirectory = file('jars')
}