Gradle plugin that helps to save your SSD write cycles by linking project build directory into /tmp on *nix.
It works on nix systems (Linux, BSD, Mac), assuming, that your /tmp directory is mounted as tmpfs and resides in computer's RAM (on Windows it just does nothing). Before project build SaveSSD checks, if project.buildDir directory exists in project. If it exists and not empty, it does nothing, else creates /tmp/gradle/your-project-path dir and creates project.buildDir symlink to it. So, your project structure remanes same as before, but temporary files, that are often rewritten, are kept in memory.
Plugin can be enabled or disabled through project properties (in gradle.properties file), so different team members can enable or disable it individually. By default it does nothing until you set saveSSD=true.
- Extend SSD lifetime by reducing number of writes to it
- Speeds up build of small projects, because build files are kept in memory, so it can be usefull for HDD owners too
- Your project /build dir contents will be lost on system reboot, relogin, etc.
- Increased memory usage
-
gradle.build
buildscript { repositories { maven { url 'http://dl.bintray.com/haunted-soft/maven' } } dependencies { classpath 'com.haunted.gradle-plugins:save-ssd:+@jar' } } apply plugin:'save-ssd'
-
gradle.properties
saveSSD=true
Optionally, you can set
saveSSDRoot=/some/path
to link build directory in other path, than /tmp/gradle/
-
Perform clean task or delete /build directory manually, than perform build (or other tasks) in your project as usual.
gradle clean gradle build
You also can run saveSsd task manually - it will run ignoring saveSSD=true check but it will do nothing while /build directory exists and not empty.
You can see a live code sample at Android MarketBin project.