diff options
author | Alan Viverette <alanv@google.com> | 2018-07-18 13:50:21 -0400 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2018-07-20 17:47:24 -0400 |
commit | 41cf3fdb47ee40c267e11ca085ae4b45f84a7467 (patch) | |
tree | b347c5bb31fd3611b5bc6b4726fd1e8ecca01b14 | |
parent | ffb75bf5926eac9b68671e75c157375ffb72dc86 (diff) | |
download | multidex-41cf3fdb47ee40c267e11ca085ae4b45f84a7467.tar.gz |
Fix ub-multidex gradle build, add docs
Bug: 63945424
Test: ./gradlew dist
Change-Id: Ib2e7ab6a02aa8944a1ebd4ac20636c90c95543ab
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | build.gradle | 32 | ||||
-rw-r--r-- | gradle.properties | 6 | ||||
-rw-r--r-- | gradle/wrapper/gradle-wrapper.properties | 2 | ||||
-rw-r--r-- | instrumentation/build.gradle | 2 | ||||
-rw-r--r-- | library/build.gradle | 20 | ||||
-rw-r--r-- | settings.gradle | 3 |
7 files changed, 38 insertions, 31 deletions
@@ -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 83cbd27..fe707f0 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -36,7 +36,7 @@ task makeVersionFile(type:Exec) { } android { - compileSdkVersion 4 + compileSdkVersion gradle.currentSdk defaultConfig { minSdkVersion 4 @@ -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/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') |