Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
com.diffplug.gradle:image-grinder
Advanced tools
To use it, just add image-grinder to your buildscript, and configure it as so:
imageGrinder {
// creates a task called 'processEclipseSvg', you can name it whatever you want
// if the name starts with 'process', then the 'processResources' task will depend on it
processEclipseSvg {
srcDir = file('src')
dstDir = file('dst')
grinder { img ->
img.render('.png')
img.render('@2x.png', 2)
}
// used for up-to-date checking, bump this if the function above changes
bumpThisNumberWhenTheGrinderChanges = 1
}
}
Every single file in srcDir
needs to be an image that ImageGrinder can parse. Each image will be parsed, and wrapped into an Img
. Call its methods to grind it into whatever you need in the dstDir
.
ImageGrinder uses the gradle Worker API to use all your CPU cores for grinding, the buildcache to minimize the necessary work, and it also supports the configuration cache for near-instant startup times. It does not currently support incremental update, but if you go back to 2.1.3
you can get that back in return for losing the configuration cache (see #9 for details).
The plugin creates tasks eagerly. If you wish to avoid this, you can rewrite the example above like this:
def processEclipseSvg = tasks.register('processEclipseSvg', com.diffplug.gradle.imagegrinder.ImageGrinderTask) {
srcDir = file('src')
dstDir = file('dst')
grinder { img ->
img.render('.png')
img.render('@2x.png', 2)
}
// used for up-to-date checking, bump this if the function above changes
bumpThisNumberWhenTheGrinderChanges = 1
}
tasks.named(JavaPlugin.PROCESS_RESOURCES_TASK_NAME) {
dependsOn processSvg
}
Not much of a grinder, but it does everything we needed. If you need more, we're happy to take PR's!
FAQs
Unknown package
We found that com.diffplug.gradle:image-grinder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.