From 87f9d49ac16a1cd1c45f4531e830d57db45741b0 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Thu, 27 Jul 2017 09:27:56 -0700 Subject: [PATCH 1/3] Consumer proguard rules, javadoc artifact Fix #137 Fix #123 Change-Id: Ifb77a4903a85614e8bd153b99039395162c6d1a4 --- app/build.gradle | 2 +- build.gradle | 6 +++--- easypermissions/build.gradle | 2 +- easypermissions/maven.gradle | 12 ++++++++++++ easypermissions/proguard-rules.pro | 20 +++----------------- gradle/wrapper/gradle-wrapper.properties | 2 +- 6 files changed, 21 insertions(+), 23 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 18cc82e..819f596 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,7 +16,7 @@ android { buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } diff --git a/build.gradle b/build.gradle index 191b970..e6ed914 100644 --- a/build.gradle +++ b/build.gradle @@ -1,11 +1,11 @@ buildscript { repositories { jcenter() - google() + maven { url 'https://maven.google.com' } } dependencies { - classpath 'com.android.tools.build:gradle:3.0.0-alpha1' + classpath 'com.android.tools.build:gradle:3.0.0-alpha8' classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5' classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3' @@ -15,7 +15,7 @@ buildscript { allprojects { repositories { jcenter() - google() + maven { url 'https://maven.google.com' } } } diff --git a/easypermissions/build.gradle b/easypermissions/build.gradle index 137f278..a3590d8 100644 --- a/easypermissions/build.gradle +++ b/easypermissions/build.gradle @@ -14,7 +14,7 @@ android { buildTypes { release { minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + consumerProguardFiles 'proguard-rules.pro' } } } diff --git a/easypermissions/maven.gradle b/easypermissions/maven.gradle index df740d1..483d820 100644 --- a/easypermissions/maven.gradle +++ b/easypermissions/maven.gradle @@ -39,6 +39,18 @@ task sourcesJar(type: Jar) { classifier = 'sources' } +task javadoc(type: Javadoc) { + source = android.sourceSets.main.java.srcDirs + classpath += configurations.compile + classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) +} + +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = 'javadoc' + from javadoc.destinationDir +} + artifacts { archives sourcesJar + archives javadocJar } diff --git a/easypermissions/proguard-rules.pro b/easypermissions/proguard-rules.pro index 5b86c08..6ca54cb 100644 --- a/easypermissions/proguard-rules.pro +++ b/easypermissions/proguard-rules.pro @@ -1,17 +1,3 @@ -# Add project specific ProGuard rules here. -# By default, the flags in this file are appended to flags specified -# in ${sdk.dir}/tools/proguard/proguard-android.txt -# You can edit the include path and order by changing the proguardFiles -# directive in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# Add any project specific keep options here: - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} +-keepclassmembers class * { + @pub.devrel.easypermissions.AfterPermissionGranted ; +} \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0bd275d..1bb331d 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=https\://services.gradle.org/distributions/gradle-4.0-rc-3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-milestone-1-all.zip From 9dcf7ac016f1d8053af1ff3f4bfa47b47c9ab8e2 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Thu, 27 Jul 2017 09:49:23 -0700 Subject: [PATCH 2/3] Fix build, errors Change-Id: Ib93ab20fe96ff86e53c0ee931b4b8736f44121e2 --- easypermissions/maven.gradle | 2 ++ easypermissions/proguard-rules.pro | 2 +- .../java/pub/devrel/easypermissions/EasyPermissions.java | 8 ++++---- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/easypermissions/maven.gradle b/easypermissions/maven.gradle index 483d820..a2ad16b 100644 --- a/easypermissions/maven.gradle +++ b/easypermissions/maven.gradle @@ -43,6 +43,8 @@ task javadoc(type: Javadoc) { source = android.sourceSets.main.java.srcDirs classpath += configurations.compile classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) + + failOnError = false } task javadocJar(type: Jar, dependsOn: javadoc) { diff --git a/easypermissions/proguard-rules.pro b/easypermissions/proguard-rules.pro index 6ca54cb..e0ba183 100644 --- a/easypermissions/proguard-rules.pro +++ b/easypermissions/proguard-rules.pro @@ -1,3 +1,3 @@ -keepclassmembers class * { @pub.devrel.easypermissions.AfterPermissionGranted ; -} \ No newline at end of file +} diff --git a/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java b/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java index a948000..0a767ae 100644 --- a/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java +++ b/easypermissions/src/main/java/pub/devrel/easypermissions/EasyPermissions.java @@ -35,7 +35,7 @@ import pub.devrel.easypermissions.helper.PermissionHelper; /** - * Utility to request and check System permissions for apps targeting Android M (API >= 23). + * Utility to request and check System permissions for apps targeting Android M (API >= 23). */ public class EasyPermissions { @@ -130,7 +130,7 @@ public static void requestPermissions( * will be displayed if the user rejects the request the first time. * @param positiveButton custom text for positive button * @param negativeButton custom text for negative button - * @param requestCode request code to track this request, must be < 256. + * @param requestCode request code to track this request, must be < 256. * @param perms a set of permissions to be requested. * @see Manifest.permission */ @@ -254,7 +254,7 @@ public static boolean somePermissionPermanentlyDenied(@NonNull Activity host, } /** - * @see #somePermissionPermanentlyDenied(Activity, List). + * @see #somePermissionPermanentlyDenied(Activity, List) */ public static boolean somePermissionPermanentlyDenied(@NonNull Fragment host, @NonNull List deniedPermissions) { @@ -284,7 +284,7 @@ public static boolean permissionPermanentlyDenied(@NonNull Activity host, } /** - * @see #permissionPermanentlyDenied(Activity, String). + * @see #permissionPermanentlyDenied(Activity, String) */ public static boolean permissionPermanentlyDenied(@NonNull Fragment host, @NonNull String deniedPermission) { From a286172bd8ece4f9b14ec202bc85bfc759fb6de6 Mon Sep 17 00:00:00 2001 From: Sam Stern Date: Thu, 27 Jul 2017 10:02:22 -0700 Subject: [PATCH 3/3] Fix build via gradle properties Change-Id: I6e02227733b693697dd9397f52f3dae2453239ad --- gradle.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gradle.properties b/gradle.properties index e8cf5b9..ff30f8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -17,3 +17,6 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +# https://github.com/robolectric/robolectric/issues/3157 +android.enableAapt2=false