@@ -40,34 +40,19 @@ pub fn initialize_legacy_release_upload(context: &UploadContext) -> Result<()> {
4040 // if a project is provided which is technically unnecessary for the
4141 // legacy upload though it will unlikely to be what users want.
4242 let chunk_options = context. chunk_upload_options ;
43- if context. projects . is_some ( )
44- && ( chunk_options. supports ( ChunkUploadCapability :: ArtifactBundles )
45- || chunk_options. supports ( ChunkUploadCapability :: ArtifactBundlesV2 ) )
43+ if chunk_options. supports ( ChunkUploadCapability :: ArtifactBundles )
44+ || chunk_options. supports ( ChunkUploadCapability :: ArtifactBundlesV2 )
4645 {
4746 return Ok ( ( ) ) ;
4847 }
4948
50- // TODO: make this into an error later down the road
51- if context. projects . is_none ( ) {
52- eprintln ! (
53- "{}" ,
54- style(
55- "warning: no project specified. \
56- While this upload will succeed it will be unlikely that \
57- this is what you wanted. Future versions of sentry will \
58- require a project to be set."
59- )
60- . red( )
61- ) ;
62- }
63-
6449 if let Some ( version) = context. release {
6550 let api = Api :: current ( ) ;
6651 api. authenticated ( ) ?. new_release (
6752 context. org ,
6853 & NewRelease {
6954 version : version. to_owned ( ) ,
70- projects : context. projects . map ( Vec :: from ) . unwrap_or_default ( ) ,
55+ projects : context. projects . into ( ) ,
7156 ..Default :: default ( )
7257 } ,
7358 ) ?;
@@ -80,7 +65,7 @@ pub fn initialize_legacy_release_upload(context: &UploadContext) -> Result<()> {
8065#[ derive( Debug , Clone ) ]
8166pub struct UploadContext < ' a > {
8267 pub org : & ' a str ,
83- pub projects : Option < NonEmptySlice < ' a , String > > ,
68+ pub projects : NonEmptySlice < ' a , String > ,
8469 pub release : Option < & ' a str > ,
8570 pub dist : Option < & ' a str > ,
8671 pub note : Option < & ' a str > ,
@@ -185,13 +170,11 @@ impl<'a> TryFrom<&'a UploadContext<'_>> for LegacyUploadContext<'a> {
185170 ..
186171 } = value;
187172
188- let project = projects
189- . map ( |projects| match <& [ _ ] >:: from ( projects) {
190- [ ] => unreachable ! ( "NonEmptySlice cannot be empty" ) ,
191- [ project] => Ok ( project. as_str ( ) ) ,
192- [ _, _, ..] => Err ( LegacyUploadContextError :: ProjectMultiple ) ,
193- } )
194- . transpose ( ) ?;
173+ let project = Some ( match <& [ _ ] >:: from ( projects) {
174+ [ ] => unreachable ! ( "NonEmptySlice cannot be empty" ) ,
175+ [ project] => Ok ( project. as_str ( ) ) ,
176+ [ _, _, ..] => Err ( LegacyUploadContextError :: ProjectMultiple ) ,
177+ } ?) ;
195178
196179 let release = release. ok_or ( LegacyUploadContextError :: ReleaseMissing ) ?;
197180
@@ -536,23 +519,12 @@ fn poll_assemble(
536519 ) ;
537520 }
538521
539- // We fall back to legacy release upload if server lacks artifact bundle support, or if
540- // no projects are specified. context.projects has Some(projects) in all cases, besides
541- // the following:
542- // - For `files upload`, we can have None projects. We don't need a separate warning,
543- // because `files upload` is already deprecated.
544- // - For `debug-files bundle-jvm`, but although that codepath uses the `UploadContext`,
545- // it does not actually use it to perform an upload, so we never hit this codepath.
546- let artifact_bundle_projects = server_supports_artifact_bundles
547- . then_some ( context. projects )
548- . flatten ( ) ;
549-
550522 let response = loop {
551523 // prefer standalone artifact bundle upload over legacy release based upload
552- let response = if let Some ( projects ) = artifact_bundle_projects {
524+ let response = if server_supports_artifact_bundles {
553525 authenticated_api. assemble_artifact_bundle (
554526 context. org ,
555- projects,
527+ context . projects ,
556528 checksum,
557529 chunks,
558530 context. release ,
@@ -642,7 +614,6 @@ fn upload_files_chunked(
642614 if let Some ( projects) = options
643615 . supports ( ChunkUploadCapability :: ArtifactBundlesV2 )
644616 . then_some ( context. projects )
645- . flatten ( )
646617 {
647618 let api = Api :: current ( ) ;
648619 let response = api. authenticated ( ) ?. assemble_artifact_bundle (
@@ -677,7 +648,7 @@ fn print_upload_context_details(context: &UploadContext) {
677648 println ! (
678649 "{} {}" ,
679650 style( "> Projects:" ) . dim( ) ,
680- style( context. projects. as_deref ( ) . unwrap_or_default ( ) . join( ", " ) ) . yellow( )
651+ style( context. projects. join( ", " ) ) . yellow( )
681652 ) ;
682653 println ! (
683654 "{} {}" ,
0 commit comments