Skip to content

Commit

Permalink
Merge pull request #113 from ehuss/add-build-finished
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed May 8, 2020
2 parents 5aea30e + 1dbfd9f commit 764e505
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Expand Up @@ -67,6 +67,9 @@
//! Message::BuildScriptExecuted(script) => {
//! println!("{:?}", script);
//! },
//! Message::BuildFinished(finished) => {
//! println!("{:?}", finished);
//! },
//! _ => () // Unknown message
//! }
//! }
Expand All @@ -93,7 +96,7 @@ pub use dependency::{Dependency, DependencyKind};
use diagnostic::Diagnostic;
pub use errors::{Error, Result};
pub use messages::{
parse_messages, Artifact, ArtifactProfile, BuildScript, CompilerMessage, Message,
parse_messages, Artifact, ArtifactProfile, BuildFinished, BuildScript, CompilerMessage, Message,
};

mod dependency;
Expand Down
15 changes: 15 additions & 0 deletions src/messages.rs
Expand Up @@ -85,6 +85,16 @@ pub struct BuildScript {
__do_not_match_exhaustively: (),
}

/// Final result of a build.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct BuildFinished {
/// Whether or not the build finished successfully.
pub success: bool,
#[doc(hidden)]
#[serde(skip)]
__do_not_match_exhaustively: (),
}

/// A cargo message
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "reason", rename_all = "kebab-case")]
Expand All @@ -95,6 +105,11 @@ pub enum Message {
CompilerMessage(CompilerMessage),
/// A build script successfully executed.
BuildScriptExecuted(BuildScript),
/// The build has finished.
///
/// This is emitted at the end of the build as the last message.
/// Added in Rust 1.44.
BuildFinished(BuildFinished),
#[doc(hidden)]
#[serde(other)]
Unknown,
Expand Down

0 comments on commit 764e505

Please sign in to comment.