/*
 * This file was generated by the Gradle 'init' task.
 *
 * This project uses @Incubating APIs which are subject to change.
 */

plugins {
    // Support convention plugins written in Groovy. Convention plugins 
    // are build scripts in 'src/main' that automatically become available 
    // as plugins in the main build.
    id 'groovy-gradle-plugin'

    // Apply eclipse plugin
    id 'eclipse'
}

repositories {
    // Use the plugin portal to apply community plugins in convention plugins.
    gradlePluginPortal()
}

sourceSets {
    main {
        groovy {
            srcDirs = ['src']
        }
    }

    test {
        groovy {
            srcDirs = ['test']
        }
    }
}

eclipse {

    project {
        file {
            // closure executed after .project content is loaded from existing file
            // and before gradle build information is merged
            beforeMerged { project ->
                project.natures.clear()
                project.buildCommands.clear()
            }

            project.natures += 'org.eclipse.buildship.core.gradleprojectnature'
            // Don't build, result not used by Eclipse anyway
            // project.buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
        }
    }
    
    classpath {
        downloadJavadoc = true
        downloadSources = true
    }

    jdt {
        file {
            withProperties { properties ->
                def formatterPrefs = new Properties()
                rootProject.file("gradle/org.eclipse.jdt.core.formatter.prefs")
                    .withInputStream { formatterPrefs.load(it) }
                properties.putAll(formatterPrefs)
            }
        }
    }
}
