Nenhuma descrição
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

crashlytics-mappingfile-upload.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.command = void 0;
  4. const command_1 = require("../command");
  5. const error_1 = require("../error");
  6. const utils = require("../utils");
  7. const buildToolsJarHelper_1 = require("../crashlytics/buildToolsJarHelper");
  8. exports.command = new command_1.Command("crashlytics:mappingfile:upload <mappingFile>")
  9. .description("upload a ProGuard/R8-compatible mapping file to deobfuscate stack traces")
  10. .option("--app <appID>", "the app id of your Firebase app")
  11. .option("--resource-file <resourceFile>", "path to the Android resource XML file that includes the mapping file id")
  12. .action(async (mappingFile, options) => {
  13. const app = getGoogleAppID(options);
  14. const debug = !!options.debug;
  15. if (!mappingFile) {
  16. throw new error_1.FirebaseError("set `--mapping-file <mappingFile>` to a valid mapping file path, e.g. app/build/outputs/mapping.txt");
  17. }
  18. const mappingFilePath = mappingFile;
  19. const resourceFilePath = options.resourceFile;
  20. if (!resourceFilePath) {
  21. throw new error_1.FirebaseError("set --resource-file <resourceFile> to a valid Android resource file path, e.g. app/main/res/values/strings.xml");
  22. }
  23. const jarFile = await (0, buildToolsJarHelper_1.fetchBuildtoolsJar)();
  24. const jarOptions = { app, mappingFilePath, resourceFilePath };
  25. utils.logBullet(`Uploading mapping file: ${mappingFilePath}`);
  26. const uploadArgs = buildArgs(jarOptions);
  27. (0, buildToolsJarHelper_1.runBuildtoolsCommand)(jarFile, uploadArgs, debug);
  28. utils.logBullet("Successfully uploaded mapping file");
  29. });
  30. function getGoogleAppID(options) {
  31. if (!options.app) {
  32. throw new error_1.FirebaseError("set --app <appId> to a valid Firebase application id, e.g. 1:00000000:android:0000000");
  33. }
  34. return options.app;
  35. }
  36. function buildArgs(options) {
  37. return [
  38. "-uploadMappingFile",
  39. options.mappingFilePath,
  40. "-resourceFile",
  41. options.resourceFilePath,
  42. "-googleAppId",
  43. options.app,
  44. "-verbose",
  45. ];
  46. }