Skip to content

Commit

Permalink
[#711] BUILD cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
remkop committed Jun 2, 2019
1 parent 8591d5d commit edef333
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 26 deletions.
44 changes: 20 additions & 24 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ apply plugin: 'com.jfrog.bintray'


allprojects {
apply plugin: 'groovy'
apply plugin: 'java'
apply plugin: 'java-library' // to avoid https:/gradle/gradle/issues/1118
sourceCompatibility = !org.gradle.api.JavaVersion.current().isJava9Compatible() ?
Expand All @@ -46,25 +45,12 @@ allprojects {
force "junit:junit-dep:$junitDepVersion"
}
}
configurations {
ivy
}
dependencies {
compileOnly "org.codehaus.groovy:groovy-all:$groovyVersion"
ivy "org.apache.ivy:ivy:$ivyVersion" // for Gradle
testCompile "junit:junit:$junitVersion",
"org.hamcrest:hamcrest-core:$hamcrestCoreVersion",
"org.fusesource.jansi:jansi:$jansiVersion",
"org.codehaus.groovy:groovy-all:$groovyVersion",
"com.github.stefanbirkner:system-rules:$systemRulesVersion"

}
tasks.withType(GroovyCompile) {
// this, and the `configurations {ivy}` section, are a workaround for the dreaded
// java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
// that occurs when trying to compile a groovy script containing a @Grab annotation in gradle.
// see https://stackoverflow.com/questions/18173908/error-compiling-a-groovy-project-using-grab-annotation
groovyClasspath += configurations.ivy
}
tasks.withType(JavaCompile) {
options.compilerArgs << '-Xlint:unchecked' << '-Xlint:deprecation'
Expand Down Expand Up @@ -193,18 +179,28 @@ javadoc {
File javadocExe = new File(System.getenv("JAVA_11_HOME"), "bin/javadoc.exe")
if (javadocExe.exists()) {
executable = javadocExe
javadoc.options.addStringOption('--frames')
javadoc.options.links = [ 'https://docs.oracle.com/en/java/javase/11/docs/api/' ]
inputs.property("moduleName", 'info.picocli')
source(new File("picocli-jpms-module/src/main/java/module-info.java").absolutePath, project.sourceSets.main.java)
//source(project(':picocli-jpms-module').sourceSets.main.java, project.sourceSets.main.java)
options.addStringOption('-module-path', classpath.asPath)
options.addStringOption('-module', 'info.picocli')
options.addStringsOption("-module-source-path", ";").setValue([new File("picocli-jpms-module/src/main/java").absolutePath, new File("src/main/java").absolutePath])
options.addBooleanOption('-frames')
}
}
javadoc.doFirst {
File moduleInfo = new File("src/main/java9/module-info.java").absoluteFile
if (moduleInfo.exists()) {
Files.copy(moduleInfo.toPath(), new File("src/main/java/module-info.java").absoluteFile.toPath())
}
}
javadoc.doLast {
new File("src/main/java/module-info.java").delete()
}
//javadoc.options.addBooleanOption('--frames')
//javadoc.options.addStringOption("--module-source-path=picocli-jpms-module/src/main/java;src/main/java")
//javadoc.options.addBooleanOption("-verbose")
//javadoc.doFirst {
// File moduleInfo = new File("picocli-jpms-module/src/main/java/module-info.java").absoluteFile
// if (moduleInfo.exists()) {
// Files.copy(moduleInfo.toPath(), new File("src/main/java/module-info.java").absoluteFile.toPath())
// }
//}
//javadoc.doLast {
// new File("src/main/java/module-info.java").delete()
//}
javadoc.dependsOn('asciidoctor')
asciidoctorj {
version = '1.5.5'
Expand Down
17 changes: 15 additions & 2 deletions picocli-examples/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
description 'Java and Groovy examples for the picocli project.'

apply plugin: 'groovy'

sourceCompatibility = 1.8 // for the JSR-380 BeanValidation example
targetCompatibility = 1.8

configurations {
ivy
}
dependencies {
compile rootProject
compile project(':picocli-groovy')
compile "org.apache.ivy:ivy:$ivyVersion", // for Intelli/J
"org.codehaus.groovy:groovy-all:$groovyVersion",
ivy "org.apache.ivy:ivy:$ivyVersion" // for Intelli/J
compile "org.codehaus.groovy:groovy-all:$groovyVersion",

// for the JSR-380 BeanValidation example
"javax.validation:validation-api:2.0.0.Final",
Expand All @@ -15,6 +21,13 @@ dependencies {
"javax.el:javax.el-api:3.0.0",
"org.glassfish.web:javax.el:2.2.6"
}
tasks.withType(GroovyCompile) {
// this, and the `configurations {ivy}` section, are a workaround for the dreaded
// java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
// that occurs when trying to compile a groovy script containing a @Grab annotation in gradle.
// see https://stackoverflow.com/questions/18173908/error-compiling-a-groovy-project-using-grab-annotation
groovyClasspath += configurations.ivy
}

def generatedResources = "$buildDir/generated-resources/main"
sourceSets {
Expand Down
14 changes: 14 additions & 0 deletions picocli-groovy/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
plugins {
id 'java'
id 'groovy'
id 'distribution'
id 'maven-publish'
id 'com.jfrog.bintray'
Expand All @@ -9,10 +10,23 @@ group 'info.picocli'
description 'Picocli Groovy - easily use picocli in Groovy scripts.'
version "$projectVersion"

configurations {
ivy
}
dependencies {
compile rootProject
compileOnly "org.codehaus.groovy:groovy-all:$groovyVersion"
ivy "org.apache.ivy:ivy:$ivyVersion" // for Gradle
testCompile "junit:junit:$junitVersion"
}
tasks.withType(GroovyCompile) {
// this, and the `configurations {ivy}` section, are a workaround for the dreaded
// java.lang.NoClassDefFoundError: org/apache/ivy/core/report/ResolveReport
// that occurs when trying to compile a groovy script containing a @Grab annotation in gradle.
// see https://stackoverflow.com/questions/18173908/error-compiling-a-groovy-project-using-grab-annotation
groovyClasspath += configurations.ivy
}

javadoc.options.links += [
'http://docs.groovy-lang.org/2.4.9/html/gapi'
]
Expand Down

0 comments on commit edef333

Please sign in to comment.