From 9f7950bb0a0fb519bb307920ab79a068f269e342 Mon Sep 17 00:00:00 2001 From: "David G. Young" Date: Sat, 29 Jun 2019 14:21:15 -0400 Subject: [PATCH 1/2] WIP Gradle 5 upgrade. Remove eclipse tasks. Change JavaDoc plugin. --- README.md | 4 +-- build.gradle | 4 ++- gradle/eclipse.gradle | 31 ------------------- gradle/package.gradle | 39 +++++------------------- gradle/wrapper/gradle-wrapper.properties | 2 +- lib/build.gradle | 15 +++++---- 6 files changed, 20 insertions(+), 75 deletions(-) delete mode 100644 gradle/eclipse.gradle diff --git a/README.md b/README.md index 6d02e7e41..b59ac0483 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ replacing `${altbeacon.version}` with the version you wish to use. ## How to build this Library This project uses an AndroidStudio/gradle build system and is known working with Android Studio -3.2.1 and Gradle 4.10.3 +3.4.1 and Gradle 5.1.1 Key Gradle build targets: ./gradlew test # run unit tests ./gradlew build # development build ./gradlew release -Prelease # release build - ./gradlew generateJavadoc + ./gradlew generateReleaseJavadoc ## License diff --git a/build.gradle b/build.gradle index 54d5e767e..a9d3b1cc3 100644 --- a/build.gradle +++ b/build.gradle @@ -2,14 +2,16 @@ buildscript { repositories { google() jcenter() + mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:3.2.1' + classpath 'com.android.tools.build:gradle:3.4.1' //noinspection GradleDependency classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1' //noinspection GradleDependency classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3' + classpath "com.vanniktech:gradle-android-javadoc-plugin:0.3.0" } } allprojects { diff --git a/gradle/eclipse.gradle b/gradle/eclipse.gradle deleted file mode 100644 index 7fbfd935b..000000000 --- a/gradle/eclipse.gradle +++ /dev/null @@ -1,31 +0,0 @@ -// tasks for creating an eclipse bundle -task unzipAar(type: Copy, dependsOn: build) { - description = 'Unzip the aar in order to create an eclipse project' - - from zipTree(file("$buildDir/outputs/aar/${project.name}-release.aar")) - into file("$buildDir/outputs/aar/android-beacon-library") -} - -task bundleEclipse(type: Tar, dependsOn: unzipAar) { - description = 'Creates a tar file for eclipse distributions' - - destinationDir = file("$buildDir/outputs/aar/") - extension = 'tar.gz' - compression = Compression.GZIP - includeEmptyDirs = true - - from("$buildDir/outputs/aar/android-beacon-library") { - into 'android-beacon-library' - exclude '*.jar' - } - - from("$buildDir/outputs/aar/android-beacon-library") { - into 'android-beacon-library/libs' - include '*.jar' - } - - from("$rootDir/eclipse-support/") { - into 'android-beacon-library/' - exclude '**/.retain' - } -} diff --git a/gradle/package.gradle b/gradle/package.gradle index c64d05f68..8d9d2f472 100644 --- a/gradle/package.gradle +++ b/gradle/package.gradle @@ -17,41 +17,16 @@ task renameAarForRelease(type: Copy, dependsOn: build) { } } -task distribution(dependsOn: [bundleEclipse, build, clean, renameAarForRelease]) << { - println "Building with version=$version" -} - -task release(dependsOn: 'distribution') << { - println('Doing release build') -} - -android.libraryVariants.all { variant -> - - task("generate${variant.name}Javadoc", type: Javadoc) { - title = "Android Beacon Library $version API" - description "Generates Javadoc for $variant.name." - source = variant.javaCompile.source - ext.androidJar = - "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - //Refer to https://stackoverflow.com/a/50833438/4068957 - doFirst { classpath = files(variant.javaCompile.classpath.files, ext.androidJar)} - options.linksOffline "http://d.android.com/reference/", "${android.sdkDirectory}/docs/reference" - exclude '**/BuildConfig.java' - exclude '**/R.java' +task distribution(dependsOn: [build, clean, renameAarForRelease]) { + doLast { + println "Building with version=$version" } - } -task generateJavadoc(type: Javadoc, dependsOn: project.configurations.doclava) { - failOnError = true - title = null - source = android.sourceSets.main.java.srcDirs - options.doclet = "com.google.doclava.Doclava" - options.docletpath = configurations.doclava.files.asType(List) - classpath += - project.files(android.getBootClasspath().join(File.pathSeparator)) + configurations.compile - - destinationDir = file("../javadocs/") +task release(dependsOn: 'distribution') { + doLast { + println('Doing release build') + } } build.mustRunAfter clean diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index eb74e6d01..51d7dccfe 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.10.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.1.1-all.zip diff --git a/lib/build.gradle b/lib/build.gradle index 1d483c1e3..bea730cbc 100644 --- a/lib/build.gradle +++ b/lib/build.gradle @@ -1,6 +1,6 @@ apply plugin: 'com.android.library' -apply from: '../gradle/eclipse.gradle' apply from: '../gradle/version.gradle' +apply plugin: "com.vanniktech.android.javadoc" android { compileSdkVersion 28 @@ -45,12 +45,11 @@ android { } } -configurations { - doclava -} - dependencies { + implementation fileTree ( dir: 'libs', include: ['*.jar'] ) + // The support library is needed for + // LocalBroadcastManager, implementation 'com.android.support:support-v4:28.0.0' implementation 'com.android.support:support-annotations:28.0.0' @@ -65,8 +64,8 @@ dependencies { androidTestImplementation 'com.android.support.test:rules:1.0.2' androidTestImplementation 'org.apache.commons:commons-math3:3.6.1' androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2' - - doclava 'com.google.doclava:doclava:1.0.6' } -apply from: '../gradle/package.gradle' \ No newline at end of file +apply from: '../gradle/package.gradle' + + From e20d518cee6ef3c8a7202f63a356b1bde7f7008b Mon Sep 17 00:00:00 2001 From: "David G. Young" Date: Fri, 5 Jul 2019 12:10:38 -0400 Subject: [PATCH 2/2] Fix gradle deprecation warning by using snapshot javadoc plugin --- build.gradle | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index a9d3b1cc3..084448ec3 100644 --- a/build.gradle +++ b/build.gradle @@ -3,6 +3,9 @@ buildscript { google() jcenter() mavenCentral() + repositories { + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + } } dependencies { @@ -11,7 +14,12 @@ buildscript { classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.1' //noinspection GradleDependency classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3' - classpath "com.vanniktech:gradle-android-javadoc-plugin:0.3.0" + // The 3.0 version of this plugin does not support Gradle 5, The latest source does support + // Grale 5. So we are using a snapshot until the 4.0 version is released. + //classpath "com.vanniktech:gradle-android-javadoc-plugin:0.3.0" + dependencies { + classpath "com.vanniktech:gradle-android-javadoc-plugin:0.4.0-SNAPSHOT" + } } } allprojects {