From b9e2017fde9fe976c64e2ef163bfc89f797ab6c5 Mon Sep 17 00:00:00 2001 From: Ryan Kurtz Date: Tue, 3 Sep 2019 13:51:30 -0400 Subject: [PATCH] GT-3127: Gradle 5.6 support. --- gradle/javaProject.gradle | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gradle/javaProject.gradle b/gradle/javaProject.gradle index e488a80fcf..0dc2cb30f7 100644 --- a/gradle/javaProject.gradle +++ b/gradle/javaProject.gradle @@ -161,3 +161,24 @@ ext.addExports = { List exports -> } } } + +// Fixup generated Eclipse projects +apply plugin: 'eclipse' +eclipse.classpath.file.whenMerged { classpath -> + + // Gradle 5.6 has a bug that creates duplicate classpath entries, so we must dedupe them. + // https://github.com/gradle/gradle/issues/10393 + classpath.entries.unique(true) { + (it instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency) ? it.path : it + } + + // 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. + classpath.entries.findAll { + it.kind == 'src' || it.kind == 'lib' + }.each { + it.entryAttributes['test'] = 'false' + } +} +