Update gradle to version 6.7

Use the Java Library plugin and switch to the new (non-deprecated)
syntax for declaring dependencies.
Various other cleanups/modernizations in build.gradle.

Change-Id: Iac6734562eeda68c588a93775596f1e598eafd1f
diff --git a/.gitignore b/.gitignore
index d4670af..f5d9e60 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,13 +5,11 @@
 bin/
 gen/
 out/
-obj/
-app/src/*/libs/
-app/src/*/obj/
 
 # Gradle files
-.gradle/
-build/
+.gradle
+**/build/
+!src/**/build/
 # Ignore Gradle GUI config
 gradle-app.setting
 # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
@@ -22,16 +20,16 @@
 # Local configuration file (sdk path, etc)
 local.properties
 
+# Log Files
+*.log
+
+# Android Studio Navigation editor temp files
+.navigation/
+
 # Eclipse project files
 .classpath
 .project
 
-# OSX files
-.DS_Store
-
-# Windows thumbnail db
-Thumbs.db
-
 # IntelliJ
 *.iml
 .idea/workspace.xml
@@ -46,12 +44,16 @@
 # Comment next line if keeping position of elements in Navigation Editor is relevant for you
 .idea/navEditor.xml
 
-# Old-style IDEA project files
-*.ipr
-*.iws
-
-# Sandbox stuff
-_sandbox
-
 # Emacs stuff
 prj.el
+
+# macOS
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# Windows
+Thumbs.db
+Thumbs.db:encryptable
+ehthumbs.db
+ehthumbs_vista.db
diff --git a/build.gradle b/build.gradle
index c9756af..31e8b4e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,33 +1,21 @@
-buildscript {
-  repositories {
-    mavenLocal()
-    jcenter()
-    mavenCentral()
-  }
-}
-
 plugins {
-  id 'java'
-  id 'maven'
+  id 'java-library'
+  id 'maven' // TODO: migrate to 'maven-publish'
   id 'signing'
   id 'checkstyle'
-  id 'org.sonarqube' version '2.8'
-  id 'net.saliman.cobertura' version '3.0.0'
+  id 'org.sonarqube' version '3.0'
+  id 'net.saliman.cobertura' version '4.0.0'
 }
 
 group = 'net.named-data.jndn-extra'
 version = '1.3.0'
 
-sourceCompatibility = JavaVersion.VERSION_1_8
-targetCompatibility = JavaVersion.VERSION_1_8
-compileJava.options.encoding = 'UTF-8'
-
 repositories {
   mavenLocal()
   jcenter()
   mavenCentral()
   maven {
-    url "https://oss.sonatype.org/content/repositories/releases/"
+    url 'https://oss.sonatype.org/content/repositories/releases'
   }
 }
 
@@ -41,81 +29,74 @@
     java {
       compileClasspath += main.output + test.output
       runtimeClasspath += main.output + test.output
-      srcDir file('src/test/java')
+      srcDir 'src/test/java'
       include '**/*IT.java'
     }
   }
 }
 
 configurations {
-  checkstyleConfig
-  integrationTestCompile.extendsFrom testCompile
-  integrationTestRuntime.extendsFrom testRuntime
+  integrationTestImplementation.extendsFrom testImplementation
+  integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
 }
 
 dependencies {
-  compile 'net.named-data:jndn:0.24'
+  api 'net.named-data:jndn:0.24'
 
-  testCompile 'junit:junit:4.12'
-  testCompile 'net.named-data.jndn-extra:jndn-mock:1.2.0'
-  testRuntime 'org.slf4j:slf4j-api:1.7.30'
-
-  checkstyleConfig 'com.puppycrawl.tools:checkstyle:8.23'
+  testImplementation 'junit:junit:4.12'
+  testImplementation 'net.named-data.jndn-extra:jndn-mock:1.2.0'
+  testRuntimeOnly 'org.slf4j:slf4j-api:1.7.30'
 }
 
-task javadocJar(type: Jar) {
-  classifier = 'javadoc'
-  from javadoc
+java {
+  sourceCompatibility = JavaVersion.VERSION_1_8
+  targetCompatibility = JavaVersion.VERSION_1_8
+  withJavadocJar()
+  withSourcesJar()
 }
 
-task sourcesJar(type: Jar) {
-  classifier = 'sources'
-  from sourceSets.main.allSource
+tasks.withType(JavaCompile) {
+  options.deprecation = true
+  options.encoding = 'UTF-8'
+}
+
+tasks.withType(Javadoc) {
+  options.addBooleanOption('Xdoclint:none', true)
 }
 
 task integrationTest(type: Test) {
-  description 'Compile and run integration tests'
+  description 'Runs integration tests.'
   group = 'verification'
 
   testClassesDirs = sourceSets.integrationTest.output.classesDirs
   classpath = sourceSets.integrationTest.runtimeClasspath
 
-  mustRunAfter test
-}
-
-tasks.withType(JavaCompile) {
-  options.deprecation = true
+  shouldRunAfter test
 }
 
 tasks.withType(Test) {
-  reports.html.destination = file("${reporting.baseDir}/${name}")
-  testLogging {
-    events "passed", "skipped", "failed"
-    showStandardStreams = true
-    exceptionFormat = "full"
-  }
   outputs.upToDateWhen { false }
-}
-
-tasks.withType(Checkstyle) {
-  checkstyleClasspath = project.configurations.checkstyleConfig
-  checkstyleMain {
-    exclude 'com/intel/jndn/management/enums/NfdTlv.java'
-  }
-  checkstyleTest {
-    configFile file('config/checkstyle/checkstyle-test.xml')
-  }
-  checkstyleIntegrationTest {
-    configFile file('config/checkstyle/checkstyle-test.xml')
+  testLogging {
+    events "passed", "failed", "skipped"
+    exceptionFormat "full"
   }
 }
 
-if (JavaVersion.current().isJava8Compatible()) {
-  allprojects {
-    tasks.withType(Javadoc) {
-      options.addStringOption('Xdoclint:none', '-quiet')
-    }
-  }
+checkstyle {
+  toolVersion '8.23'
+}
+checkstyleMain {
+  exclude 'com/intel/jndn/management/enums/NfdTlv.java'
+}
+checkstyleTest {
+  configFile file('config/checkstyle/checkstyle-test.xml')
+}
+checkstyleIntegrationTest {
+  configFile file('config/checkstyle/checkstyle-test.xml')
+}
+
+cobertura {
+  coverageFormats = ['html', 'xml']
 }
 
 artifacts {
@@ -183,7 +164,3 @@
     }
   }
 }
-
-cobertura {
-  coverageFormats = ['html', 'xml']
-}
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
index f3d88b1..e708b1c 100644
--- a/gradle/wrapper/gradle-wrapper.jar
+++ b/gradle/wrapper/gradle-wrapper.jar
Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index 1b16c34..be52383 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-bin.zip
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
index 2fe81a7..4f906e0 100755
--- a/gradlew
+++ b/gradlew
@@ -82,6 +82,7 @@
 
 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
@@ -129,6 +130,7 @@
 if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
     APP_HOME=`cygpath --path --mixed "$APP_HOME"`
     CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
+
     JAVACMD=`cygpath --unix "$JAVACMD"`
 
     # We build the pattern for arguments to be converted via cygpath
diff --git a/gradlew.bat b/gradlew.bat
index 24467a1..ac1b06f 100644
--- a/gradlew.bat
+++ b/gradlew.bat
@@ -29,6 +29,9 @@
 set APP_BASE_NAME=%~n0

 set APP_HOME=%DIRNAME%

 

+@rem Resolve any "." and ".." in APP_HOME to make it shorter.

+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

+

 @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.

 set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

 

@@ -37,7 +40,7 @@
 

 set JAVA_EXE=java.exe

 %JAVA_EXE% -version >NUL 2>&1

-if "%ERRORLEVEL%" == "0" goto init

+if "%ERRORLEVEL%" == "0" goto execute

 

 echo.

 echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.

@@ -51,7 +54,7 @@
 set JAVA_HOME=%JAVA_HOME:"=%

 set JAVA_EXE=%JAVA_HOME%/bin/java.exe

 

-if exist "%JAVA_EXE%" goto init

+if exist "%JAVA_EXE%" goto execute

 

 echo.

 echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%

@@ -61,28 +64,14 @@
 

 goto fail

 

-:init

-@rem Get command-line arguments, handling Windows variants

-

-if not "%OS%" == "Windows_NT" goto win9xME_args

-

-:win9xME_args

-@rem Slurp the command line arguments.

-set CMD_LINE_ARGS=

-set _SKIP=2

-

-:win9xME_args_slurp

-if "x%~1" == "x" goto execute

-

-set CMD_LINE_ARGS=%*

-

 :execute

 @rem Setup the command line

 

 set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar

 

+

 @rem Execute Gradle

-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%

+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

 

 :end

 @rem End local scope for the variables with windows NT shell