24 Dec 2013

Save programmer's SSD

Recently, building project, I thought, how many file i/o operations happen during build process, and how terribly it reduces my SSD lifetime by consuming a limited number of write cycles. Immediately appeared a natural wish to link a build system's temporary files directory somewere in tmpfs. At first I wanted to write a shell script, but soon understood that it's a wrong way and decided to include according instructions in build project. As I wanted to make this easily reusable, a small SaveSSD plugin for Gradle was born. Source code is published at Github, and the compiled library can be included in project by referencing my maven repository at Bintray. Plugin was tested in Android Studio and Intellij IDEA with Android and Java projects, but it should work with any Gradle project on all *nix systems (on Windows it just does nothing). By the way, as RAM access is much faster, than HDD access, HDD owners also can gain profit from SaveSSD plugin usage - build process becomes faster. Nevertheless, there is an option to turn it on and off for every team member individually.

To use SaveSSD plugin in your project, you should:
  1. Reference SaveSSD plugin in your gradle.build (this sample references the newest plugin version in my repository)
    buildscript {
        repositories {
            maven {
                url 'http://dl.bintray.com/haunted-soft/maven'
        dependencies {
            classpath 'com.haunted.gradle-plugins:save-ssd:+@jar'
    apply plugin:'save-ssd'
  2. Tell that you wish to activate plugin on current machine in gradle.properties (typically, this file contains individual developer's preferences and excluded from version control system)
    saveSSD = true
  3. 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.
I wish you happy programming and a long life to your drives!

From: Urals Highlander: Save programmer's SSD

1 comment:

  1. Fiat payouts, the opposite hand|however|then again}, are 1xbet processed and delivered inside 5-7 working days. We discovered lots of of money lines that span throughout 22+ betting markets, and their devoted racebook incorporates the best odds from tens of international tracks. As you might count on from a gambling web site named “MyBookie”, find a way to|you possibly can} wager on three sorts of horse racing.