plugins {
    id 'java'
    id 'groovy'
}

group 'info.picocli'
description 'Picocli Groovy - easily use picocli in Groovy scripts.'
version "$projectVersion"

configurations {
    ivy
}
dependencies {
    api                rootProject
    compileOnly        "org.codehaus.groovy:groovy-all:$groovyVersion"
    ivy                "org.apache.ivy:ivy:$ivyVersion" // for Gradle
    testImplementation "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'
]
//javadoc.options.linksOffline 'http://docs.groovy-lang.org/2.4.9/html/gapi', 'gradle/javadocs/jdk/9/'

jar {
    manifest {
        attributes  'Specification-Title'   : 'Picocli Groovy',
                    'Specification-Vendor'  : 'Remko Popma',
                    'Specification-Version' : archiveVersion.get(),
                    'Implementation-Title'  : 'Picocli Groovy',
                    'Implementation-Vendor' : 'Remko Popma',
                    'Implementation-Version': archiveVersion.get(),
                    'Automatic-Module-Name' : 'info.picocli.groovy'
    }
}

ext {
    PUBLISH_GROUP_ID = group
    PUBLISH_ARTIFACT_ID = project.name
    PUBLISH_VERSION = "$projectVersion"
}
apply from: "${rootProject.projectDir}/gradle/publish-mavencentral.gradle"
