-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
147 lines (125 loc) · 4.94 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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
id 'application'
}
group 'com.github.waifu'
repositories {
mavenCentral()
}
shadowJar {
exclude 'images.zip'
classifier = ''
}
dependencies {
implementation 'com.ardikars.pcap:pcap-spi:1.5.0'
implementation 'com.ardikars.pcap:pcap-jdk7:1.5.0'
implementation 'org.jsoup:jsoup:1.15.4'
implementation 'com.intellij:forms_rt:7.0.3'
implementation 'com.formdev:flatlaf:3.0'
implementation 'org.json:json:20230227'
implementation group: 'net.sourceforge.tess4j', name: 'tess4j', version: '5.6.0'
implementation group: 'com.github.jai-imageio', name: 'jai-imageio-core', version: '1.4.0'
implementation group: 'commons-io', name: 'commons-io', version: '2.11.0'
implementation group: 'net.java.dev.jna', name: 'jna', version: '5.12.1'
implementation group: 'net.sourceforge.lept4j', name: 'lept4j', version: '1.18.0'
implementation group: 'org.apache.pdfbox', name: 'pdfbox', version: '2.0.27'
implementation group: 'org.apache.pdfbox', name: 'pdfbox-tools', version: '2.0.27'
implementation group: 'org.apache.pdfbox', name: 'jbig2-imageio', version: '3.0.4'
implementation group: 'org.jboss', name: 'jboss-vfs', version: '3.2.16.Final'
implementation group: 'org.slf4j', name: 'slf4j-api', version: '2.0.5'
implementation 'org.apache.logging.log4j:log4j-api:2.20.0'
implementation 'org.apache.logging.log4j:log4j-core:2.20.0'
implementation 'org.apiguardian:apiguardian-api:1.1.2'
implementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testImplementation(platform('org.junit:junit-bom:5.9.2'))
testImplementation('org.junit.jupiter:junit-jupiter:5.9.2')
implementation files("lib/spmf.jar")
}
configurations {
flatlaf
yguard
}
dependencies {
yguard 'com.yworks:yguard:4.0.0'
}
test {
useJUnitPlatform()
}
sourceSets {
test {
java {
srcDirs = ['src/test/java']
}
}
}
compileJava.options.encoding = 'UTF-8'
application {
mainClassName = "com.github.waifu.gui.Main"
}
jar {
manifest {
attributes(
'Main-Class': "com.github.waifu.gui.Main"
)
}
}
version = { ->
def versionPropertiesFile = file('/src/main/resources/version.properties')
if(!versionPropertiesFile.exists()) {
throw new Exception('No version.properties file found')
}
Properties versionProperties = new Properties()
versionPropertiesFile.withInputStream { stream ->
versionProperties.load(stream)
}
def major = versionProperties.major
def minor = versionProperties.minor
def patch = versionProperties.patch
def release = versionProperties.release.toBoolean() ? '' : '-SNAPSHOT'
return "$major.$minor.$patch$release"
}()
task obfuscate {
dependsOn shadowJar
group 'yGuard'
description 'Obfuscates the java archive.'
doLast {
def archivePath = shadowJar.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)
rename(logfile: "${buildDir}/${rootProject.name}_renamelog.xml") {
adjust(replacePath: false) {
// keep the complete path to the resources even if
// package com.yworks.example gets obfuscated by name
include(name: "com/yworks/example/resources/*")
}
adjust(replaceContent: true, replaceContentSeparator: ".", replaceName: true) {
// plain-text class names in the config files will
// be replaced with the obfuscated name versions
// replace the .properties files' names with the obfuscated
// versions if the corresponding .class files get obfuscated
include(name: "**/*.properties")
}
keep {
'method'(name: 'void main(java.lang.String[])', class: application.mainClassName)
'class'(classes: "private", methods: "private", fields: "private") {
'patternset' {
include(name: "com.formdev.**")
include(name: "net.sourceforge.**")
include(name: "com.sun.**")
include(name: "pcap.**")
include(name: "com.github.waifu.packets.packetcapture.**")
}
}
}
}
}
}
}