// include this file in subprojects:
// apply from: rootProject.file('libs/common.gradle')

repositories {
  mavenLocal()
  jcenter()
  mavenCentral()
}

apply plugin: 'maven' // add "install" task
apply plugin: 'groovy'

group = rootProject.ext.group
version = rootProject.ext.version

dependencies {
  compile "org.codehaus.groovy:groovy-all:${groovy_version}"
  testCompile "org.spockframework:spock-core:${spock_version}"
}

task sourcesJar(type: Jar, dependsOn: classes, description: 'Creates sources jar') {
  classifier = 'sources'
  from sourceSets.main.allSource
}

task javadocJar(type: Jar, description: 'Creates javadoc jar') {
  dependsOn javadoc
  classifier = 'javadoc'
  from javadoc.destinationDir
  if(tasks.findByName('groovydoc')) {
    dependsOn groovydoc
    from groovydoc.destinationDir
  }
}

afterEvaluate {
  // lib projects should be always installed into "$HOME/.m2"
  project.tasks.build.finalizedBy project.tasks.install
  rootProject.tasks.buildExamples.dependsOn project.tasks.install
}

artifacts {
  archives sourcesJar, javadocJar
}

