Skip to content

Commit

Permalink
make platform-specific executables compile everywhere
Browse files Browse the repository at this point in the history
Some Rust tools get hung up if the entire workspace cannot be compiled.

refs rust-lang/cargo#5220
  • Loading branch information
mhils committed Aug 21, 2023
1 parent 2a05fc7 commit ba0bdfe
Show file tree
Hide file tree
Showing 4 changed files with 580 additions and 561 deletions.
7 changes: 7 additions & 0 deletions macos-certificate-truster/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#[cfg(target_os = "macos")]
use security_framework::{
item::{ItemClass, ItemSearchOptions, Reference, SearchResult},
trust_settings::{Domain, TrustSettings},
};

#[cfg(target_os = "macos")]
fn main() {
if let SearchResult::Ref(Reference::Certificate(cert)) = ItemSearchOptions::new()
.class(ItemClass::certificate())
Expand All @@ -18,3 +20,8 @@ fn main() {
.unwrap();
}
}

#[cfg(not(target_os = "macos"))]
fn main() {
panic!("The macOS certificate truster works on macOS only.");
}
4 changes: 4 additions & 0 deletions windows-redirector/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#[cfg(windows)]
fn main() {
let mut res = winres::WindowsResource::new();
res.set_manifest(
Expand All @@ -16,3 +17,6 @@ fn main() {
res.set_icon("mitmproxy.ico");
res.compile().unwrap();
}

#[cfg(not(windows))]
fn main() {}
Loading

0 comments on commit ba0bdfe

Please sign in to comment.