fix: eclipse classpath generation
This commit is contained in:
38
.classpath
38
.classpath
@@ -1,46 +1,46 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||||
|
<classpathentry kind="output" path="bin/default"/>
|
||||||
|
<classpathentry output="bin/main" kind="src" path="src/main/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="main"/>
|
<attribute name="gradle_scope" value="main"/>
|
||||||
<attribute name="gradle_used_by_scope" value="main,test,jmh"/>
|
<attribute name="gradle_used_by_scope" value="main,test,jmh"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/java">
|
<classpathentry output="bin/main" kind="src" path="src/main/resources">
|
||||||
|
<attributes>
|
||||||
|
<attribute name="gradle_scope" value="main"/>
|
||||||
|
<attribute name="gradle_used_by_scope" value="main,test,jmh"/>
|
||||||
|
</attributes>
|
||||||
|
</classpathentry>
|
||||||
|
<classpathentry output="bin/test" kind="src" path="src/test/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="test"/>
|
<attribute name="gradle_scope" value="test"/>
|
||||||
<attribute name="gradle_used_by_scope" value="test,jmh"/>
|
<attribute name="gradle_used_by_scope" value="test,jmh"/>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/main" path="src/main/resources">
|
<classpathentry output="bin/test" kind="src" path="src/test/resources">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="main"/>
|
<attribute name="gradle_scope" value="test"/>
|
||||||
<attribute name="gradle_used_by_scope" value="main,test,jmh"/>
|
<attribute name="gradle_used_by_scope" value="test,jmh"/>
|
||||||
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/jmh" path="src/jmh/java">
|
<classpathentry output="bin/jmh" kind="src" path="src/jmh/java">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="jmh"/>
|
<attribute name="gradle_scope" value="jmh"/>
|
||||||
<attribute name="gradle_used_by_scope" value="jmh"/>
|
<attribute name="gradle_used_by_scope" value="jmh"/>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="src" output="bin/jmh" path="build/third-party/snowball/source/libstemmer_java-3.0.1/java">
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-25/"/>
|
||||||
<attributes>
|
<classpathentry output="bin/jmh" kind="src" path="build/third-party/snowball/source/libstemmer_java-3.0.1/java">
|
||||||
<attribute name="gradle_scope" value="jmh"/>
|
|
||||||
<attribute name="gradle_used_by_scope" value="jmh"/>
|
|
||||||
<attribute name="test" value="true"/>
|
|
||||||
</attributes>
|
|
||||||
</classpathentry>
|
|
||||||
<classpathentry kind="src" output="bin/test" path="src/test/resources">
|
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="gradle_scope" value="test"/>
|
<attribute name="gradle_scope" value="jmh"/>
|
||||||
<attribute name="gradle_used_by_scope" value="test,jmh"/>
|
<attribute name="gradle_used_by_scope" value="jmh"/>
|
||||||
<attribute name="test" value="true"/>
|
<attribute name="test" value="true"/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-21/"/>
|
|
||||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
|
||||||
<classpathentry kind="output" path="bin/default"/>
|
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|||||||
@@ -1,10 +1,27 @@
|
|||||||
|
import org.gradle.plugins.ide.eclipse.model.SourceFolder
|
||||||
|
|
||||||
|
|
||||||
def snowballVersion = '3.0.1'
|
def snowballVersion = '3.0.1'
|
||||||
def snowballArchiveName = "libstemmer_java-${snowballVersion}.tar.gz"
|
def snowballArchiveName = "libstemmer_java-${snowballVersion}.tar.gz"
|
||||||
|
def snowballDistributionDirectoryName = "libstemmer_java-${snowballVersion}"
|
||||||
|
def snowballRootRelativePath = 'third-party/snowball'
|
||||||
|
def snowballSourceRelativePath = "${snowballRootRelativePath}/source"
|
||||||
|
def snowballJavaSourceRelativePath = "${snowballSourceRelativePath}/${snowballDistributionDirectoryName}/java"
|
||||||
def snowballDownloadUrl = "https://snowballstem.org/dist/${snowballArchiveName}"
|
def snowballDownloadUrl = "https://snowballstem.org/dist/${snowballArchiveName}"
|
||||||
def snowballDownloadFile = layout.buildDirectory.file("third-party/snowball/${snowballArchiveName}")
|
def snowballDownloadFile = layout.buildDirectory.file("${snowballRootRelativePath}/${snowballArchiveName}")
|
||||||
def snowballExtractDirectory = layout.buildDirectory.dir('third-party/snowball/source')
|
def snowballExtractDirectory = layout.buildDirectory.dir(snowballSourceRelativePath)
|
||||||
def snowballJavaSourceDirectory = layout.buildDirectory.dir(
|
def snowballJavaSourceDirectory = layout.buildDirectory.dir(snowballJavaSourceRelativePath)
|
||||||
"third-party/snowball/source/libstemmer_java-${snowballVersion}/java")
|
def snowballJavaSourceClasspathPath = provider {
|
||||||
|
project.relativePath(snowballJavaSourceDirectory.get().asFile)
|
||||||
|
}
|
||||||
|
def snowballEclipseClasspathAttributes = [
|
||||||
|
gradle_scope : 'jmh',
|
||||||
|
gradle_used_by_scope: 'jmh',
|
||||||
|
test : 'true'
|
||||||
|
]
|
||||||
|
def isAbsoluteClasspathPath = { String path ->
|
||||||
|
path.startsWith('/') || path ==~ /^[A-Za-z]:[\\\/].*/
|
||||||
|
}
|
||||||
|
|
||||||
tasks.register('downloadSnowballJava') {
|
tasks.register('downloadSnowballJava') {
|
||||||
group = 'build setup'
|
group = 'build setup'
|
||||||
@@ -46,4 +63,31 @@ sourceSets {
|
|||||||
|
|
||||||
tasks.named('compileJmhJava') {
|
tasks.named('compileJmhJava') {
|
||||||
dependsOn(tasks.named('extractSnowballJava'))
|
dependsOn(tasks.named('extractSnowballJava'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
eclipse {
|
||||||
|
classpath {
|
||||||
|
file {
|
||||||
|
whenMerged { classpath ->
|
||||||
|
String generatedSnowballPath = snowballJavaSourceClasspathPath.get()
|
||||||
|
String modelSnowballPath = snowballJavaSourceRelativePath
|
||||||
|
|
||||||
|
classpath.entries.removeAll { entry ->
|
||||||
|
entry.hasProperty('path') && (
|
||||||
|
entry.path == generatedSnowballPath ||
|
||||||
|
entry.path == modelSnowballPath ||
|
||||||
|
isAbsoluteClasspathPath(entry.path)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
SourceFolder snowballEntry = new SourceFolder(generatedSnowballPath, null)
|
||||||
|
snowballEntry.output = 'bin/jmh'
|
||||||
|
snowballEclipseClasspathAttributes.each { String name, String value ->
|
||||||
|
snowballEntry.entryAttributes[name] = value
|
||||||
|
}
|
||||||
|
|
||||||
|
classpath.entries.add(snowballEntry)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user