From 0625dfe0e9904f84ff066b602cfc266a127fd18a Mon Sep 17 00:00:00 2001 From: travisc Date: Wed, 7 Dec 2016 23:09:24 +0000 Subject: [PATCH] Setup a basic gradle build. Any interaction with Maven is missing, and docs/API txt's are not currently generating. These will be done in future CLs. PiperOrigin-RevId: 141363143 --- .gitignore | 2 +- build.gradle | 70 +++++++++++++++++++ .../AndroidManifest.xml | 0 lib/build.gradle | 48 +++---------- 4 files changed, 79 insertions(+), 41 deletions(-) create mode 100644 build.gradle rename AndroidManifest.xml => lib/AndroidManifest.xml (100%) diff --git a/.gitignore b/.gitignore index 166f30bf0..e2c287452 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,6 @@ /.idea/workspace.xml /.idea/libraries .DS_Store -/build +build/ /captures .externalNativeBuild diff --git a/build.gradle b/build.gradle new file mode 100644 index 000000000..6d6949065 --- /dev/null +++ b/build.gradle @@ -0,0 +1,70 @@ +buildscript { + repositories { + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:2.2.2' + } +} + +allprojects { + repositories { + jcenter() + } +} + +ext { + extraVersion = 40 + buildNumber = Integer.toString(extraVersion) + buildToolsVersion = '24.0.1' + compileSdkVersion = 25 + minSdkVersion = 9 + targetSdkVersion = 25 + supportVersion = '25.1.0-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" +} + +// 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 + 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 isJavaLibrary = "org.gradle.api.plugins.JavaPlugin".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. + project.android.buildTypes.debug.testCoverageEnabled = !hasProperty('android.injected.invoked.from.ide') + + // TODO: setup code coverage collection for tests + + // Enforce NewApi lint check as fatal. + project.android.lintOptions.check 'NewApi' + project.android.lintOptions.fatal 'NewApi' + project.parent.lint.dependsOn project.lint + } + + if (isAndroidLibrary || isJavaLibrary) { + // TODO: setup maven release building? + } + } +} diff --git a/AndroidManifest.xml b/lib/AndroidManifest.xml similarity index 100% rename from AndroidManifest.xml rename to lib/AndroidManifest.xml diff --git a/lib/build.gradle b/lib/build.gradle index 8ae45d7a4..6db39d9e3 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -3,10 +3,10 @@ apply plugin: 'com.android.library' archivesBaseName = 'design' dependencies { - compile project(':support-v4') - compile project(':support-appcompat-v7') - compile project(':support-recyclerview-v7') - compile project(':support-transition') + compile 'com.android.support:support-v4:25.0.1' + compile 'com.android.support:appcompat-v7:25.0.1' + compile 'com.android.support:recyclerview-v7:25.0.1' + compile 'com.android.support:transition:25.0.1' androidTestCompile ("com.android.support.test:runner:${project.rootProject.ext.testRunnerVersion}") { exclude module: 'support-annotations' @@ -21,10 +21,12 @@ dependencies { } android { - compileSdkVersion project.ext.currentSdk + compileSdkVersion rootProject.ext.compileSdkVersion + buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { - minSdkVersion 9 + minSdkVersion rootProject.ext.minSdkVersion + targetSdkVersion rootProject.ext.targetSdkVersion testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" // This disables the builds tools automatic vector -> PNG generation generatedDensities = [] @@ -96,37 +98,3 @@ android.libraryVariants.all { variant -> artifacts.add('archives', javadocJarTask); artifacts.add('archives', sourcesJarTask); } - -uploadArchives { - repositories { - mavenDeployer { - repository(url: uri(rootProject.ext.supportRepoOut)) { - } - - pom.project { - name 'Android Design Support Library' - description "The Support Library is a static library that you can add to your Android application in order to use APIs that are either not available for older platform versions or utility APIs that aren't a part of the framework APIs. Compatible on devices running API 4 or later." - url 'http://developer.android.com/tools/extras/support-library.html' - inceptionYear '2011' - - licenses { - license { - name 'The Apache Software License, Version 2.0' - url 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution 'repo' - } - } - - scm { - url "http://source.android.com" - connection "scm:git:https://android.googlesource.com/platform/frameworks/support" - } - developers { - developer { - name 'The Android Open Source Project' - } - } - } - } - } -}