dependencies {
    implementation project(':freeplane')
    implementation project(':freeplane_plugin_jsyntaxpane')
	lib ('org.apache.groovy:groovy-all:4.0.27') {
		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.apache.groovy:groovy-dateutil:4.0.27'
	lib 'org.apache.ivy:ivy:2.5.3'

}

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

ext.bundleImports = 'de.sciss.syntaxpane.*'

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')
      .include('**/GroovyStaticImports.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
