Skip to content

Commit 368a57f

Browse files
committed
feat(build): Add --date-built parameter for artifact uploads (EME-631)
Add support for passing build timestamps when uploading Android artifacts via the build upload command. This allows the sentry-android-gradle-plugin to capture the build time and send it to Sentry. Changes: - Add --date-built CLI argument to build upload command - Add date_built field to ChunkedBuildRequest struct - Pass date_built through upload_file function to API - Update help text with ISO 8601 format example - Update test snapshots
1 parent beefb7d commit 368a57f

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

src/api/data_types/chunking/build.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ pub struct ChunkedBuildRequest<'a> {
1111
pub build_configuration: Option<&'a str>,
1212
#[serde(skip_serializing_if = "Option::is_none")]
1313
pub release_notes: Option<&'a str>,
14+
#[serde(skip_serializing_if = "Option::is_none")]
15+
pub date_built: Option<&'a str>,
1416
#[serde(flatten)]
1517
pub vcs_info: &'a VcsInfo<'a>,
1618
}

src/commands/build/upload.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ pub fn make_command(command: Command) -> Command {
106106
.long("release-notes")
107107
.help("The release notes to use for the upload.")
108108
)
109+
.arg(
110+
Arg::new("date_built")
111+
.long("date-built")
112+
.help("The date and time when the build was created (ISO 8601 format with timezone, e.g., '2025-11-26T10:30:00Z')")
113+
)
109114
}
110115

111116
pub fn execute(matches: &ArgMatches) -> Result<()> {
@@ -280,6 +285,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
280285

281286
let build_configuration = matches.get_one("build_configuration").map(String::as_str);
282287
let release_notes = matches.get_one("release_notes").map(String::as_str);
288+
let date_built = matches.get_one("date_built").map(String::as_str);
283289

284290
let api = Api::current();
285291
let authenticated_api = api.authenticated()?;
@@ -350,6 +356,7 @@ pub fn execute(matches: &ArgMatches) -> Result<()> {
350356
&project,
351357
build_configuration,
352358
release_notes,
359+
date_built,
353360
&vcs_info,
354361
) {
355362
Ok(artifact_url) => {
@@ -513,6 +520,7 @@ fn upload_file(
513520
project: &str,
514521
build_configuration: Option<&str>,
515522
release_notes: Option<&str>,
523+
date_built: Option<&str>,
516524
vcs_info: &VcsInfo<'_>,
517525
) -> Result<String> {
518526
const SELF_HOSTED_ERROR_HINT: &str = "If you are using a self-hosted Sentry server, \
@@ -575,6 +583,7 @@ fn upload_file(
575583
chunks: &checksums,
576584
build_configuration,
577585
release_notes,
586+
date_built,
578587
vcs_info,
579588
},
580589
)?;

tests/integration/_cases/build/build-upload-help-macos.trycmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ Options:
5353
be used.
5454
--release-notes <release_notes>
5555
The release notes to use for the upload.
56+
--date-built <date_built>
57+
The date and time when the build was created (ISO 8601 format with timezone, e.g.,
58+
'2025-11-26T10:30:00Z')
5659
-h, --help
5760
Print help
5861

0 commit comments

Comments
 (0)