mirror of
https://github.com/material-components/material-components-android.git
synced 2026-02-20 08:39:55 +08:00
198 lines
6.7 KiB
Groovy
198 lines
6.7 KiB
Groovy
apply plugin: 'com.android.library'
|
|
apply plugin: 'com.github.dcendents.android-maven'
|
|
|
|
archivesBaseName = getArchivesBaseName(project.name)
|
|
version = rootProject.ext.mdcLibraryVersion
|
|
|
|
dependencies {
|
|
api compatibility("annotations")
|
|
api compatibility("compat")
|
|
api compatibility("core_ui")
|
|
api compatibility("core_utils")
|
|
api compatibility("fragment")
|
|
api compatibility("transition")
|
|
api compatibility("v7/appcompat")
|
|
api compatibility("v7/cardview")
|
|
api compatibility("v7/recyclerview")
|
|
|
|
testImplementation("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") {
|
|
exclude module: 'support-annotations'
|
|
}
|
|
testImplementation "junit:junit:4.12"
|
|
testImplementation "com.google.truth:truth:0.35"
|
|
testImplementation "org.mockito:mockito-core:1.9.5"
|
|
testImplementation "org.robolectric:robolectric:3.3.2"
|
|
}
|
|
|
|
def srcDirs = [
|
|
'com/google/android/material/animation',
|
|
'com/google/android/material/appbar',
|
|
'com/google/android/material/behavior',
|
|
'com/google/android/material/bottomappbar',
|
|
'com/google/android/material/bottomnavigation',
|
|
'com/google/android/material/bottomsheet',
|
|
'com/google/android/material/button',
|
|
'com/google/android/material/canvas',
|
|
'com/google/android/material/card',
|
|
'com/google/android/material/checkbox',
|
|
'com/google/android/material/chip',
|
|
'com/google/android/material/circularreveal',
|
|
'com/google/android/material/circularreveal/cardview',
|
|
'com/google/android/material/circularreveal/coordinatorlayout',
|
|
'com/google/android/material/color',
|
|
'com/google/android/material/dialog',
|
|
'com/google/android/material/drawable',
|
|
'com/google/android/material/expandable',
|
|
'com/google/android/material/floatingactionbutton',
|
|
'com/google/android/material/internal',
|
|
'com/google/android/material/math',
|
|
'com/google/android/material/menu',
|
|
'com/google/android/material/navigation',
|
|
'com/google/android/material/radiobutton',
|
|
'com/google/android/material/resources',
|
|
'com/google/android/material/ripple',
|
|
'com/google/android/material/shape',
|
|
'com/google/android/material/shadow',
|
|
'com/google/android/material/snackbar',
|
|
'com/google/android/material/stateful',
|
|
'com/google/android/material/switchmaterial',
|
|
'com/google/android/material/tabs',
|
|
'com/google/android/material/textfield',
|
|
'com/google/android/material/theme',
|
|
'com/google/android/material/transformation',
|
|
'com/google/android/material/typography',
|
|
]
|
|
|
|
android {
|
|
sourceSets {
|
|
main.manifest.srcFile 'java/com/google/android/material/AndroidManifest.xml'
|
|
main.java.srcDir 'java'
|
|
main.java.includes = srcDirs.collect { it + '/**/*.java' }
|
|
main.java.excludes = [
|
|
'**/build/**',
|
|
]
|
|
srcDirs.forEach {
|
|
main.res.srcDirs += 'java/' + it + '/res'
|
|
main.res.srcDirs += 'java/' + it + '/res-public'
|
|
}
|
|
|
|
test.java.srcDir 'javatests'
|
|
}
|
|
|
|
testOptions.unitTests.includeAndroidResources = true
|
|
|
|
buildTypes.all {
|
|
consumerProguardFiles 'proguard-behaviors.pro', 'proguard-inflater.pro'
|
|
}
|
|
}
|
|
|
|
// Add the resource directories to the main sourceSet for all test tasks
|
|
gradle.projectsEvaluated {
|
|
tasks.withType(Test) { task ->
|
|
srcDirs.forEach {
|
|
android.sourceSets.main.res.srcDirs += 'javatests/' + it + '/res'
|
|
}
|
|
}
|
|
}
|
|
|
|
task generateJavadocs(type: Javadoc, dependsOn: ':lib:compileReleaseJavaWithJavac') {
|
|
if (project.hasProperty("online")) {
|
|
options.addStringOption("toroot", "/")
|
|
options.addStringOption("hdf", "android.whichdoc online")
|
|
options.addStringOption("hdf", "dac")
|
|
options.addBooleanOption("devsite", true)
|
|
options.addBooleanOption("yamlV2", true)
|
|
options.addStringOption("dac_libraryroot", "com/google/android/material")
|
|
options.addStringOption("dac_dataname", "MATERIAL_DATA")
|
|
}
|
|
|
|
if (project.hasProperty("docletPathRoot")) {
|
|
def docletPathRoot = project.property("docletPathRoot")
|
|
def outputPath = project.hasProperty("outputPath") ? project.property("outputPath") : "doclava-out"
|
|
|
|
source = android.sourceSets.main.java.source
|
|
source = source.findAll { it.name.endsWith(".java") }
|
|
include '**/com/google/android/material/**'
|
|
|
|
title = null
|
|
destinationDir = new File(outputPath)
|
|
classpath = files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
|
|
options.addStringOption("federate Android", "https://developer.android.com")
|
|
options.encoding = "UTF-8"
|
|
options.doclet = "com.google.doclava.Doclava"
|
|
options.docletpath = [
|
|
file(docletPathRoot + "/doclava/current/doclava.jar"),
|
|
file(docletPathRoot + "/jsilver/v1_0_0/jsilver.jar")
|
|
]
|
|
}
|
|
}
|
|
|
|
task getVersion << {
|
|
println version
|
|
}
|
|
|
|
task generateApiXml(type: Javadoc, dependsOn: ':lib:compileReleaseJavaWithJavac') {
|
|
if (project.hasProperty("apiName")) {
|
|
def jdiff = project.property("jdiffJar")
|
|
def apiName = project.property("apiName")
|
|
source = android.sourceSets.main.java.source
|
|
source = source.findAll { it.name.endsWith(".java") }
|
|
classpath = files("${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
|
|
include '**/com/google/android/material/**'
|
|
options.doclet = "jdiff.JDiff"
|
|
options.addStringOption("subpackages", ".")
|
|
options.addStringOption("apiname", apiName)
|
|
options.docletpath = [
|
|
file(jdiff),
|
|
]
|
|
}
|
|
}
|
|
|
|
task generateJdiffReport(type: Javadoc) {
|
|
if (project.hasProperty("oldApi")) {
|
|
def outputPath = project.hasProperty("outputPath") ? project.property("outputPath") : "diffs-out"
|
|
def jdiff = project.property("jdiffjar")
|
|
def xerces = project.property("xercesjar")
|
|
def oldApi = project.property("oldApi")
|
|
def newApi = project.property("newApi")
|
|
def newApiDir = project.property("newApiDir")
|
|
def oldApiDir = project.property("oldApiDir")
|
|
destinationDir = new File(outputPath)
|
|
options.doclet = "jdiff.JDiff"
|
|
options.addStringOption("subpackages", ".")
|
|
options.addStringOption("newapidir", newApiDir)
|
|
options.addStringOption("oldapidir", oldApiDir)
|
|
options.addStringOption("oldapi", oldApi)
|
|
options.addBooleanOption("verbose", true)
|
|
options.addStringOption("newapi", newApi)
|
|
options.docletpath = [
|
|
file(jdiff),
|
|
file(xerces),
|
|
]
|
|
}
|
|
}
|
|
|
|
afterEvaluate {
|
|
addResources([generateJavadocs, generateApiXml])
|
|
}
|
|
|
|
def addResources(tasks) {
|
|
tasks.each {
|
|
def releaseVariant = android.libraryVariants.find { it.name == 'release' }
|
|
it.classpath += files(android.libraryVariants.collect { variant ->
|
|
variant.javaCompile.classpath.files
|
|
})
|
|
it.classpath += releaseVariant.getCompileClasspath(null)
|
|
it.classpath += it.project.files(releaseVariant.javaCompile.destinationDir)
|
|
it.source += releaseVariant.javaCompile.source
|
|
}
|
|
}
|
|
|
|
uploadArchives {
|
|
repositories {
|
|
mavenDeployer {
|
|
repository(url: rootProject.ext.mavenRepoUrl)
|
|
}
|
|
}
|
|
}
|