Skip to content

Commit

Permalink
Remove mentions of xbuild from error variants and code comments
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-opp committed Jul 17, 2020
1 parent b141085 commit d9a04cd
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
22 changes: 11 additions & 11 deletions src/builder/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ pub enum BuildKernelError {
)]
XbuildNotFound,

/// Running `cargo xbuild` failed.
/// Running `cargo build` failed.
#[error("Kernel build failed.\nStderr: {}", String::from_utf8_lossy(.stderr))]
XbuildFailed {
BuildFailed {
/// The standard error output.
stderr: Vec<u8>,
},

/// The output of `cargo xbuild --message-format=json` was not valid UTF-8
/// The output of `cargo build --message-format=json` was not valid UTF-8
#[error("Output of kernel build with --message-format=json is not valid UTF-8:\n{0}")]
XbuildJsonOutputInvalidUtf8(std::string::FromUtf8Error),
/// The output of `cargo xbuild --message-format=json` was not valid JSON
BuildJsonOutputInvalidUtf8(std::string::FromUtf8Error),
/// The output of `cargo build --message-format=json` was not valid JSON
#[error("Output of kernel build with --message-format=json is not valid JSON:\n{0}")]
XbuildJsonOutputInvalidJson(json::Error),
BuildJsonOutputInvalidJson(json::Error),
}

/// Represents an error that occurred when creating a bootimage.
Expand All @@ -59,7 +59,7 @@ pub enum CreateBootimageError {
/// Building the bootloader failed
#[error("Bootloader build failed.\nStderr: {}", String::from_utf8_lossy(.stderr))]
BootloaderBuildFailed {
/// The `cargo xbuild` output to standard error
/// The `cargo build` output to standard error
stderr: Vec<u8>,
},

Expand All @@ -76,12 +76,12 @@ pub enum CreateBootimageError {
error: io::Error,
},

/// The output of `cargo xbuild --message-format=json` was not valid UTF-8
/// The output of `cargo build --message-format=json` was not valid UTF-8
#[error("Output of bootloader build with --message-format=json is not valid UTF-8:\n{0}")]
XbuildJsonOutputInvalidUtf8(std::string::FromUtf8Error),
/// The output of `cargo xbuild --message-format=json` was not valid JSON
BuildJsonOutputInvalidUtf8(std::string::FromUtf8Error),
/// The output of `cargo build --message-format=json` was not valid JSON
#[error("Output of bootloader build with --message-format=json is not valid JSON:\n{0}")]
XbuildJsonOutputInvalidJson(json::Error),
BuildJsonOutputInvalidJson(json::Error),
}

/// There is something wrong with the bootloader dependency.
Expand Down
16 changes: 8 additions & 8 deletions src/builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Builder {
&self.manifest_path
}

/// Builds the kernel by executing `cargo xbuild` with the given arguments.
/// Builds the kernel by executing `cargo build` with the given arguments.
///
/// Returns a list of paths to all built executables. For crates with only a single binary,
/// the returned list contains only a single element.
Expand All @@ -54,7 +54,7 @@ impl Builder {
println!("Building kernel");
}

// try to run cargo xbuild
// try to build kernel
let cargo = std::env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned());
let mut cmd = process::Command::new(&cargo);
cmd.args(&config.build_command);
Expand All @@ -80,7 +80,7 @@ impl Builder {
}
}
}
return Err(BuildKernelError::XbuildFailed {
return Err(BuildKernelError::BuildFailed {
stderr: output.stderr,
});
}
Expand All @@ -95,17 +95,17 @@ impl Builder {
error: err,
})?;
if !output.status.success() {
return Err(BuildKernelError::XbuildFailed {
return Err(BuildKernelError::BuildFailed {
stderr: output.stderr,
});
}
let mut executables = Vec::new();
for line in String::from_utf8(output.stdout)
.map_err(BuildKernelError::XbuildJsonOutputInvalidUtf8)?
.map_err(BuildKernelError::BuildJsonOutputInvalidUtf8)?
.lines()
{
let mut artifact =
json::parse(line).map_err(BuildKernelError::XbuildJsonOutputInvalidJson)?;
json::parse(line).map_err(BuildKernelError::BuildJsonOutputInvalidJson)?;
if let Some(executable) = artifact["executable"].take_string() {
executables.push(PathBuf::from(executable));
}
Expand Down Expand Up @@ -165,11 +165,11 @@ impl Builder {
}
let mut bootloader_elf_path = None;
for line in String::from_utf8(output.stdout)
.map_err(CreateBootimageError::XbuildJsonOutputInvalidUtf8)?
.map_err(CreateBootimageError::BuildJsonOutputInvalidUtf8)?
.lines()
{
let mut artifact =
json::parse(line).map_err(CreateBootimageError::XbuildJsonOutputInvalidJson)?;
json::parse(line).map_err(CreateBootimageError::BuildJsonOutputInvalidJson)?;
if let Some(executable) = artifact["executable"].take_string() {
if bootloader_elf_path
.replace(PathBuf::from(executable))
Expand Down

0 comments on commit d9a04cd

Please sign in to comment.