Build leanback with Gradle.
Change-Id: Id3a2664149aa18b865957dca6aa8d44e3c062e62
diff --git a/settings.gradle b/settings.gradle
index 2104257..b92434f 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -18,3 +18,6 @@
include ':support-v13'
project(':support-v13').projectDir = new File(rootDir, 'v13')
+
+include ':support-leanback-v17'
+project(':support-leanback-v17').projectDir = new File(rootDir, 'v17/leanback')
diff --git a/v17/leanback/build.gradle b/v17/leanback/build.gradle
index 89d5f3b..92e9efd 100644
--- a/v17/leanback/build.gradle
+++ b/v17/leanback/build.gradle
@@ -8,21 +8,96 @@
}
android {
- compileSdkVersion 'current'
+ // WARNING: should be 17
+ compileSdkVersion 19
+
buildToolsVersion "19.0.1"
+ defaultConfig {
+ minSdkVersion 17
+ // TODO: get target from branch
+ //targetSdkVersion 19
+ }
+
sourceSets {
main.manifest.srcFile 'AndroidManifest.xml'
- main.java.srcDirs = [
- 'src',
- 'kitkat',
- 'jbmr2'
- ]
- main.res.srcDir 'res'
+ main.java.srcDirs = ['common', 'jbmr2', 'kitkat', 'src']
+ main.aidl.srcDirs = ['common', 'jbmr2', 'kitkat', 'src']
+ main.res.srcDirs = ['res']
+
+ androidTest.setRoot('tests')
+ androidTest.java.srcDir 'tests/java'
}
lintOptions {
// TODO: fix errors and reenable.
abortOnError false
}
-}
\ No newline at end of file
+}
+
+android.libraryVariants.all { variant ->
+ def name = variant.buildType.name
+
+ if (name.equals(com.android.builder.BuilderConstants.DEBUG)) {
+ return; // Skip debug builds.
+ }
+ def suffix = name.capitalize()
+
+ def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
+ dependsOn variant.javaCompile
+ from variant.javaCompile.destinationDir
+ from 'LICENSE.txt'
+ }
+ def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
+ source android.sourceSets.main.allJava
+ classpath = files(variant.javaCompile.classpath.files) + files(
+ "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
+ }
+
+ def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
+ classifier = 'javadoc'
+ from 'build/docs/javadoc'
+ }
+
+ def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.allSource
+ }
+
+ artifacts.add('archives', javadocJarTask);
+ artifacts.add('archives', sourcesJarTask);
+}
+
+uploadArchives {
+ repositories {
+ mavenDeployer {
+ repository(url: uri(rootProject.ext.supportRepoOut)) {
+ }
+
+ pom.project {
+ name 'Android Support Leanback v17'
+ description "Android Support Leanback v17"
+ 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'
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/v4/build.gradle b/v4/build.gradle
index 52f5b6e..59790bd 100644
--- a/v4/build.gradle
+++ b/v4/build.gradle
@@ -1,6 +1,11 @@
apply plugin: 'android-library'
archivesBaseName = 'support-v4'
+// create a jar task for the code internal implementation
+tasks.create(name: "internalJar", type: Jar) {
+ baseName "internal_impl"
+}
+
// --------------------------
// TO ADD NEW PLATFORM SPECIFIC CODE, UPDATE THIS:
// create and configure the sourcesets/dependencies for platform-specific code.
@@ -36,6 +41,9 @@
setupDependencies(configName, previousSource)
}
ext.allSS.add(sourceSet)
+
+ internalJar.from sourceSet.output
+
return sourceSet
}
@@ -44,15 +52,6 @@
project.getDependencies().add(configName, previousSourceSet.compileClasspath)
}
-// create a jar task for the code above
-tasks.create(name: "internalJar", type: Jar) {
- baseName "internal_impl"
-}
-
-ext.allSS.each { ss ->
- internalJar.from ss.output
-}
-
dependencies {
compile project(':support-annotations')
diff --git a/v7/recyclerview/build.gradle b/v7/recyclerview/build.gradle
index f7d0607..40a58ad 100644
--- a/v7/recyclerview/build.gradle
+++ b/v7/recyclerview/build.gradle
@@ -10,6 +10,10 @@
compileSdkVersion 7
buildToolsVersion "19.0.1"
+ defaultConfig {
+ minSdkVersion 7
+ }
+
sourceSets {
main.manifest.srcFile 'AndroidManifest.xml'
main.java.srcDir 'src'
@@ -21,4 +25,71 @@
// TODO: fix errors and reenable.
abortOnError false
}
-}
\ No newline at end of file
+}
+
+android.libraryVariants.all { variant ->
+ def name = variant.buildType.name
+
+ if (name.equals(com.android.builder.BuilderConstants.DEBUG)) {
+ return; // Skip debug builds.
+ }
+ def suffix = name.capitalize()
+
+ def jarTask = project.tasks.create(name: "jar${suffix}", type: Jar){
+ dependsOn variant.javaCompile
+ from variant.javaCompile.destinationDir
+ from 'LICENSE.txt'
+ }
+ def javadocTask = project.tasks.create(name: "javadoc${suffix}", type: Javadoc) {
+ source android.sourceSets.main.allJava
+ classpath = files(variant.javaCompile.classpath.files) + files(
+ "${android.plugin.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar")
+ }
+
+ def javadocJarTask = project.tasks.create(name: "javadocJar${suffix}", type: Jar) {
+ classifier = 'javadoc'
+ from 'build/docs/javadoc'
+ }
+
+ def sourcesJarTask = project.tasks.create(name: "sourceJar${suffix}", type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.allSource
+ }
+
+ artifacts.add('archives', javadocJarTask);
+ artifacts.add('archives', sourcesJarTask);
+}
+
+uploadArchives {
+ repositories {
+ mavenDeployer {
+ repository(url: uri(rootProject.ext.supportRepoOut)) {
+ }
+
+ pom.project {
+ name 'Android Support RecyclerView v7'
+ description "Android Support RecyclerView v7"
+ 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'
+ }
+ }
+ }
+ }
+ }
+}