Contentsquare CLI
A Dart plugin that offers a command-line interface for users of the Contentsquare package.
Installation
Section titled InstallationAdd contentsquare_cli as a dev dependency.
flutter pub add -d contentsquare_clidev_dependencies: contentsquare_cli: ^1.0.0then run
dart run contentsquare_cliUsage
Section titled Usageupload-debug-files command
Section titled upload-debug-files commandThis command enables you to upload debug files generated by the flutter build command to Contentsquare. This allows you to read the Flutter errors generated in an obfuscated or de-symbolized app.
Configuration
Section titled ConfigurationTo use the command, provide the following identification elements. These can be passed directly as arguments each time you run the command or set up in a configuration file within your project for a more streamlined command usage.
The required information includes:
-
The targeted platform
iosorandroid, corresponding to theflutter buildcommand. -
The project ID
- Login to the Contentsquare platform on https://app.contentsquare.com ↗
- Make sure to be on the right project
- The project ID can be found in the URL query parameter
project:https://app.contentsquare.com/#/{MODULE_NAME}?project={PROJECT_ID}&hash={HASH}]
-
Valid API credentials
Follow the dedicated documentation from the Help Center to get the client ID and client Secret: How to create API credentials ↗.
-
The debug info directory
Provided to the
--split-debug-infooption during build command -
The obfuscation map path (optional)
If you use the
--obfuscateoption during the build process, you can specify the path for the obfuscation map by adding the build option--extra-gen-snapshot-options=--save-obfuscation-map=[YOUR DESIRED FILE PATH].
Using the YAML configuration file
Section titled Using the YAML configuration fileYou can supply this information by adding a contentsquare_cli.yaml file to the root of your project.
contentsquare_cli: android: client_id: "[ANDROID CLIENT ID]" client_secret: "[ANDROID CLIENT SECRET]" project_id: "[ANDROID PROJECT ID]" debug_info_dir: "[PATH PROVIDED TO THE --split-debug-info option]" obfuscation_mapping_file: "[PATH TO THE OBFUSCATION MAP]" ios: client_id: "[IOS CLIENT ID]" client_secret: "[IOS CLIENT SECRET]" project_id: "[IOS PROJECT ID]" debug_info_dir: "[PATH PROVIDED TO THE --split-debug-info option]" obfuscation_mapping_file: "[PATH TO THE OBFUSCATION MAP]"Using the command line arguments
Section titled Using the command line argumentsAlternatively, this information can be provided directly as arguments on the command line.
| Option | Description |
|---|---|
| —platform | The target platform for which the debug files are uploaded |
| —client-id | The client ID of API credentials ↗ |
| —client-secret | The client SECRET of API credentials ↗ |
| —project-id | The contentsquare project ID |
| —debug-info-dir | The path from --split-debug-info option |
| —obfuscation-mapping-file | The generated obfuscation map path |
Examples
Section titled ExamplesLet’s take the case of debug files generated by this flutter build command:
flutter build apk --release --split-debug-info=myDebugInfoDir --obfuscate --extra-gen-snapshot-options=--save-obfuscation-map=app.android.map.jsonUsing this configuration file:
contentsquare_cli: android: client_id: "my-client-id-android" client_secret: "myClientSecretAndroid" project_id: "00000" debug_info_dir: "myDebugInfoDir" obfuscation_mapping_file: "app.android.map.json" ios: client_id: "my-client-id-ios" client_secret: "myClientSecretIos" project_id: "00001" debug_info_dir: "myDebugInfoDir" obfuscation_mapping_file: "app.ios.map.json"You can invoke the upload-debug-files command as follows:
dart run contentsquare_cli upload-debug-files --platform=androidIf you prefer using the command line only:
dart run contentsquare_cli upload-debug-files --platform=android --client-id=my-client-id-android --client-secret="myClientSecretAndroid" --project-id=00000 --debug-info-dir=./myDebugInfoDir --obfuscation-mapping-file=./app.android.map.jsonChangelog
Section titled Changelog1.0.1 - 2024.12.10
Section titled 1.0.1 - 2024.12.10- Update package metadata
1.0.0 - 2024.11.05
Section titled 1.0.0 - 2024.11.05- Introduce the
upload-debug-filescommand