-
Notifications
You must be signed in to change notification settings - Fork 154
Description
Describe the bug
Our project makes use of two flavor dimensions. The first one is the customer, the second the backend environment.
For each customer we have two google-services.json
, one for release and one for all other build types and backend environments. These are located in the following locations:
app/src/${customer}/google-services.json
: for non-release buildsapp/src/${customer}${backend_environment}Release/google-services.json
: for release builds
Yesterday we upgraded the Google Services plugin from version 4.3.5 to 4.3.8 and noticed that the construction of the path to our release google-services.json
changed, such that it could not find the JSON file for release builds.
The problem boils down to our second dimension using camelCase, which is no longer being respected. The lookup is lowercasing the camelCase in the second flavor for the lookup.
I have created a minimal working example (MWE) here. That repo has CI set up to run the Google Services plugin at different versions. The repo does not contain a google-services.json
file, in order for the lookup locations to be printed out.
Trying to narrow down in which version this change happened, I realized that versions 4.3.6 and 4.3.7 don't even work.
The MWE defines these flavors:
flavorDimensions 'first', 'second'
productFlavors {
fooBar { dimension 'first' }
helloWorld { dimension 'second' }
}
The lookup error in version 4.3.5 (seen here) says this (I've highlighted the line that we relied on in our app):
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
app/src/foo/bar/hello/world/debug/google-services.json
app/src/foo/bar/hello/debug/google-services.json
app/src/foo/bar/hello/world/google-services.json
app/src/foo/bar/hello/worldDebug/google-services.json
app/src/foo/bar/debug/google-services.json
app/src/foo/bar/hello/google-services.json
app/src/foo/bar/helloDebug/google-services.json
app/src/fooBarHelloWorld/debug/google-services.json
app/src/debug/fooBarHelloWorld/google-services.json
app/src/foo/debug/google-services.json
app/src/foo/bar/google-services.json
app/src/foo/barDebug/google-services.json
app/src/fooBarHelloWorld/google-services.json
app/src/debug/google-services.json
app/src/fooBarHelloWorldDebug/google-services.json <-------- This line we rely on
app/src/foo/google-services.json
app/src/fooDebug/google-services.json
app/google-services.json
In version 4.3.8 (seen here), it looks like this:
> File google-services.json is missing. The Google Services Plugin cannot function without it.
Searched Location:
app/src/fooBar/helloWorld/debug/google-services.json
app/src/fooBarHelloworld/debug/google-services.json
app/src/debug/fooBarHelloworld/google-services.json
app/src/fooBar/debug/google-services.json
app/src/fooBar/helloWorld/google-services.json
app/src/fooBar/helloWorldDebug/google-services.json
app/src/fooBarHelloworld/google-services.json
app/src/debug/google-services.json
app/src/fooBarHelloworldDebug/google-services.json <-------- This line we rely on
app/src/fooBar/google-services.json
app/src/fooBarDebug/google-services.json
app/google-services.json
Notice how the line we rely on no longer respects the casing of the flavor name:
- v4.3.5:
fooBarHelloWorldDebug
- v4.3.8:
fooBarHelloworldDebug
For now we'll be using app/src/fooBarDebug/google-services.json
as a workaround as that seems better than renaming the previously used folder. Note that this location is new and did not exist in version 4.3.5. This is not ideal as I expect it to be gone again on the next update.
To Reproduce
- Check out https://github.com/fphilipe/google-services-plugin-bug
- Run
VERSION=4.3.5 ./gradlew :app:processFooBarHelloWorldDebugGoogleServices
to see the old locations - Run
VERSION=4.3.8 ./gradlew :app:processFooBarHelloWorldDebugGoogleServices
to see the new locations
Expected behavior
Given that this is a patch release, I expect no change in lookup behavior.