File tree 1 file changed +20
-1
lines changed
1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change
1
+ use std:: collections:: HashMap ;
1
2
use std:: fmt:: Debug ;
2
3
3
4
use anyhow:: Result ;
@@ -21,7 +22,13 @@ pub struct BuildCmd {
21
22
22
23
impl BuildCmd {
23
24
pub ( crate ) fn process ( self ) -> Result < ( ) > {
24
- let opt = self . package . as_opt ( ) ;
25
+ let mut opt = self . package . as_opt ( ) ;
26
+ if target_not_specified ( ) {
27
+ let tmap = Self :: target_map ( ) ;
28
+ if let Some ( tgt) = tmap. get ( & opt. target . as_str ( ) ) {
29
+ opt. target = tgt. to_string ( ) ;
30
+ }
31
+ }
25
32
let package_info = PackageInfo :: from_options ( & opt) ?;
26
33
27
34
build_connector (
@@ -32,4 +39,16 @@ impl BuildCmd {
32
39
} ,
33
40
)
34
41
}
42
+
43
+ /// Map to most supported native target
44
+ fn target_map ( ) -> HashMap < & ' static str , & ' static str > {
45
+ let mut map = HashMap :: new ( ) ;
46
+ map. insert ( "x86_64-unknown-linux-musl" , "x86_64-unknown-linux-gnu" ) ;
47
+ map
48
+ }
49
+ }
50
+
51
+ fn target_not_specified ( ) -> bool {
52
+ let args = std:: env:: args ( ) . collect :: < Vec < String > > ( ) ;
53
+ !args. iter ( ) . any ( |arg| arg. contains ( "--target" ) )
35
54
}
You can’t perform that action at this time.
0 commit comments