Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
af-afk authored and rauljordan committed Dec 12, 2024
1 parent 1ce422a commit 90f7f32
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
5 changes: 5 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh -e

cargo fmt
cargo clippy --package cargo-stylus --package cargo-stylus-example
cargo install --path main
25 changes: 21 additions & 4 deletions main/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,12 @@ struct ReplayArgs {
/// Whether to use stable Rust. Note that nightly is needed to expand macros.
#[arg(short, long)]
stable_rust: bool,
/// Any features that should be passed to cargo build.
#[arg(short, long)]
features: Option<Vec<String>>,
/// Which specific package to build during replay, if any.
#[arg(long)]
package: Option<String>,
/// Whether this process is the child of another.
#[arg(short, long, hide(true))]
child: bool,
Expand Down Expand Up @@ -681,7 +687,7 @@ async fn replay(args: ReplayArgs) -> Result<()> {
let provider = sys::new_provider(&args.trace.endpoint)?;
let trace = Trace::new(provider, args.trace.tx, args.trace.use_native_tracer).await?;

build_shared_library(&args.trace.project)?;
build_shared_library(&args.trace.project, args.package, args.feature)?;
let library_extension = if macos { ".dylib" } else { ".so" };
let shared_library = find_shared_library(&args.trace.project, library_extension)?;

Expand All @@ -704,12 +710,23 @@ async fn replay(args: ReplayArgs) -> Result<()> {
Ok(())
}

pub fn build_shared_library(path: &Path) -> Result<()> {
pub fn build_shared_library(
path: &Path,
package: Option<String>,
features: Option<Vec<String>>,
) -> Result<()> {
let mut cargo = sys::new_command("cargo");

cargo.current_dir(path).arg("build");

if let Some(f) = features {
cargo.arg("--features").arg(f.join(","));
}
if let Some(p) = package {
cargo.arg("--package").arg(p);
}

cargo
.current_dir(path)
.arg("build")
.arg("--lib")
.arg("--locked")
.arg("--target")
Expand Down

0 comments on commit 90f7f32

Please sign in to comment.