-
-
Notifications
You must be signed in to change notification settings - Fork 222
/
build.gradle
116 lines (110 loc) · 3.88 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
buildscript {
repositories {
jcenter()
google()
maven { url 'https://jitpack.io' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
classpath 'com.github.JakeWharton:sdk-manager-plugin:0ce4cdf08009d79223850a59959d9d6e774d0f77'
classpath 'de.mobilej.unmock:UnMockPlugin:0.6.4'
}
}
apply plugin: 'com.android.application'
apply plugin: 'de.mobilej.unmock'
android {
compileSdkVersion 28
buildToolsVersion '28.0.3'
defaultConfig {
applicationId 'io.appium.uiautomator2'
minSdkVersion 21
targetSdkVersion 28
versionCode 22
archivesBaseName = 'appium-uiautomator2'
/**
* versionName should be updated and inline with version in package.json for every npm release.
*/
versionName '2.8.0'
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
debug {
debuggable true
}
customDebuggableBuildType {
debuggable true
}
applicationVariants.all { variant ->
variant.outputs.all {
outputFileName = outputFileName.replace('debug.apk', "v${defaultConfig.versionName}.apk")
}
}
}
flavorDimensions 'default'
lintOptions {
abortOnError false
}
productFlavors {
e2eTest {
applicationId 'io.appium.uiautomator2.e2etest'
}
server {
applicationId 'io.appium.uiautomator2.server'
}
}
testOptions {
unitTests.returnDefaultValues = true
}
packagingOptions {
exclude 'META-INF/maven/com.google.guava/guava/pom.properties'
exclude 'META-INF/maven/com.google.guava/guava/pom.xml'
}
}
unMock {
keepStartingWith 'com.android.internal.util.'
keepStartingWith 'android.util.'
keepStartingWith 'android.view.'
keepStartingWith 'android.internal.'
}
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'io.netty:netty-all:4.0.41.Final'
implementation 'com.jayway.jsonpath:json-path:0.8.1'
implementation 'com.squareup.okhttp:okhttp:2.5.0'
implementation 'androidx.test:runner:1.1.1'
implementation 'androidx.test:core:1.1.0'
implementation 'androidx.test.uiautomator:uiautomator:2.2.0'
unmock 'org.robolectric:android-all:7.1.0_r7-robolectric-0'
testImplementation 'org.json:json:20160810'
testImplementation 'junit:junit:4.12'
testImplementation 'org.powermock:powermock-module-junit4:1.7.4'
testImplementation 'org.powermock:powermock-module-junit4-rule:1.7.4'
testImplementation 'org.powermock:powermock-api-mockito2:1.7.4'
testImplementation 'org.powermock:powermock-classloading-xstream:1.7.4'
testImplementation 'org.robolectric:robolectric:4.0.2'
androidTestImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test.uiautomator:uiautomator:2.2.0'
androidTestImplementation 'androidx.test.espresso:espresso-web:3.1.1'
}
task installAUT(type: Exec) {
group = 'test'
description = 'Install app under test'
doFirst {
println('Install AUT')
def adb = "$System.env.ANDROID_HOME/platform-tools/adb"
def apk = file('../node_modules/android-apidemos/apks/ApiDemos-debug.apk')
def sdkVersion = "$adb shell getprop ro.build.version.sdk".execute().text.trim()
println "Device SDK version: $sdkVersion"
/* This seems weird but it is what it is: https://github.com/wix/detox/issues/274 */
def command = sdkVersion.toInteger() < 23 ? "$adb install -r $apk" : "$adb install -r -g $apk"
println "Execute command: $command"
commandLine command.split(' ')
}
}
afterEvaluate {
tasks.each { task ->
if (task.name.startsWith('connectedE2eTestDebugAndroidTest')) {
task.dependsOn installAUT
}
}
}