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

Add BuildFinished message. #113

Merged
merged 1 commit into from May 8, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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