GP-3130: Eclipse now recognizes test source folders

This commit is contained in:
Ryan Kurtz 2023-02-23 10:08:17 -05:00
parent ddc6814c9e
commit 9e4ea632c7
2 changed files with 22 additions and 14 deletions

View file

@ -185,18 +185,25 @@ ext.addExports = { List<String> exports ->
}
}
// Fixup generated Eclipse projects
// Customize generated Eclipse projects
apply plugin: 'eclipse'
eclipse.classpath.file.whenMerged { classpath ->
// Prevent Gradle 5.6 from setting the 'test' attribute on our test source folders and jars.
// If we don't do this, things that we have outside of test directories that depend on test
// libraries (like junit) will not compile in Eclipse.
// Also prevent Gradle 7.0 from adding jars to the modulepath instead of the classpath.
classpath.entries.findAll {
it.kind == 'src' || it.kind == 'lib'
}.each {
it.entryAttributes['test'] = 'false'
it.entryAttributes['module'] = 'false'
eclipse {
classpath {
// Expose test classes to dependent projects
containsTestFixtures = true
// Customizing which Eclipse source directories should be marked as test.
// Only screenShots must be added...test and integrationTest are automatically picked up.
// NOTE: When we upgrade to Gradle 7.5+, we can just set the "testSourceSets" property
file {
whenMerged { classpath ->
classpath.entries.findAll {
it.kind == 'src' && it.path.startsWith('src/screen/')
}.each {
it.entryAttributes['test'] = 'true'
}
}
}
}
}