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

chore(visitor): break up visitor to multiple modules #9306

Merged
merged 13 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions crates/turborepo-lib/src/opts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,15 +170,32 @@ pub struct RunOpts {
pub ui_mode: UIMode,
}

/// Projection of `RunOpts` that only includes information necessary to compute
/// pass through args.
#[derive(Debug)]
pub struct TaskArgs<'a> {
pass_through_args: &'a [String],
tasks: &'a [String],
}

impl RunOpts {
pub fn args_for_task(&self, task_id: &TaskId) -> Option<Vec<String>> {
pub fn task_args(&self) -> TaskArgs {
TaskArgs {
pass_through_args: &self.pass_through_args,
tasks: &self.tasks,
}
}
}

impl<'a> TaskArgs<'a> {
pub fn args_for_task(&self, task_id: &TaskId) -> Option<&'a [String]> {
if !self.pass_through_args.is_empty()
&& self
.tasks
.iter()
.any(|task| task.as_str() == task_id.task())
{
Some(self.pass_through_args.clone())
Some(self.pass_through_args)
} else {
None
}
Expand Down
1 change: 1 addition & 0 deletions crates/turborepo-lib/src/process/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use turbopath::AbsoluteSystemPathBuf;

/// A command builder that can be used to build both regular
/// child processes and ones spawned hooked up to a PTY
#[derive(Debug, Clone)]
pub struct Command {
program: OsString,
args: Vec<OsString>,
Expand Down
1 change: 0 additions & 1 deletion crates/turborepo-lib/src/run/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,6 @@ impl Run {
package_inputs_hashes,
&self.env_at_execution_start,
&global_hash,
self.opts.run_opts.env_mode,
self.color_config,
self.processes.clone(),
&self.repo_root,
Expand Down
Loading
Loading