forked from uber/okbuck
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
206 lines (181 loc) · 6.2 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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
buildscript {
apply from: rootProject.file("dependencies.gradle")
repositories {
jcenter()
google()
maven { url "https://plugins.gradle.org/m2/" }
// Remove once butterknife is updated to a stable version
// TODO: https://github.com/uber/okbuck/issues/570
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
dependencies {
classpath deps.build.androidPlugin
classpath deps.build.butterKnifePlugin
classpath deps.build.kotlinPlugin
classpath deps.build.kotlinAllOpen
classpath deps.build.sqlDelightPlugin
classpath deps.build.shadowJar
}
}
allprojects { project ->
project.apply from: rootProject.file("dependencies.gradle")
repositories {
jcenter()
google()
maven { url "https://plugins.gradle.org/m2/" }
// Remove once butterknife is updated to a stable version
// TODO: https://github.com/uber/okbuck/issues/570
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
}
}
apply plugin: "com.uber.okbuck"
subprojects { project ->
afterEvaluate {
if (project.plugins.hasPlugin("java")) {
addCommonConfigurationForJavaModules(project)
} else if (project.plugins.hasPlugin("com.android.application")
|| project.plugins.hasPlugin("com.android.library")) {
addCommonConfigurationForAndroidModules(project)
}
project.tasks.withType(Test) { Test task ->
task.jvmArgs << "-Djava.awt.headless=true"
}
}
}
def addCommonConfigurationForJavaModules(Project project) {
project.sourceCompatibility = JavaVersion.VERSION_1_8
project.targetCompatibility = JavaVersion.VERSION_1_8
}
def addCommonConfigurationForAndroidModules(Project project) {
project.android {
compileSdkVersion config.build.compileSdk
buildToolsVersion config.build.buildTools
defaultConfig {
minSdkVersion config.build.minSdk
targetSdkVersion config.build.targetSdk
vectorDrawables.useSupportLibrary = true
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
lintOptions {
lintConfig project.rootProject.file("config/lint/lint.xml")
}
}
def variants
if (project.plugins.hasPlugin("com.android.application")) {
project.android {
signingConfigs {
debug {
storeFile project.rootProject.file("config/signing/debug.keystore")
}
}
buildTypes {
debug {
signingConfig signingConfigs.debug
}
release {
signingConfig signingConfigs.debug
}
}
}
variants = project.android.applicationVariants
} else {
variants = project.android.libraryVariants
}
if (project.plugins.hasPlugin("com.squareup.sqldelight")) {
variants.all {
Task okbuckTask = project.tasks.getByName("okbuck")
Task sqlDelightTask = project.tasks.getByName("generate${it.name.capitalize()}SqlDelightInterface")
okbuckTask.dependsOn(sqlDelightTask)
project.android.sourceSets."${it.name}".java.srcDirs += [sqlDelightTask.outputs.files[0] as String]
}
}
}
okbuck {
buildToolVersion = config.build.buildTools
target = "android-${config.build.compileSdk}"
primaryDexPatterns = [
"app": [
"^com/uber/okbuck/example/AppShell^",
"^com/uber/okbuck/example/BuildConfig^",
"^android/support/multidex/",
"^com/facebook/buck/android/support/exopackage/",
"^com/github/promeg/xlog_android/lib/XLogConfig^",
"^com/squareup/leakcanary/LeakCanary^",
"^com/uber/okbuck/example/common/Calc^",
"^com/uber/okbuck/example/common/BuildConfig^",
]
]
exopackage = [
"appDevDebug": true
]
appLibDependencies = [
"appProd": [
"buck-android-support",
"com.android.support:multidex",
"libraries/javalibrary:main",
"libraries/common:paidRelease",
],
"appDev" : [
"buck-android-support",
"com.android.support:multidex",
"libraries/javalibrary:main",
"libraries/common:freeDebug",
],
"appDemo": [
"buck-android-support",
"com.android.support:multidex",
"libraries/javalibrary:main",
"libraries/common:paidRelease",
]
]
buckProjects = project.subprojects.findAll { it.name != "plugin" && it.name != "transform-cli" }
intellij {
sources = true
}
test {
espresso = true
robolectric = true
}
wrapper {
watch += ["**/*.sq"]
}
kotlin {
version = deps.versions.kotlin
}
lint {
version = deps.versions.androidTools
jvmArgs = '-Xmx1g'
}
experimental {
transform = true
}
transform {
transforms = [
"appProd": [
[transform: "com.uber.okbuck.transform.DummyTransform"]
]
]
}
dependencies {
transform project(":dummy-transform")
}
extraDefs += project.file("tooling/buck-defs/DEFS")
libraryBuildConfig = false
extraBuckOpts = [
"appDebug": [
"android_binary": [
"trim_resource_ids = True"
]
]
]
}
gradle.buildFinished {
"zip -d .okbuck/cache/org.hamcrest--hamcrest-core--1.3.jar__ LICENSE.txt".execute()
"zip -d .okbuck/cache/org.hamcrest--hamcrest-library--1.3.jar LICENSE.txt".execute()
"zip -d .okbuck/cache/org.hamcrest--hamcrest-integration--1.3.jar LICENSE.txt".execute()
}