Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bin-cargo-args from config file are ignored #400

Open
collinpa opened this issue Nov 29, 2024 · 0 comments · May be fixed by #401
Open

bin-cargo-args from config file are ignored #400

collinpa opened this issue Nov 29, 2024 · 0 comments · May be fixed by #401

Comments

@collinpa
Copy link

bin-cargo-args from the config file are ignored and only applied from command line args.

Applying the example flags from the readme don't work for the bin target:

bin-cargo-args = ["--timings"]

They do work for the lib target.

Easiest to just point out the code. The lib target has the correct functionality

// src/config/lib_package.rs
        let cargo_args = cli
            .lib_cargo_args
            .clone()
            .or_else(|| config.lib_cargo_args.clone());

        Ok(Self {
            name,
            abs_dir,
            rel_dir,
            wasm_file,
            js_file,
            features,
            default_features: config.lib_default_features,
            output_name,
            src_paths: src_deps,
            front_target_path,
            profile,
            cargo_args,
        })

The bin target doesn't have this logic and only applies it from the cli.

// src/config/bin_package.rs
        log::debug!("BEFORE BIN {:?}", config.bin_cargo_command);
        Ok(Self {
            name,
            abs_dir,
            rel_dir,
            exe_file,
            target: target.name,
            features,
            default_features: config.bin_default_features,
            src_paths,
            profile,
            target_triple: config.bin_target_triple.clone(),
            target_dir: config.bin_target_dir.clone(),
            cargo_command: config.bin_cargo_command.clone(),
            cargo_args: cli.bin_cargo_args.clone(),
            bin_args: bin_args.map(ToOwned::to_owned),
        })

It seems like it could be fixed with the following change.

// src/config/bin_package.rs
        let cargo_args = cli
            .bin_cargo_args
            .clone()
            .or_else(|| config.bin_cargo_args.clone());

        log::debug!("BEFORE BIN {:?}", config.bin_cargo_command);
        Ok(Self {
            name,
            abs_dir,
            rel_dir,
            exe_file,
            target: target.name,
            features,
            default_features: config.bin_default_features,
            src_paths,
            profile,
            target_triple: config.bin_target_triple.clone(),
            target_dir: config.bin_target_dir.clone(),
            cargo_command: config.bin_cargo_command.clone(),
            cargo_args,
            bin_args: bin_args.map(ToOwned::to_owned),
        })

Note I haven't tested it

@collinpa collinpa linked a pull request Nov 29, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant