Skip to content

Commit

Permalink
Reproduce JMH plugin issue
Browse files Browse the repository at this point in the history
  • Loading branch information
zml2008 committed Jan 10, 2022
1 parent f83f869 commit 2af9e99
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/run-reproducer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
java-version: 11
- uses: gradle/gradle-build-action@v2
with:
arguments: help --info
arguments: eclipseClasspath --info
34 changes: 34 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -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!");
}
}
8 changes: 8 additions & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
rootProject.name = 'reproducer-project'

dependencyResolutionManagement {
repositories {
mavenCentral()
}
}

include 'subproject'
11 changes: 11 additions & 0 deletions subproject/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry output="bin/main" kind="src" path="src/main/java">
<attributes>
<attribute name="gradle_scope" value="main"/>
<attribute name="gradle_used_by_scope" value="main,test"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin/default"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
</classpath>
Empty file added subproject/build.gradle
Empty file.
8 changes: 8 additions & 0 deletions subproject/src/main/java/pkg/Test.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package pkg;

public class Test {

public static String line() {
return "hello";
}
}

0 comments on commit 2af9e99

Please sign in to comment.