Skip to content

Commit 080023b

Browse files
committed
Fix action graph.
1 parent 347115a commit 080023b

9 files changed

Lines changed: 52 additions & 91 deletions

crates/action-graph/tests/action_graph_builder_test.rs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ mod action_graph_builder {
230230
let sandbox = create_sandbox("projects");
231231
sandbox.append_file(".moon/toolchain.yml", "bun:\n version: '1.0.0'");
232232

233-
let mut container = ActionGraphContainer::new(sandbox.path());
233+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
234234

235235
let wg = container.create_workspace_graph().await;
236236
let mut builder = container.create_builder(wg.clone()).await;
@@ -751,7 +751,7 @@ mod action_graph_builder {
751751
#[tokio::test(flavor = "multi_thread")]
752752
async fn graphs() {
753753
let sandbox = create_sandbox("projects");
754-
let mut container = ActionGraphContainer::new(sandbox.path());
754+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
755755
let mut builder = container
756756
.create_builder(container.create_workspace_graph().await)
757757
.await;
@@ -791,7 +791,7 @@ mod action_graph_builder {
791791
#[tokio::test(flavor = "multi_thread")]
792792
async fn ignores_dupes() {
793793
let sandbox = create_sandbox("projects");
794-
let mut container = ActionGraphContainer::new(sandbox.path());
794+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
795795
let mut builder = container
796796
.create_builder(container.create_workspace_graph().await)
797797
.await;
@@ -838,7 +838,7 @@ mod action_graph_builder {
838838
#[tokio::test(flavor = "multi_thread")]
839839
async fn sets_interactive() {
840840
let sandbox = create_sandbox("projects");
841-
let mut container = ActionGraphContainer::new(sandbox.path());
841+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
842842
let mut builder = container
843843
.create_builder(container.create_workspace_graph().await)
844844
.await;
@@ -866,7 +866,7 @@ mod action_graph_builder {
866866
#[tokio::test(flavor = "multi_thread")]
867867
async fn sets_interactive_from_requirement() {
868868
let sandbox = create_sandbox("projects");
869-
let mut container = ActionGraphContainer::new(sandbox.path());
869+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
870870
let mut builder = container
871871
.create_builder(container.create_workspace_graph().await)
872872
.await;
@@ -899,7 +899,7 @@ mod action_graph_builder {
899899
#[tokio::test(flavor = "multi_thread")]
900900
async fn sets_persistent() {
901901
let sandbox = create_sandbox("projects");
902-
let mut container = ActionGraphContainer::new(sandbox.path());
902+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
903903
let mut builder = container
904904
.create_builder(container.create_workspace_graph().await)
905905
.await;
@@ -927,7 +927,7 @@ mod action_graph_builder {
927927
#[tokio::test(flavor = "multi_thread")]
928928
async fn distinguishes_between_args() {
929929
let sandbox = create_sandbox("projects");
930-
let mut container = ActionGraphContainer::new(sandbox.path());
930+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
931931
let mut builder = container
932932
.create_builder(container.create_workspace_graph().await)
933933
.await;
@@ -1006,7 +1006,7 @@ mod action_graph_builder {
10061006
#[tokio::test(flavor = "multi_thread")]
10071007
async fn flattens_same_args() {
10081008
let sandbox = create_sandbox("projects");
1009-
let mut container = ActionGraphContainer::new(sandbox.path());
1009+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
10101010
let mut builder = container
10111011
.create_builder(container.create_workspace_graph().await)
10121012
.await;
@@ -1064,7 +1064,7 @@ mod action_graph_builder {
10641064
#[tokio::test(flavor = "multi_thread")]
10651065
async fn flattens_same_args_with_diff_enum() {
10661066
let sandbox = create_sandbox("projects");
1067-
let mut container = ActionGraphContainer::new(sandbox.path());
1067+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
10681068
let mut builder = container
10691069
.create_builder(container.create_workspace_graph().await)
10701070
.await;
@@ -1122,7 +1122,7 @@ mod action_graph_builder {
11221122
#[tokio::test(flavor = "multi_thread")]
11231123
async fn distinguishes_between_env() {
11241124
let sandbox = create_sandbox("projects");
1125-
let mut container = ActionGraphContainer::new(sandbox.path());
1125+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
11261126
let mut builder = container
11271127
.create_builder(container.create_workspace_graph().await)
11281128
.await;
@@ -1201,7 +1201,7 @@ mod action_graph_builder {
12011201
#[tokio::test(flavor = "multi_thread")]
12021202
async fn flattens_same_env() {
12031203
let sandbox = create_sandbox("projects");
1204-
let mut container = ActionGraphContainer::new(sandbox.path());
1204+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
12051205
let mut builder = container
12061206
.create_builder(container.create_workspace_graph().await)
12071207
.await;
@@ -1259,7 +1259,7 @@ mod action_graph_builder {
12591259
#[tokio::test(flavor = "multi_thread")]
12601260
async fn distinguishes_between_args_and_env() {
12611261
let sandbox = create_sandbox("projects");
1262-
let mut container = ActionGraphContainer::new(sandbox.path());
1262+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
12631263
let mut builder = container
12641264
.create_builder(container.create_workspace_graph().await)
12651265
.await;
@@ -1364,7 +1364,7 @@ mod action_graph_builder {
13641364
#[tokio::test(flavor = "multi_thread")]
13651365
async fn doesnt_graph_if_not_affected_by_touched_files() {
13661366
let sandbox = create_sandbox("projects");
1367-
let mut container = ActionGraphContainer::new(sandbox.path());
1367+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
13681368
let mut builder = container
13691369
.create_builder(container.create_workspace_graph().await)
13701370
.await;
@@ -1428,7 +1428,7 @@ mod action_graph_builder {
14281428
#[tokio::test(flavor = "multi_thread")]
14291429
async fn includes_deps_if_owning_task_is_affected() {
14301430
let sandbox = create_sandbox("tasks");
1431-
let mut container = ActionGraphContainer::new(sandbox.path());
1431+
let mut container = ActionGraphContainer::new_legacy(sandbox.path());
14321432

14331433
let wg = container.create_workspace_graph().await;
14341434
let mut builder = container.create_builder(wg.clone()).await;

crates/action-graph/tests/snapshots/action_graph_builder_test__action_graph_builder__run_task_by_target__runs_all.snap

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ digraph {
1010
4 [ label="SyncProject(client)" ]
1111
5 [ label="SyncProject(server)" ]
1212
6 [ label="RunTask(client:build)" ]
13-
7 [ label="SetupToolchain(rust:global)" ]
14-
8 [ label="InstallProjectDeps(rust:global, server)" ]
15-
9 [ label="RunTask(server:build)" ]
16-
10 [ label="RunTask(base:build)" ]
13+
7 [ label="SetupToolchain(unstable_rust)" ]
14+
8 [ label="RunTask(server:build)" ]
15+
9 [ label="RunTask(base:build)" ]
1716
2 -> 0 [ ]
1817
1 -> 0 [ ]
1918
1 -> 2 [ ]
@@ -23,12 +22,10 @@ digraph {
2322
4 -> 5 [ ]
2423
4 -> 1 [ ]
2524
7 -> 0 [ ]
26-
8 -> 0 [ ]
25+
8 -> 5 [ ]
2726
8 -> 7 [ ]
28-
9 -> 5 [ ]
29-
9 -> 8 [ ]
3027
6 -> 4 [ ]
31-
6 -> 9 [ ]
28+
6 -> 8 [ ]
3229
6 -> 3 [ ]
33-
10 -> 2 [ ]
30+
9 -> 2 [ ]
3431
}

crates/action-graph/tests/snapshots/action_graph_builder_test__action_graph_builder__run_task_by_target__runs_all.snap.new

Lines changed: 0 additions & 32 deletions
This file was deleted.

crates/action-graph/tests/snapshots/action_graph_builder_test__action_graph_builder__run_task_by_target__runs_all_with_query.snap

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ expression: graph.to_dot()
55
digraph {
66
0 [ label="SyncWorkspace" ]
77
1 [ label="SyncProject(server)" ]
8-
2 [ label="SetupToolchain(rust:global)" ]
9-
3 [ label="InstallProjectDeps(rust:global, server)" ]
10-
4 [ label="RunTask(server:build)" ]
8+
2 [ label="SetupToolchain(unstable_rust)" ]
9+
3 [ label="RunTask(server:build)" ]
1110
1 -> 0 [ ]
1211
2 -> 0 [ ]
13-
3 -> 0 [ ]
12+
3 -> 1 [ ]
1413
3 -> 2 [ ]
15-
4 -> 1 [ ]
16-
4 -> 3 [ ]
1714
}

crates/action-graph/tests/snapshots/action_graph_builder_test__action_graph_builder__run_task_by_target__runs_all_with_query.snap.new

Lines changed: 0 additions & 15 deletions
This file was deleted.

crates/action-graph/tests/snapshots/action_graph_builder_test__action_graph_builder__run_task_by_target_locator__runs_by_tag_glob.snap

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,9 @@ digraph {
99
3 [ label="SyncProject(common)" ]
1010
4 [ label="SyncProject(base)" ]
1111
5 [ label="RunTask(client:build)" ]
12-
6 [ label="SetupToolchain(rust:global)" ]
13-
7 [ label="InstallProjectDeps(rust:global, server)" ]
14-
8 [ label="RunTask(server:build)" ]
15-
9 [ label="RunTask(common:build)" ]
12+
6 [ label="SetupToolchain(unstable_rust)" ]
13+
7 [ label="RunTask(server:build)" ]
14+
8 [ label="RunTask(common:build)" ]
1615
2 -> 0 [ ]
1716
4 -> 0 [ ]
1817
3 -> 0 [ ]
@@ -21,12 +20,10 @@ digraph {
2120
1 -> 2 [ ]
2221
1 -> 3 [ ]
2322
6 -> 0 [ ]
24-
7 -> 0 [ ]
23+
7 -> 2 [ ]
2524
7 -> 6 [ ]
26-
8 -> 2 [ ]
27-
8 -> 7 [ ]
28-
9 -> 3 [ ]
25+
8 -> 3 [ ]
2926
5 -> 1 [ ]
27+
5 -> 7 [ ]
3028
5 -> 8 [ ]
31-
5 -> 9 [ ]
3229
}

crates/action-graph/tests/snapshots/action_graph_builder_test__action_graph_builder__run_task_by_target_locator__runs_by_target.snap

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,10 @@ expression: graph.to_dot()
55
digraph {
66
0 [ label="SyncWorkspace" ]
77
1 [ label="SyncProject(server)" ]
8-
2 [ label="SetupToolchain(rust:global)" ]
9-
3 [ label="InstallProjectDeps(rust:global, server)" ]
10-
4 [ label="RunTask(server:build)" ]
8+
2 [ label="SetupToolchain(unstable_rust)" ]
9+
3 [ label="RunTask(server:build)" ]
1110
1 -> 0 [ ]
1211
2 -> 0 [ ]
13-
3 -> 0 [ ]
12+
3 -> 1 [ ]
1413
3 -> 2 [ ]
15-
4 -> 1 [ ]
16-
4 -> 3 [ ]
1714
}

crates/action-graph/tests/utils.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,17 @@ impl ActionGraphContainer {
2020
}
2121
}
2222

23+
pub fn new_legacy(root: &Path) -> Self {
24+
Self {
25+
mocker: WorkspaceMocker::new(root)
26+
.load_default_configs()
27+
.with_legacy_toolchains()
28+
.with_test_toolchains()
29+
.with_default_projects()
30+
.with_global_envs(),
31+
}
32+
}
33+
2334
pub fn set_working_dir(mut self, dir: PathBuf) -> Self {
2435
self.mocker = self.mocker.set_working_dir(dir);
2536
self

crates/test-utils/src/workspace_mocker.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,15 @@ impl WorkspaceMocker {
145145
})
146146
}
147147

148+
pub fn with_legacy_toolchains(self) -> Self {
149+
self.update_toolchain_config(|config| {
150+
config.bun = Some(BunConfig::default());
151+
config.deno = Some(DenoConfig::default());
152+
config.node = Some(NodeConfig::default());
153+
config.rust = Some(RustConfig::default());
154+
})
155+
}
156+
148157
pub fn with_test_toolchains(self) -> Self {
149158
self.update_toolchain_config(|config| {
150159
for id in [

0 commit comments

Comments
 (0)