Skip to content

Instantly share code, notes, and snippets.

@yushijinhun
Last active December 19, 2019 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yushijinhun/c4eeaa026132bb7a0dbea040ec0b7ed2 to your computer and use it in GitHub Desktop.
Save yushijinhun/c4eeaa026132bb7a0dbea040ec0b7ed2 to your computer and use it in GitHub Desktop.
[gradle|jpms|eclipse|buildship] Add modularity support to Buildship
// - Adds modularity support to Buildship
// Code is originally from https://github.com/java9-modularity/gradle-modules-plugin/issues/33#issue-376998502
apply plugin: 'eclipse'
eclipse {
classpath {
file {
whenMerged {
entries.findAll { isModule(it) }.each {
it.entryAttributes['module'] = 'true'
}
entries.findAll { isSource(it) && isTestScope(it) }.each {
it.entryAttributes['test'] = 'true'
}
entries.findAll { isLibrary(it) && isTestScope(it) }.each {
it.entryAttributes['test'] = 'true'
}
}
}
}
}
def isLibrary(entry) { entry.properties.kind == 'lib' }
def isTestScope(entry) { entry.entryAttributes['gradle_used_by_scope'] == 'test' }
def isModule(entry) { isLibrary(entry) && !isTestScope(entry) }
def isSource(entry) { entry.properties.kind == 'src' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment