My app has three flavours (flavourOne
, flavourTwo
and flavourThree
) and each flavour has its own versions.properties
I need, at build time, to retrieve a value in that file.
If I do this:
defaultConfig {
....
def file = file("${project.projectDir}/src/flavourOne/version.properties")
// I can now access to the file and obtain the value that I want.
}
But in the above solution, I need to explicitly set the path to the file. Since I want the file that is contained I would like to do something like:
def file = file("${project.projectDir}/src/../version.properties")
and dependending of the selected flavour that file would be transformed into:
def file = file("${project.projectDir}/src/flavourOne/version.properties")
def file = file("${project.projectDir}/src/flavourTwo/version.properties")
def file = file("${project.projectDir}/src/flavourThree/version.properties")
Instead, what the above does its to set the file to ${project.projectDir}/version.properties
How can I read the specific flavour file at build time?