loshkin
loshkin

Reputation: 1630

Where to define gradle task so that it doesn't run with every build

I have defined a gradle task that increments version code. The thing is that it is in the app.gradle and it runs with every build. My goal is to make it run on demand from our CI server.

Upvotes: 0

Views: 69

Answers (1)

moallemi
moallemi

Reputation: 2467

Just make your task depends on a special task. In your case:

task incVersionCode(dependsOn: ["assembleRelease"]) << {
    // your task code
}

you can also use this android gradle plugin for auto increasing version code: https://github.com/moallemi/gradle-advanced-build-version/

Upvotes: 1

Related Questions