forked from gradle/gradle-java-modules
-
Notifications
You must be signed in to change notification settings - Fork 4
Chainsaw DSL since 0.3.0
Tomasz Jędrzejewski edited this page Mar 15, 2018
·
3 revisions
This is a summary of Chainsaw plugin DSL, starting from 0.3.0 release:
plugins {
id 'com.zyxist.chainsaw' version 'x.y.z'
}
javaModule.allowModuleNamingViolations = false
javaModule.extraTestModules = ['org.mockito']
javaModule.hacks {
opens('java.base', 'java.lang', 'com.google.guice')
reads('com.example.mymodule', 'ALL-UNNAMED')
exports('com.example.mymodule', 'com.example.mymodule.somePackage', 'com.example.anotherModule')
patches('com.google.code.findbugs:jsr305', 'jsr250.api')
}
dependencies {
patch 'com.google.code.findbugs:jsr305:1.3.9'
compile 'javax.annotation:jsr250-api:1.0'
compile 'com.google.guava:guava:23.2-jre'
testCompile 'org.mockito:mockito-core:x.y.z'
}
Flag reference:
-
allowModuleNamingViolations
- enables violating the convention for naming Jigsaw modules -
extraTestModules
- unit tests don't have their own module. In order to make additional test modules (e.g. Mockito) accessible for the unit tests, they must be listed here. Note that JUnit 4 and 5 are recognized automatically. -
hacks
- section for adding custom Jigsaw flags, such as--add-opens
,--add-reads
,--add-exports
, and for making patches between dependencies.
The hacks
section offers the following methods:
-
opens('moduleName', 'packageName', 'reflectingModule')
produces--add-opens moduleName/packageName=reflectingModule
-
reads('moduleName', 'targetModule')
produces--add-reads moduleName=targetModule
-
exports('moduleName', 'packageName', 'readingModule')
produces--add-exports moduleName/packageName=readingModule
-
patches('patchingDependency', 'patchedModule')
produces--patch-modules
flags. The first argument is the dependency ID (group:artifact
), and the second - the module being patched.
All patching dependencies must be specified in a special patch configuration.