Skip to content

Commit 718df71

Browse files
feat(proguard): upload-proguardproguard upload (#3174)
Move the `sentry-cli upload-proguard` command to `sentry-cli proguard upload`. This new API matches the API for the `debug-files upload` and `sourcemap upload` commands. This API will also enable us to add new subcommands, which will be useful for #3173. `sentry-cli upload-proguard` is retained as an alias to `sentry-cli proguard upload`, and we intend to keep it around for the foreseeable future, so no one needs to migrate.
1 parent c84fd84 commit 718df71

File tree

18 files changed

+427
-6
lines changed

18 files changed

+427
-6
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Improvements
6+
7+
- Moved `sentry-cli upload-proguard` to `sentry-cli proguard upload`, aligning the API with similar upload commands like `debug-files upload` and `sourcemaps upload` ([#3174](https://github.com/getsentry/sentry-cli/pull/3174)). `sentry-cli upload-proguard` remains supported as an alias, so no migration is required.
8+
39
## 3.2.3
410

511
### Experimental Feature 🧑‍🔬 (internal-only)

src/commands/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ mod login;
3232
mod logs;
3333
mod monitors;
3434
mod organizations;
35+
mod proguard;
3536
mod projects;
3637
mod react_native;
3738
mod releases;
@@ -60,6 +61,7 @@ macro_rules! each_subcommand {
6061
$mac!(logs);
6162
$mac!(monitors);
6263
$mac!(organizations);
64+
$mac!(proguard);
6365
$mac!(projects);
6466
$mac!(react_native);
6567
$mac!(releases);

src/commands/proguard/mod.rs

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
use anyhow::Result;
2+
use clap::{ArgMatches, Command};
3+
4+
pub mod upload;
5+
6+
macro_rules! each_subcommand {
7+
($mac:ident) => {
8+
$mac!(upload);
9+
};
10+
}
11+
12+
pub fn make_command(mut command: Command) -> Command {
13+
macro_rules! add_subcommand {
14+
($name:ident) => {{
15+
command = command.subcommand(crate::commands::proguard::$name::make_command(
16+
Command::new(stringify!($name).replace('_', "-")),
17+
));
18+
}};
19+
}
20+
21+
command = command
22+
.about("Manage ProGuard mapping files.")
23+
.subcommand_required(true)
24+
.arg_required_else_help(true);
25+
26+
each_subcommand!(add_subcommand);
27+
command
28+
}
29+
30+
pub fn execute(matches: &ArgMatches) -> Result<()> {
31+
macro_rules! execute_subcommand {
32+
($name:ident) => {{
33+
if let Some(sub_matches) =
34+
matches.subcommand_matches(&stringify!($name).replace('_', "-"))
35+
{
36+
return crate::commands::proguard::$name::execute(&sub_matches);
37+
}
38+
}};
39+
}
40+
41+
each_subcommand!(execute_subcommand);
42+
unreachable!();
43+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use anyhow::Result;
2+
use clap::{ArgMatches, Command};
3+
4+
pub fn make_command(command: Command) -> Command {
5+
// Retained as a top-level command for backward compatibility.
6+
crate::commands::proguard::upload::make_command(command)
7+
}
8+
9+
pub fn execute(matches: &ArgMatches) -> Result<()> {
10+
crate::commands::proguard::upload::execute(matches)
11+
}

tests/integration/_cases/help/help-windows.trycmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Commands:
2121
logs [BETA] Manage logs in Sentry
2222
monitors Manage cron monitors on Sentry.
2323
organizations Manage organizations on Sentry.
24+
proguard Manage ProGuard mapping files.
2425
projects Manage projects on Sentry.
2526
react-native Upload build artifacts for react-native projects.
2627
releases Manage releases on Sentry.

tests/integration/_cases/help/help.trycmd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Commands:
2121
logs [BETA] Manage logs in Sentry
2222
monitors Manage cron monitors on Sentry.
2323
organizations Manage organizations on Sentry.
24+
proguard Manage ProGuard mapping files.
2425
projects Manage projects on Sentry.
2526
react-native Upload build artifacts for react-native projects.
2627
releases Manage releases on Sentry.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
```
2+
$ sentry-cli proguard --help
3+
? success
4+
Manage ProGuard mapping files.
5+
6+
Usage: sentry-cli[EXE] proguard [OPTIONS] <COMMAND>
7+
8+
Commands:
9+
upload Upload ProGuard mapping files to a project.
10+
help Print this message or the help of the given subcommand(s)
11+
12+
Options:
13+
--header <KEY:VALUE> Custom headers that should be attached to all requests
14+
in key:value format.
15+
--auth-token <AUTH_TOKEN> Use the given Sentry auth token.
16+
--log-level <LOG_LEVEL> Set the log output verbosity. [possible values: trace, debug, info,
17+
warn, error]
18+
--quiet Do not print any output while preserving correct exit code. This
19+
flag is currently implemented only for selected subcommands.
20+
[aliases: --silent]
21+
-h, --help Print help
22+
23+
```
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
```
2+
$ sentry-cli proguard upload --help
3+
? success
4+
Upload ProGuard mapping files to a project.
5+
6+
Usage: sentry-cli[EXE] proguard upload [OPTIONS] [PATH]...
7+
8+
Arguments:
9+
[PATH]... The path to the mapping files.
10+
11+
Options:
12+
-o, --org <ORG> The organization ID or slug.
13+
--header <KEY:VALUE> Custom headers that should be attached to all requests
14+
in key:value format.
15+
-p, --project <PROJECT> The project ID or slug.
16+
--auth-token <AUTH_TOKEN> Use the given Sentry auth token.
17+
--no-upload Disable the actual upload.
18+
This runs all steps for the processing but does not trigger the
19+
upload. This is useful if you just want to verify the mapping
20+
files and write the proguard UUIDs into a properties file.
21+
--log-level <LOG_LEVEL> Set the log output verbosity. [possible values: trace, debug, info,
22+
warn, error]
23+
--write-properties <PATH> Write the UUIDs for the processed mapping files into the given
24+
properties file.
25+
--quiet Do not print any output while preserving correct exit code. This
26+
flag is currently implemented only for selected subcommands.
27+
[aliases: --silent]
28+
--require-one Requires at least one file to upload or the command will error.
29+
-u, --uuid <UUID> Explicitly override the UUID of the mapping file with another one.
30+
This should be used with caution as it means that you can upload
31+
multiple mapping files if you don't take care. This however can be
32+
useful if you have a build process in which you need to know the
33+
UUID of the proguard file before it was created. If you upload a
34+
file with a forced UUID you can only upload a single proguard file.
35+
-h, --help Print help
36+
37+
```
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
```
2+
$ sentry-cli proguard upload tests/integration/_fixtures/proguard.txt --no-upload
3+
? success
4+
warning: ignoring proguard mapping 'tests/integration/_fixtures/proguard.txt': Proguard mapping does not contain line information
5+
> skipping upload.
6+
7+
```

0 commit comments

Comments
 (0)