mirror of
https://github.com/fluencelabs/wasm-bindgen
synced 2025-04-25 06:02:13 +00:00
Bump to 0.2.18
At the same time, also add a `publish.rs` script to ease our publishing woes.
This commit is contained in:
parent
85fd49f90a
commit
98008b9e77
2
.gitignore
vendored
2
.gitignore
vendored
@ -7,3 +7,5 @@ package-lock.json
|
||||
npm-shrinkwrap.json
|
||||
yarn.lock
|
||||
*.d.ts
|
||||
/publish
|
||||
/publish.exe
|
||||
|
10
Cargo.toml
10
Cargo.toml
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
@ -28,15 +28,15 @@ nightly = []
|
||||
xxx_debug_only_print_generated_code = ["wasm-bindgen-macro/xxx_debug_only_print_generated_code"]
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.17" }
|
||||
wasm-bindgen-macro = { path = "crates/macro", version = "=0.2.18" }
|
||||
serde = { version = "1.0", optional = true }
|
||||
serde_json = { version = "1.0", optional = true }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||
wasm-bindgen-test = { path = 'crates/test', version = '=0.2.17' }
|
||||
wasm-bindgen-test = { path = 'crates/test', version = '=0.2.18' }
|
||||
serde_derive = "1.0"
|
||||
wasm-bindgen-test-crate-a = { path = 'tests/crates/a' }
|
||||
wasm-bindgen-test-crate-b = { path = 'tests/crates/b' }
|
||||
wasm-bindgen-test-crate-a = { path = 'tests/crates/a', version = '0.1' }
|
||||
wasm-bindgen-test-crate-b = { path = 'tests/crates/b', version = '0.1' }
|
||||
|
||||
[workspace]
|
||||
members = [
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-backend"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/backend"
|
||||
@ -21,4 +21,4 @@ proc-macro2 = "0.4.8"
|
||||
quote = '0.6'
|
||||
serde_json = "1.0"
|
||||
syn = { version = '0.14', features = ['full', 'visit'] }
|
||||
wasm-bindgen-shared = { path = "../shared", version = "=0.2.17" }
|
||||
wasm-bindgen-shared = { path = "../shared", version = "=0.2.18" }
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-cli-support"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli-support"
|
||||
@ -17,6 +17,6 @@ parity-wasm = "0.31"
|
||||
serde = "1.0"
|
||||
serde_json = "1.0"
|
||||
tempfile = "3.0"
|
||||
wasm-bindgen-shared = { path = "../shared", version = '=0.2.17' }
|
||||
wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.17' }
|
||||
wasm-bindgen-shared = { path = "../shared", version = '=0.2.18' }
|
||||
wasm-bindgen-wasm-interpreter = { path = "../wasm-interpreter", version = '=0.2.18' }
|
||||
wasm-gc-api = "0.1.9"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-cli"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/cli"
|
||||
@ -23,8 +23,8 @@ rouille = { version = "2.1.0", default-features = false }
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_json = "1.0"
|
||||
wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.17" }
|
||||
wasm-bindgen-shared = { path = "../shared", version = "=0.2.17" }
|
||||
wasm-bindgen-cli-support = { path = "../cli-support", version = "=0.2.18" }
|
||||
wasm-bindgen-shared = { path = "../shared", version = "=0.2.18" }
|
||||
openssl = { version = '0.10.11', optional = true }
|
||||
|
||||
[features]
|
||||
|
@ -7,12 +7,12 @@ license = "MIT/Apache-2.0"
|
||||
name = "wasm-bindgen-futures"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/futures"
|
||||
readme = "./README.md"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
|
||||
[dependencies]
|
||||
futures = "0.1.20"
|
||||
js-sys = { path = "../js-sys", version = '0.2.1' }
|
||||
wasm-bindgen = { path = "../..", version = '0.2.17' }
|
||||
js-sys = { path = "../js-sys", version = '0.2.3' }
|
||||
wasm-bindgen = { path = "../..", version = '0.2.18' }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||
wasm-bindgen-test = { path = '../test', version = '0.2.17' }
|
||||
wasm-bindgen-test = { path = '../test', version = '0.2.18' }
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "js-sys"
|
||||
version = "0.2.2"
|
||||
version = "0.2.3"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
readme = "./README.md"
|
||||
categories = ["wasm"]
|
||||
@ -18,9 +18,9 @@ test = false
|
||||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen = { path = "../..", version = "0.2.17" }
|
||||
wasm-bindgen = { path = "../..", version = "0.2.18" }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||
futures = "0.1.20"
|
||||
wasm-bindgen-test = { path = '../test', version = '=0.2.17' }
|
||||
wasm-bindgen-futures = { path = '../futures', version = '=0.2.17' }
|
||||
wasm-bindgen-test = { path = '../test', version = '=0.2.18' }
|
||||
wasm-bindgen-futures = { path = '../futures', version = '=0.2.18' }
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-macro-support"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro-support"
|
||||
@ -18,5 +18,5 @@ extra-traits = ["syn/extra-traits"]
|
||||
syn = { version = '0.14', features = ['full'] }
|
||||
quote = '0.6'
|
||||
proc-macro2 = "0.4.9"
|
||||
wasm-bindgen-backend = { path = "../backend", version = "=0.2.17" }
|
||||
wasm-bindgen-shared = { path = "../shared", version = "=0.2.17" }
|
||||
wasm-bindgen-backend = { path = "../backend", version = "=0.2.18" }
|
||||
wasm-bindgen-shared = { path = "../shared", version = "=0.2.18" }
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-macro"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/macro"
|
||||
@ -18,5 +18,5 @@ spans = ["wasm-bindgen-macro-support/spans"]
|
||||
xxx_debug_only_print_generated_code = []
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.17" }
|
||||
wasm-bindgen-macro-support = { path = "../macro-support", version = "=0.2.18" }
|
||||
quote = "0.6"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-shared"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/shared"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-test-macro"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
description = "Internal testing macro for wasm-bindgen"
|
||||
license = "MIT/Apache-2.0"
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-test"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
description = "Internal testing crate for wasm-bindgen"
|
||||
license = "MIT/Apache-2.0"
|
||||
@ -9,11 +9,11 @@ repository = "https://github.com/rustwasm/wasm-bindgen"
|
||||
[dependencies]
|
||||
console_error_panic_hook = '0.1'
|
||||
futures = "0.1"
|
||||
js-sys = { path = '../js-sys', version = '0.2.1' }
|
||||
js-sys = { path = '../js-sys', version = '0.2.3' }
|
||||
scoped-tls = "0.1"
|
||||
wasm-bindgen = { path = '../..', version = '0.2.17' }
|
||||
wasm-bindgen-futures = { path = '../futures', version = '0.2.17' }
|
||||
wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.2.17' }
|
||||
wasm-bindgen = { path = '../..', version = '0.2.18' }
|
||||
wasm-bindgen-futures = { path = '../futures', version = '0.2.18' }
|
||||
wasm-bindgen-test-macro = { path = '../test-macro', version = '=0.2.18' }
|
||||
|
||||
[lib]
|
||||
test = false
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "wasm-bindgen-wasm-interpreter"
|
||||
version = "0.2.17"
|
||||
version = "0.2.18"
|
||||
authors = ["The wasm-bindgen Developers"]
|
||||
license = "MIT/Apache-2.0"
|
||||
repository = "https://github.com/rustwasm/wasm-bindgen/tree/master/crates/wasm-interpreter"
|
||||
|
@ -15,11 +15,10 @@ wasm-bindgen-webidl = { path = "../webidl", version = "=0.2.17" }
|
||||
sourcefile = "0.1"
|
||||
|
||||
[dependencies]
|
||||
wasm-bindgen = { path = "../..", version = "0.2.17" }
|
||||
js-sys = { path = '../js-sys', version = '0.2.1' }
|
||||
wasm-bindgen = { path = "../..", version = "0.2.18" }
|
||||
js-sys = { path = '../js-sys', version = '0.2.3' }
|
||||
|
||||
[target.'cfg(target_arch = "wasm32")'.dev-dependencies]
|
||||
futures = "0.1"
|
||||
js-sys = { path = '../js-sys', version = '0.2.1' }
|
||||
wasm-bindgen-test = { path = '../test', version = '0.2.17' }
|
||||
wasm-bindgen-futures = { path = '../futures', version = '0.2.17' }
|
||||
wasm-bindgen-test = { path = '../test', version = '0.2.18' }
|
||||
wasm-bindgen-futures = { path = '../futures', version = '0.2.18' }
|
||||
|
@ -19,5 +19,5 @@ log = "0.4.1"
|
||||
proc-macro2 = "0.4.8"
|
||||
quote = '0.6'
|
||||
syn = { version = '0.14', features = ['full'] }
|
||||
wasm-bindgen-backend = { version = "=0.2.17", path = "../backend" }
|
||||
wasm-bindgen-backend = { version = "=0.2.18", path = "../backend" }
|
||||
weedle = "0.6"
|
||||
|
197
publish.rs
Normal file
197
publish.rs
Normal file
@ -0,0 +1,197 @@
|
||||
//! Helper script to publish the wasm-bindgen suite of crates
|
||||
//!
|
||||
//! Usage:
|
||||
//!
|
||||
//! * First, compile this script
|
||||
//! * Next, set cwd to the root of the wasm-bindgen repository
|
||||
//! * Execute `./publish bump` to bump versions
|
||||
//! * Send a PR
|
||||
//! * Merge when green
|
||||
//! * Execute `./publish publish` to publish crates
|
||||
|
||||
use std::env;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
|
||||
const CRATES_TO_PUBLISH: &[&str] = &[
|
||||
"wasm-bindgen",
|
||||
"js-sys",
|
||||
"wasm-bindgen-backend",
|
||||
"wasm-bindgen-cli",
|
||||
"wasm-bindgen-cli-support",
|
||||
"wasm-bindgen-futures",
|
||||
"wasm-bindgen-macro",
|
||||
"wasm-bindgen-macro-support",
|
||||
"wasm-bindgen-shared",
|
||||
"wasm-bindgen-test",
|
||||
"wasm-bindgen-test-macro",
|
||||
"wasm-bindgen-wasm-interpreter",
|
||||
];
|
||||
|
||||
const CRATES_TO_AVOID_PUBLISH: &[&str] = &[
|
||||
// We'll publish these when they're ready one day
|
||||
"wasm-bindgen-typescript",
|
||||
"web-sys",
|
||||
"wasm-bindgen-webidl",
|
||||
|
||||
// These are internal crates, unlikely to ever be published
|
||||
"ui-tests",
|
||||
"sample",
|
||||
"webidl-tests",
|
||||
];
|
||||
|
||||
struct Crate {
|
||||
manifest: PathBuf,
|
||||
name: String,
|
||||
version: String,
|
||||
next_version: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut crates = Vec::new();
|
||||
crates.push(read_crate("./Cargo.toml".as_ref()));
|
||||
find_crates("crates".as_ref(), &mut crates);
|
||||
|
||||
match &env::args().nth(1).expect("must have one argument")[..] {
|
||||
"bump" => {
|
||||
for krate in crates.iter() {
|
||||
bump_version(&krate, &crates);
|
||||
}
|
||||
}
|
||||
|
||||
"publish" => {
|
||||
for krate in crates.iter() {
|
||||
publish(&krate);
|
||||
}
|
||||
}
|
||||
|
||||
s => panic!("unknown command: {}", s),
|
||||
}
|
||||
}
|
||||
|
||||
fn find_crates(dir: &Path, dst: &mut Vec<Crate>) {
|
||||
if dir.join("Cargo.toml").exists() {
|
||||
let krate = read_crate(&dir.join("Cargo.toml"));
|
||||
if CRATES_TO_PUBLISH.iter()
|
||||
.chain(CRATES_TO_AVOID_PUBLISH)
|
||||
.any(|c| krate.name == *c)
|
||||
{
|
||||
dst.push(krate);
|
||||
} else {
|
||||
panic!("failed to find {:?} in whitelist or blacklist", krate.name);
|
||||
}
|
||||
}
|
||||
|
||||
for entry in dir.read_dir().unwrap() {
|
||||
let entry = entry.unwrap();
|
||||
if entry.file_type().unwrap().is_dir() {
|
||||
find_crates(&entry.path(), dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn read_crate(manifest: &Path) -> Crate {
|
||||
let mut name = None;
|
||||
let mut version = None;
|
||||
for line in fs::read_to_string(manifest).unwrap().lines() {
|
||||
if name.is_none() && line.starts_with("name = \"") {
|
||||
name = Some(line.replace("name = \"", "")
|
||||
.replace("\"", "")
|
||||
.trim()
|
||||
.to_string());
|
||||
}
|
||||
if version.is_none() && line.starts_with("version = \"") {
|
||||
version = Some(line.replace("version = \"", "")
|
||||
.replace("\"", "")
|
||||
.trim()
|
||||
.to_string());
|
||||
}
|
||||
}
|
||||
let name = name.unwrap();
|
||||
let version = version.unwrap();
|
||||
let next_version = if CRATES_TO_PUBLISH.contains(&&name[..]) {
|
||||
bump(&version)
|
||||
} else {
|
||||
version.clone()
|
||||
};
|
||||
Crate {
|
||||
manifest: manifest.to_path_buf(),
|
||||
name,
|
||||
version,
|
||||
next_version,
|
||||
}
|
||||
}
|
||||
|
||||
fn bump_version(krate: &Crate, crates: &[Crate]) {
|
||||
let contents = fs::read_to_string(&krate.manifest).unwrap();
|
||||
|
||||
let mut new_manifest = String::new();
|
||||
let mut is_deps = false;
|
||||
for line in contents.lines() {
|
||||
let mut rewritten = false;
|
||||
if line.starts_with("version =") {
|
||||
if CRATES_TO_PUBLISH.contains(&&krate.name[..]) {
|
||||
println!("bump `{}` {} => {}",
|
||||
krate.name,
|
||||
krate.version,
|
||||
krate.next_version);
|
||||
new_manifest.push_str(&line.replace(&krate.version, &krate.next_version));
|
||||
rewritten = true;
|
||||
}
|
||||
}
|
||||
|
||||
is_deps = if line.starts_with("[") {
|
||||
line.contains("dependencies")
|
||||
} else {
|
||||
is_deps
|
||||
};
|
||||
|
||||
for other in crates {
|
||||
if !is_deps || !line.starts_with(&format!("{} ", other.name)) {
|
||||
continue
|
||||
}
|
||||
if !line.contains(&other.version) {
|
||||
if !line.contains("version =") {
|
||||
continue
|
||||
}
|
||||
panic!("{:?} has a dep on {} but doesn't list version {}",
|
||||
krate.manifest,
|
||||
other.name,
|
||||
other.version);
|
||||
}
|
||||
rewritten = true;
|
||||
new_manifest.push_str(&line.replace(&other.version, &other.next_version));
|
||||
break
|
||||
}
|
||||
if !rewritten {
|
||||
new_manifest.push_str(line);
|
||||
}
|
||||
new_manifest.push_str("\n");
|
||||
}
|
||||
fs::write(&krate.manifest, new_manifest).unwrap();
|
||||
}
|
||||
|
||||
fn bump(version: &str) -> String {
|
||||
let mut iter = version.split('.').map(|s| s.parse::<u32>().unwrap());
|
||||
let major = iter.next().expect("major version");
|
||||
let minor = iter.next().expect("minor version");
|
||||
let patch = iter.next().expect("patch version");
|
||||
format!("{}.{}.{}", major, minor, patch + 1)
|
||||
}
|
||||
|
||||
fn publish(krate: &Crate) {
|
||||
if !CRATES_TO_PUBLISH.iter().any(|s| *s == krate.name) {
|
||||
return
|
||||
}
|
||||
let status = Command::new("cargo")
|
||||
.arg("publish")
|
||||
.current_dir(krate.manifest.parent().unwrap())
|
||||
.arg("--no-verify")
|
||||
.arg("--allow-dirty")
|
||||
.status()
|
||||
.expect("failed to run cargo");
|
||||
if !status.success() {
|
||||
println!("FAIL: failed to publish `{}`: {}", krate.name, status);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user