/
build.gradle
155 lines (138 loc) · 3.9 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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
apply plugin: 'com.android.application'
import java.util.regex.Matcher
import java.util.regex.Pattern
android {
compileSdkVersion 27
buildToolsVersion '27.0.3'
buildDir = rootDir.absolutePath + "/../../../target/android/gradle/servoapp"
defaultConfig {
applicationId "org.mozilla.servo"
minSdkVersion 18
targetSdkVersion 27
versionCode 1
versionName "1.0.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// Share all of that with servoview
flavorDimensions "default"
productFlavors {
main {
}
googlevr {
minSdkVersion 21
}
oculusvr {
minSdkVersion 21
}
}
splits {
density {
enable false
}
abi {
enable false
}
}
sourceSets {
main {
java.srcDirs = ['src/main/java']
}
}
buildTypes {
debug {
}
release {
signingConfig signingConfigs.debug // Change this to sign with a production key
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
// Custom build types
armDebug {
initWith(debug)
ndk {
abiFilters getNDKAbi('arm')
}
}
armRelease {
initWith(release)
ndk {
abiFilters getNDKAbi('arm')
}
}
armv7Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('armv7')
}
}
armv7Release {
initWith(release)
ndk {
abiFilters getNDKAbi('armv7')
}
}
arm64Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('arm64')
}
}
arm64Release {
initWith(release)
ndk {
abiFilters getNDKAbi('arm64')
}
}
x86Debug {
initWith(debug)
ndk {
abiFilters getNDKAbi('x86')
}
}
x86Release {
initWith(release)
ndk {
abiFilters getNDKAbi('x86')
}
}
}
// Ignore default 'debug' and 'release' build types
variantFilter { variant ->
if(variant.buildType.name.equals('release') || variant.buildType.name.equals('debug')) {
variant.setIgnore(true);
}
}
project.afterEvaluate {
android.applicationVariants.all { variant ->
Pattern pattern = Pattern.compile(/^[\w\d]+([A-Z][\w\d]+)(Debug|Release)/)
Matcher matcher = pattern.matcher(variant.name)
if (!matcher.find()) {
throw new GradleException("Invalid variant name for output: " + variant.name)
}
def arch = matcher.group(1)
def debug = variant.name.contains("Debug")
def finalFolder = getTargetDir(debug, arch)
def finalFile = new File(finalFolder, "servoapp.apk")
variant.outputs.all { output ->
Task copyAndRenameAPKTask = project.task("copyAndRename${variant.name.capitalize()}APK", type: Copy) {
from output.outputFile.getParent()
into finalFolder
include output.outputFileName
rename(output.outputFileName, finalFile.getName())
}
variant.assemble.finalizedBy(copyAndRenameAPKTask)
}
}
}
}
dependencies {
implementation 'com.android.support.constraint:constraint-layout:1.1.2'
if (findProject(':servoview-local')) {
implementation project(':servoview-local')
} else {
implementation project(':servoview')
}
}