From 5ac1fa2aaa0ea0a884492a83c4ee1202be09b0ba Mon Sep 17 00:00:00 2001 From: Fenhl Date: Tue, 8 Oct 2024 15:43:41 +0000 Subject: [PATCH] Build script maintenance * winres is unmaintained, switch to winresource https://github.com/mxre/winres/issues/40#issuecomment-1321141396 * Double colon syntax for build script outputs is preferred https://doc.rust-lang.org/cargo/reference/build-scripts.html#outputs-of-the-build-script --- Cargo.lock | 50 ++++++++++++++++++++------- crate/multiworld-bizhawk/build.rs | 2 +- crate/multiworld-gui/Cargo.toml | 2 +- crate/multiworld-gui/build.rs | 2 +- crate/multiworld-installer/Cargo.toml | 2 +- crate/multiworld-installer/build.rs | 4 +-- crate/multiworld-updater/Cargo.toml | 2 +- crate/multiworld-updater/build.rs | 2 +- crate/ootrmwd/build.rs | 2 +- 9 files changed, 47 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7be98fa..88fedbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4197,7 +4197,7 @@ dependencies = [ "tokio-tungstenite", "url", "wheel", - "winres", + "winresource", "xdg", ] @@ -4238,7 +4238,7 @@ dependencies = [ "url", "wheel", "which 6.0.3", - "winres", + "winresource", "winver", "xdg", ] @@ -4304,7 +4304,7 @@ dependencies = [ "url", "wheel", "windows 0.58.0", - "winres", + "winresource", "xdg", ] @@ -5401,7 +5401,7 @@ version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit", + "toml_edit 0.22.22", ] [[package]] @@ -7688,11 +7688,14 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.11" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" +checksum = "dd79e69d3b627db300ff956027cc6c3798cef26d22526befdfcd12feeb6d2257" dependencies = [ "serde", + "serde_spanned", + "toml_datetime", + "toml_edit 0.19.15", ] [[package]] @@ -7704,7 +7707,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit", + "toml_edit 0.22.22", ] [[package]] @@ -7716,6 +7719,19 @@ dependencies = [ "serde", ] +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.6.0", + "serde", + "serde_spanned", + "toml_datetime", + "winnow 0.5.40", +] + [[package]] name = "toml_edit" version = "0.22.22" @@ -7726,7 +7742,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow", + "winnow 0.6.20", ] [[package]] @@ -9105,6 +9121,15 @@ dependencies = [ "xkbcommon-dl", ] +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + [[package]] name = "winnow" version = "0.6.20" @@ -9134,12 +9159,13 @@ dependencies = [ ] [[package]] -name = "winres" -version = "0.1.12" +name = "winresource" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c" +checksum = "77e2aaaf8cfa92078c0c0375423d631f82f2f57979c2884fdd5f604a11e45329" dependencies = [ - "toml 0.5.11", + "toml 0.7.8", + "version_check", ] [[package]] diff --git a/crate/multiworld-bizhawk/build.rs b/crate/multiworld-bizhawk/build.rs index 29a29d4..a1106dd 100644 --- a/crate/multiworld-bizhawk/build.rs +++ b/crate/multiworld-bizhawk/build.rs @@ -30,7 +30,7 @@ enum Error { #[wheel::main] async fn main() -> Result<(), Error> { - println!("cargo:rerun-if-changed=nonexistent.foo"); // check a nonexistent file to make sure build script is always run (see https://github.com/rust-lang/cargo/issues/4213 and https://github.com/rust-lang/cargo/issues/5663) + println!("cargo::rerun-if-changed=nonexistent.foo"); // check a nonexistent file to make sure build script is always run (see https://github.com/rust-lang/cargo/issues/4213 and https://github.com/rust-lang/cargo/issues/5663) // check for extern function definitions in C# which aren't defined in Rust let rust_file = fs::read_to_string("../multiworld-csharp/src/lib.rs").await?; let mut rust_functions = HashSet::new(); diff --git a/crate/multiworld-gui/Cargo.toml b/crate/multiworld-gui/Cargo.toml index 0ad9dd1..888a3d8 100644 --- a/crate/multiworld-gui/Cargo.toml +++ b/crate/multiworld-gui/Cargo.toml @@ -14,7 +14,7 @@ unused_qualifications = "deny" warnings = "deny" [build-dependencies] -winres = "0.1" +winresource = "0.1" [dependencies] arrayref = "0.3.7" diff --git a/crate/multiworld-gui/build.rs b/crate/multiworld-gui/build.rs index 0e22a09..651f230 100644 --- a/crate/multiworld-gui/build.rs +++ b/crate/multiworld-gui/build.rs @@ -6,7 +6,7 @@ use { env, io, }, - winres::WindowsResource, + winresource::WindowsResource, }; fn main() -> io::Result<()> { diff --git a/crate/multiworld-installer/Cargo.toml b/crate/multiworld-installer/Cargo.toml index cc809c1..c8d1605 100644 --- a/crate/multiworld-installer/Cargo.toml +++ b/crate/multiworld-installer/Cargo.toml @@ -9,7 +9,7 @@ workspace = true [build-dependencies] thiserror = "1" -winres = "0.1" +winresource = "0.1" [build-dependencies.wheel] git = "https://github.com/fenhl/wheel" diff --git a/crate/multiworld-installer/build.rs b/crate/multiworld-installer/build.rs index 5ad2ead..9b05aa5 100644 --- a/crate/multiworld-installer/build.rs +++ b/crate/multiworld-installer/build.rs @@ -8,7 +8,7 @@ use { io::prelude::*, path::PathBuf, }, - winres::WindowsResource, + winresource::WindowsResource, }; #[cfg(unix)] use { std::{ @@ -40,7 +40,7 @@ enum Error { #[wheel::main] async fn main() -> Result<(), Error> { - println!("cargo:rerun-if-changed=nonexistent.foo"); // check a nonexistent file to make sure build script is always run (see https://github.com/rust-lang/cargo/issues/4213 and https://github.com/rust-lang/cargo/issues/5663) + println!("cargo::rerun-if-changed=nonexistent.foo"); // check a nonexistent file to make sure build script is always run (see https://github.com/rust-lang/cargo/issues/4213 and https://github.com/rust-lang/cargo/issues/5663) if env::var_os("CARGO_CFG_WINDOWS").is_some() { WindowsResource::new() .set_icon("../../assets/icon.ico") diff --git a/crate/multiworld-updater/Cargo.toml b/crate/multiworld-updater/Cargo.toml index 82eaa56..9fdbd34 100644 --- a/crate/multiworld-updater/Cargo.toml +++ b/crate/multiworld-updater/Cargo.toml @@ -14,7 +14,7 @@ unused_qualifications = "deny" warnings = "deny" [build-dependencies] -winres = "0.1" +winresource = "0.1" [dependencies] async_zip = { version = "0.0.17", features = ["full"] } diff --git a/crate/multiworld-updater/build.rs b/crate/multiworld-updater/build.rs index 0e22a09..651f230 100644 --- a/crate/multiworld-updater/build.rs +++ b/crate/multiworld-updater/build.rs @@ -6,7 +6,7 @@ use { env, io, }, - winres::WindowsResource, + winresource::WindowsResource, }; fn main() -> io::Result<()> { diff --git a/crate/ootrmwd/build.rs b/crate/ootrmwd/build.rs index e789f6e..b9b74f5 100644 --- a/crate/ootrmwd/build.rs +++ b/crate/ootrmwd/build.rs @@ -10,7 +10,7 @@ use { }; fn main() { - println!("cargo:rerun-if-changed=nonexistent.foo"); // check a nonexistent file to make sure build script is always run (see https://github.com/rust-lang/cargo/issues/4213 and https://github.com/rust-lang/cargo/issues/5663) + println!("cargo::rerun-if-changed=nonexistent.foo"); // check a nonexistent file to make sure build script is always run (see https://github.com/rust-lang/cargo/issues/4213 and https://github.com/rust-lang/cargo/issues/5663) let mut f = File::create(Path::new(&env::var_os("OUT_DIR").unwrap()).join("version.rs")).unwrap(); let version = env::var("CARGO_PKG_VERSION").unwrap().parse::().unwrap(); assert!(version.pre.is_empty());