From 4607851afe0d9f418f04385552ce1bf26241a7d3 Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Sat, 17 Aug 2024 08:27:42 -0600 Subject: [PATCH 1/6] testing branch for adding babel layer for bindgen 0.2.93 compatibility --- Cargo.toml | 4 ++-- src/constants/types.rs | 34 ++++++++++++++-------------------- src/lib.rs | 4 ++++ 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5784c9d4..53088075 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "screeps-game-api" -version = "0.21.3" +version = "0.21.4" authors = ["David Ross "] documentation = "https://docs.rs/screeps-game-api/" edition = "2021" @@ -39,7 +39,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" serde_repr = "0.1" serde-wasm-bindgen = "0.6" -wasm-bindgen = "=0.2.92" +wasm-bindgen = "0.2" [dev-dependencies] bincode = "1.3" diff --git a/src/constants/types.rs b/src/constants/types.rs index 743ddfe2..394ff2f4 100644 --- a/src/constants/types.rs +++ b/src/constants/types.rs @@ -834,7 +834,7 @@ mod test { #[test] fn resources_rust_to_serde_json_from_serde_json_roundtrip() { for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { + if resource != ResourceType::__Invalid { let serialized = serde_json::to_string(&resource).unwrap(); let parsed: ResourceType = serde_json::from_str(&serialized).unwrap(); assert_eq!(resource, parsed); @@ -845,7 +845,7 @@ mod test { #[test] fn resources_rust_to_display_from_str_roundtrip() { for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { + if resource != ResourceType::__Invalid { let string = format!("{}", resource); let parsed = ResourceType::from_str(&string).unwrap(); assert_eq!(resource, parsed); @@ -857,7 +857,7 @@ mod test { fn resources_rust_vec_to_serde_json_from_serde_json_roundtrip() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { + if resource != ResourceType::__Invalid { resources.push(resource); } } @@ -870,7 +870,7 @@ mod test { fn resources_rust_vec_to_serde_json_from_serde_json_roundtrip_via_values() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != ResourceType::__Nonexhaustive { + if resource != ResourceType::__Invalid { resources.push(resource); } } @@ -887,7 +887,7 @@ mod test { #[test] fn intershard_resources_rust_to_serde_json_from_serde_json_roundtrip() { for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { + if resource != IntershardResourceType::__Invalid { let serialized = serde_json::to_string(&resource).unwrap(); let parsed: IntershardResourceType = serde_json::from_str(&serialized).unwrap(); assert_eq!(resource, parsed); @@ -898,7 +898,7 @@ mod test { #[test] fn intershard_resources_rust_to_display_from_str_roundtrip() { for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { + if resource != IntershardResourceType::__Invalid { let string = format!("{}", resource); let parsed = IntershardResourceType::from_str(&string).unwrap(); assert_eq!(resource, parsed); @@ -910,7 +910,7 @@ mod test { fn intershard_resources_rust_vec_to_serde_json_from_serde_json_roundtrip() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { + if resource != IntershardResourceType::__Invalid { resources.push(resource); } } @@ -924,7 +924,7 @@ mod test { fn intershard_resources_rust_vec_to_serde_json_from_serde_json_roundtrip_via_values() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != IntershardResourceType::__Nonexhaustive { + if resource != IntershardResourceType::__Invalid { resources.push(resource); } } @@ -941,11 +941,9 @@ mod test { #[test] fn market_resources_rust_to_serde_json_from_serde_json_roundtrip() { for resource in enum_iterator::all::() { - if resource != MarketResourceType::Resource(ResourceType::__Nonexhaustive) + if resource != MarketResourceType::Resource(ResourceType::__Invalid) && resource - != MarketResourceType::IntershardResource( - IntershardResourceType::__Nonexhaustive, - ) + != MarketResourceType::IntershardResource(IntershardResourceType::__Invalid) { let serialized = serde_json::to_string(&resource).unwrap(); let parsed: MarketResourceType = serde_json::from_str(&serialized).unwrap(); @@ -958,11 +956,9 @@ mod test { fn market_resources_rust_vec_to_serde_json_from_serde_json_roundtrip() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != MarketResourceType::Resource(ResourceType::__Nonexhaustive) + if resource != MarketResourceType::Resource(ResourceType::__Invalid) && resource - != MarketResourceType::IntershardResource( - IntershardResourceType::__Nonexhaustive, - ) + != MarketResourceType::IntershardResource(IntershardResourceType::__Invalid) { resources.push(resource); } @@ -977,11 +973,9 @@ mod test { fn market_resources_rust_vec_to_serde_json_from_serde_json_roundtrip_via_values() { let mut resources = vec![]; for resource in enum_iterator::all::() { - if resource != MarketResourceType::Resource(ResourceType::__Nonexhaustive) + if resource != MarketResourceType::Resource(ResourceType::__Invalid) && resource - != MarketResourceType::IntershardResource( - IntershardResourceType::__Nonexhaustive, - ) + != MarketResourceType::IntershardResource(IntershardResourceType::__Invalid) { resources.push(resource); } diff --git a/src/lib.rs b/src/lib.rs index 6117ad0f..0b87246b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -94,6 +94,10 @@ // #![warn(clippy::missing_const_for_fn)] +// disable deprecation warnings - TODO need to figure out how to get wasm_bindgen's new thread_local +// attribute working +#![allow(deprecated)] + pub mod console; pub mod constants; pub mod enums; From d721e21bcf4f1052111654c7093c86dbd299eeed Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Sat, 17 Aug 2024 23:53:44 -0600 Subject: [PATCH 2/6] changelog for breaking cargo-screeps --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f4afec1e..e6b8b39c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ Unreleased ### Breaking: +- `cargo-screeps` is no longer supported as a deployment method - `wasm-bindgen` as of 0.2.93 + generates code that needs transpiled; (todo readme on migrating) - Change return type of `RoomXY::get_range_to` and input type of `RoomXY::in_range_to` to u8 ### Additions: From bfe3e0fadeebc8b744a78b7d5ed46dcbd673f10f Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Sun, 18 Aug 2024 09:19:54 -0600 Subject: [PATCH 3/6] Require version of bindgen with the `__Invalid` variant updates --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 53088075..6ab689fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,7 +39,7 @@ serde = { version = "1", features = ["derive"] } serde_json = "1" serde_repr = "0.1" serde-wasm-bindgen = "0.6" -wasm-bindgen = "0.2" +wasm-bindgen = ">=0.2.93" [dev-dependencies] bincode = "1.3" From 9ad0aa158454e1ecf5550e2d70e8884cecdc59d6 Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Sun, 18 Aug 2024 09:25:31 -0600 Subject: [PATCH 4/6] Bump to 0.22 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 6ab689fe..191fbaa7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "screeps-game-api" -version = "0.21.4" +version = "0.22.0" authors = ["David Ross "] documentation = "https://docs.rs/screeps-game-api/" edition = "2021" From db277632d08205dc6edcaec2f90ae3a1397939cb Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Tue, 27 Aug 2024 14:45:02 -0600 Subject: [PATCH 5/6] Update changelog --- CHANGELOG.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a4519f9..9bf4e054 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,8 +3,8 @@ Unreleased ### Breaking: -- `cargo-screeps` is no longer supported as a deployment method - `wasm-bindgen` as of 0.2.93 - generates code that needs transpiled; (todo readme on migrating) +- `cargo-screeps` is no longer supported as a deployment method, `wasm-bindgen` as of 0.2.93 + generates code that needs transpiled; see the starter project's README for migration instructions - Change return type of `RoomXY::get_range_to` and input type of `RoomXY::in_range_to` to u8 ### Additions: From 6e9e87e689181b0899c56407ca4e6386ed9d8517 Mon Sep 17 00:00:00 2001 From: Shane Madden Date: Tue, 27 Aug 2024 14:49:21 -0600 Subject: [PATCH 6/6] Add version to changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9bf4e054..976e1b41 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ Unreleased ========== +0.22.0 (2024-08-27) +=================== + ### Breaking: - `cargo-screeps` is no longer supported as a deployment method, `wasm-bindgen` as of 0.2.93