opentelemetry-java-instrume.../gradle/java.gradle

116 lines
2.5 KiB
Groovy

apply plugin: 'java'
apply plugin: 'groovy'
sourceCompatibility = 1.7
targetCompatibility = 1.7
apply plugin: "io.franzbecker.gradle-lombok"
lombok { // optional: values below are the defaults
version = "1.16.20"
sha256 = "c5178b18caaa1a15e17b99ba5e4023d2de2ebc18b58cde0f5a04ca4b31c10e6d"
}
apply plugin: "eclipse"
eclipse {
classpath {
downloadSources = true
downloadJavadoc = true
}
}
if (configurations.find { it.name == 'jmh' }) {
eclipse.classpath.plusConfigurations += [ configurations.jmh ]
}
task packageSources(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts.archives packageSources
repositories {
mavenLocal()
jcenter()
mavenCentral()
}
dependencies {
testCompile deps.junit
testCompile group: 'org.assertj', name: 'assertj-core', version: '2.9.+'
testCompile group: 'org.mockito', name: 'mockito-core', version: '2.7.22'
testCompile deps.spock
testCompile deps.groovy
testCompile deps.testLogging
testCompile group: 'io.ratpack', name: 'ratpack-groovy-test', version: '1.4.6'
}
tasks.withType(Javadoc) {
options.encoding = "utf-8"
options.docEncoding = "utf-8"
options.charSet = "utf-8"
options.addStringOption('Xdoclint:none', '-quiet')
doFirst {
if (project.ext.has("apiLinks")) {
options.links(*project.apiLinks)
}
}
}
javadoc {
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
options {
setMemberLevel JavadocMemberLevel.PUBLIC
setAuthor true
links "https://docs.oracle.com/javase/8/docs/api/"
}
}
task sourceJar(type: Jar) {
from sourceSets.main.allJava
classifier = 'sources'
}
task javaDocJar(type: Jar, dependsOn: javadoc) {
from javadoc.destinationDir
classifier = 'javadoc'
}
artifacts {
archives sourceJar
archives javaDocJar
}
if (project.plugins.hasPlugin('com.github.johnrengelman.shadow')) {
// Remove the no-deps jar from the archives to prevent publication
configurations.archives.with {
artifacts.remove artifacts.find { it.archiveTask.is jar }
}
artifacts {
archives shadowJar
}
}
if (project.hasProperty("removeJarVersionNumbers") && removeJarVersionNumbers) {
tasks.withType(AbstractArchiveTask) {
version = null
}
}
apply from: "$rootDir/gradle/checkstyle.gradle"
apply from: "$rootDir/gradle/codenarc.gradle"
plugins.withType(BasePlugin) {
project.afterEvaluate {
def deleteTasks = tasks.withType(Delete) + project.tasks.findByPath('clean')
def otherTasks = tasks - deleteTasks
otherTasks*.mustRunAfter deleteTasks
}
}