-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathbuild.gradle
48 lines (38 loc) · 989 Bytes
/
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
plugins {
id 'java'
}
repositories {
mavenCentral()
}
configurations {
yguard
}
dependencies {
yguard 'com.yworks:yguard:4.1.1'
}
task obfuscate {
dependsOn jar
group 'yGuard'
description 'Obfuscates the java archive.'
doLast {
def archivePath = jar.archiveFile.get().asFile.path
def unobfJar = archivePath.replace(".jar", "_unobf.jar")
ant.move(file: archivePath, tofile: unobfJar, verbose: true)
ant.taskdef(
name: 'yguard',
classname: 'com.yworks.yguard.YGuardTask',
classpath: configurations.yguard.asPath
)
ant.yguard {
inoutpair(in: unobfJar, out: archivePath)
// Prevent yGuard from removing "Deprecated" attributes from .class files.
attribute(name: "Deprecated")
rename(logfile: "${buildDir}/${rootProject.name}_renamelog.xml") {
keep {
'class'(classes: 'protected', methods: 'protected', fields: 'protected')
}
}
}
}
}
assemble.dependsOn obfuscate