summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-build-prod (mdb) <android-build-team-robot@google.com>2019-10-08 00:35:36 +0000
committerandroid-build-prod (mdb) <android-build-team-robot@google.com>2019-10-08 00:35:36 +0000
commit171759a1b51ab7e7ca40f2da65bf0f431d7f24d7 (patch)
tree39a3f8a28908e4472402613f4ccb3205ef128087
parent7c0e6bfbd0769c9d82fa6c99ea7f52294515a4db (diff)
parent69445972703ba195cc120e1c4daf4fab3f40f000 (diff)
downloadmultidex-171759a1b51ab7e7ca40f2da65bf0f431d7f24d7.tar.gz
Snap for 5925869 from 69445972703ba195cc120e1c4daf4fab3f40f000 to sdk-releaseplatform-tools-29.0.5
Change-Id: Ib19eb058f1dbf7b450de85b37ff45f137409bcfe
-rw-r--r--.gitignore4
-rw-r--r--build.gradle32
-rw-r--r--gradle.properties6
-rw-r--r--gradle/wrapper/gradle-wrapper.properties2
-rw-r--r--instrumentation/build.gradle2
-rw-r--r--library/build.gradle18
-rw-r--r--library/src/androidx/multidex/MultiDexExtractor.java7
-rw-r--r--settings.gradle3
8 files changed, 43 insertions, 31 deletions
diff --git a/.gitignore b/.gitignore
index 639cdd5..cd8d22c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,5 @@
local.properties
+.gradle
+.idea
+*.iml
+library
diff --git a/build.gradle b/build.gradle
index c30a000..45d505b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -19,34 +19,28 @@ import org.gradle.internal.os.OperatingSystem
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:2.3.0'
+ classpath 'com.android.tools.build:gradle:3.0.1'
}
}
apply from: 'version.gradle'
-final String platform = OperatingSystem.current().isMacOsX() ? 'darwin' : 'linux'
-System.setProperty('android.dir', "${rootDir}/../../")
-final String fullSdkPath = "${rootDir}/../../prebuilts/fullsdk-${platform}"
-if (file(fullSdkPath).exists()) {
- gradle.ext.currentSdk = 26
- ext.buildToolsVersion = '26.0.0'
- project.ext.androidJar = files("${fullSdkPath}/platforms/android-${gradle.currentSdk}/android.jar")
- System.setProperty('android.home', "${rootDir}/../../prebuilts/fullsdk-${platform}")
- File props = file("local.properties")
- props.write "sdk.dir=${fullSdkPath}"
-} else {
- gradle.ext.currentSdk = 'current'
- ext.buildToolsVersion = '26.0.0'
- project.ext.androidJar = files("${project.rootDir}/../../prebuilts/sdk/current/public/android.jar")
- File props = file("local.properties")
- props.write "android.dir=../../"
+String platform = OperatingSystem.current().isMacOsX() ? 'darwin' : 'linux'
+File fullSdkPath = file("${rootDir}/../../prebuilts/fullsdk-${platform}")
+if (!fullSdkPath.exists()) {
+ throw GradleException("missing fullsdk")
}
+gradle.ext.currentSdk = 28
+ext.buildToolsVersion = '27.0.3'
+project.ext.fullSdkPath = fullSdkPath
+project.ext.androidJar = files("${fullSdkPath}/platforms/android-${gradle.currentSdk}/android.jar")
+
+File props = file("local.properties")
+props.write "sdk.dir=${fullSdkPath.getAbsolutePath()}"
+
/*
* 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.
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..2b49a88
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,6 @@
+org.gradle.jvmargs=-Xmx4g
+org.gradle.daemon=true
+org.gradle.configureondemand=true
+org.gradle.parallel=true
+org.gradle.caching=true
+android.builder.sdkDownload=false
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 84939b4..3d7397a 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=../../../../tools/external/gradle/gradle-3.3-bin.zip
+distributionUrl=../../../../tools/external/gradle/gradle-4.8-bin.zip
diff --git a/instrumentation/build.gradle b/instrumentation/build.gradle
index 1e6fd98..fe6d8ee 100644
--- a/instrumentation/build.gradle
+++ b/instrumentation/build.gradle
@@ -21,7 +21,7 @@ dependencies {
}
android {
- compileSdkVersion 4
+ compileSdkVersion gradle.currentSdk
defaultConfig {
minSdkVersion 4
diff --git a/library/build.gradle b/library/build.gradle
index 1f17008..fe707f0 100644
--- a/library/build.gradle
+++ b/library/build.gradle
@@ -55,15 +55,21 @@ android {
manifest.srcFile 'AndroidManifest.xml'
}
}
+}
+
+android.libraryVariants.all { variant ->
+ variant.getJavaCompiler().dependsOn(makeVersionFile)
- lintOptions {
- // TODO: fix errors and reenable.
- abortOnError false
+ if (!name.equals(com.android.builder.core.BuilderConstants.RELEASE)) {
+ return // Skip non-release
}
-}
-android.libraryVariants.all {
- v -> v.getJavaCompiler().dependsOn(makeVersionFile)
+
+ def sourceJar = project.tasks.create(name: "sourceJarRelease", type: Jar) {
+ classifier = 'sources'
+ from android.sourceSets.main.java.srcDirs
+ }
+ artifacts.add("archives", sourceJar)
}
uploadArchives {
diff --git a/library/src/androidx/multidex/MultiDexExtractor.java b/library/src/androidx/multidex/MultiDexExtractor.java
index 2b96113..a63d724 100644
--- a/library/src/androidx/multidex/MultiDexExtractor.java
+++ b/library/src/androidx/multidex/MultiDexExtractor.java
@@ -20,6 +20,7 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.util.Log;
+
import java.io.BufferedOutputStream;
import java.io.Closeable;
import java.io.File;
@@ -177,7 +178,11 @@ final class MultiDexExtractor implements Closeable {
final String extractedFilePrefix = sourceApk.getName() + EXTRACTED_NAME_EXT;
SharedPreferences multiDexPreferences = getMultiDexPreferences(context);
- int totalDexNumber = multiDexPreferences.getInt(prefsKeyPrefix + KEY_DEX_NUMBER, 1);
+ int totalDexNumber = multiDexPreferences.getInt(prefsKeyPrefix + KEY_DEX_NUMBER, 0);
+ if (totalDexNumber < 1) {
+ // Guard against SharedPreferences corruption
+ throw new IOException("Invalid dex number: " + totalDexNumber);
+ }
final List<ExtractedDex> files = new ArrayList<ExtractedDex>(totalDexNumber - 1);
for (int secondaryNumber = 2; secondaryNumber <= totalDexNumber; secondaryNumber++) {
diff --git a/settings.gradle b/settings.gradle
index 7fffc9b..f4605ce 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -16,6 +16,3 @@
include ':multidex'
project(':multidex').projectDir = new File(rootDir, 'library')
-
-include ':multidex-instrumentation'
-project(':multidex-instrumentation').projectDir = new File(rootDir, 'instrumentation')