mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
This also bumps up the build tools + Android gradle plugin version, since these were out of date, and removes a couple unused version values. PiperOrigin-RevId: 153652782
95 lines
3.0 KiB
Groovy
95 lines
3.0 KiB
Groovy
buildscript {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
dependencies {
|
|
classpath 'com.android.tools.build:gradle:2.3.1'
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
jcenter()
|
|
}
|
|
}
|
|
|
|
ext {
|
|
buildToolsVersion = '25.0.2'
|
|
compileSdkVersion = 25
|
|
minSdkVersion = 14
|
|
targetSdkVersion = 25
|
|
supportVersion = '25.3.1-SNAPSHOT'
|
|
|
|
testRunnerVersion = '0.6-alpha'
|
|
espressoVersion = '2.3-alpha'
|
|
|
|
// Enforce the use of prebuilt dependencies in all sub-projects. This is
|
|
// required for the doclava dependency.
|
|
usePrebuilts = "true"
|
|
|
|
// Disable pre-dexing when gradle called with -PdisablePreDex;
|
|
preDexLibs = !project.hasProperty('disablePreDex')
|
|
}
|
|
|
|
// lint every library
|
|
task(lint) << {
|
|
}
|
|
|
|
// TODO: setup docs build and API txt generation
|
|
|
|
task clean(type: Delete) {
|
|
delete rootProject.buildDir
|
|
}
|
|
|
|
subprojects {
|
|
version = rootProject.ext.supportVersion
|
|
// Set a different group for demos to resolve module name conflicts with other subprojects.
|
|
if (project.path.startsWith(':demos')) {
|
|
group = 'io.material.demo'
|
|
} else {
|
|
group = 'com.android.support'
|
|
}
|
|
|
|
project.plugins.whenPluginAdded { plugin ->
|
|
def isAndroidLibrary = "com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)
|
|
def isAndroidApp = "com.android.build.gradle.AppPlugin".equals(plugin.class.name)
|
|
def isAndroidTest = "com.android.build.gradle.TestPlugin".equals(plugin.class.name)
|
|
|
|
if (isAndroidLibrary || isAndroidApp) {
|
|
// Enable code coverage for debug builds only if we are not running inside the IDE,
|
|
// since enabling coverage reports breaks the method parameter resolution in the IDE
|
|
// debugger. Note that we avoid doing this for Android Test projects as it causes
|
|
// crashes on Dalvik ('Class ref in pre-verified class resolved to unexpected implementation')
|
|
project.android.buildTypes.debug.testCoverageEnabled = !hasProperty('android.injected.invoked.from.ide')
|
|
}
|
|
|
|
if (isAndroidLibrary || isAndroidApp || isAndroidTest) {
|
|
// Enforce NewApi lint check as fatal.
|
|
project.android.lintOptions.check 'NewApi'
|
|
project.android.lintOptions.fatal 'NewApi'
|
|
// Output lint errors on stdout
|
|
project.android.lintOptions.textReport true
|
|
project.android.lintOptions.textOutput 'stdout'
|
|
// Disable pre-dexing when gradle called with -PdisablePreDex;
|
|
project.android.dexOptions.preDexLibraries = rootProject.ext.preDexLibs
|
|
|
|
rootProject.lint.dependsOn project.lint
|
|
|
|
project.android {
|
|
compileSdkVersion rootProject.ext.compileSdkVersion
|
|
buildToolsVersion rootProject.ext.buildToolsVersion
|
|
|
|
defaultConfig.minSdkVersion rootProject.ext.minSdkVersion
|
|
defaultConfig.targetSdkVersion rootProject.ext.targetSdkVersion
|
|
// This disables the builds tools automatic vector -> PNG generation
|
|
defaultConfig.generatedDensities = []
|
|
|
|
compileOptions.sourceCompatibility JavaVersion.VERSION_1_7
|
|
compileOptions.targetCompatibility JavaVersion.VERSION_1_7
|
|
|
|
aaptOptions.additionalParameters "--no-version-vectors"
|
|
}
|
|
}
|
|
}
|
|
}
|