forked from realm/realm-android-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
90 lines (79 loc) · 2.83 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
apply plugin: 'ch.netzwerg.release'
buildscript {
ext {
sdkVersion = 31
buildTools = '31.0.0'
realmVersion = '10.8.1'
androidXVersion = '1.2.1'
}
repositories {
google()
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url 'https://oss.jfrog.org/artifactory/oss-snapshot-local'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:7.0.4'
classpath 'ch.netzwerg:gradle-release-plugin:1.2.0'
classpath 'gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.7.1'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
classpath "io.realm:realm-gradle-plugin:${realmVersion}"
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.1.0"
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.+'
}
}
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()
mavenCentral()
maven {
url 'https://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}")
}
}
}
}
}
}
apply from: "${rootDir}/mavencentral-publish.gradle"
// Configure ch.netzwerg.release plugin
// See https://github.com/netzwerg/gradle-release-plugin
task build {}
release {
push = false
versionSuffix = '-SNAPSHOT'
tagPrefix = 'v'
}