Skip to content

Commit 80ab967

Browse files
bors[bot]FaultyRAM
andauthored
Merge #16
16: Update to 0.2.2 r=FaultyRAM a=FaultyRAM Addresses #15 Co-authored-by: FaultyRAM <316014+FaultyRAM@users.noreply.github.com>
2 parents 2b34012 + 10b1689 commit 80ab967

File tree

11 files changed

+95
-142
lines changed

11 files changed

+95
-142
lines changed

.travis.yml

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,30 @@
1+
sudo: false
12
branches:
23
only:
3-
- staging
4-
- trying
5-
- master
6-
dist: trusty
7-
sudo: false
4+
- staging
5+
- trying
6+
- master
87
os:
9-
- linux
10-
- osx
8+
- windows
119
language: rust
1210
rust:
13-
- stable
14-
- beta
15-
- nightly
11+
- stable-x86_64-pc-windows-msvc
12+
- stable-x86_64-pc-windows-gnu
13+
- beta-x86_64-pc-windows-msvc
14+
- beta-x86_64-pc-windows-gnu
15+
- nightly-x86_64-pc-windows-msvc
16+
- nightly-x86_64-pc-windows-gnu
1617
matrix:
1718
allow_failures:
18-
- beta
19-
- nightly
19+
- rust: beta-x86_64-pc-windows-msvc
20+
- rust: beta-x86_64-pc-windows-gnu
21+
- rust: nightly-x86_64-pc-windows-msvc
22+
- rust: nightly-x86_64-pc-windows-gnu
23+
fast_finish: true
24+
install:
25+
- rustup component add clippy rustfmt
26+
script:
27+
- cargo clippy
28+
- cargo build -p windres-test
29+
- cargo doc --no-deps
30+
- cargo fmt --all -- --check

CHANGES.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# windres-rs Changelog
22

3+
## 0.2.2 (27/02/2021)
4+
5+
* Previous versions of this crate were broken for MSVC targets by a breaking change in Rust (see
6+
https://github.com/rust-lang/rust/pull/72785). This version adds a workaround for the breakage.
7+
* To prevent future breakage, trivial changes were made to parts of the code. This is a refactor,
8+
i.e. no change in behaviour from the previous version, but the minimum working Rust version may
9+
have increased as a result.
10+
311
## 0.2.1 (18/08/2018)
412

513
* Update find-winsdk to 0.2. This fixes Windows 8.1A SDK support and adds support for earlier

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ members = ["windres-test"]
33

44
[package]
55
name = "windres"
6-
version = "0.2.1"
6+
version = "0.2.2"
77
authors = ["FaultyRAM <explodingpsu@gmail.com>"]
88
description = "Compiles Windows resource files (.rc) into a Rust program."
99
repository = "https://github.com/FaultyRAM/windres-rs"

LICENSE-MIT

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2017-2018 FaultyRAM
1+
Copyright (c) 2017-2021 FaultyRAM
22

33
Permission is hereby granted, free of charge, to any person obtaining
44
a copy of this software and associated documentation files (the

README.md

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# windres-rs
22

33
[![Travis CI](https://travis-ci.org/FaultyRAM/windres-rs.svg)][1]
4-
[![AppVeyor](https://ci.appveyor.com/api/projects/status/ffj632w0xqh98c83?retina=true&svg=true)][2]
5-
[![Crates.io](https://img.shields.io/crates/v/windres.svg)][3]
6-
[![Docs.rs](https://docs.rs/windres/badge.svg)][4]
4+
[![Crates.io](https://img.shields.io/crates/v/windres.svg)][2]
5+
[![Docs.rs](https://docs.rs/windres/badge.svg)][3]
76

8-
`windres` is a [Rust][5] library crate for compiling [Windows resource (.rc) files][6] into object
7+
`windres` is a [Rust][4] library crate for compiling [Windows resource (.rc) files][5] into object
98
files at build time, which are then forwarded to the linker. This allows for embedding icons,
109
version information, native UI data, etc. in binaries compiled from Rust code.
1110

@@ -36,7 +35,7 @@ fn main() {
3635
You need to install the resource compiler for your target ABI in order for `windres` to work.
3736
Currently the following compilers are supported:
3837

39-
* `windres.exe` for GNU targets (included in the [mingw-w64][7] toolchain)
38+
* `windres.exe` for GNU targets (included in the [mingw-w64][6] toolchain)
4039
* `rc.exe` for MSVC targets (included in the Windows SDK, which can be installed via Visual Studio
4140
Installer)
4241

@@ -73,10 +72,8 @@ license, shall be dual licensed as above, without any additional terms or
7372
conditions.
7473

7574
[1]: https://travis-ci.org/FaultyRAM/windres-rs
76-
[2]: https://ci.appveyor.com/project/FaultyRAM/windres-rs
77-
[3]: https://crates.io/crates/windres
78-
[4]: https://docs.rs/windres
79-
[5]: https://www.rust-lang.org
80-
[6]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx
81-
[7]: https://mingw-w64.org
82-
[8]: https://www.visualstudio.com
75+
[2]: https://crates.io/crates/windres
76+
[3]: https://docs.rs/windres
77+
[4]: https://www.rust-lang.org
78+
[5]: https://msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx
79+
[6]: https://mingw-w64.org

appveyor.yml

Lines changed: 0 additions & 72 deletions
This file was deleted.

src/gnu.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,35 @@
1-
// Copyright (c) 2017-2018 FaultyRAM
1+
// Copyright (c) 2017-2021 FaultyRAM
22
//
33
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
44
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
55
// http://opensource.org/licenses/MIT>, at your option. This file may not be copied, modified, or
66
// distributed except according to those terms.
77

8-
//! GNU implementation details.
9-
8+
use super::Build;
109
use std::env;
1110
use std::ffi::{OsStr, OsString};
1211
use std::io::{self, Write};
1312
use std::path::{Path, PathBuf};
1413
use std::process::Command;
15-
use Build;
1614

1715
impl Build {
1816
/// Locates the tool used to compile resources.
1917
pub(crate) fn find_resource_compiler() -> io::Result<PathBuf> {
20-
if let Some(p) = env::var_os("PATH").and_then(|path| {
21-
env::split_paths(&path)
22-
.map(|p| p.join("windres.exe"))
23-
.find(|p| p.exists())
24-
}) {
25-
Ok(p)
26-
} else {
27-
Err(io::Error::new(
28-
io::ErrorKind::NotFound,
29-
"could not locate windres.exe",
30-
))
31-
}
18+
env::var_os("PATH")
19+
.and_then(|path| {
20+
env::split_paths(&path)
21+
.map(|p| p.join("windres.exe"))
22+
.find(|p| p.exists())
23+
})
24+
.map_or_else(
25+
|| {
26+
Err(io::Error::new(
27+
io::ErrorKind::NotFound,
28+
"could not locate windres.exe",
29+
))
30+
},
31+
Ok,
32+
)
3233
}
3334

3435
/// Invokes the resource compiler using the current arguments.
@@ -87,7 +88,8 @@ impl Build {
8788
"cargo:rerun-if-changed=",
8889
rc_file.as_ref().to_string_lossy(),
8990
"\n"
90-
).as_bytes(),
91+
)
92+
.as_bytes(),
9193
);
9294
}
9395
let e = if let Some(code) = status.code() {

src/lib.rs

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 FaultyRAM
1+
// Copyright (c) 2017-2021 FaultyRAM
22
//
33
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
44
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
@@ -13,25 +13,26 @@
1313
//! files, so this crate must be used instead to achieve the same effect.
1414
1515
#![cfg(target_os = "windows")]
16-
#![forbid(warnings)]
17-
#![deny(unused)]
18-
#![forbid(box_pointers)]
19-
#![forbid(missing_copy_implementations)]
20-
#![forbid(missing_debug_implementations)]
21-
#![forbid(missing_docs)]
22-
#![forbid(trivial_casts)]
23-
#![forbid(trivial_numeric_casts)]
24-
#![forbid(unused_extern_crates)]
25-
#![forbid(unused_import_braces)]
26-
#![deny(unused_qualifications)]
27-
#![forbid(unused_results)]
28-
#![forbid(variant_size_differences)]
29-
#![cfg_attr(feature = "cargo-clippy", forbid(clippy))]
30-
#![cfg_attr(feature = "cargo-clippy", forbid(clippy_pedantic))]
31-
#![cfg_attr(feature = "cargo-clippy", forbid(clippy_complexity))]
32-
#![cfg_attr(feature = "cargo-clippy", forbid(clippy_correctness))]
33-
#![cfg_attr(feature = "cargo-clippy", forbid(clippy_perf))]
34-
#![cfg_attr(feature = "cargo-clippy", forbid(clippy_style))]
16+
#![deny(
17+
clippy::all,
18+
clippy::pedantic,
19+
warnings,
20+
future_incompatible,
21+
rust_2018_idioms,
22+
rustdoc,
23+
unused,
24+
deprecated_in_future,
25+
missing_copy_implementations,
26+
missing_debug_implementations,
27+
non_ascii_idents,
28+
trivial_casts,
29+
trivial_numeric_casts,
30+
unreachable_pub,
31+
unused_import_braces,
32+
unused_lifetimes,
33+
unused_results
34+
)]
35+
#![allow(clippy::must_use_candidate, missing_doc_code_examples)]
3536

3637
#[macro_use(concat_string)]
3738
extern crate concat_string;
@@ -78,7 +79,7 @@ impl Build {
7879
/// Specifies an additional preprocessor definition to use during preprocessing.
7980
pub fn define<'a, V: Into<Option<&'a str>>>(&mut self, name: &str, value: V) -> &mut Self {
8081
self.extra_cpp_defs
81-
.push((name.to_owned(), value.into().map(|s| s.to_owned())));
82+
.push((name.to_owned(), value.into().map(ToOwned::to_owned)));
8283
self
8384
}
8485

@@ -89,6 +90,11 @@ impl Build {
8990
}
9091

9192
/// Compiles a Windows resource file (.rc).
93+
///
94+
/// # Errors
95+
///
96+
/// This method returns a `std::io::Error` if it either cannot locate a resource compiler or
97+
/// fails to compile the resource.
9298
pub fn compile<P: AsRef<Path>>(&mut self, rc_file: P) -> io::Result<()> {
9399
Self::find_resource_compiler().and_then(|compiler| self.compile_resource(rc_file, compiler))
94100
}

src/msvc.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 FaultyRAM
1+
// Copyright (c) 2017-2021 FaultyRAM
22
//
33
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
44
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
@@ -7,13 +7,13 @@
77

88
//! MSVC implementation details.
99
10+
use super::Build;
1011
use find_winsdk::{SdkInfo, SdkVersion};
1112
use std::env;
1213
use std::ffi::{OsStr, OsString};
1314
use std::io::{self, ErrorKind, Write};
1415
use std::path::{Path, PathBuf};
1516
use std::process::Command;
16-
use Build;
1717

1818
#[cfg(target_arch = "x86")]
1919
const RC_EXE: &str = "x86/rc.exe";
@@ -96,7 +96,7 @@ impl Build {
9696
"cargo:rustc-link-search=native=",
9797
out_file.parent().expect("empty parent").to_string_lossy(),
9898
"\n",
99-
"cargo:rustc-link-lib=static=",
99+
"cargo:rustc-link-lib=",
100100
out_file
101101
.file_stem()
102102
.expect("empty filename")
@@ -105,7 +105,8 @@ impl Build {
105105
"cargo:rerun-if-changed=",
106106
rc_file.as_ref().to_string_lossy(),
107107
"\n"
108-
).as_bytes(),
108+
)
109+
.as_bytes(),
109110
);
110111
}
111112
let e = if let Some(code) = status.code() {

windres-test/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 FaultyRAM
1+
// Copyright (c) 2017-2021 FaultyRAM
22
//
33
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
44
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or

windres-test/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2017-2018 FaultyRAM
1+
// Copyright (c) 2017-2021 FaultyRAM
22
//
33
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
44
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or

0 commit comments

Comments
 (0)