-
Notifications
You must be signed in to change notification settings - Fork 134
/
build.gradle
88 lines (76 loc) · 2.81 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
apply plugin: 'ch.netzwerg.release'
buildscript {
ext {
sdkVersion = 28
buildTools = '28.0.3'
realmVersion = '5.8.0'
androidXVersion = '1.0.0'
}
repositories {
google()
jcenter()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1' // Android Build tools
classpath 'ch.netzwerg:gradle-release-plugin:1.2.0' // Manage Release tags / versioning
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0' // Allows you to install AAR's locally
classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:4.5.4' // OJO integration
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' // Bintray integration
classpath "io.realm:realm-gradle-plugin:${realmVersion}" // Realm base library
}
}
static String getAppId (path) {
String build = new File(path).text
def matcher = build =~ 'applicationId.*'
def appId = matcher.size() > 0 ? matcher[0].trim() - 'applicationId' - ~/\s/ : ''
String myappId = appId.replaceAll('"', '')
myappId = myappId.replaceAll('\'', '')
return myappId
}
// Don't cache SNAPSHOT (changing) dependencies.
configurations.all {
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
allprojects {
group = 'io.realm'
version = file("${rootDir}/version.txt").text.trim();
repositories {
google()
jcenter()
maven {
url 'http://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
// Add support for running Monkey on the project
if (project.name.startsWith("example")) {
["Debug", "Release"].each {
task "monkey${it}"(dependsOn: "install${it}") {
doLast {
def numberOfEvents = 2000
def appId = getAppId("${project.projectDir}/build.gradle")
def process = "adb shell monkey -p ${appId} --pct-syskeys 0 ${numberOfEvents}".execute([], project.rootDir)
def sout = new StringBuilder(), serr = new StringBuilder()
process.consumeProcessOutput(sout, serr)
process.waitFor()
if (process.exitValue() != 0) {
throw new GradleException("monkey failed for AppID: ${appId}\nExit value: ${process.exitValue()}\n\nStd out: ${sout}\nStd err: ${serr}")
}
}
}
}
}
}
// Configure ch.netzwerg.release plugin
// See https://github.com/netzwerg/gradle-release-plugin
task build {}
release {
push = false
versionSuffix = '-SNAPSHOT'
tagPrefix = 'v'
}
task wrapper(type: Wrapper) {
gradleVersion = '3.5'
}