Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.13k stars 341 forks source link

Wrong service account used for flavor #842

Closed WhatDo closed 4 years ago

WhatDo commented 4 years ago

Describe the bug

I have multiple white label apps that go to different Play accounts, and i have a service account for each account. I set the service account file for each flavor, and debugging the plugin i can see that the merged PlayPublisherExtension is correct, however, when the GenerateEdit task is run, the extension object has gotten its serviceAccountCredentials overwritten.

Output of the tasks is a 403 from the Play API since the wrong service account is being used. Furthermore, i successfully called the Play API using the google python lib to confirm that the service account is correctly set up.

How To Reproduce

My build.gradle.kts looks roughly like

android {
  productFlavors {
    create("myflav1") { /* .. */ }
    create("myflav2") { /* .. */ }
  }

  playConfigs {
    val sa1 = file("mysa1.json")
    val sa2 = file("mysa2.json")
    register("myflav1") {
      serviceAccountCredentials.set(sa1)
    }

    register("myflav2") {
      serviceAccountCredentials.set(sa2)
    }
  }
}

Versions

Tasks executed

bootstrap and bootstrapMyflav1

Expected behavior

For my resources to be bootstrapped

Additional context (if a crash, provide stack trace)

Add any other context about the problem here. If this bug is a crash, run the task with --stacktrace to get the full context.

SUPERCILEX commented 4 years ago

Was able to repo the bug. It's nasty, thanks for finding it!

SUPERCILEX commented 4 years ago

Would you mind checking that it's been fixed in the 3.0 snapshots? (You might have to ./gradlew --refresh-dependencies.)

WhatDo commented 4 years ago

seems to work perfectly, thanks a lot