forked from openedx-unsupported/edx-app-android
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
97 lines (88 loc) · 3.37 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
allprojects {
repositories {
// The order in which you list these repositories matter.
google()
jcenter()
maven { url 'https://maven.google.com' }
maven { url 'https://jitpack.io' }
}
project.apply from: "${rootDir}/constants.gradle"
}
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
project.apply from: "${rootDir}/constants.gradle"
repositories {
google()
jcenter() // This is the default repo
mavenCentral() // This is the Maven Central repo
}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.google.gms:google-services:4.3.3'
// Add the dependency for the Performance Monitoring plugin
classpath 'com.google.firebase:perf-plugin:1.2.1' // Performance Monitoring plugin
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${KOTLIN_VERSION}"
// Firebase Crashlytics Gradle plugin.
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.1'
}
}
// task that creates 'artifacts' directory
task createBuildArtifactsDirectory { task ->
doLast {
def hashPipe = new ByteArrayOutputStream()
task.project.exec {
commandLine = ['git', 'rev-parse', '--verify', 'HEAD']
standardOutput = hashPipe
}
def destDir = "artifacts"
task.project.exec {
commandLine = ['mkdir', '-p', destDir]
}
}
}
// Copies unit test reports to the 'artifacts' directory
task copyUnitTestBuildArtifacts { task ->
doLast {
// copy unit test reports
def srcPath = "OpenEdXMobile/build/reports"
task.project.exec {
commandLine = ['cp', '-R', srcPath, 'artifacts']
}
}
}
copyUnitTestBuildArtifacts.dependsOn createBuildArtifactsDirectory
// Copies lint report to the 'artifacts' directory
task copyLintBuildArtifacts(type: Copy) {
from 'OpenEdXMobile/build/outputs'
into 'artifacts'
include 'lint-results*'
include 'lint-results*/**'
}
copyLintBuildArtifacts.dependsOn createBuildArtifactsDirectory
// Copies acceptance test reports to the 'artifacts' directory
task copyAcceptanceTestBuildArtifacts { task ->
doLast {
// copy acceptance test reports
srcPath = "AcceptanceTests/Test-Reports"
task.project.exec {
commandLine = ['cp', '-R', srcPath, 'artifacts']
}
}
}
copyAcceptanceTestBuildArtifacts.dependsOn createBuildArtifactsDirectory
// Disables preDex which reduces the amount of memory required to build an APK. This is important
// for CI where there is a memory limit. PreDex is also not useful in CI where a new build is
// desired on every run.
project.ext.preDexLibs = !project.hasProperty('disablePreDex')
subprojects {
project.plugins.whenPluginAdded { plugin ->
if ("com.android.build.gradle.AppPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
} else if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
}
}
}
// Increases adb timeout for installing an apk. This tweak is need for slow adb installs on an
// emulator for CI.
com.android.ddmlib.DdmPreferences.setTimeOut(600000)