@@ -61,23 +61,30 @@ fn dist_server() -> Result<()> {
61
61
if cfg ! ( target_os = "linux" ) {
62
62
env:: set_var ( "CC" , "clang" ) ;
63
63
}
64
- cmd ! ( "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release" ) . run ( ) ?;
65
64
66
- let ( src, dst) = if cfg ! ( target_os = "linux" ) {
67
- ( "./target/release/rust-analyzer" , "./dist/rust-analyzer-linux" )
65
+ fn copy_artifact ( src : & str , dst : & str ) -> Result < ( ) > {
66
+ let src = Path :: new ( src) ;
67
+ let dst = Path :: new ( dst) ;
68
+
69
+ cp ( & src, & dst) ?;
70
+ gzip ( & src, & dst. with_extension ( "gz" ) ) ?;
71
+
72
+ Ok ( ( ) )
73
+ }
74
+
75
+ cmd ! ( "cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release" ) . run ( ) ?;
76
+ if cfg ! ( target_os = "linux" ) {
77
+ copy_artifact ( "./target/release/rust-analyzer" , "./dist/rust-analyzer-linux" ) ?;
68
78
} else if cfg ! ( target_os = "windows" ) {
69
- ( "./target/release/rust-analyzer.exe" , "./dist/rust-analyzer-windows.exe" )
79
+ copy_artifact ( "./target/release/rust-analyzer.exe" , "./dist/rust-analyzer-windows.exe" ) ?
70
80
} else if cfg ! ( target_os = "macos" ) {
71
- ( "./target/release/rust-analyzer" , "./dist/rust-analyzer-mac" )
72
- } else {
73
- panic ! ( "Unsupported OS" )
74
- } ;
81
+ copy_artifact ( "./target/release/rust-analyzer" , "./dist/rust-analyzer-mac" ) ?;
75
82
76
- let src = Path :: new ( src ) ;
77
- let dst = Path :: new ( dst ) ;
78
-
79
- cp ( & src , & dst ) ? ;
80
- gzip ( & src , & dst . with_extension ( "gz" ) ) ? ;
83
+ cmd ! ( "cargo +beta build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --target aarch64-apple-darwin --release" ) . run ( ) ? ;
84
+ copy_artifact ( "./target/release/rust-analyzer" , "./dist/rust-analyzer-mac-arm" ) ? ;
85
+ } else {
86
+ panic ! ( "Unsupported OS" ) ;
87
+ }
81
88
82
89
Ok ( ( ) )
83
90
}
0 commit comments