-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(cdk): prebuild artifacts for publish and deploy (#3252)
Abstracts the build command used for `build`, `test`, `deploy` and `publish` and then makes sure commands relying on binaries from build process output (Artifacts) are present by spawning the `build` process before proceeding.
- Loading branch information
1 parent
0728e43
commit 7957551
Showing
6 changed files
with
72 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
pub mod build { | ||
use anyhow::Result; | ||
|
||
use cargo_builder::package::PackageInfo; | ||
use cargo_builder::cargo::Cargo; | ||
|
||
pub struct BuildOpts { | ||
pub(crate) release: String, | ||
pub(crate) extra_arguments: Vec<String>, | ||
} | ||
|
||
impl BuildOpts { | ||
pub fn with_release(release: &str) -> Self { | ||
Self { | ||
release: release.to_string(), | ||
extra_arguments: Vec::default(), | ||
} | ||
} | ||
} | ||
|
||
/// Builds a Connector given it's package info and Cargo Build options | ||
pub fn build_connector(package_info: &PackageInfo, opts: BuildOpts) -> Result<()> { | ||
let cargo = Cargo::build() | ||
.profile(opts.release) | ||
.lib(false) | ||
.package(package_info.package_name()) | ||
.target(package_info.arch_target()) | ||
.extra_arguments(opts.extra_arguments) | ||
.build()?; | ||
|
||
cargo.run() | ||
} | ||
} |