@@ -33,6 +33,92 @@ use crate::utils::vcs::{
3333 git_repo_head_ref, git_repo_remote_url,
3434} ;
3535
36+ pub fn make_command ( command : Command ) -> Command {
37+ #[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
38+ const HELP_TEXT : & str =
39+ "The path to the build to upload. Supported files include Apk, Aab, XCArchive, and IPA." ;
40+ #[ cfg( not( all( target_os = "macos" , target_arch = "aarch64" ) ) ) ]
41+ const HELP_TEXT : & str =
42+ "The path to the build to upload. Supported files include Apk, and Aab." ;
43+ command
44+ . about ( "Upload builds to a project." )
45+ . org_arg ( )
46+ . project_arg ( false )
47+ . arg (
48+ Arg :: new ( "paths" )
49+ . value_name ( "PATH" )
50+ . help ( HELP_TEXT )
51+ . num_args ( 1 ..)
52+ . action ( ArgAction :: Append )
53+ . required ( true ) ,
54+ )
55+ . arg (
56+ Arg :: new ( "head_sha" )
57+ . long ( "head-sha" )
58+ . value_parser ( parse_sha_allow_empty)
59+ . help ( "The VCS commit sha to use for the upload. If not provided, the current commit sha will be used." )
60+ )
61+ . arg (
62+ Arg :: new ( "base_sha" )
63+ . long ( "base-sha" )
64+ . value_parser ( parse_sha_allow_empty)
65+ . help ( "The VCS commit's base sha to use for the upload. If not provided, the merge-base of the current and remote branch will be used." )
66+ )
67+ . arg (
68+ Arg :: new ( "vcs_provider" )
69+ . long ( "vcs-provider" )
70+ . help ( "The VCS provider to use for the upload. If not provided, the current provider will be used." )
71+ )
72+ . arg (
73+ Arg :: new ( "head_repo_name" )
74+ . long ( "head-repo-name" )
75+ . help ( "The name of the git repository to use for the upload (e.g. organization/repository). If not provided, the current repository will be used." )
76+ )
77+ . arg (
78+ Arg :: new ( "base_repo_name" )
79+ . long ( "base-repo-name" )
80+ . help ( "The name of the git repository to use for the upload (e.g. organization/repository). If not provided, the current repository will be used." )
81+ )
82+ . arg (
83+ Arg :: new ( "head_ref" )
84+ . long ( "head-ref" )
85+ . help ( "The reference (branch) to use for the upload. If not provided, the current reference will be used." )
86+ )
87+ . arg (
88+ Arg :: new ( "base_ref" )
89+ . long ( "base-ref" )
90+ . help ( "The base reference (branch) to use for the upload. If not provided, the merge-base with the remote tracking branch will be used." )
91+ )
92+ . arg (
93+ Arg :: new ( "pr_number" )
94+ . long ( "pr-number" )
95+ . value_parser ( clap:: value_parser!( u32 ) )
96+ . help ( "The pull request number to use for the upload. If not provided and running \
97+ in a pull_request-triggered GitHub Actions workflow, the PR number will be automatically \
98+ detected from GitHub Actions environment variables.")
99+ )
100+ . arg (
101+ Arg :: new ( "build_configuration" )
102+ . long ( "build-configuration" )
103+ . help ( "The build configuration to use for the upload. If not provided, the current version will be used." )
104+ )
105+ . arg (
106+ Arg :: new ( "release_notes" )
107+ . long ( "release-notes" )
108+ . help ( "The release notes to use for the upload." )
109+ )
110+ . arg (
111+ Arg :: new ( "git_metadata" )
112+ . long ( "git-metadata" )
113+ . num_args ( 0 ..=1 )
114+ . default_missing_value ( "true" )
115+ . value_parser ( clap:: value_parser!( bool ) )
116+ . help ( "Controls whether to collect and send git metadata (branch, commit, etc.). \
117+ Use --git-metadata to force enable, --git-metadata=false to force disable. \
118+ If not specified, git metadata is automatically collected only when running in a CI environment.")
119+ )
120+ }
121+
36122/// Holds git metadata collected for build uploads.
37123#[ derive( Debug , Default ) ]
38124struct GitMetadata {
@@ -268,92 +354,6 @@ fn collect_git_metadata(matches: &ArgMatches, config: &Config, auto_collect: boo
268354 }
269355}
270356
271- pub fn make_command ( command : Command ) -> Command {
272- #[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
273- const HELP_TEXT : & str =
274- "The path to the build to upload. Supported files include Apk, Aab, XCArchive, and IPA." ;
275- #[ cfg( not( all( target_os = "macos" , target_arch = "aarch64" ) ) ) ]
276- const HELP_TEXT : & str =
277- "The path to the build to upload. Supported files include Apk, and Aab." ;
278- command
279- . about ( "Upload builds to a project." )
280- . org_arg ( )
281- . project_arg ( false )
282- . arg (
283- Arg :: new ( "paths" )
284- . value_name ( "PATH" )
285- . help ( HELP_TEXT )
286- . num_args ( 1 ..)
287- . action ( ArgAction :: Append )
288- . required ( true ) ,
289- )
290- . arg (
291- Arg :: new ( "head_sha" )
292- . long ( "head-sha" )
293- . value_parser ( parse_sha_allow_empty)
294- . help ( "The VCS commit sha to use for the upload. If not provided, the current commit sha will be used." )
295- )
296- . arg (
297- Arg :: new ( "base_sha" )
298- . long ( "base-sha" )
299- . value_parser ( parse_sha_allow_empty)
300- . help ( "The VCS commit's base sha to use for the upload. If not provided, the merge-base of the current and remote branch will be used." )
301- )
302- . arg (
303- Arg :: new ( "vcs_provider" )
304- . long ( "vcs-provider" )
305- . help ( "The VCS provider to use for the upload. If not provided, the current provider will be used." )
306- )
307- . arg (
308- Arg :: new ( "head_repo_name" )
309- . long ( "head-repo-name" )
310- . help ( "The name of the git repository to use for the upload (e.g. organization/repository). If not provided, the current repository will be used." )
311- )
312- . arg (
313- Arg :: new ( "base_repo_name" )
314- . long ( "base-repo-name" )
315- . help ( "The name of the git repository to use for the upload (e.g. organization/repository). If not provided, the current repository will be used." )
316- )
317- . arg (
318- Arg :: new ( "head_ref" )
319- . long ( "head-ref" )
320- . help ( "The reference (branch) to use for the upload. If not provided, the current reference will be used." )
321- )
322- . arg (
323- Arg :: new ( "base_ref" )
324- . long ( "base-ref" )
325- . help ( "The base reference (branch) to use for the upload. If not provided, the merge-base with the remote tracking branch will be used." )
326- )
327- . arg (
328- Arg :: new ( "pr_number" )
329- . long ( "pr-number" )
330- . value_parser ( clap:: value_parser!( u32 ) )
331- . help ( "The pull request number to use for the upload. If not provided and running \
332- in a pull_request-triggered GitHub Actions workflow, the PR number will be automatically \
333- detected from GitHub Actions environment variables.")
334- )
335- . arg (
336- Arg :: new ( "build_configuration" )
337- . long ( "build-configuration" )
338- . help ( "The build configuration to use for the upload. If not provided, the current version will be used." )
339- )
340- . arg (
341- Arg :: new ( "release_notes" )
342- . long ( "release-notes" )
343- . help ( "The release notes to use for the upload." )
344- )
345- . arg (
346- Arg :: new ( "git_metadata" )
347- . long ( "git-metadata" )
348- . num_args ( 0 ..=1 )
349- . default_missing_value ( "true" )
350- . value_parser ( clap:: value_parser!( bool ) )
351- . help ( "Controls whether to collect and send git metadata (branch, commit, etc.). \
352- Use --git-metadata to force enable, --git-metadata=false to force disable. \
353- If not specified, git metadata is automatically collected only when running in a CI environment.")
354- )
355- }
356-
357357pub fn execute ( matches : & ArgMatches ) -> Result < ( ) > {
358358 let config = Config :: current ( ) ;
359359 let path_strings = matches
0 commit comments