forked from dropbox/dropbox-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
100 lines (84 loc) · 2.86 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
apply plugin: 'maven'
apply plugin: 'java'
description = 'ProGuard minified SDK test suite for ProGuard compatibility tests.'
group = 'com.dropbox.core.test'
archivesBaseName = 'dropbox-proguard-test'
version = '0-SNAPSHOT'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
ext {
authInfoPropertyName = 'com.dropbox.test.authInfoFile'
}
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'net.sf.proguard:proguard-gradle:5.2.1'
classpath 'net.sf.proguard:proguard-base:5.2.1'
}
}
repositories {
jcenter()
mavenLocal()
mavenCentral()
}
dependencies {
compile group: 'com.dropbox.core', name: 'dropbox-core-sdk', version: '0-SNAPSHOT', changing: true
compile 'org.testng:testng:6.9.10'
}
compileJava {
options.compilerArgs << '-Xlint:all'
options.warnings = true
options.deprecation = true
options.encoding = 'utf-8'
}
// copied from rootProject's build.gradle. We avoid using subprojects due to Android Studio bug and
// dbapp-android integration.
def getAuthInfoFile() {
if (!project.hasProperty(authInfoPropertyName)) {
throw new GradleException('' +
"These tests require the \"${authInfoPropertyName}\" " +
"project property be set to point to an authorization JSON file " +
"(e.g. ./gradlew proguardTest -P${authInfoPropertyName}=auth.json)."
)
}
def authInfoFile = file(project.property(authInfoPropertyName))
if (!authInfoFile.exists()) {
throw new GradleException('' +
"The test auth info file does not exist: \"${authInfoFile.absolutePath}\". " +
"Please ensure the \"${authInfoPropertyName}\" project property is set to point to " +
"the correct authorization JSON file."
)
}
return authInfoFile
}
task proguard(type: proguard.gradle.ProGuardTask) {
ext {
configDir = file("src/main/resources/proguard/")
configFile = file("../examples/android/proguard-rules.pro")
proguardJar = file("${project.libsDir}/${project.archivesBaseName}-${project.version}-proguard.jar")
}
inputs.dir configDir
inputs.file configFile
injars sourceSets.main.runtimeClasspath, filter:'!META-INF/*'
libraryjars "${System.getProperty('java.home')}/lib/rt.jar"
libraryjars sourceSets.main.compileClasspath.filter { file ->
return !sourceSets.main.runtimeClasspath.contains(file)
}
outjars proguardJar
fileTree(dir: configDir, include: '**/*.pro').each { file ->
configuration file
}
configuration configFile
}
task proguardTest(type: JavaExec) {
dependsOn proguard
classpath = files(proguard.proguardJar)
main = 'com.dropbox.core.test.proguard.Main'
ignoreExitValue false
doFirst {
args getAuthInfoFile().absolutePath
}
}