Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't recompile dpe every single time #391

Merged
merged 2 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 9 additions & 10 deletions dpe/build.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Licensed under the Apache-2.0 license

use std::env;
use std::fs::File;
use std::io::Write;
use std::path::PathBuf;

fn main() {
let default_value: usize = 24;
Expand All @@ -18,13 +17,13 @@ fn main() {
println!("cargo:rerun-if-env-changed=ARBITRARY_MAX_HANDLES");
println!("cargo:rerun-if-changed=build.rs");

let mut file = File::create(&dest_path).unwrap();
write!(
file,
"pub const MAX_HANDLES: usize = {};",
arbitrary_max_handles
)
.unwrap();
let max_handles_str = format!("pub const MAX_HANDLES: usize = {};", arbitrary_max_handles);

println!("cargo:rerun-if-changed={}", dest_path);
let dest_path = PathBuf::from(&dest_path);
if dest_path.exists()
&& std::fs::read_to_string(&dest_path).unwrap_or_default() != max_handles_str
{
std::fs::write(&dest_path, max_handles_str).unwrap();
}
println!("cargo:rerun-if-changed={}", dest_path.display());
}
7 changes: 3 additions & 4 deletions dpe/src/x509.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1590,7 +1590,7 @@ impl CertWriter<'_> {
/// AuthorityKeyIdentifier ::= SEQUENCE {
/// keyIdentifier [0] KeyIdentifier OPTIONAL,
/// authorityCertIssuer [1] GeneralNames OPTIONAL,
/// authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL
/// authorityCertSerialNumber [2] CertificateSerialNumber OPTIONAL
/// }
fn encode_authority_key_identifier_extension(
&mut self,
Expand Down Expand Up @@ -2994,9 +2994,8 @@ pub(crate) mod tests {
_ => (),
}

match cert.get_extension_unique(&oid!(2.5.29 .35)) {
Err(_) => panic!("multiple authority key identifier extensions found"),
_ => (),
if let Err(_) = cert.get_extension_unique(&oid!(2.5.29 .35)) {
panic!("multiple authority key identifier extensions found")
}

match cert.subject_alternative_name() {
Expand Down