import org.gradle.build.startscripts.StartScriptsGenerator

dependencies {
    groovy libraries.groovy_depends

    compile project(':core')
    compile project(':ui')

    compile libraries.slf4j_api

    testCompile project(path: ':core', configuration: 'testFixtures')
    testRuntime project(path: ':core', configuration: 'testFixturesRuntime')
}

jar.manifest.mainAttributes('Main-Class': "org.gradle.launcher.GradleMain")
jar.doFirst {
    jar.manifest.mainAttributes('Class-Path': "${project(':core').jar.archivePath.name}")
}

task startScripts << {
    ant.mkdir(dir: startScriptsDir)
    StartScriptsGenerator.generate(jar.archiveName, startScriptsDir, 'gradle')
}

ideaModule {
    whenConfigured { module ->
        def runtimeProjects = rootProject.groovyProjects() - ([project] +
                configurations.runtime.getAllDependencies(ProjectDependency).collect { it.dependencyProject })
        runtimeProjects.each { groovyProject ->
            module.dependencies.add(new org.gradle.plugins.idea.model.ModuleDependency(groovyProject.name, "RUNTIME"))
        }
    }
}
