Skip to content

Commit

Permalink
Add module descriptor while maintaining Eclipse IDE experience
Browse files Browse the repository at this point in the history
* Fixes ben-manes#535
* Uses Gradle Eclipse plugin to exclude module-info from
  compilation in Eclipse. Prevents hordes of issues.
  • Loading branch information
A248 committed Apr 29, 2021
1 parent ba78559 commit d7ec017
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 6 deletions.
14 changes: 12 additions & 2 deletions caffeine/build.gradle
Expand Up @@ -23,8 +23,18 @@ idea.module {
scopes.PROVIDED.plus += [ configurations.javaPoetCompileClasspath ]
}

eclipse.classpath.file.whenMerged {
entries.findAll { it instanceof SourceFolder && it.output == 'bin/codeGen' }*.output = 'bin/main'
eclipse.classpath {
containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
file {
whenMerged {
entries.findAll {
it instanceof SourceFolder && it.output == 'bin/codeGen'
}*.output = 'bin/main'
// Exclude module-info when compiling through Eclipse
def main = entries.find { it instanceof SourceFolder && it.path == 'src/main/java' }
main.excludes.add('module-info.java')
}
}
}

plugins.withType(EclipsePlugin) {
Expand Down
7 changes: 7 additions & 0 deletions caffeine/src/main/java/module-info.java
@@ -0,0 +1,7 @@
module com.github.benmanes.caffeine {
exports com.github.benmanes.caffeine.cache;
exports com.github.benmanes.caffeine.cache.stats;

requires static transitive com.google.errorprone.annotations;
requires static transitive org.checkerframework.checker.qual;
}
1 change: 0 additions & 1 deletion gradle/codeQuality.gradle
Expand Up @@ -148,7 +148,6 @@ tasks.withType(JavaCompile).configureEach {
annotatedPackages.add('com.github.benmanes.caffeine')
}
}
modularity.inferModulePath.set(false)
checkerFramework.skipCheckerFramework = true
}

Expand Down
10 changes: 7 additions & 3 deletions gradle/dependencies.gradle
Expand Up @@ -41,7 +41,7 @@ ext {
elasticSearch: '7.12.0',
expiringMap: '0.5.9',
fastfilter: '1.0',
fastutil: '8.5.4',
fastutil: '8.5.2',
flipTables: '1.1.0',
googleJavaFormat: '1.10.0',
guava: '30.1.1-jre',
Expand Down Expand Up @@ -165,10 +165,14 @@ ext {
jcacheTck: "javax.cache:cache-tests:${testVersions.jcacheTck}",
jcacheTckTests: "javax.cache:cache-tests:${testVersions.jcacheTck}:tests",
jctools: "org.jctools:jctools-core:${testVersions.jctools}",
junit: "junit:junit:${testVersions.junit}",
junit: dependencies.create("junit:junit:${testVersions.junit}") {
exclude group: 'org.hamcrest'
},
mockito: "org.mockito:mockito-core:${testVersions.mockito}",
osgiCompile: [
"org.ops4j.pax.exam:pax-exam-junit4:${testVersions.paxExam}",
dependencies.create("org.ops4j.pax.exam:pax-exam-junit4:${testVersions.paxExam}") {
exclude group: 'org.hamcrest'
},
],
osgiRuntime: [
"org.apache.felix:org.apache.felix.framework:${testVersions.felix}",
Expand Down
4 changes: 4 additions & 0 deletions guava/build.gradle
Expand Up @@ -14,6 +14,10 @@ dependencies {
testImplementation testLibraries.guavaTestLib
}

compileJava {
modularity.inferModulePath = false
}

jar.manifest {
attributes 'Bundle-SymbolicName': 'com.github.ben-manes.caffeine.guava'
attributes 'Import-Package': [
Expand Down
4 changes: 4 additions & 0 deletions jcache/build.gradle
Expand Up @@ -30,6 +30,10 @@ dependencies {
doc "${libraries.jcache}:javadoc"
}

compileJava {
modularity.inferModulePath = false
}

jar.manifest {
attributes 'Bundle-SymbolicName': 'com.github.ben-manes.caffeine.jcache'
attributes 'Import-Package': [
Expand Down
4 changes: 4 additions & 0 deletions simulator/build.gradle
Expand Up @@ -35,6 +35,10 @@ dependencies {
testImplementation testLibraries.testng
}

compileJava {
modularity.inferModulePath = false
}

test {
useTestNG()
}
Expand Down

0 comments on commit d7ec017

Please sign in to comment.