From ce94683c739d311db9e22284c16c15f146598fe0 Mon Sep 17 00:00:00 2001 From: barindervir <44568973+barindervir@users.noreply.github.com> Date: Fri, 17 May 2024 15:29:38 +0530 Subject: [PATCH] Mapping file for bundles (#440) * Update main.ts * Update vsts-extension-google-play.json * Update task.json * Update task.loc.json * Update fileHelper.ts * common logic in a separate function * update versions --------- Co-authored-by: DenisRumyantsev --- Tasks/GooglePlayReleaseV4/main.ts | 62 +++++++++---------- .../GooglePlayReleaseV4/modules/fileHelper.ts | 12 ++-- Tasks/GooglePlayReleaseV4/task.json | 2 +- Tasks/GooglePlayReleaseV4/task.loc.json | 4 +- vsts-extension-google-play.json | 2 +- 5 files changed, 38 insertions(+), 44 deletions(-) diff --git a/Tasks/GooglePlayReleaseV4/main.ts b/Tasks/GooglePlayReleaseV4/main.ts index 4456ac89..9e4791f3 100644 --- a/Tasks/GooglePlayReleaseV4/main.ts +++ b/Tasks/GooglePlayReleaseV4/main.ts @@ -129,6 +129,32 @@ async function run(): Promise { if (action === 'OnlyStoreListing') { tl.debug('Selected store listing update only -> skip APK/AAB reading'); } else { + async function uploadRelatedFiles (filePath: string, versionCode: number): Promise { + // Uploading mapping file + if (uploadMappingFiles) { + const mappingFilePath: string | null = fileHelper.getMappingFile(filePath); + + if (mappingFilePath !== null) { + tl.debug(`Uploading ${mappingFilePath} for version code ${versionCode}`); + await googleutil.uploadDeobfuscation(edits, mappingFilePath, packageName, versionCode); + } else { + tl.warning(tl.loc('NotFoundMappingFile', versionCode)); + } + } + + // Uploading native debug symbols file + if (uploadNativeDebugSymbolFiles) { + const nativeDebugSymbolsFilePath: string | null = fileHelper.getSymbolsFile(filePath); + + if (nativeDebugSymbolsFilePath !== null) { + tl.debug(`Uploading ${nativeDebugSymbolsFilePath} for version code ${versionCode}`); + await googleutil.uploadNativeDeobfuscation(edits, nativeDebugSymbolsFilePath, packageName, versionCode); + } else { + tl.warning(tl.loc('NotFoundSymbolsFile', versionCode)); + } + } + } + requireTrackUpdate = true; tl.debug(`Uploading ${bundleFileList.length} AAB(s).`); @@ -137,19 +163,8 @@ async function run(): Promise { tl.debug(`Uploading bundle ${bundleFile}`); const bundle: pub3.Schema$Bundle = await googleutil.addBundle(edits, packageName, bundleFile); tl.debug(`Uploaded ${bundleFile} with the version code ${bundle.versionCode}`); + await uploadRelatedFiles(bundleFile, bundle.versionCode); versionCodes.push(bundle.versionCode); - - // Uploading native debug symbols for aab files - if (uploadNativeDebugSymbolFiles) { - const nativeDebugSymbolsFilePath: string | null = fileHelper.getSymbolsFile(bundleFile); - - if (nativeDebugSymbolsFilePath !== null) { - tl.debug(`Uploading ${nativeDebugSymbolsFilePath} for version code ${bundle.versionCode}`); - await googleutil.uploadNativeDeobfuscation(edits, nativeDebugSymbolsFilePath, packageName, bundle.versionCode); - } else { - tl.warning(tl.loc('NotFoundSymbolsFile', bundle.versionCode)); - } - } } tl.debug(`Uploading ${apkFileList.length} APK(s).`); @@ -177,28 +192,7 @@ async function run(): Promise { } } - if (uploadMappingFiles) { - const mappingFilePath: string | null = fileHelper.getMappingFile(apkFile); - - if (mappingFilePath !== null) { - tl.debug(`Uploading ${mappingFilePath} for version code ${apk.versionCode}`); - await googleutil.uploadDeobfuscation(edits, mappingFilePath, packageName, apk.versionCode); - } else { - tl.warning(tl.loc('NotFoundMappingFile', apk.versionCode)); - } - } - - if (uploadNativeDebugSymbolFiles) { - const nativeDebugSymbolsFilePath: string | null = fileHelper.getSymbolsFile(apkFile); - - if (nativeDebugSymbolsFilePath !== null) { - tl.debug(`Uploading ${nativeDebugSymbolsFilePath} for version code ${apk.versionCode}`); - await googleutil.uploadNativeDeobfuscation(edits, nativeDebugSymbolsFilePath, packageName, apk.versionCode); - } else { - tl.warning(tl.loc('NotFoundSymbolsFile', apk.versionCode)); - } - } - + await uploadRelatedFiles(apkFile, apk.versionCode); versionCodes.push(apk.versionCode); } diff --git a/Tasks/GooglePlayReleaseV4/modules/fileHelper.ts b/Tasks/GooglePlayReleaseV4/modules/fileHelper.ts index fedc49fd..cfc50309 100644 --- a/Tasks/GooglePlayReleaseV4/modules/fileHelper.ts +++ b/Tasks/GooglePlayReleaseV4/modules/fileHelper.ts @@ -77,19 +77,19 @@ export function getObbFile(apkPath: string, packageName: string, versionCode: nu } /** - * Get `mapping.txt` file from apk directory - * @param apkPath apk file path + * Get `mapping.txt` file from apk/aab directory + * @param filePath apk file path * @returns path of the `mapping.txt` file if present else null */ -export function getMappingFile(apkPath: string): string | null { - const mappingFilePath: string = path.join(path.dirname(apkPath), 'mapping.txt'); +export function getMappingFile(filePath: string): string | null { + const mappingFilePath: string = path.join(path.dirname(filePath), 'mapping.txt'); if (fs.existsSync(mappingFilePath)) { - tl.debug(`Found Mapping file for upload in apk directory: ${mappingFilePath}`); + tl.debug(`Found Mapping file for upload in apk/aab directory: ${mappingFilePath}`); return mappingFilePath; } - tl.debug(`No Mapping file found for ${apkPath}, skipping upload`); + tl.debug(`No Mapping file found for ${filePath}, skipping upload`); return null; } diff --git a/Tasks/GooglePlayReleaseV4/task.json b/Tasks/GooglePlayReleaseV4/task.json index 0c4cd7a5..81ea5484 100644 --- a/Tasks/GooglePlayReleaseV4/task.json +++ b/Tasks/GooglePlayReleaseV4/task.json @@ -14,7 +14,7 @@ "demands": [], "version": { "Major": "4", - "Minor": "236", + "Minor": "240", "Patch": "0" }, "minimumAgentVersion": "2.182.1", diff --git a/Tasks/GooglePlayReleaseV4/task.loc.json b/Tasks/GooglePlayReleaseV4/task.loc.json index cfed7459..096fd603 100644 --- a/Tasks/GooglePlayReleaseV4/task.loc.json +++ b/Tasks/GooglePlayReleaseV4/task.loc.json @@ -14,7 +14,7 @@ "demands": [], "version": { "Major": "4", - "Minor": "236", + "Minor": "240", "Patch": "0" }, "minimumAgentVersion": "2.182.1", @@ -398,4 +398,4 @@ "Default": "4.232.1", "Node20-228": "4.235.0" } -} \ No newline at end of file +} diff --git a/vsts-extension-google-play.json b/vsts-extension-google-play.json index 0736e53a..07a12653 100644 --- a/vsts-extension-google-play.json +++ b/vsts-extension-google-play.json @@ -2,7 +2,7 @@ "manifestVersion": 1.0, "id": "google-play", "name": "Google Play", - "version": "4.235.0", + "version": "4.240.0", "publisher": "ms-vsclient", "description": "Provides tasks for continuous delivery to the Google Play Store from TFS/Team Services build or release definitions", "categories": [