diff --git a/.github/workflows/run-reproducer.yml b/.github/workflows/run-reproducer.yml index 9a8ed55..8d4ed65 100644 --- a/.github/workflows/run-reproducer.yml +++ b/.github/workflows/run-reproducer.yml @@ -14,4 +14,4 @@ jobs: java-version: 11 - uses: gradle/gradle-build-action@v2 with: - arguments: help --info \ No newline at end of file + arguments: eclipseClasspath --info \ No newline at end of file diff --git a/build.gradle b/build.gradle index e69de29..2fab10a 100644 --- a/build.gradle +++ b/build.gradle @@ -0,0 +1,34 @@ +plugins { + // Applying this plugin casuses build to fail + // comment out line for a successful build + id 'me.champeau.jmh' version '0.6.6' +} + +defaultTasks 'eclipseClasspath' + +allprojects { + apply plugin: 'java-library' + apply plugin: 'eclipse' +} + +dependencies { + // ALSO: change this to testImplementation, testRuntimeOnly, or compileOnly for successful build + testCompileOnly project(':subproject') +} + +def dependencyFound = new boolean[1]; + +eclipse.classpath.file.whenMerged { classpath -> + classpath.entries.each { entry -> + if (entry instanceof org.gradle.plugins.ide.eclipse.model.ProjectDependency) { + println "Found dependency: $entry" + dependencyFound[0] = true + } + } +} + +gradle.buildFinished { + if (!dependencyFound[0]) { + throw new GradleException("The project dependency should have been included in eclipse classpath!"); + } +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 112c400..6a13b34 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1,9 @@ rootProject.name = 'reproducer-project' + +dependencyResolutionManagement { + repositories { + mavenCentral() + } +} + +include 'subproject' diff --git a/subproject/.classpath b/subproject/.classpath new file mode 100644 index 0000000..857aa3d --- /dev/null +++ b/subproject/.classpath @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/subproject/build.gradle b/subproject/build.gradle new file mode 100644 index 0000000..e69de29 diff --git a/subproject/src/main/java/pkg/Test.java b/subproject/src/main/java/pkg/Test.java new file mode 100644 index 0000000..bde86ec --- /dev/null +++ b/subproject/src/main/java/pkg/Test.java @@ -0,0 +1,8 @@ +package pkg; + +public class Test { + + public static String line() { + return "hello"; + } +} \ No newline at end of file