-
Notifications
You must be signed in to change notification settings - Fork 100
/
build.gradle
122 lines (101 loc) · 3.17 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
//file:noinspection GroovyAssignabilityCheck
buildscript {
repositories {
google()
mavenLocal()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.4.2'
}
}
apply plugin: 'com.android.application'
repositories {
google()
mavenLocal()
mavenCentral()
}
android {
compileSdkVersion 33
defaultConfig {
applicationId "com.tngtech.jgiven.android.example"
minSdkVersion 29
targetSdkVersion 32
versionCode 1
versionName "${version}"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}
configurations {
jgivenReport
}
dependencies {
implementation('androidx.appcompat:appcompat:1.6.1') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
androidTestImplementation('androidx.test.espresso:espresso-core:3.5.1', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'com.google.guava', module: 'listenablefuture'
})
androidTestImplementation('androidx.test.ext:junit:1.1.5') {
exclude group: 'com.google.guava', module: 'listenablefuture'
}
androidTestImplementation('androidx.test:rules:1.5.0') {
exclude group: "junit"
}
androidTestImplementation('com.tngtech.jgiven:jgiven-android:' + version)
jgivenReport 'com.tngtech.jgiven:jgiven-html5-report:' + version
jgivenReport 'org.slf4j:slf4j-simple:2.0.11'
}
def targetDir = 'build/reports/jgiven/json'
def adb = android.getAdbExe().toString()
def reportsDir = '/storage/emulated/0/Download/jgiven-reports'
task cleanJGivenReports(type: Delete) {
delete targetDir
}
task pullJGivenReports(type: Exec, dependsOn: cleanJGivenReports) {
doFirst {
if (!file(targetDir).mkdirs()) {
println("Cannot create dir " + targetDir)
}
}
commandLine adb, 'pull', reportsDir, targetDir
doLast {
println("Pulled " + reportsDir + " to " + targetDir)
}
}
task cleanJGivenReportsFromDevice(type: Exec) {
commandLine adb, 'shell', 'rm -rf', reportsDir
doLast {
println("Deleted " + reportsDir)
}
}
pullJGivenReports.finalizedBy(cleanJGivenReportsFromDevice)
task cleanJGivenHtmlReport(type: Delete) {
delete 'build/reports/jgiven/html'
}
task jgivenHtml5Report(type: JavaExec, dependsOn: cleanJGivenHtmlReport) {
//noinspection GroovyAccessibility
mainClass = 'com.tngtech.jgiven.report.ReportGenerator'
args '--sourceDir=build/reports/jgiven/json',
'--targetDir=build/reports/jgiven/html',
'--format=html5',
'--exclude-empty-scenarios=true'
classpath = configurations.jgivenReport
}
pullJGivenReports.finalizedBy(jgivenHtml5Report)
tasks.whenTaskAdded { task ->
if (task.name == 'connectedAndroidTest') {
task.finalizedBy 'pullJGivenReports'
}
}