Skip to content
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
1,144 changes: 523 additions & 621 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ regex = "1.11.1"
regex-syntax = "0.8.5"
serde = { version = "1.0.215", features = ["derive"] }
smol = "2.0.2"
toml_edit = "0.22.22"
toml_edit = "0.23.9"
futures = "0.3.31"
annotate-snippets = "0.11.5"
annotate-snippets = "0.12.10"
anstream = "0.6.18"

[workspace.lints.clippy]
Expand Down
2 changes: 1 addition & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ anstream.workspace = true
winnow.workspace = true

[dev-dependencies]
criterion = "0.5.1"
criterion = "0.8.1"
iai = "0.1"

[lib]
Expand Down
13 changes: 7 additions & 6 deletions tests/fail/ambiguous_build_recipe.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
error[R0011]: ambiguous pattern match: /foofoo
|
note: first pattern here
--> /INPUT:3:7
|
3 | build "%foo" {
| ------ note: first pattern here
4 | info "<out>"
5 | }
6 |
7 | build "foo%" {
| ------ note: second pattern here
| ------
note: second pattern here
--> /INPUT:7:7
|
7 | build "foo%" {
| ------
7 changes: 5 additions & 2 deletions tests/fail/ambiguous_path_resolution.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
error[E0032]: ambiguous path resolution: /bar exists in the workspace, but also matches a build recipe
--> /INPUT:6:10
|
5 | build "bar" {
| ----- note: matched this build recipe
6 | info "<out>"
| ^^^^^^^ ambiguous path resolution: /bar exists in the workspace, but also matches a build recipe
|
::: /INPUT:5:7
|
5 | build "bar" {
| ----- matched this build recipe
|
= help: use `<...:out-dir>` or `<...:workspace>` to disambiguate between paths in the workspace and the output directory
6 changes: 4 additions & 2 deletions tests/fail/duplicate_config.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
error[E0033]: duplicate config statement
--> /INPUT:2:1
|
1 | config foo = "a"
| ---------------- note: previous config statement here
2 | config foo = "b"
| ^^^^^^^^^^^^^^^^ duplicate config statement
|
::: /INPUT:1:1
|
1 | config foo = "a"
| ---------------- previous config statement here
1 change: 0 additions & 1 deletion tests/fail/include_missing.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ error[E0027]: error including '/does-not-exist.werk': file not found
|
1 | include "does-not-exist.werk"
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error including '/does-not-exist.werk': file not found
|
3 changes: 1 addition & 2 deletions tests/fail/include_self.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ error[E0035]: same file included twice: /included
::: /INPUT:1:1
|
1 | include "included"
| ------------------ note: already included here
|
| ------------------ already included here
6 changes: 4 additions & 2 deletions tests/fail/include_twice.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
error[E0035]: same file included twice: /included
--> /INPUT:2:1
|
1 | include "included"
| ------------------ note: already included here
2 | include "included"
| ^^^^^^^^^^^^^^^^^^ same file included twice: /included
|
::: /INPUT:1:1
|
1 | include "included"
| ------------------ already included here
8 changes: 4 additions & 4 deletions tests/fail/include_with_default.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ error[E0036]: `default` statements are not allowed in included files
1 | default target="foo"
| ^^^^^^^^^^^^^^^^^^^^ `default` statements are not allowed in included files
|
::: /INPUT:1:1
= help: move `default` statements to the top-level Werkfile
note: included here
--> /INPUT:1:1
|
1 | include "included"
| ------------------ note: included here
|
= help: move `default` statements to the top-level Werkfile
| ^^^^^^^^^^^^^^^^^^
12 changes: 6 additions & 6 deletions tests/fail/include_with_error.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
error[P1001]: parse error
--> /included:1:1
--> /included:1:7
|
1 | let a=
| - ^ expected expression
| |
| info: while parsing `let` statement
| while parsing `let` statement
|
::: /INPUT:1:1
= help: expressions must start with a value, or an `env`, `glob`, `which`, or `shell` operation
note: included here
--> /INPUT:1:1
|
1 | include "included"
| ------------------ note: included here
|
= help: expressions must start with a value, or an `env`, `glob`, `which`, or `shell` operation
| ^^^^^^^^^^^^^^^^^^
14 changes: 8 additions & 6 deletions tests/mock_io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,11 @@ impl<'a> Test<'a> {
let ast = match werk_parser::parse_werk(self.source) {
Ok(ast) => ast,
Err(err) => {
return Err(Error::Eval(EvalError::Parse(DiagnosticFileId(0), err))
.into_diagnostic_error(&*self as _));
return Err(Error::Eval(EvalError::Parse(werk_parser::ErrorInFile {
file: DiagnosticFileId(0),
error: err,
}))
.into_diagnostic_error(&*self as _));
}
};
self.reload_test_pragmas(&ast);
Expand Down Expand Up @@ -863,10 +866,9 @@ pub fn touch_fs(fs: &mut MockDir, path: &std::path::Path, now: SystemTime) -> st
}
} else {
match occupied_entry.into_mut() {
MockDirEntry::File(..) => Err(std::io::Error::new(
std::io::ErrorKind::Other,
"touch file below file",
)),
MockDirEntry::File(..) => {
Err(std::io::Error::other("touch file below file"))
}
MockDirEntry::Dir(subdir) => touch_fs(subdir, rest, now),
}
}
Expand Down
13 changes: 8 additions & 5 deletions werk-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ path = "main.rs"

[dependencies]
ahash.workspace = true
annotate-snippets = "0.11.5"
annotate-snippets.workspace = true
anstream.workspace = true
anstyle-query = "1.1.2"
anyhow = "1.0.93"
Expand All @@ -23,7 +23,7 @@ line-span = "0.1.5"
num_cpus = "1.16.0"
owo-colors = "4.1.0"
parking_lot.workspace = true
shadow-rs = "1.1.1"
shadow-rs = "1.4.0"
smol.workspace = true
thiserror.workspace = true
toml_edit.workspace = true
Expand All @@ -36,19 +36,22 @@ werk-util.workspace = true
anstyle = "1.0.10"
serde.workspace = true
serde_json = "1.0.137"
notify-debouncer-full = "0.5.0"
notify-debouncer-full = "0.6.0"
ctrlc = { version = "3.4.5", features = ["termination"] }
futures.workspace = true
libc = "0.2.169"
clap_complete = { version = "4.5.44", features = ["unstable-dynamic"] }

[target.'cfg(windows)'.dependencies]
# Needed to get terminal width.
windows-sys = { version = "0.59.0", features = [
windows-sys = { version = "0.61.2", features = [
"Win32_System_Console",
"Win32_Foundation",
"Win32_Security",
"Win32_Storage",
"Win32_Storage_FileSystem",
] }


[build-dependencies]
shadow-rs = "0.38.0"
shadow-rs = "1.4.0"
3 changes: 1 addition & 2 deletions werk-cli/render/ansi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,6 @@ impl<const LINEAR: bool> Renderer<LINEAR> {

fn warning(&mut self, _task_id: Option<TaskId>, warning: &Warning) {
// TODO: Dedup warnings based on span and ID.
let diagnostic = warning.as_diagnostic();
// TODO: Get the term width.
let renderer = annotate_snippets::Renderer::styled();

Expand All @@ -362,7 +361,7 @@ impl<const LINEAR: bool> Renderer<LINEAR> {
out,
"{} {}",
"[warn]".bright_yellow(),
diagnostic.display(&state.source_map, &renderer)
renderer.render(&warning.as_diagnostic(&state.source_map))
)
});
}
Expand Down
6 changes: 3 additions & 3 deletions werk-fs/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl Path {

#[inline]
#[must_use]
pub fn ancestors(&self) -> Ancestors {
pub fn ancestors(&self) -> Ancestors<'_> {
Ancestors { path: Some(self) }
}

Expand Down Expand Up @@ -401,7 +401,7 @@ impl Path {

#[inline]
#[must_use]
pub fn components(&self) -> Components {
pub fn components(&self) -> Components<'_> {
Components { path: Some(self) }
}

Expand Down Expand Up @@ -433,7 +433,7 @@ impl Path {
}

#[inline]
pub fn normalize(&self) -> Result<Cow<Absolute<Self>>, PathError> {
pub fn normalize(&self) -> Result<Cow<'_, Absolute<Self>>, PathError> {
Normalize::normalize(self).map_err(Into::into)
}
}
Expand Down
5 changes: 1 addition & 4 deletions werk-fs/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,7 @@ impl<'a> Normalize<'a> for &'a std::path::Path {
std::path::Component::CurDir => {}
std::path::Component::ParentDir => {
if !buf.pop() {
return Err(std::io::Error::new(
std::io::ErrorKind::Other,
TooManyParents,
));
return Err(std::io::Error::other(TooManyParents));
}
}
_ => buf.push(c),
Expand Down
Loading