Permalink
188 lines (160 sloc) 6.13 KB
/*
adding the plugin jars to the classpath to apply them later.
currently the new plugins DSL does apply them directly.
there are other limitations too. See https://docs.gradle.org/current/userguide/plugins.html#sec:plugins_block
we don't need to apply the jruby and bintray plugin on the rootProject.
*/
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "com.github.jruby-gradle:jruby-gradle-plugin:0.1.17"
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7"
classpath "gradle.plugin.io.sdkman:gradle-sdkvendor-plugin:1.1.0"
}
}
// TIP use -PpublishRelease=true to active release behavior regardless of the version
status = project.hasProperty('publishRelease') && project.publishRelease.toBoolean() ?
'release' : ((version == 'unspecified' || version.endsWith('-SNAPSHOT')) ? 'snapshot' : 'release')
// using ExpandoMetaClass to add isDistribution() Method to Project instances...
Project.metaClass.isDistribution = { delegate.getName().endsWith("-distribution") }
ext {
buildDateTime = new Date()
(buildDateOnly, buildTimeOnly) = new java.text.SimpleDateFormat('yyyy-MM-dd HH:mm:ss.SSSZ').format(buildDateTime).split(' ')
statusIsRelease = (status == 'release')
// jar versions
guavaVersion = '18.0'
hamcrestVersion = '1.3'
jcommanderVersion = '1.35'
jrubyVersion = '1.7.26'
jsoupVersion = '1.8.3'
junitVersion = '4.12'
saxonVersion = '9.5.1-6'
xmlMatchersVersion = '1.0-RC1'
// gem versions
asciidoctorGemVersion = project.hasProperty('asciidoctorGemVersion') ? project.asciidoctorGemVersion : '1.5.5'
asciidoctorEpub3GemVersion = project(':asciidoctorj-epub3').version.replace('-', '.')
asciidoctorPdfGemVersion = project(':asciidoctorj-pdf').version.replace('-', '.')
asciidoctorDiagramGemVersion = project(':asciidoctorj-diagram').version.replace('-', '.')
addressableVersion = '2.4.0'
public_suffixVersion = '1.4.6'
coderayGemVersion = '1.1.0'
erubisGemVersion = '2.7.0'
hamlGemVersion = '4.0.5'
openUriCachedGemVersion = '0.0.5'
prawnGemVersion = '1.3.0'
rougeGemVersion = '1.10.1'
slimGemVersion = '3.0.6'
threadSafeGemVersion = '0.3.5'
tiltGemVersion = '2.0.1'
ttfunkGemVersion = '1.2.2'
}
allprojects {
group = 'org.asciidoctor'
defaultTasks 'check'
}
subprojects {
// NOTE applying Java plugin changes the status; take steps to preserve value
def _status = status
apply plugin: 'java'
if (JavaVersion.current().isJava7Compatible()) {
apply from: rootProject.file('gradle/signing.gradle')
if (!it.isDistribution()) {
apply from: rootProject.file('gradle/publish.gradle')
}
apply from: rootProject.file('gradle/deploy.gradle')
}
status = _status
// NOTE sourceCompatibility & targetCompatibility are set in gradle.properties to meet requirements of Gradle
// Must redefine here to work around a bug in the Eclipse plugin
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_6
plugins.withType(JavaPlugin) {
project.tasks.withType(JavaCompile) { task ->
task.sourceCompatibility = project.sourceCompatibility
task.targetCompatibility = project.targetCompatibility
}
project.tasks.withType(GroovyCompile) { task ->
task.sourceCompatibility = project.sourceCompatibility
task.targetCompatibility = project.targetCompatibility
}
}
repositories {
if (project.hasProperty('useMavenLocal') && project.useMavenLocal.toBoolean()) {
mavenLocal()
}
jcenter()
}
dependencies {
testCompile "junit:junit:$junitVersion"
testCompile "org.hamcrest:hamcrest-library:$hamcrestVersion"
}
test {
forkEvery = 10
minHeapSize = '128m'
maxHeapSize = '1024m'
if (JavaVersion.current().isJava8Compatible()) {
jvmArgs '-XX:-UseGCOverheadLimit'
}
else {
jvmArgs '-XX:MaxPermSize=256m', '-XX:-UseGCOverheadLimit'
}
testLogging {
// events 'passed', 'failed', 'skipped', 'standard_out', 'standard_error'
// events 'standard_out', 'standard_error'
afterSuite { desc, result ->
if (!desc.parent && logger.infoEnabled) {
logger.info "Test results: ${result.resultType} (${result.testCount} tests, ${result.successfulTestCount} passed, ${result.failedTestCount} failed, ${result.skippedTestCount} skipped)"
}
}
}
}
}
// apply JRuby and sources/javadocs packaging stuff for all subprojects except the distribution
configure(subprojects.findAll { !it.isDistribution() }) {
apply plugin: 'com.github.jruby-gradle.base'
apply from: rootProject.file('gradle/eclipse.gradle')
apply from: rootProject.file('gradle/versioncheck.gradle')
repositories {
maven {
name 'rubygems-release'
url 'http://rubygems-proxy.torquebox.org/releases'
}
maven {
name 'rubygems-prerelease'
url 'http://rubygems-proxy.torquebox.org/prereleases'
}
}
if (JavaVersion.current().isJava8Compatible()) {
javadoc {
// Oracle JDK8 likes to fail the build over spoiled HTML
options.addStringOption('Xdoclint:none', '-quiet')
}
}
task sourcesJar(type: Jar, dependsOn: classes, group: 'Release') {
description 'Assembles a jar archive containing the main source code.'
from sourceSets.main.allSource
classifier 'sources'
}
task javadocJar(type: Jar, dependsOn: javadoc, group: 'Release') {
description 'Assembles a jar archive containing the Javadoc API documentation for the main source code.'
from javadoc.destinationDir
classifier 'javadoc'
}
// jcenter & Maven Central requires sources & javadoc jars (even if empty), so give 'em what they want
artifacts {
archives sourcesJar, javadocJar
}
jruby {
defaultRepositories = false
defaultVersion = jrubyVersion
execVersion = jrubyVersion
// TODO I'd like to be able to customize the name of the gemInstallDir
}
// QUESTION is this the right place to insert this task dependency in the lifecycle?
// IMPORTANT The TMP or TEMP environment variable must be set for the gem install command to work on Windows
processResources.dependsOn jrubyPrepareGems
}