Skip to content

Commit

Permalink
feat(build): Support build-finished message
Browse files Browse the repository at this point in the history
Fixes #40
  • Loading branch information
Ed Page committed Jan 31, 2021
1 parent debb804 commit 4dbb90c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
<!-- next-header -->
## [Unreleased] - ReleaseDate

#### Features

* Support `build-finished` message

## [0.5.0] - 2019-04-08

#### Features
Expand Down
16 changes: 16 additions & 0 deletions src/format/mod.rs
Expand Up @@ -15,6 +15,8 @@ type CowStr<'a> = borrow::Cow<'a, str>;
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(tag = "reason", rename_all = "kebab-case")]
pub enum Message<'a> {
/// Build completed, all further output should not be parsed
BuildFinished(BuildFinished),
/// The compiler generated an artifact
#[serde(borrow)]
CompilerArtifact(Artifact<'a>),
Expand All @@ -30,6 +32,14 @@ pub enum Message<'a> {
Unknown,
}

/// Build completed, all further output should not be parsed
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_unstable", serde(deny_unknown_fields))]
#[non_exhaustive]
pub struct BuildFinished {
success: bool,
}

/// A compiler-generated file.
#[derive(Debug, Clone, Serialize, Deserialize)]
#[cfg_attr(feature = "strict_unstable", serde(deny_unknown_fields))]
Expand Down Expand Up @@ -77,6 +87,9 @@ pub struct Target<'a> {
/// Whether this is a doctest or not
#[serde(default)]
pub doctest: Option<bool>,
/// Whether this is a test file
#[serde(default)]
pub test: bool,

#[serde(default)]
#[serde(rename = "required-features")]
Expand Down Expand Up @@ -173,6 +186,9 @@ pub struct BuildScript<'a> {
#[cfg(not(feature = "print"))]
pub(crate) fn log_message(msg: &Message<'_>) {
match msg {
Message::BuildFinished(ref finished) => {
log::trace!("Build Finished: {:?}", finished.success);
}
Message::CompilerArtifact(ref art) => {
log::trace!("Building {:#?}", art.package_id,);
}
Expand Down

0 comments on commit 4dbb90c

Please sign in to comment.