-
Notifications
You must be signed in to change notification settings - Fork 51
/
build.gradle
117 lines (100 loc) · 3.39 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
buildscript {
repositories {
mavenCentral()
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.3'
classpath 'net.sf.proguard:proguard-gradle:6.2.0'
classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
}
}
plugins {
id "net.ltgt.apt" version "0.21"
id "com.github.spotbugs" version "2.0.1"
id "java"
id "idea"
}
version = '2.1.0'
group = 'org.cf'
sourceCompatibility = 1.8
def jarVersion = version
jar {
version = jarVersion
}
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
options.fork = true
}
// Ugly work-around until vscode plays better with auto generated sources
// https://github.com/redhat-developer/vscode-java/issues/339
sourceSets {
main {
java {
srcDirs = ['src/main/java', 'build/generated/sources/annotationProcessor/java/main/']
}
}
}
repositories {
mavenCentral()
jcenter()
maven { url "https://jitpack.io" }
maven { url 'https://maven.repository.redhat.com/ga/' }
}
// Build a separate jar that contains all dependencies
task fatJar(type: Jar) {
from sourceSets.main.output
from { configurations.compile.collect { it.isDirectory() ? it : zipTree(it) } } {
exclude "META-INF/*.SF"
exclude "META-INF/*.DSA"
exclude "META-INF/*.RSA"
}
manifest {
attributes('Main-Class': 'org.cf.apkfile.Main')
}
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
doLast {
if (!System.getProperty('os.name').toLowerCase().contains('windows')) {
ant.symlink(link: file("${destinationDir}/apkfile.jar"), resource: archivePath, overwrite: true)
}
}
}
tasks.getByPath('build').dependsOn(fatJar)
spotbugs {
ignoreFailures = true
effort = 'min'
showProgress = true
reportLevel = 'medium'
// Only run spotbugs directly as it's slow AF. Can still run with "gradle spotbugsMain"
sourceSets = []
}
tasks.withType(com.github.spotbugs.SpotBugsTask) {
reports {
xml.enabled = false
html.enabled = true
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.29'
compile group: 'org.smali', name: 'dexlib2', version: '2.3.4'
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
compile group: 'net.sf.trove4j', name: 'trove4j', version: '3.0.3'
compile group: 'xmlpull', name: 'xmlpull', version: '1.1.4.redhat-1'
compile group: 'org.bouncycastle', name: 'bcmail-jdk15on', version: '1.64'
compile group: 'net.lingala.zip4j', name: 'zip4j', version: '2.2.4'
compile 'com.github.spotbugs:spotbugs:3.1.12'
compileOnly 'com.github.spotbugs:spotbugs-annotations:3.1.12'
compileOnly group: 'com.google.auto.value', name: 'auto-value-annotations', version: '1.7'
annotationProcessor group: 'com.google.auto.value', name: 'auto-value', version: '1.7'
}
task proguard(type: proguard.gradle.ProGuardTask, dependsOn: fatJar) {
configuration 'proguard.txt'
def outFile = fatJar.destinationDir.getPath() + '/' + fatJar.baseName + '-' + fatJar.version + '-proguard' + '.' + fatJar.extension
injars fatJar.archivePath
outjars outFile
libraryjars "${System.properties['java.home']}/lib/rt.jar"
}