blob: 9c2c371e67740e331550871a74f48d40ee7cfcb7 [file] [log] [blame]
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.neenbedankt.gradle.plugins:android-apt:1.8'
classpath 'com.uber:okbuck:0.8.4'
classpath 'com.jakewharton:butterknife-gradle-plugin:8.4.0'
}
}
allprojects {
project -> project.apply from: rootProject.file('dependencies.gradle')
repositories {
jcenter()
}
def logger = new com.android.build.gradle.internal.LoggerWrapper(project.logger)
def sdkHandler = new com.android.build.gradle.internal.SdkHandler(project, logger)
for (File file : sdkHandler.sdkLoader.repositories) {
repositories.maven {
url = file.toURI()
}
}
}
def multidexApps = []
subprojects { project ->
group = "com.studio"
afterEvaluate {
project.configurations.all {
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
exclude group: 'org.json', module: 'json'
exclude group: 'commons-logging', module: 'commons-logging'
exclude group: 'org.javassist', module: 'javassist'
exclude group: 'com.google.code.findbugs', module: 'jsr305'
exclude group: 'com.google.code.findbugs', module: 'annotations'
exclude group: 'org.glassfish', module: 'javax.annotation'
exclude module: 'xmlParserAPIs'
exclude module: 'xpp3'
exclude module: 'xmlpull'
if (it.name.contains("Test")) {
resolutionStrategy {
force 'io.reactivex:rxandroid:1.2.1'
force 'com.android.support:appcompat-v7:24.2.1'
force 'com.android.support:recyclerview-v7:24.2.1'
force 'com.android.support:animated-vector-drawable:24.2.1'
force 'com.android.support:support-v4:24.2.1'
}
}
resolutionStrategy {
force 'com.google.guava:guava:19.0'
}
}
if (project.plugins.hasPlugin('java')) {
addCommonConfigurationForJavaModules(project)
} else if (project.plugins.hasPlugin('com.android.application')
|| project.plugins.hasPlugin('com.android.library')) {
addCommonConfigurationForAndroidModules(project)
}
if (project.plugins.hasPlugin('com.android.application')) {
multidexApps.add(project.name)
project.android{
defaultConfig {
multiDexEnabled true
}
signingConfigs {
debug {
storeFile file('config/signing/debug.keystore')
}
}
buildTypes {
release {
signingConfig signingConfigs.debug
}
}
packagingOptions {
exclude 'META-INF/LICENSE'
}
dexOptions {
javaMaxHeapSize "4g"
}
}
}
}
}
def addCommonConfigurationForJavaModules(Project project) {
project.sourceCompatibility = JavaVersion.VERSION_1_7
project.targetCompatibility = JavaVersion.VERSION_1_7
}
def addCommonConfigurationForAndroidModules(Project project) {
project.android {
compileSdkVersion config.build.compileSdkVersion
buildToolsVersion config.build.buildToolsVersion
defaultConfig {
minSdkVersion config.build.minSdkVersion
targetSdkVersion config.build.targetSdkVersion
vectorDrawables.useSupportLibrary = true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
lintOptions {
abortOnError false
}
}
}
apply plugin: 'com.uber.okbuck'
okbuck {
linearAllocHardLimit = multidexApps.collectEntries { target ->
[target, 16 * 1024 * 1024]
}
extraBuckOpts = multidexApps.collectEntries { target ->
[target, ["binary": [
"trim_resource_ids = True",
]
]
]
}
}
def ENTRIES_TO_DELETE = [
'LICENSE.txt',
'LICENSE',
'NOTICE',
'asm-license.txt',
].join(" ")
def ARCHIVES = [
'.okbuck/cache/org.hamcrest.hamcrest-core-1.3.jar',
'.okbuck/cache/org.hamcrest.hamcrest-library-1.3.jar',
'.okbuck/cache/org.hamcrest.hamcrest-integration-1.3.jar',
'.okbuck/cache/org.mockito.mockito-core-1.10.19.jar',
'.okbuck/cache/org.assertj.assertj-core-1.7.1.jar',
]
afterEvaluate {
rootProject.tasks.getByName("okbuck").doLast {
ARCHIVES.each { archive ->
"zip -d ${archive} ${ENTRIES_TO_DELETE}".execute().waitFor()
}
}
}