google / secrets-gradle-plugin

A Gradle plugin for providing your secrets to your Android project.
Apache License 2.0
1.13k stars 99 forks source link

Build-Variant Specific Properties not working when file name as more then one dot. #64

Open Thomas-Bagnolati opened 1 year ago

Thomas-Bagnolati commented 1 year ago

Config

build.gradle.kts

secrets {
    propertiesFileName = "secrets.properties"
}

files names on root project :

Result Error

Always show the secrets.properties content, even when set as

Solution

There is no bug, I finaly realise my mistake. But in case of someone did the same I have to say you you have to replace the first world by the build variant insted of add it. So, for propertiesFileName = "secrets.properties" and a debug variant, use file named debug.properties.

Thomas-Bagnolati commented 1 year ago

After some tests, it's not working when more then one dot is set: Not working -> debug.secrets.properties default.secrets.properties

Makalaster commented 5 months ago

@Thomas-Bagnolati How did you ultimately set up the files and secrets block with multiple build variants? Is there still a secrets.properties file? What do you set in the secrets block for the propertiesFileName?

olibac commented 3 months ago

@Thomas-Bagnolati So the only name you can have for the debug properties file is debug.properties?

olibac commented 2 months ago

Finally this is what I ended up doing:

secrets{
  propertiesFileName = project.gradle.startParameter.taskNames.any {
        it.contains("Release") } ? "apikeys.release.properties" : "apikeys.debug.properties"
}

@Thomas-Bagnolati, @Makalaster Do you see any problems with this?