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: Ie091964955bc0fb9f3d7fe01572ffe1853b8f109
diff --git a/build.gradle b/build.gradle
index 48d82bf..a827935 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,71 +1,53 @@
-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.2.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'
}
}
-configurations {
- checkstyleConfig
-}
-
dependencies {
- compile 'net.named-data:jndn:0.24'
+ api 'net.named-data:jndn:0.24'
- testCompile 'junit:junit:4.12'
- testRuntime 'org.slf4j:slf4j-api:1.7.30'
-
- checkstyleConfig 'com.puppycrawl.tools:checkstyle:8.23'
+ testImplementation 'junit:junit:4.12'
+ testRuntimeOnly 'org.slf4j:slf4j-api:1.7.30'
}
-task javadocJar(type: Jar) {
- classifier = 'javadoc'
- from javadoc
-}
-
-task sourcesJar(type: Jar) {
- classifier = 'sources'
- from sourceSets.main.allSource
+java {
+ sourceCompatibility = JavaVersion.VERSION_1_8
+ targetCompatibility = JavaVersion.VERSION_1_8
+ withJavadocJar()
+ withSourcesJar()
}
tasks.withType(JavaCompile) {
options.deprecation = true
+ options.encoding = 'UTF-8'
+}
+
+tasks.withType(Javadoc) {
+ options.addBooleanOption('Xdoclint:none', true)
}
tasks.withType(Test) {
- reports.html.destination = file("${reporting.baseDir}/${name}")
- testLogging {
- events "passed", "skipped", "failed"
- showStandardStreams = true
- exceptionFormat = "full"
- }
outputs.upToDateWhen { false }
+ testLogging {
+ events "passed", "failed", "skipped"
+ exceptionFormat "full"
+ }
}
tasks.withType(Checkstyle) {
@@ -75,12 +57,8 @@
}
}
-if (JavaVersion.current().isJava8Compatible()) {
- allprojects {
- tasks.withType(Javadoc) {
- options.addStringOption('Xdoclint:none', '-quiet')
- }
- }
+cobertura {
+ coverageFormats = ['html', 'xml']
}
artifacts {
@@ -148,7 +126,3 @@
}
}
}
-
-cobertura {
- coverageFormats = ['html', 'xml']
-}