Sometimes I may want to only build a server with vanilla ice cream, sometimes with chocolate and strawberry, and sometimes with all 31 flavors. How can I do this with gradle? I am aware that you can pass in properties through a gradle.properties file, and there may be a way to set up some blocks for some logic to build by applying properties from certain .gradle files, but would there be a simple way of simply running something along the lines of:
gradle build all
or
gradle build chocolate vanilla
?
The reason why these modules are structured in this project is because they all typically have the same dependencies.
Create specific tasks that only depends on the flavors you need (.e…g buildChoclate, buildNeapolitan) 2) Create a generic task that will dynamically configure the project dependencies given your input from command line, file, etc…
Option 2 sounds best because I plan on passing in a parameter/parameters from Jenkins when doing a production build. How would you do this?
I am aware you can pass a project property in with
gradle build -Pflavor=chocolate
but can you pass in more than one property?
If this is not possible, then perhaps I may have to go with specifying flavour groups in certain .gradle files, eg. have a “neapolitan.gradle” file, which when the flavor property is neopolitan, the task uses
apply from: neapolitan.gradle
builds and bundles three different projects. Problem is that this method requires that someone has commited a gradle file for each configuration.
EDIT: Seems like a possible solution I have found might be to split the arguments by a whitespace token.