Introduction‎ > ‎

Customisations

Both Gradle and Apphance Flow are highly customisable. 

Sometimes you want to apply your own, specific changes to how Flow builds the projects.  This can be done on many levels:

Project properties

Project properties specific for each plugin are described in Configuration reference - separately for each plugin.  They are usually different for each project and you have to configure the properties for every project before the project has been build. This is typically done by running:

gradle prepareSetup -q

This command walks you through project properties setup, suggest appropriate values.

Configuring gradle tasks

Apphance Flow build consists of gradle tasks. For instance, typical android build and release with two variants is made of following tasks:

:sendMailMessage:cleanFlow
:copySources
:updateVersion
:addApphanceDebug
:buildDebug
:buildAllDebug
:addApphanceRelease
:buildRelease
:buildAllRelease
:buildAll
:compileJava
:processResources
:classes
:checkstyleMain
:compileTestJava
:processTestResources
:testClasses
:checkstyleTest
:cpd
:findbugsMain
:findbugsTest
:lint
:pmdMain
:pmdTest
:test
:check
:prepareImageMontage
:buildSourcesZip
:prepareAvailableArtifactsInfo

If you need custom logic at some point you can:
  • add your own gradle task and put it in proper position by configuring dependencies
  • add groovy actions to existing tasks using doFirst or doLast methods

Android NDK example

If you want to run ndk-build before debug and release variant builds you can add following code to your build gradle:

project.buildRelease.doFirst { buildNdk('flow-tmp/Release', '0') }
project.buildDebug.doFirst { buildNdk('flow-tmp/Debug', '1') }

def buildNdk(dir, debug) {
    exec {
        workingDir dir
        executable "${System.getenv('NDK_ROOT')}/ndk-build"
        args "NDK_DEBUG=$debug"
    }
}

Comments