-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathbuild.gradle
85 lines (74 loc) · 2.52 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
import proguard.gradle.ProGuardTask
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'com.guardsquare', name: 'proguard-gradle', version: '7.2.0-beta2'
}
}
plugins {
id 'java'
}
group = project.plugin_group as Object
version = project.plugin_version as Object
def targetJavaVersion = 8
java {
def javaVersion = JavaVersion.toVersion(targetJavaVersion)
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
if (JavaVersion.current() < javaVersion) {
toolchain.languageVersion = JavaLanguageVersion.of(targetJavaVersion)
}
}
tasks.withType(JavaCompile).configureEach {
if (targetJavaVersion >= 10 || JavaVersion.current().isJava10Compatible()) {
options.release = targetJavaVersion
}
}
repositories {
mavenCentral()
maven {
name = 'spigotmc-repo'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name = 'sonatype'
url = 'https://oss.sonatype.org/content/groups/public/'
}
}
dependencies {
// implementation 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
implementation group: 'org.spigotmc', name: 'spigot-api', version: '1.18.1-R0.1-SNAPSHOT'
}
processResources {
def properties = [version: project.plugin_version, name: project.plugin_name,
group : project.plugin_group, website: project.plugin_website,
author : project.plugin_author]
inputs.properties properties
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand properties
}
}
def proguardOutFile = rootProject.file("$buildDir/libs/release.jar")
def jarFile = jar.outputs.files.singleFile
task proguard(type: ProGuardTask) {
outputs.upToDateWhen { false }
configuration 'configuration.pro'
injars jarFile
outjars proguardOutFile
libraryjars configurations.findByName('runtimeClasspath').getFiles()
// Java 8
libraryjars "${System.getProperty("java.home")}/lib/rt.jar"
// Java 9+ compatibility
libraryjars "${System.getProperty("java.home")}/jmods/java.base.jmod"
libraryjars "${System.getProperty("java.home")}/jmods/java.desktop.jmod"
libraryjars "${System.getProperty("java.home")}/jmods/java.logging.jmod"
libraryjars "${System.getProperty("java.home")}/jmods/jdk.unsupported.jmod"
}
jar.finalizedBy proguard
proguard.doLast {
if (!jarFile.delete()) throw new IllegalStateException()
if (!proguardOutFile.renameTo(jarFile)) throw new IllegalStateException()
}