Skip to content

Commit

Permalink
Polish.
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj committed Dec 8, 2023
1 parent 320c750 commit 4d82f85
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 30 deletions.
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pathdiff = "0.2.1"
petgraph = { version = "0.6.4", default-features = false, features = [
"serde-1",
] }
proto_core = "0.24.2"
proto_core = "0.24.3"
relative-path = { version = "1.9.0", features = ["serde"] }
regex = "1.10.2"
reqwest = { version = "0.11.22", default-features = false, features = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ expression: assert.output()
---
▪▪▪▪ bun install
▪▪▪▪ bun:passthroughArgs
Args: -aBc --opt value --optCamel=value foo bar baz --opt-kebab 123
Args: -aBc --opt value --optCamel=value foo 'bar baz' --opt-kebab 123
▪▪▪▪ bun:passthroughArgs (100ms)

Tasks: 1 completed
Expand Down
4 changes: 2 additions & 2 deletions crates/core/action-pipeline/src/actions/sync_workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async fn install_proto(workspace: &Workspace) -> miette::Result<()> {
download_from_url_to_file(
&script_url,
&script_path,
workspace.proto_env.get_http_client()?,
workspace.proto_env.get_plugin_loader()?.get_client()?,
)
.await?;

Expand All @@ -127,7 +127,7 @@ async fn install_proto(workspace: &Workspace) -> miette::Result<()> {

// Copy the binary to the bin folder
let bin_name = if cfg!(windows) { "proto.exe" } else { "proto" };
let bin_path = workspace.proto_env.bin_dir.join(&bin_name);
let bin_path = workspace.proto_env.bin_dir.join(bin_name);

if !bin_path.exists() {
fs::copy_file(install_dir.join(bin_name), bin_path)?;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/runner/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ impl<'a> Runner<'a> {
.set_error_on_nonzero(false);

// Wrap in a shell
if !task.options.shell {
if task.options.shell.is_none() || task.options.shell.is_some_and(|s| !s) {
command.without_shell();
}

Expand Down
2 changes: 1 addition & 1 deletion crates/core/tool/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub async fn load_tool_plugin(
) -> miette::Result<ProtoTool> {
let mut manifest = ProtoTool::create_plugin_manifest(
proto,
Wasm::file(proto.get_plugin_loader().load_plugin(id, locator).await?),
Wasm::file(proto.get_plugin_loader()?.load_plugin(id, locator).await?),
)?;

inject_default_manifest_config(id, proto, &mut manifest)?;
Expand Down
2 changes: 1 addition & 1 deletion nextgen/common/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ pub const CONFIG_PROJECT_FILENAME: &str = "moon.yml";

pub const CONFIG_TEMPLATE_FILENAME: &str = "template.yml";

pub const PROTO_CLI_VERSION: &str = "0.23.4";
pub const PROTO_CLI_VERSION: &str = "0.24.2";
6 changes: 5 additions & 1 deletion nextgen/task-builder/src/tasks_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@ impl<'proj> TasksBuilder<'proj> {
TaskType::Test
};

if task.platform.is_system() && task.options.shell.is_none() {
task.options.shell = Some(true);
}

Ok(task)
}

Expand Down Expand Up @@ -546,7 +550,7 @@ impl<'proj> TasksBuilder<'proj> {
}

if let Some(shell) = &config.shell {
options.shell = *shell;
options.shell = Some(*shell);
}
}

Expand Down
13 changes: 13 additions & 0 deletions nextgen/task-builder/tests/tasks_builder_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,19 @@ mod tasks_builder {
assert!(!task.options.run_in_ci);
assert_eq!(task.options.output_style, Some(TaskOutputStyle::Stream));
}

#[tokio::test]
async fn shell() {
let sandbox = create_sandbox("builder");
let tasks = build_tasks(sandbox.path(), "platforms/moon.yml").await;

// True for system
assert_eq!(tasks.get("system").unwrap().options.shell, Some(true));

// None for others
assert_eq!(tasks.get("bun").unwrap().options.shell, None);
assert_eq!(tasks.get("node").unwrap().options.shell, None);
}
}

mod local_mode {
Expand Down
4 changes: 2 additions & 2 deletions nextgen/task/src/task_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ cacheable!(

pub run_from_workspace_root: bool,

pub shell: bool,
pub shell: Option<bool>,
}
);

Expand All @@ -60,7 +60,7 @@ impl Default for TaskOptions {
run_deps_in_parallel: true,
run_in_ci: true,
run_from_workspace_root: false,
shell: true,
shell: None,
}
}
}
18 changes: 4 additions & 14 deletions packages/cli/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,15 @@
- More accurately monitors signals (ctrl+c) and shutdowns.
- Tasks can now be configured with a timeout.

## NEXT
## Unreleased

#### 🚀 Updates

- Rewrote toolchain based task running to use a shell.
- Instead of locating a direct executable, we'll now use the shell to locate the executable.
- Rewrote toolchain based task running to use a path based approach.
- Instead of manually locating an executable, we now rely on `PATH` to locate the executable.
- Non-system tasks can now be wrapped in a shell using the `shell` option.
- This approach will now benefit from proto shims and binaries.
- We'll also download and install the `proto` binary if it does not exist.
- Reworked the `moon init` command.
- Will no longer scaffold the toolchain configuration by default.
- The tool to scaffold into a toolchain can be passed as an argument.
- The path to initialize in is now behined the `--to` option.
- Added support for the `bun` tool.
- Simplified the workflow overall.

## Unreleased

#### 🚀 Updates

- Reworked the `moon init` command.
- Will no longer scaffold the toolchain configuration by default.
- The tool to scaffold into a toolchain can be passed as an argument.
Expand Down

0 comments on commit 4d82f85

Please sign in to comment.