summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@google.com>2014-10-27 21:12:20 -0700
committerXavier Ducrohet <xav@google.com>2014-10-28 09:51:52 -0700
commitb98bb46334f2cead330588b9bc7c92361c54bb5b (patch)
treef29db613e732b13a8b3e35f74618db9decabab9e
parent6624fbd355c4b3c874bec920aab662b2056a7278 (diff)
downloadandroid_frameworks_multidex-b98bb46334f2cead330588b9bc7c92361c54bb5b.tar.gz
android_frameworks_multidex-b98bb46334f2cead330588b9bc7c92361c54bb5b.tar.bz2
android_frameworks_multidex-b98bb46334f2cead330588b9bc7c92361c54bb5b.zip
Enable building the multi-dex libs for shipping.
This is mostly a copy of the support libs' gradle files, in order to generate a support library that will contain the current public versions + the new version being built. Change-Id: I4937073909206653bd0ffd128694161cf59445a9
-rw-r--r--build.gradle159
-rw-r--r--gradle/wrapper/gradle-wrapper.jarbin0 -> 51106 bytes
-rw-r--r--gradle/wrapper/gradle-wrapper.properties6
-rwxr-xr-xgradlew174
-rw-r--r--instrumentation/AndroidManifest.xml1
-rw-r--r--instrumentation/build.gradle58
-rw-r--r--library/build.gradle37
-rw-r--r--settings.gradle2
8 files changed, 437 insertions, 0 deletions
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 0000000..d85baa3
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1,159 @@
+buildscript {
+ repositories {
+ maven { url '../../prebuilts/gradle-plugin' }
+ maven { url '../../prebuilts/tools/common/m2/repository' }
+ maven { url '../../prebuilts/tools/common/m2/internal' }
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:0.10.0'
+ }
+}
+
+ext.supportVersion = '1.0.0'
+ext.extraVersion = 8
+ext.supportRepoOut = ''
+ext.buildToolsVersion = '19.0.3'
+
+/*
+ * With the build server you are given two env variables.
+ * The OUT_DIR is a temporary directory you can use to put things during the build.
+ * The DIST_DIR is where you want to save things from the build.
+ *
+ * The build server will copy the contents of DIST_DIR to somewhere and make it available.
+ */
+if (System.env.DIST_DIR != null && System.env.OUT_DIR != null) {
+ buildDir = new File(System.env.OUT_DIR + '/gradle/frameworks/support/build').getCanonicalFile()
+ project.ext.distDir = new File(System.env.DIST_DIR).getCanonicalFile()
+} else {
+ buildDir = file('../../out/host/gradle/frameworks/support/build')
+ project.ext.distDir = file('../../out/dist')
+}
+
+ext.supportRepoOut = new File(buildDir, 'support_repo')
+
+// Main task called by the build server.
+task(createArchive) << {
+}
+
+// upload anchor for subprojects to upload their artifacts
+// to the local repo.
+task(mainUpload) << {
+}
+
+// repository creation task
+task createRepository(type: Zip, dependsOn: mainUpload) {
+ from project.ext.supportRepoOut
+ destinationDir project.ext.distDir
+ into 'm2repository'
+ baseName = String.format("android_m2repository_r%02d", project.ext.extraVersion)
+}
+createArchive.dependsOn createRepository
+
+// prepare repository with older versions
+task unzipRepo(type: Copy) {
+ from "$rootDir/../../prebuilts/maven_repo/android"
+ into project.ext.supportRepoOut
+}
+
+unzipRepo.doFirst {
+ project.ext.supportRepoOut.deleteDir()
+ project.ext.supportRepoOut.mkdirs()
+}
+
+// anchor for prepare repo. This is post unzip + sourceProp.
+task(prepareRepo) << {
+}
+
+import com.google.common.io.Files
+import com.google.common.base.Charsets
+
+task(createXml) << {
+ def repoArchive = createRepository.archivePath
+ def repoArchiveName = createRepository.archiveName
+ def size = repoArchive.length()
+ def sha1 = getSha1(repoArchive)
+
+ def xml =
+"<sdk:sdk-addon xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:sdk=\"http://schemas.android.com/sdk/android/addon/6\">\n\
+ <sdk:extra>\n\
+ <sdk:revision>\n\
+ <sdk:major>${project.ext.extraVersion}</sdk:major>\n\
+ </sdk:revision>\n\
+ <sdk:vendor-display>Android</sdk:vendor-display>\n\
+ <sdk:vendor-id>android</sdk:vendor-id>\n\
+ <sdk:name-display>Local Maven repository for Support Libraries</sdk:name-display>\n\
+ <sdk:path>m2repository</sdk:path>\n\
+ <sdk:archives>\n\
+ <sdk:archive os=\"any\" arch=\"any\">\n\
+ <sdk:size>${size}</sdk:size>\n\
+ <sdk:checksum type=\"sha1\">${sha1}</sdk:checksum>\n\
+ <sdk:url>${repoArchiveName}</sdk:url>\n\
+ </sdk:archive>\n\
+ </sdk:archives>\n\
+ </sdk:extra>\n\
+</sdk:sdk-addon>"
+
+ Files.write(xml, new File(project.ext.distDir, 'repo-extras.xml'), Charsets.UTF_8)
+}
+createArchive.dependsOn createXml
+
+task(createSourceProp) << {
+ def sourceProp =
+"Extra.VendorDisplay=Android\n\
+Extra.Path=m2repository\n\
+Archive.Arch=ANY\n\
+Extra.NameDisplay=Android Support Repository\n\
+Archive.Os=ANY\n\
+Pkg.Revision=${project.ext.extraVersion}.0.0\n\
+Extra.VendorId=android"
+
+ Files.write(sourceProp, new File(project.ext.supportRepoOut, 'source.properties'), Charsets.UTF_8)
+}
+createSourceProp.dependsOn unzipRepo
+prepareRepo.dependsOn createSourceProp
+
+
+import com.google.common.hash.HashCode
+import com.google.common.hash.HashFunction
+import com.google.common.hash.Hashing
+
+def getSha1(File inputFile) {
+ HashFunction hashFunction = Hashing.sha1()
+ HashCode hashCode = hashFunction.hashString(inputFile.getAbsolutePath())
+ return hashCode.toString()
+}
+
+subprojects {
+ // Change buildDir first so that all plugins pick up the new value.
+ project.buildDir = project.file("$project.parent.buildDir/../$project.name/build")
+
+ apply plugin: 'maven'
+
+ version = rootProject.ext.supportVersion
+ group = 'com.android.support'
+
+ task release(type: Upload) {
+ configuration = configurations.archives
+ repositories {
+ mavenDeployer {
+ repository(url: uri("$rootProject.ext.supportRepoOut"))
+ }
+ }
+ }
+
+ // before the upload, make sure the repo is ready.
+ release.dependsOn rootProject.tasks.prepareRepo
+ // make the mainupload depend on this one.
+ mainUpload.dependsOn release
+
+ project.plugins.whenPluginAdded { plugin ->
+ if ("com.android.build.gradle.LibraryPlugin".equals(plugin.class.name)) {
+ project.android.buildToolsVersion = rootProject.buildToolsVersion
+ }
+ }
+}
+
+FileCollection getAndroidPrebuilt(String apiLevel) {
+ files("$rootDir/../../prebuilts/sdk/$apiLevel/android.jar")
+}
+
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..3c7abdf
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..127125b
--- /dev/null
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Tue Mar 18 16:49:12 PDT 2014
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=../../../../tools/external/gradle/gradle-1.11-bin.zip
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..89509d7
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,174 @@
+#!/usr/bin/env bash
+
+##############################################################################
+##
+## Gradle start up script for UN*X
+##
+##############################################################################
+
+# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+APP_NAME="Gradle"
+APP_BASE_NAME=`basename "$0"`
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD="maximum"
+
+warn ( ) {
+ echo "$*"
+}
+
+die ( ) {
+ echo
+ echo "$*"
+ echo
+ exit 1
+}
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+case "`uname`" in
+ CYGWIN* )
+ cygwin=true
+ ;;
+ Darwin* )
+ darwin=true
+ ;;
+ MINGW* )
+ msys=true
+ ;;
+esac
+
+# For Cygwin, ensure paths are in UNIX format before anything is touched.
+if $cygwin ; then
+ [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
+fi
+
+# Attempt to set APP_HOME
+# Resolve links: $0 may be a link
+PRG="$0"
+# Need this for relative symlinks.
+while [ -h "$PRG" ] ; do
+ ls=`ls -ld "$PRG"`
+ link=`expr "$ls" : '.*-> \(.*\)$'`
+ if expr "$link" : '/.*' > /dev/null; then
+ PRG="$link"
+ else
+ PRG=`dirname "$PRG"`"/$link"
+ fi
+done
+SAVED="`pwd`"
+cd "`dirname \"$PRG\"`/" >&-
+APP_HOME="`pwd -P`"
+cd "$SAVED" >&-
+
+CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD="$JAVA_HOME/jre/sh/java"
+ else
+ JAVACMD="$JAVA_HOME/bin/java"
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ JAVACMD="java"
+ which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
+ MAX_FD_LIMIT=`ulimit -H -n`
+ if [ $? -eq 0 ] ; then
+ if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
+ MAX_FD="$MAX_FD_LIMIT"
+ fi
+ ulimit -n $MAX_FD
+ if [ $? -ne 0 ] ; then
+ warn "Could not set maximum file descriptor limit: $MAX_FD"
+ fi
+ else
+ warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
+ fi
+fi
+
+# For Darwin, add options to specify how the application appears in the dock
+if $darwin; then
+ GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
+fi
+
+# For Cygwin, switch paths to Windows format before running java
+if $cygwin ; then
+ APP_HOME=`cygpath --path --mixed "$APP_HOME"`
+ CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
+ # We build the pattern for arguments to be converted via cygpath
+ ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
+ SEP=""
+ for dir in $ROOTDIRSRAW ; do
+ ROOTDIRS="$ROOTDIRS$SEP$dir"
+ SEP="|"
+ done
+ OURCYGPATTERN="(^($ROOTDIRS))"
+ # Add a user-defined pattern to the cygpath arguments
+ if [ "$GRADLE_CYGPATTERN" != "" ] ; then
+ OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
+ fi
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ i=0
+ for arg in "$@" ; do
+ CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
+ CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
+
+ if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
+ eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
+ else
+ eval `echo args$i`="\"$arg\""
+ fi
+ i=$((i+1))
+ done
+ case $i in
+ (0) set -- ;;
+ (1) set -- "$args0" ;;
+ (2) set -- "$args0" "$args1" ;;
+ (3) set -- "$args0" "$args1" "$args2" ;;
+ (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
+ (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
+ (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
+ (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
+ (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
+ (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
+ esac
+fi
+
+# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
+function splitJvmOpts() {
+ JVM_OPTS=("$@")
+}
+eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
+JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+
+# Change the project's .gradle to the android out dir.
+ANDROID_GRADLE_ROOT="$APP_HOME/../../out/host/gradle/frameworks/support"
+if [[ -z "$ANDROID_CACHE_DIR" ]]; then
+ ANDROID_CACHE_DIR="$ANDROID_GRADLE_ROOT/.gradle"
+fi
+
+# Change the local user directories to be under the android out dir
+export GRADLE_USER_HOME="$ANDROID_GRADLE_ROOT/.gradle"
+export M2_HOME="$ANDROID_GRADLE_ROOT/.m2"
+
+exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain --project-cache-dir=$ANDROID_CACHE_DIR "$@"
diff --git a/instrumentation/AndroidManifest.xml b/instrumentation/AndroidManifest.xml
index f29fe15..c3ac899 100644
--- a/instrumentation/AndroidManifest.xml
+++ b/instrumentation/AndroidManifest.xml
@@ -16,4 +16,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="android.support.multidex">
<uses-sdk android:minSdkVersion="4"/>
+ <application />
</manifest>
diff --git a/instrumentation/build.gradle b/instrumentation/build.gradle
new file mode 100644
index 0000000..15ea3e8
--- /dev/null
+++ b/instrumentation/build.gradle
@@ -0,0 +1,58 @@
+apply plugin: 'android-library'
+archivesBaseName = 'multidex-instrumentation'
+
+android {
+ compileSdkVersion 4
+
+ sourceSets {
+ main {
+ java.srcDirs = ['src']
+ resources.srcDirs = ['res']
+ res.srcDirs = ['src']
+ manifest.srcFile 'AndroidManifest.xml'
+ }
+ }
+
+ lintOptions {
+ // TODO: fix errors and reenable.
+ abortOnError false
+ }
+}
+
+dependencies {
+ compile project(':library')
+}
+
+uploadArchives {
+ repositories {
+ mavenDeployer {
+ repository(url: uri(rootProject.ext.supportRepoOut)) {
+ }
+
+ pom.project {
+ name 'Android Multi-Dex Instrumentation Library'
+ description "Library for legacy multi-dex support"
+ url ''
+ inceptionYear '2013'
+
+ 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/multidex"
+ }
+ developers {
+ developer {
+ name 'The Android Open Source Project'
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/library/build.gradle b/library/build.gradle
index 0fe5882..f04615d 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -1,6 +1,9 @@
apply plugin: 'android-library'
+archivesBaseName = 'multidex'
android {
+ compileSdkVersion 4
+
sourceSets {
main {
java.srcDirs = ['src']
@@ -15,3 +18,37 @@ android {
abortOnError false
}
}
+
+uploadArchives {
+ repositories {
+ mavenDeployer {
+ repository(url: uri(rootProject.ext.supportRepoOut)) {
+ }
+
+ pom.project {
+ name 'Android Multi-Dex Library'
+ description "Library for legacy multi-dex support"
+ url ''
+ inceptionYear '2013'
+
+ 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/multidex"
+ }
+ developers {
+ developer {
+ name 'The Android Open Source Project'
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle
new file mode 100644
index 0000000..c1c64f3
--- /dev/null
+++ b/settings.gradle
@@ -0,0 +1,2 @@
+include ':library'
+include ':instrumentation'