Skip to content

Plugin for Android Gradle to automatically overlay the app icon with the current git commit SHA1.

License

Notifications You must be signed in to change notification settings

raumfeld/gradle-android-appiconoverlay

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gradle-android-appiconoverlay

Plugin for Android Gradle to automatically overlay the app icon with information about the current build: git branch name and commit SHA1.

Example

Example: app icon with overlay

Usage

  1. This plugin is published on JCenter. Add dependency in your Android project's top-level build.gradle file:

    buildscript {
        dependencies {
            classpath 'com.github.splatte:gradle-android-appiconoverlay:1.1'
        }
    }
  2. Apply the plugin in your app module's build.gradle file:

    apply plugin: 'app-icon-overlay'
    appiconoverlay {
        /* then see below for configuration options */
    }
    
    android {
        /* project config */
    }
  3. You will need convert from the ImageMagick project to do the image processing. You can install it using a command along the lines of:

    # debian/ubuntu
    sudo apt-get install imagemagick
    
    # osx
    sudo port install imagemagick
    sudo brew install imagemagick

The plugin will hook into your build process automatically and overwrite the target app icon files for debug builds. It will not mess with any files in your repository.

Customization

The plugin offers some options for customizing the appearance of the generated icon. Simply add a block to your app module's build.gradle:

appiconoverlay {
    textColor '#FFF'           /* #rrggbbaa format */
    backgroundColor "#0008"    /* #rrggbbaa format */
    format '$branch\n$commit'  /* GString */
    imageMagick 'convert'      /* command to run ImageMagick */
}
Option Description
textColor Text color in #rrggbbaa format.
backgroundColor Background color for overlay in #rrggbbaa format.
format Format string to be used to create the text in the overlay.
Note: Use single quotes, it's a GString.
The following variables are available:
  • $branch name of git branch
  • $commit short SHA1 of latest commit in current branch
imageMagick Command to run ImageMagick's "convert".

Credits

Idea based on the IconOverlaying project by Krzysztof Zabłocki, which implements a similar feature for iOS builds.

About

Plugin for Android Gradle to automatically overlay the app icon with the current git commit SHA1.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Groovy 100.0%