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.12k stars 340 forks source link

Use the apk/aab file name for internal sharing json file names #929

Closed Wouter12 closed 3 years ago

Wouter12 commented 3 years ago

Hi, I created a PR to fix #928

Wouter12 commented 3 years ago

I did not find a way to check if the name of the json corresponds with the name of the apk, so I just removed the checks on the file name

SUPERCILEX commented 3 years ago

Would you mind giving me push access to the PR or applying these patches?

Index: play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingApk.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingApk.kt b/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingApk.kt
--- a/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingApk.kt (revision 1b3742eae749686339875a76b5509acf872a7ad1)
+++ b/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingApk.kt (revision 4fc97734aeb43b4044f663b10e97a2aeaa9a629a)
@@ -69,7 +69,7 @@
             val response = apiService.publisher.uploadInternalSharingApk(apkFile)

             println("Upload successful: ${response.downloadUrl}")
-            parameters.outputDir.get().file("${apkFile.name}.json").asFile
+            parameters.outputDir.get().file("${apkFile.nameWithoutExtension}.json").asFile
                     .writeText(response.json)
         }

Index: play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingBundle.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingBundle.kt b/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingBundle.kt
--- a/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingBundle.kt  (revision 1b3742eae749686339875a76b5509acf872a7ad1)
+++ b/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/PublishInternalSharingBundle.kt  (revision 4fc97734aeb43b4044f663b10e97a2aeaa9a629a)
@@ -69,7 +69,7 @@
             val response = apiService.publisher.uploadInternalSharingBundle(bundleFile)

             println("Upload successful: ${response.downloadUrl}")
-            parameters.outputDir.get().file("${bundleFile.name}.json").asFile
+            parameters.outputDir.get().file("${bundleFile.nameWithoutExtension}.json").asFile
                     .writeText(response.json)
         }

Index: play/plugin/src/test/kotlin/com/github/triplet/gradle/play/tasks/shared/PublishInternalSharingArtifactIntegrationTests.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/play/plugin/src/test/kotlin/com/github/triplet/gradle/play/tasks/shared/PublishInternalSharingArtifactIntegrationTests.kt b/play/plugin/src/test/kotlin/com/github/triplet/gradle/play/tasks/shared/PublishInternalSharingArtifactIntegrationTests.kt
--- a/play/plugin/src/test/kotlin/com/github/triplet/gradle/play/tasks/shared/PublishInternalSharingArtifactIntegrationTests.kt (revision 1b3742eae749686339875a76b5509acf872a7ad1)
+++ b/play/plugin/src/test/kotlin/com/github/triplet/gradle/play/tasks/shared/PublishInternalSharingArtifactIntegrationTests.kt (revision 4fc97734aeb43b4044f663b10e97a2aeaa9a629a)
@@ -16,8 +16,8 @@

         assertThat(outputDir.listFiles()).isNotNull()
         assertThat(outputDir.listFiles()!!.size).isEqualTo(1)
-        assertThat(outputDir.listFiles()!!.first().name).endsWith(".json")
-        assertThat(outputDir.listFiles()!!.first().readText()).isEqualTo("json-payload")
+        assertThat(outputDir.listFiles()!!.single().name).endsWith(".json")
+        assertThat(outputDir.listFiles()!!.single().readText()).isEqualTo("json-payload")
     }

     @Test
Index: README.md
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/README.md b/README.md
--- a/README.md (revision 4fc97734aeb43b4044f663b10e97a2aeaa9a629a)
+++ b/README.md (revision 5fe0d60ff0b091a1e3bb45cfff3104530997c414)
@@ -388,11 +388,10 @@

 After running an Internal Sharing task, the output of the API response will be stored in the
 following directory: `build/outputs/internal-sharing/[bundle/apk]/[variant]/`. Each file will be
-named `[file creation timestamp].json` so that you can get the latest response by sorting the files
-in descending order and then picking the first entry.
+named `[apk/aab name].json`.

 For example, here are the contents
-of `app/build/outputs/internal-sharing/bundle/release/1567900521492.json`:
+of `app/build/outputs/internal-sharing/bundle/release/app-release.json`:

 ```json
 {
SUPERCILEX commented 3 years ago

Thanks!