Skip to content

Commit

Permalink
Eclipse resource filters
Browse files Browse the repository at this point in the history
From buildship eclipse bug report 495799.
  • Loading branch information
kpage committed Jan 28, 2017
1 parent 6b11850 commit 623c90c
Show file tree
Hide file tree
Showing 23 changed files with 1,272 additions and 2 deletions.
1 change: 1 addition & 0 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ libraries += [
jcip: "net.jcip:jcip-annotations:1.0@jar",
junit: 'junit:junit:4.12@jar',
xmlunit: 'xmlunit:xmlunit:1.3',
equalsVerifier: 'nl.jqno.equalsverifier:equalsverifier:2.1.6',
nekohtml: 'net.sourceforge.nekohtml:nekohtml:1.9.14',
xbean: 'org.apache.xbean:xbean-reflect:3.4@jar', //required by maven3 classes
nativePlatform: 'net.rubygrapefruit:native-platform:0.13',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
<td>file</td>
<td/>
</tr>
<tr>
<td>resourceFilters</td>
<td>[]</td>
</tr>
</table>
</section>
<section>
Expand All @@ -61,6 +65,9 @@
<tr>
<td>file</td>
</tr>
<tr>
<td>resourceFilter</td>
</tr>
</table>
</section>
</section>
</section>
1 change: 1 addition & 0 deletions subprojects/ide/ide.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ dependencies {
compile libraries.inject

testCompile libraries.xmlunit
testCompile libraries.equalsVerifier
testCompile project(':dependencyManagement')

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.gradle.plugins.ide.eclipse

import groovy.xml.XmlUtil
import org.custommonkey.xmlunit.XMLUnit
import org.gradle.test.fixtures.file.TestFile

class EclipseProjectFixture {
Expand All @@ -40,10 +42,25 @@ class EclipseProjectFixture {
return this.project.'comment'.text()
}

Node getFilteredResourcesNode() {
def r = this.project.filteredResources
return r ? r[0] : null
}

void assertHasReferencedProjects(String... referencedProjects) {
assert this.project.projects.project*.text() == referencedProjects as List
}

void assertHasResourceFilterXml(String expectedFilteredResourcesXml) {
def actualFilteredResourcesXml = XmlUtil.serialize(this.project.filteredResources[0])
def xmlUnitIgnoreWhitespaceOriginal = XMLUnit.getIgnoreWhitespace()
XMLUnit.setIgnoreWhitespace(true)
try {
assert XMLUnit.compareXML(expectedFilteredResourcesXml, actualFilteredResourcesXml).similar()
} finally {
XMLUnit.setIgnoreWhitespace(xmlUnitIgnoreWhitespaceOriginal)
}
}

void assertHasJavaFacetNatures() {
assertHasNatures("org.eclipse.jdt.core.javanature",
Expand Down

0 comments on commit 623c90c

Please sign in to comment.