@@ -80,6 +80,8 @@ fn main() {
80
80
let main_dir = self_dir. join ( "../../../.." ) ;
81
81
std:: env:: set_current_dir ( main_dir) . unwrap ( ) ;
82
82
83
+ let args: Args = argh:: from_env ( ) ;
84
+
83
85
let version_locs = vec ! [
84
86
Location :: new(
85
87
"Cargo.toml" ,
@@ -103,24 +105,23 @@ fn main() {
103
105
r#"html_root_url = "https://docs.rs/mongodb/(?<target>.*?)""# ,
104
106
) ,
105
107
] ;
106
- let bson_version_loc = Location :: new ( "Cargo.toml" , r#"bson = (?<target>\{ git = .*? \})\n"# ) ;
107
- let mongocrypt_version_loc =
108
- Location :: new ( "Cargo.toml" , r#"mongocrypt = (?<target>\{ git = .*? \})\n"# ) ;
109
-
110
- let args: Args = argh:: from_env ( ) ;
111
-
112
108
let mut pending = PendingUpdates :: new ( ) ;
113
109
for loc in & version_locs {
114
110
pending. apply ( loc, & args. version ) ;
115
111
}
112
+
116
113
if let Some ( bson) = args. bson {
117
- pending. apply ( & bson_version_loc, & format ! ( "{:?}" , bson) ) ;
114
+ let bson_version_loc =
115
+ Location :: new ( "Cargo.toml" , r#"bson =.*version = "(?<target>.*?)".*"# ) ;
116
+ pending. apply ( & bson_version_loc, & bson) ;
118
117
}
118
+
119
119
if let Some ( mongocrypt) = args. mongocrypt {
120
- pending . apply (
121
- & mongocrypt_version_loc ,
122
- & format ! ( "{{ version = {:?}, optional = true }}" , mongocrypt ) ,
120
+ let mongocrypt_version_loc = Location :: new (
121
+ "Cargo.toml" ,
122
+ r#"mongocrypt =.* version = "(?<target>.*?)".*"# ,
123
123
) ;
124
+ pending. apply ( & mongocrypt_version_loc, & mongocrypt) ;
124
125
}
125
126
pending. write ( ) ;
126
127
}
0 commit comments