Skip to content

Commit dfa49e1

Browse files
committed
add Session::plan_synthetic_task
1 parent dfc5e86 commit dfa49e1

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

crates/vite_task/src/session/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,23 @@ impl<'a, CustomSubcommand> Session<'a, CustomSubcommand> {
205205
}
206206

207207
impl<'a, CustomSubcommand: clap::Subcommand> Session<'a, CustomSubcommand> {
208-
pub async fn plan(
208+
async fn plan_synthetic_task(
209+
&mut self,
210+
synthetic_plan_request: SyntheticPlanRequest,
211+
) -> Result<ExecutionPlan, vite_task_plan::Error> {
212+
let plan = ExecutionPlan::plan(
213+
PlanRequest::Synthetic(synthetic_plan_request),
214+
&self.workspace_path,
215+
&self.cwd,
216+
&self.envs,
217+
&mut self.plan_request_parser,
218+
&mut self.lazy_task_graph,
219+
)
220+
.await?;
221+
Ok(plan)
222+
}
223+
224+
pub async fn plan_from_cli(
209225
&mut self,
210226
cwd: Arc<AbsolutePath>,
211227
cli_args: TaskCLIArgs<CustomSubcommand>,

crates/vite_task_bin/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async fn main() -> anyhow::Result<()> {
2828

2929
let mut owned_callbacks = OwnedSessionCallbacks::default();
3030
let mut session = Session::init(owned_callbacks.as_callbacks())?;
31-
let plan = session.plan(cwd, task_cli_args).await?;
31+
let plan = session.plan_from_cli(cwd, task_cli_args).await?;
3232
dbg!(plan);
3333

3434
Ok(())

crates/vite_task_bin/tests/test_snapshots/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ fn run_case(runtime: &Runtime, tmpdir: &AbsolutePath, fixture_path: &Path) {
147147
CLIArgs::NonTask(never) => match never {},
148148
};
149149

150-
let plan_result =
151-
session.plan(workspace_root.path.join(plan.cwd).into(), task_cli_args).await;
150+
let plan_result = session
151+
.plan_from_cli(workspace_root.path.join(plan.cwd).into(), task_cli_args)
152+
.await;
152153

153154
let plan = match plan_result {
154155
Ok(plan) => plan,

0 commit comments

Comments
 (0)