contentsquare_cli 1.0.1
contentsquare_cli: ^1.0.1 copied to clipboard
A Command Line Interface offering commands for the Contentsquare plugin
contentsquare_cli #
A Command Line Interface for the Contentsquare plugin.
It provides a way to upload debug symbols and mapping files to the Contentsquare plugin if you use at least one of the following options in your flutter build
command:
-
--split-debug-info
: You will need to upload the symbols files generated by the Flutter compilation in order to be able to read the stack traces. -
--obfuscate
: The obfuscation map will be needed to clearly display your error messages.
Installation #
In your pubspec.yaml, add contentsquare_cli
as a dev dependency
dev_dependencies:
contentsquare_cli: ^1.0.0
Configuration #
The upload command requires the following information:
-
The targeted platform
ios
orandroid
-
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-info
option during build command -
The obfuscation map path (optional)
If you're using the
--obfuscate
option during build. It can be extracted with the additional build option--extra-gen-snapshot-options=--save-obfuscation-map=[YOUR DESIRED FILENAME]
Using YAML file #
You can provide this information by adding a contentsquare_cli.yaml
file at 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 command line arguments #
Alternatively, this information can be added as arguments directly 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 |
Use
--help
option for further information
You can mix these two solutions if, for example, you want to use the YAML solution to store the paths and project id but supply the client identifier and secret as a command line argument.
How to use #
The upload command must be executed after each build command.
Example assuming you're using the following YAML 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"
### Your build apk command
flutter build apk --split-debug-info=myDebugInfoDir --obfuscate --extra-gen-snapshot-options=--save-obfuscation-map=app.android.map.json
### Upload generated debug files to contentsquare
dart run contentsquare_cli upload-debug-files --platform=android
Alternatively, Flutter can be used instead of dart:
flutter packages pub run contentsquare_cli upload-debug-files --platform=android
Example of upload command without using the YAML config file:
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.json
For an automatic execution, we highly recommend to integrate this command in a release script or in a CI/CD pipeline.
For more information, please refer to the contentsquare documentation