Skip to content

Commit a4f2f60

Browse files
committed
Tweak Eclipse settings and disable test in platform-tests in Eclipse
1 parent f4ac7cc commit a4f2f60

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

gradle/plugins/common/src/main/kotlin/junitbuild.java-library-conventions.gradle.kts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
32
import junitbuild.extensions.isSnapshot
43
import org.gradle.plugins.ide.eclipse.model.Classpath
@@ -54,6 +53,10 @@ eclipse {
5453
entries.removeIf { it is ProjectDependency && it.path.equals("/code-generator-model") }
5554
entries.filterIsInstance<SourceFolder>().forEach {
5655
it.excludes.add("**/module-info.java")
56+
if (project.name == "platform-tests" && it.path == "src/test/resources") {
57+
// Exclude Foo.java and FooBar.java in the modules-2500 folder.
58+
it.excludes.add("**/Foo*.java")
59+
}
5760
}
5861
entries.filterIsInstance<ProjectDependency>().forEach {
5962
it.entryAttributes.remove("module")

platform-tests/src/test/java/org/junit/platform/commons/support/scanning/DefaultClasspathScannerTests.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import java.util.spi.ToolProvider;
4343

4444
import org.junit.jupiter.api.Test;
45+
import org.junit.jupiter.api.condition.DisabledIf;
4546
import org.junit.jupiter.api.fixtures.TrackLogRecords;
4647
import org.junit.jupiter.api.io.TempDir;
4748
import org.junit.platform.commons.PreconditionViolationException;
@@ -299,8 +300,8 @@ void scanForResourcesInPackage() {
299300
uriOf("/org/junit/platform/commons/other-example.resource"));
300301
}
301302

302-
@Test
303-
// #2500
303+
@Test // #2500
304+
@DisabledIf("runningInEclipse")
304305
void scanForClassesInPackageWithinModulesSharingNamePrefix(@TempDir Path temp) throws Exception {
305306
var moduleSourcePath = Path.of(getClass().getResource("/modules-2500/").toURI()).toString();
306307
run("javac", "--module", "foo,foo.bar", "--module-source-path", moduleSourcePath, "-d", temp.toString());
@@ -629,4 +630,12 @@ public Enumeration<URL> getResources(String name) throws IOException {
629630
}
630631
}
631632

633+
/**
634+
* Determine if the current code is running in the Eclipse IDE.
635+
*/
636+
static boolean runningInEclipse() {
637+
return StackWalker.getInstance().walk(
638+
stream -> stream.anyMatch(stackFrame -> stackFrame.getClassName().startsWith("org.eclipse.jdt")));
639+
}
640+
632641
}

0 commit comments

Comments
 (0)