This repository has been archived by the owner on May 31, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
build.gradle
89 lines (73 loc) · 2.67 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
apply plugin: 'groovy'
repositories {
jcenter()
}
dependencies {
testImplementation "com.google.guava:guava:23.5-jre"
testImplementation gradleTestKit()
testImplementation "junit:junit:4.12"
testImplementation "org.spockframework:spock-core:1.1-groovy-2.4@jar"
}
def androidHome = file(System.getenv("ANDROID_HOME") ?: "${System.getProperty("user.home")}/Library/Android/sdk")
def checkoutDir = file("checkout/santa-tracker")
def originalDir = file("build/original")
def relocatedDir = file("build/relocated")
task processFileResources(type: Copy) {
from "src/files/resources"
into "build/files/resources"
filter(org.apache.tools.ant.filters.ReplaceTokens, tokens: [
ANDROID_HOME: androidHome.absolutePath
])
}
task cleanCheckout {
doFirst {
println "Building Santa Tracker from commmit:"
exec {
workingDir = checkoutDir
commandLine = ["git", "clean", "-fdx"]
}
exec {
workingDir = checkoutDir
commandLine = ["git", "rev-parse", "HEAD"]
}
exec {
workingDir = checkoutDir
commandLine = ["git", "status", "--branch", "--untracked-files"]
}
}
}
task copyOriginal(type: Copy) {
dependsOn cleanCheckout
from checkoutDir
from processFileResources
into originalDir
}
task copyRelocated(type: Copy) {
dependsOn cleanCheckout
from checkoutDir
from processFileResources
into relocatedDir
}
test {
dependsOn copyOriginal
dependsOn copyRelocated
systemProperty "original.dir", originalDir.absolutePath
systemProperty "relocated.dir", relocatedDir.absolutePath
systemProperty "org.gradle.android.test.gradle-installation", System.getProperty("org.gradle.android.test.gradle-installation")
systemProperty "org.gradle.android.test.android-version", System.getProperty("org.gradle.android.test.android-version")
systemProperty "org.gradle.android.test.scan-url", System.getProperty("org.gradle.android.test.scan-url")
systemProperty "org.gradle.smoketests.init.script", System.getProperty("org.gradle.smoketests.init.script")
def pluginPortalUrl = System.getProperty('org.gradle.internal.plugins.portal.url.override')
if (pluginPortalUrl) {
systemProperty 'org.gradle.internal.plugins.portal.url.override', pluginPortalUrl
}
inputs.dir originalDir withPropertyName "original.dir"
inputs.dir relocatedDir withPropertyName "relocated.dir"
if (System.getenv("TRAVIS") == "true" || Boolean.getBoolean("org.gradle.android.test.show-output")) {
testLogging.showStandardStreams = true
}
}
assemble {
dependsOn copyOriginal
dependsOn copyRelocated
}