class RbSys::CargoBuilder

def cargo_command(cargo_dir, dest_path, args = [])

def cargo_command(cargo_dir, dest_path, args = [])
  manifest = File.join(cargo_dir, "Cargo.toml")
  cargo = ENV.fetch("CARGO", "cargo")
  cmd = []
  cmd += [cargo, "rustc"]
  cmd += ["--target", target] if target
  cmd += ["--target-dir", dest_path]
  cmd += ["--features", features.join(",")] unless features.empty?
  cmd += ["--manifest-path", manifest]
  cmd += ["--lib"]
  cmd += ["--profile", profile.to_s]
  cmd += ["--locked"] if profile.to_s == "release"
  cmd += Gem::Command.build_args
  cmd += args
  cmd += ["--"]
  cmd += [*cargo_rustc_args(dest_path)]
  cmd += extra_rustc_args
  cmd
end