MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / main

Function main

scripts/publish.rs:147–216  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

145}
146
147fn main() {
148 let mut crates = Vec::new();
149 let root = read_crate(None, "./Cargo.toml".as_ref());
150 let ws = Workspace {
151 version: root.version.clone(),
152 };
153 crates.push(root);
154 find_crates("crates".as_ref(), &ws, &mut crates);
155 find_crates("cranelift".as_ref(), &ws, &mut crates);
156 find_crates("pulley".as_ref(), &ws, &mut crates);
157 find_crates("winch".as_ref(), &ws, &mut crates);
158
159 let pos = CRATES_TO_PUBLISH
160 .iter()
161 .enumerate()
162 .map(|(i, c)| (*c, i))
163 .collect::<HashMap<_, _>>();
164 crates.sort_by_key(|krate| pos.get(&krate.name[..]));
165
166 match &env::args().nth(1).expect("must have one argument")[..] {
167 name @ "bump" | name @ "bump-patch" => {
168 for krate in crates.iter() {
169 bump_version(&krate, &crates, name == "bump-patch");
170 }
171 // update C API version in wasmtime.h
172 update_capi_version();
173 // update the lock file
174 run_cmd(Command::new("cargo").arg("fetch"));
175 }
176
177 "publish" => {
178 // We have so many crates to publish we're frequently either
179 // rate-limited or we run into issues where crates can't publish
180 // successfully because they're waiting on the index entries of
181 // previously-published crates to propagate. This means we try to
182 // publish in a loop and we remove crates once they're successfully
183 // published. Failed-to-publish crates get enqueued for another try
184 // later on.
185 for _ in 0..10 {
186 crates.retain(|krate| !publish(krate));
187
188 if crates.is_empty() {
189 break;
190 }
191
192 println!(
193 "{} crates failed to publish, waiting for a bit to retry",
194 crates.len(),
195 );
196 thread::sleep(Duration::from_secs(40));
197 }
198
199 assert!(crates.is_empty(), "failed to publish all crates");
200
201 println!("");
202 println!("===================================================================");
203 println!("");
204 println!("Don't forget to push a git tag for this release!");

Callers

nothing calls this directly

Calls 15

read_crateFunction · 0.85
find_cratesFunction · 0.85
bump_versionFunction · 0.85
update_capi_versionFunction · 0.85
run_cmdFunction · 0.85
publishFunction · 0.85
sort_by_keyMethod · 0.80
verifyFunction · 0.70
newFunction · 0.50
as_refMethod · 0.45
cloneMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected