@@ -55,12 +55,6 @@ fn to_snake_case(string: &str) -> String {
5555
5656/// Get the crate's metadata either by looking for the `Cargo.toml` file at the
5757/// `--manifest-path` or at the ancestors of the current directory.
58- ///
59- /// If successful, the return value is a pair of metadata and all of the
60- /// `cargo_args` except the `--manifest-path` and the path to the manifest file.
61- /// This last part is used for reproducible builds. There we want to keep the
62- /// remaining `cargo` arguments, but the manifest path does not make sense since
63- /// the project is built from a specific location inside the container.
6458pub fn get_crate_metadata ( cargo_args : & [ String ] ) -> anyhow:: Result < Metadata > {
6559 let mut cmd = MetadataCommand :: new ( ) ;
6660 let mut args = cargo_args
@@ -170,7 +164,6 @@ fn create_archive(
170164 for file in files {
171165 let file = file?;
172166 let file_path = file. path ( ) ;
173- println ! ( "{file_path:?}" ) ;
174167 if file_path == workspace_root || omit_files. iter ( ) . any ( |f| file_path. starts_with ( f) ) {
175168 // We don't want to add the root path since we are adding all
176169 // relative paths under it.
@@ -268,16 +261,18 @@ struct ContainerBuildOutput {
268261/// tar archive. The arguments are
269262///
270263/// - `image`, the docker image that will be used to build.
271- /// - `package_target_dir`,
272- /// - `package_root_path`,
264+ /// - `package`, the package to build.
265+ /// - `package_root_path`, the cargo metadata object.
273266/// - `extra_args`, the extra arguments to pass to the cargo build command.
274267/// - `container_runtime`, the container runtime to use, e.g. `docker` or
275268/// `podman`
276- /// - `out_path`, - the path to the out file for the wasm artifact. This should
269+ /// - `out_path`, the path to the out file for the wasm artifact. This should
277270/// be a fully expanded, canonical path.
278- /// - `tar_path`, - the path to the tar archive. This should be a fully
271+ /// - `tar_path`, the path to the tar archive. This should be a fully
279272/// expanded, canonical path.
280- fn build_in_container < ' a > (
273+ /// - `source_link`, the link to where the source code will be located
274+ #[ allow( clippy:: too_many_arguments) ]
275+ fn build_in_container (
281276 image : String ,
282277 package : & Package ,
283278 metadata : & Metadata ,
@@ -307,7 +302,7 @@ fn build_in_container<'a>(
307302 locked : true ,
308303 features : & [ ] ,
309304 package : Some ( & package. name ) ,
310- extra_args : & extra_args ,
305+ extra_args,
311306 }
312307 . get_cargo_cmd_as_strings ( ) ?;
313308
@@ -376,7 +371,6 @@ fn build_in_container<'a>(
376371///
377372/// Note that even if a verifiable build is requested the schemas are built on
378373/// the host machine.
379- #[ allow( clippy:: too_many_arguments) ]
380374pub ( crate ) fn build_contract (
381375 options : BuildOptions ,
382376 cargo_args : & [ String ] ,
@@ -526,7 +520,7 @@ pub(crate) fn build_contract(
526520 } = build_in_container (
527521 image,
528522 package,
529- & metadata,
523+ metadata,
530524 & args_without_manifest,
531525 & container_runtime,
532526 & out_filename,
@@ -774,11 +768,10 @@ pub fn build_contract_schema<A>(
774768 anyhow:: bail!( "Compilation failed." ) ;
775769 }
776770
777- let filename = format ! (
778- "{}/wasm32-unknown-unknown/release/{}.wasm" ,
779- target_dir,
780- to_snake_case( package. name. as_str( ) )
781- ) ;
771+ let filename = target_dir
772+ . join ( "wasm32-unknown-unknown" )
773+ . join ( "release" )
774+ . join ( format ! ( "{}.wasm" , to_snake_case( package. name. as_str( ) ) ) ) ;
782775
783776 if !skip_wasm_opt {
784777 wasm_opt:: OptimizationOptions :: new_opt_level_0 ( )
@@ -1493,6 +1486,7 @@ struct CargoBuildParameters<'a> {
14931486}
14941487
14951488impl < ' a > CargoBuildParameters < ' a > {
1489+ /// Get the cargo arguments as a list of strings, i.e. `Vec!["cargo", "build", ...]`.
14961490 fn get_cargo_cmd_as_strings ( & self ) -> anyhow:: Result < Vec < String > > {
14971491 let mut args = vec ! [
14981492 "cargo" ,
@@ -1524,6 +1518,7 @@ impl<'a> CargoBuildParameters<'a> {
15241518 Ok ( args)
15251519 }
15261520
1521+ /// Run the `cargo build` command with the specified parameters.
15271522 fn run_cargo_cmd ( & self ) -> anyhow:: Result < std:: process:: Output > {
15281523 let mut args = self . get_cargo_cmd_as_strings ( ) ?;
15291524 let executable = args. remove ( 0 ) ; // "cargo"
0 commit comments