-
Notifications
You must be signed in to change notification settings - Fork 286
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Self-hosted implementation of
cargo-cp-artifact
:
- Core functionality implemented in crates/cargo-cp-artifact as a regular crate - crates/cargo-cp-artifact also has a bin so it can be used to build the self-hosted JS package - pkgs/cargo-cp-artifact has a Neon implementation that depends on crates/cargo-cp-artifact - pkgs/cargo-cp-artifact/package.json uses `cargo run -p cargo-cp-artifact` to build itself from the monorepo
- Loading branch information
Showing
18 changed files
with
1,111 additions
and
451 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -2,4 +2,5 @@ | |
members = [ | ||
"crates/*", | ||
"test/*", | ||
"pkgs/cargo-cp-artifact", | ||
] |
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,13 @@ | ||
[package] | ||
name = "cargo-cp-artifact" | ||
version = "0.2.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[[bin]] | ||
name = "cargo-cp-artifact" | ||
path = "src/bin.rs" | ||
|
||
[dependencies] | ||
cargo_metadata = "0.15.3" |
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,23 @@ | ||
#[derive(Debug, PartialEq, Eq, Hash)] | ||
pub enum ArtifactKind { | ||
Bin, | ||
CDylib, | ||
Dylib, | ||
} | ||
|
||
impl ArtifactKind { | ||
pub fn parse(str: &impl AsRef<str>) -> Option<Self> { | ||
match str.as_ref() { | ||
"bin" => Some(ArtifactKind::Bin), | ||
"cdylib" => Some(ArtifactKind::CDylib), | ||
"dylib" => Some(ArtifactKind::Dylib), | ||
_ => None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Debug, PartialEq, Eq, Hash)] | ||
pub struct Artifact { | ||
pub kind: ArtifactKind, | ||
pub crate_name: String, | ||
} |
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,12 @@ | ||
mod artifact; | ||
mod cargo; | ||
mod cli; | ||
|
||
use cargo::Status; | ||
|
||
fn main() { | ||
// Skip the native binary name (argv[0]). | ||
if let Status::Failure = cli::run(1) { | ||
std::process::exit(1); | ||
} | ||
} |
Oops, something went wrong.