@@ -18,13 +18,13 @@ impl ReleaseAsset {
1818 }
1919
2020 pub fn dfx_tarball_with_dfx_contents ( version : & str , executable : & [ u8 ] ) -> ReleaseAsset {
21- let filename = Self :: dfx_tarball_filename ( ) . to_string ( ) ;
2221 let version = Version :: parse ( version) . unwrap ( ) ;
22+ let filename = Self :: dfx_tarball_filename ( & version) . to_string ( ) ;
2323
2424 // must match the download_url_template in ReleaseServer::new
2525 let url_path = format ! ( "/any/arbitrary/path/{version}/{filename}" ) ;
2626
27- let contents = dfx_tarball ( executable) ;
27+ let contents = dfx_tarball ( & version , executable) ;
2828 ReleaseAsset {
2929 url_path,
3030 filename,
@@ -52,27 +52,41 @@ impl ReleaseAsset {
5252 . unwrap ( )
5353 }
5454
55- pub fn dfx_tarball_basename ( ) -> & ' static str {
56- #[ cfg( target_os = "macos" ) ]
57- let basename = "dfx-x86_64-apple-darwin" ;
58- #[ cfg( target_os = "linux" ) ]
59- let basename = "dfx-x86_64-unknown-linux-gnu" ;
60- basename
55+ #[ allow( unused_variables) ]
56+ pub fn dfx_tarball_basename ( version : & Version ) -> & ' static str {
57+ #[ cfg( all( target_os = "macos" , target_arch = "x86_64" ) ) ]
58+ return "dfx-x86_64-apple-darwin" ;
59+ #[ cfg( all( target_os = "macos" , target_arch = "aarch64" ) ) ]
60+ {
61+ // This is the first version that supports aarch64-apple-darwin.
62+ let aarch64_apple_darwin_version = Version :: parse ( "0.28.0-beta.1" ) . unwrap ( ) ;
63+ if version >= & aarch64_apple_darwin_version {
64+ return "dfx-aarch64-apple-darwin" ;
65+ }
66+ return "dfx-x86_64-apple-darwin" ;
67+ }
68+ #[ cfg( all( target_os = "linux" , target_arch = "x86_64" ) ) ]
69+ return "dfx-x86_64-unknown-linux-gnu" ;
70+ #[ cfg( all( target_os = "linux" , target_arch = "aarch64" ) ) ]
71+ return "dfx-aarch64-unknown-linux-gnu" ;
6172 }
6273
63- pub fn dfx_tarball_filename ( ) -> String {
64- let basename = Self :: dfx_tarball_basename ( ) ;
74+ pub fn dfx_tarball_filename ( version : & Version ) -> String {
75+ let basename = Self :: dfx_tarball_basename ( version ) ;
6576 let archive_format = "tar.gz" ;
6677 format ! ( "{basename}.{archive_format}" )
6778 }
6879
80+ #[ allow( unused_variables) ]
6981 pub fn dfxvm_tarball_basename ( ) -> String {
70- #[ cfg( target_arch = "aarch64" ) ]
71- let arch_and_os = "aarch64-apple-darwin" ;
82+ #[ cfg( all( target_os = "linux" , target_arch = "x86_64" ) ) ]
83+ let arch_and_os = "x86_64-unknown-linux-gnu" ;
84+ #[ cfg( all( target_os = "linux" , target_arch = "aarch64" ) ) ]
85+ let arch_and_os = "aarch64-unknown-linux-gnu" ;
7286 #[ cfg( all( target_os = "macos" , target_arch = "x86_64" ) ) ]
7387 let arch_and_os = "x86_64-apple-darwin" ;
74- #[ cfg( target_os = "linux" ) ]
75- let arch_and_os = "x86_64-unknown-linux-gnu " ;
88+ #[ cfg( all ( target_os = "macos" , target_arch = "aarch64" ) ) ]
89+ let arch_and_os = "aarch64-apple-darwin " ;
7690
7791 format ! ( "dfxvm-{}" , arch_and_os)
7892 }
0 commit comments