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

Can't upload mapping file when artifactDir is specified #686

Closed zsavely closed 5 years ago

zsavely commented 5 years ago

Describe the bug

A proguard mapping is not uploaded when using a custom artifact dir.

play {
  serviceAccountCredentials = file("api.json")
  track = "internal"
  releaseStatus = "completed"
  resolutionStrategy = "auto"
  artifactDir = file("$projectDir/build/outputs/apk/release")
}

In proguard-rules.pro I have a line, so that mapping.txt is existent in two places:

  1. app/build/outputs/apk/release/mapping.txt
  2. app/build/outputs/mapping/release/mapping.txt
-printmapping build/outputs/apk/release/mapping.txt

How To Reproduce

Versions

Tasks executed

publishApk, publishReleaseApk

Expected behavior

The mapping is uploaded to GPlay.

SUPERCILEX commented 5 years ago

This is normal: the mapping file needs to be in the same folder as the artifact dir. If you're just using the APK that's built straight from AGP, then let GPP handle everything for you.

zsavely commented 5 years ago

But as I originally stated, the mapping and the APK file are generated in the same folder (build/outputs/apk/release/).

zsavely commented 5 years ago

While publishing a release, I execute two separate commands:

  1. ./gradlew -Pci --console=plain clean lint assembleRelease --stacktrace
  2. ./gradlew publishApk --stacktrace

After the first command, I manually go to the release folder and find that both app-release.apk and mapping.txt files are in place, precisely in $projectDir/app/build/outputs/apk/release.

Then, I execute the second command, and it does upload only APK file. This is clearly not how it is documented in README.md and is a bug. Why would you close it?

SUPERCILEX commented 5 years ago

Hmmm

zsavely commented 5 years ago
  1. I am using it in order not to rebuild the APK. publishApk without an artifact dir definitely works, however I would like to not rebuild an APK.

  2. Yes, I've just checked the mapping file, and it's not empty.

  3. Sure, the info I get is from Google Play Store. The three greened check marks were done without a custom artifact dir.

image

  1. I have just checked my git history and it seems that I have already tried the snapshot build. Unfortunately, it hasn't helped.
SUPERCILEX commented 5 years ago
  1. I don't understand your use case. Just run ./gradlew -Pci --console=plain clean lint assembleRelease publishApk --stacktrace
  2. Dang
  3. Can you share the logs from the Gradle build?
  4. Also dang
zsavely commented 5 years ago
  1. Do I understand this correctly, publishApk will build the APK again, right after the assembleRelease? If yes, I am not willing to build again, it alters the SHA of the APK file.

I can share the logs, sure. Could you provide the exact command with which you would like the logs to be shared? For example, --debug or others?

SUPERCILEX commented 5 years ago

Nope, that would be horrible UX. If you run any publishing task within the same build as an assemble task, assembly will only run once. This is how Gradle works BTW and isn't related to GPP: a task can only run once per build invocation.

I'm begging you at this point, just remove artifactDir. It'll work as you expect, trust me. 😛 However, I would like to get to the bottom of the bug, so can you run ./gradlew publishApk --info > logs.txt and upload the file?

Sidenote: clearly the docs need fixing. Does this make more sense?

zsavely commented 5 years ago

Yes, sure. For some reason, this morning my account has been suspended, so I cannot really get you the gradle build info currently, so if you are not in a rush, let's wait and I'll get you the logs.

As per the documentation, I would write like this:

By default, GPP will not build your artifact unless it absolutely has to (e.g. in case there is no artifact available). In advanced cases, this might not be the desired behavior.

SUPERCILEX commented 5 years ago

Oof, sorry to hear that about your account being suspended. And thanks for your thoughts on the documentation, it gave me an idea which I think is as simple as possible without the confusion you ran into.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.