123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- import org.gradle.plugins.ide.eclipse.model.SourceFolder
- apply plugin: 'eclipse-wtp'
- apply plugin: 'propdeps-idea'
- apply plugin: 'propdeps-eclipse'
- eclipse.classpath.downloadSources = true
- eclipse.project.buildCommand "net.sf.eclipsecs.core.CheckstyleBuilder"
- eclipse.project.natures "net.sf.eclipsecs.core.CheckstyleNature"
- // Include project specific settings
- task eclipseCheckstyle(type: Copy) {
- from rootProject.files(
- "etc/eclipse/.checkstyle")
- into project.projectDir
- expand(configDir: rootProject.file('config/checkstyle').absolutePath)
- }
- task eclipseSettings(type: Copy) {
- from rootProject.files(
- "etc/eclipse/org.eclipse.jdt.ui.prefs",
- "etc/eclipse/org.eclipse.wst.common.project.facet.core.xml")
- into project.file('.settings/')
- outputs.upToDateWhen { false }
- }
- task eclipseWstComponent(type: Copy) {
- from rootProject.files(
- "etc/eclipse/org.eclipse.wst.common.component")
- into project.file('.settings/')
- expand(deployname: project.name)
- outputs.upToDateWhen { false }
- }
- task eclipseJdtPrepare(type: Copy) {
- from rootProject.file("etc/eclipse/org.eclipse.jdt.core.prefs")
- into project.file(".settings/")
- outputs.upToDateWhen { false }
- }
- task cleanEclipseJdtUi(type: Delete) {
- delete project.file(".settings/org.eclipse.jdt.core.prefs")
- delete project.file(".settings/org.eclipse.jdt.ui.prefs")
- delete project.file(".settings/org.eclipse.wst.common.component")
- delete project.file(".settings/org.eclipse.wst.common.project.facet.core.xml")
- }
- tasks["eclipseJdt"].dependsOn(eclipseJdtPrepare)
- tasks["cleanEclipse"].dependsOn(cleanEclipseJdtUi)
- tasks["eclipse"].dependsOn(eclipseCheckstyle, eclipseSettings, eclipseWstComponent)
- eclipse {
- classpath {
- plusConfigurations += [ configurations.integrationTestCompile ]
- }
- }
- // http://forums.gradle.org/gradle/topics/eclipse_wtp_deploys_testcode_to_server_example_provided
- eclipse.classpath {
- defaultOutputDir = file('bin/main')
- file.whenMerged { cp ->
- cp.entries.findAll { it instanceof SourceFolder && (it.path.contains("test") || it.path.contains("Test")) }*.output = "bin/test"
- }
- }
- // GRADLE-1116
- project.eclipse.classpath.file.whenMerged { classpath ->
- classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/test') }
- classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/test') }
- classpath.entries.removeAll { entry -> entry.path.endsWith('/build/resources/main') }
- classpath.entries.removeAll { entry -> entry.path.endsWith('/build/classes/main') }
- }
- // GRADLE-1422
- project.eclipseClasspath.doFirst {
- // delay adding whenMerged till the entryAttributes are added (must be the last whenMerged)
- project.eclipse.classpath.file.whenMerged { classpath ->
- def includeDeps = project.configurations.getByName('runtime').collect {f -> f.absolutePath } as Set
- classpath.entries.each { cp ->
- if(cp instanceof org.gradle.plugins.ide.eclipse.model.Library) {
- def include = includeDeps.contains(cp.path)
- def attr = 'org.eclipse.jst.component.dependency'
- if(!include) {
- cp.entryAttributes.remove(attr)
- }
- }
- }
- }
- }
- project.idea.module {
- scopes.TEST.plus += [project.configurations.integrationTestRuntime]
- testSourceDirs += sourceSets.integrationTest.resources.srcDirs
- }
|