Archive for February, 2014

Automatically increasing versionCode with Gradle – Followup

Wednesday, February 12th, 2014

This article is a followup to the original that can be found here.

As a normal use case the original article provides a good way not to worry about increasing the version number. The only drawback is that the number is really increased every time you compile the source code. This results in jumping versionCodes in the commit history. For instance lets say you checked out the App with the versionCode set to 3. After compiling the application for several times, until you deem it stable, you might check it in with a versionCode of 15. It would be more desirable to increase it just by one.

To achieve this we are going to base our new implementation on the committed state of the AndroidManifest.xml (here for the DriveNow project).

To incorporate this into the normal build process, we can basically use the same methodology we used in the original version. If we want to go a step further and don’t increase the version if we are running on our integration server, we can also alter the task definition a little bit.

Running the build now with  ./gradlew assemble -D buildConfig.keepVersionCode=true will build the project without increasing the versionCode.

Colour your git

Friday, February 7th, 2014

You want autocompletion, colours and your current branch in your terminal? You can find hundreds of tutorials on the net, I will just tell you what to do on MacOS:

Add these lines to your .bash_profile

This will enable autocompletion for git commands and branch names and also show your current branch. Note that in the last line, you can change colours if you’d like to be different.

You may need these two files in /usr/local/git/contrib/completion.

To enable fancy colours in your git command output, type:

or just some of these if you don’t want everything coloured:

Enjoy your all-new Terminal.