dependencies {
    compile project(':freeplane')
    compile project(':freeplane_plugin_jsyntaxpane')
	lib ('org.codehaus.groovy:groovy-all:2.5.4') {
		exclude group:'org.codehaus.groovy', module:'groovy-test'
		exclude group:'org.codehaus.groovy', module:'groovy-test-junit5'
		exclude group:'org.codehaus.groovy', module:'groovy-testng'
		exclude group:'org.codehaus.groovy', module:'groovy-ant'
		exclude group:'org.codehaus.groovy', module:'groovy-docgenerator'
		exclude group:'org.codehaus.groovy', module:'groovy-groovydoc'
		exclude group:'org.codehaus.groovy', module:'groovy-cli-commons'
		exclude group:'org.codehaus.groovy', module:'groovy-cli-picocli'
	}
	lib 'org.codehaus.groovy:groovy-dateutil:2.5.4'
	lib 'org.apache.ivy:ivy:2.4.0'

}

tasks.withType(JavaCompile) {
	if (JavaVersion.current().isJava8Compatible())
		options.compilerArgs << '-parameters'
}

ext.bundleImports = 'jsyntaxpane.*'

ext.bundleExports = """\
             org.freeplane.plugin.script,
             org.freeplane.plugin.script.addons,
             org.freeplane.plugin.script.dependencies,
             org.freeplane.plugin.script.filter,
             org.freeplane.plugin.script.proxy
             """

task copyScripts(type: Copy) {
    from('scripts/') {
        include('*.groovy')
    }
    into(globalBin + '/scripts')
}

javadoc {
    enabled = true
    
    title = "Freeplane API ${project.version}"

    source = fileTree(dir: 'src/main/java')
      .include('**/Proxy.java')
      .include('**/Convertible.java')
      .include('**/FreeplaneScriptBaseClass.java')
      .include('**/ScriptUtils.java') +
		fileTree(dir: '../freeplane_api/src/main/java')
		  .include('**/api/*.java') +
		fileTree(dir: '../freeplane/src/main/java')
		  .include('**/UITools.java')
		  .include('**/TextUtils.java')
		  .include('**/FreeplaneVersion.java')
		  .include('**/HtmlUtils.java')
		  .include('**/LogUtils.java')
		  .include('**/MenuUtils.java') + fileTree(dir: '../freeplane_framework/src/main/java')
		  .include('**/Launcher.java')
  

    destinationDir = new File(globalBin + '/doc/api/')
}

// TODO: this doesn't work yet!
/*
task zipJavadoc(type: Zip) {
  baseName = 'scripting-api'
  from (globalBin + '/doc/api/') {
      include('**')
  }
  destinationDir = new File(globalBin)
  dependsOn javadoc
}
*/

build.dependsOn copyScripts
build.dependsOn javadoc
//build.dependsOn zipJavadoc
