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
51 changes: 51 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ toml_edit = "0.23.9"
futures = "0.3.31"
annotate-snippets = "0.12.10"
anstream = "0.6.18"
stringleton = { version = "0.2.1", features = ["serde"] }

[workspace.lints.clippy]
pedantic = { level = "warn", priority = -1 }
Expand Down
1 change: 1 addition & 0 deletions tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ werk-util.workspace = true
anstream.workspace = true
# Hijacking winnow for the Offset trait
winnow.workspace = true
stringleton.workspace = true

[dev-dependencies]
criterion = "0.8.1"
Expand Down
2 changes: 2 additions & 0 deletions tests/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
// This file intentionally left blank.
pub mod mock_io;

stringleton::enable!(werk_runner);
2 changes: 1 addition & 1 deletion tests/test_expressions.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use werk_runner::Value;

use stringleton::Symbol;
use tests::mock_io::*;
use werk_util::Symbol;

fn evaluate_global(source: &str, global_variable_name_to_check: &str) -> Value {
let mut test = Test::new(source).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion tests/test_outdatedness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use macro_rules_attribute::apply;
use tests::mock_io;

use mock_io::*;
use stringleton::Symbol;
use werk_fs::{Absolute, Path};
use werk_runner::{BuildStatus, Outdatedness, Reason, ShellCommandLine, TaskId};
use werk_util::Symbol;

static WERK: &str = r#"
config profile = env "PROFILE"
Expand Down
23 changes: 10 additions & 13 deletions tests/test_path_resolution.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use macro_rules_attribute::apply;
use stringleton::sym;
use tests::mock_io::*;
use werk_fs::Absolute;
use werk_runner::{Runner, TaskId, Value};
use werk_util::{Annotated, Symbol};
use werk_util::Annotated;

stringleton::enable!(tests);

#[test]
fn test_path_resolution() {
Expand Down Expand Up @@ -44,41 +47,35 @@ let exists-not-explicit-workspace = "<exists-not:workspace>"
};
let globals = &workspace.manifest.global_variables;
assert_eq!(
globals.get(&Symbol::new("exists-resolved")).unwrap().value,
globals.get(&sym!("exists-resolved")).unwrap().value,
Value::from(foo_workspace.clone())
);
assert_eq!(
globals
.get(&Symbol::new("exists-explicit-out-dir"))
.unwrap()
.value,
globals.get(&sym!("exists-explicit-out-dir")).unwrap().value,
Value::from(foo_output)
);
assert_eq!(
globals
.get(&Symbol::new("exists-explicit-workspace"))
.get(&sym!("exists-explicit-workspace"))
.unwrap()
.value,
Value::from(foo_workspace.clone())
);

assert_eq!(
globals
.get(&Symbol::new("exists-not-resolved"))
.unwrap()
.value,
globals.get(&sym!("exists-not-resolved")).unwrap().value,
Value::from(bar_output.clone())
);
assert_eq!(
globals
.get(&Symbol::new("exists-not-explicit-out-dir"))
.get(&sym!("exists-not-explicit-out-dir"))
.unwrap()
.value,
Value::from(bar_output.clone())
);
assert_eq!(
globals
.get(&Symbol::new("exists-not-explicit-workspace"))
.get(&sym!("exists-not-explicit-workspace"))
.unwrap()
.value,
Value::from(bar_workspace)
Expand Down
1 change: 1 addition & 0 deletions werk-fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ winnow.workspace = true
thiserror.workspace = true
serde.workspace = true
werk-util.workspace = true
stringleton.workspace = true

[lints]
workspace = true
2 changes: 1 addition & 1 deletion werk-fs/sym.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use werk_util::Symbol;
use stringleton::Symbol;

use crate::{Absolute, Path, PathBuf};

Expand Down
1 change: 1 addition & 0 deletions werk-parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ regex.workspace = true
annotate-snippets.workspace = true
serde.workspace = true
werk-util.workspace = true
stringleton.workspace = true

[dev-dependencies]
anstream.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion werk-parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub mod token;

pub use expr::*;
pub use string::*;
use werk_util::Symbol;
use stringleton::Symbol;

/// Whitespace and comments within statements and expressions (not doc
/// comments).
Expand Down
3 changes: 2 additions & 1 deletion werk-parser/ast/string.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{fmt::Write, hash::Hash as _};

use werk_util::{SemanticHash, Span, Symbol};
use stringleton::Symbol;
use werk_util::{SemanticHash, Span};

use crate::parser::{
escape_pattern_literal, escape_string_literal, parse_pattern_expr_unquoted,
Expand Down
3 changes: 2 additions & 1 deletion werk-parser/parser/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use crate::{
fatal,
parser::{Input, Parser as _},
};
use werk_util::{Offset, Symbol};
use stringleton::Symbol;
use werk_util::Offset;
use winnow::{
Parser,
ascii::{dec_int, digit1, multispace1},
Expand Down
1 change: 1 addition & 0 deletions werk-runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ memchr = "2.7.4"
annotate-snippets.workspace = true
werk-util.workspace = true
bitflags = "2.8.0"
stringleton.workspace = true

[lints]
workspace = true
2 changes: 1 addition & 1 deletion werk-runner/cache.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::collections::BTreeMap;

use stringleton::Symbol;
use werk_fs::Absolute;
use werk_util::Symbol;

/// The contents of `.werk-cache`.
#[derive(Debug, Default, serde::Serialize, serde::Deserialize)]
Expand Down
3 changes: 2 additions & 1 deletion werk-runner/eval.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
mod string;
mod used;
pub(crate) use string::*;
use stringleton::Symbol;
pub use used::*;

use werk_fs::Absolute;
use werk_util::{DiagnosticFileId, Spanned as _, Symbol};
use werk_util::{DiagnosticFileId, Spanned as _};

use std::sync::Arc;

Expand Down
3 changes: 2 additions & 1 deletion werk-runner/eval/string.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
use std::{borrow::Cow, fmt::Write as _, sync::Arc};

use indexmap::IndexMap;
use stringleton::Symbol;
use werk_fs::Absolute;
use werk_parser::ast;
use werk_util::{DiagnosticFileId, DiagnosticSpan, Symbol};
use werk_util::{DiagnosticFileId, DiagnosticSpan};

use crate::{
AmbiguousPatternError, EvalError, Lookup, LookupValue, Pattern, PatternMatcher, PatternRegex,
Expand Down
2 changes: 1 addition & 1 deletion werk-runner/eval/used.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::{
ops::{BitOr, BitOrAssign},
};

use stringleton::Symbol;
use werk_fs::{Absolute, SymPath};
use werk_util::Symbol;

use crate::cache::Hash128;

Expand Down
3 changes: 2 additions & 1 deletion werk-runner/ir.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use indexmap::IndexMap;
use stringleton::Symbol;
use werk_fs::Absolute;
use werk_parser::ast;
use werk_util::{DiagnosticFileId, DiagnosticMainSourceMap, DiagnosticSpan, Symbol};
use werk_util::{DiagnosticFileId, DiagnosticMainSourceMap, DiagnosticSpan};

use crate::{
AmbiguousPatternError, ConfigVar, EvalError, LocalVariables, Pattern, PatternMatchData, Value,
Expand Down
2 changes: 2 additions & 0 deletions werk-runner/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ pub use which::Error as WhichError;

#[doc(no_inline)]
pub use globset;

stringleton::enable!();
2 changes: 1 addition & 1 deletion werk-runner/outdatedness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::{
ops::{BitOr, BitOrAssign},
};

use stringleton::Symbol;
use werk_fs::{Absolute, SymPath};
use werk_util::Symbol;

use crate::{
TaskId, Workspace,
Expand Down
7 changes: 4 additions & 3 deletions werk-runner/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ use std::{future::Future, sync::Arc, time::SystemTime};
use futures::{StreamExt, channel::oneshot, future};
use indexmap::{IndexMap, map::Entry};
use parking_lot::Mutex;
use stringleton::sym;
use werk_fs::{Absolute, Normalize as _, Path, SymPath};
use werk_util::{Annotated, AsDiagnostic, DiagnosticSpan, Symbol, cancel};
use werk_util::{Annotated, AsDiagnostic, DiagnosticSpan, cancel};

use crate::{
AmbiguousPatternError, BuildRecipeScope, ChildCaptureOutput, ChildLinesStream, Env, Error,
Expand Down Expand Up @@ -378,7 +379,7 @@ impl<'a> Inner<'a> {
) -> Result<BuildStatus, Error> {
let mut scope = BuildRecipeScope::new(self.workspace, task_id, &recipe_match);
scope.set(
Symbol::new("out"),
sym!("out"),
Eval::inherent(Value::from(recipe_match.target_file.to_string())),
);

Expand Down Expand Up @@ -514,7 +515,7 @@ impl<'a> Inner<'a> {

// Make the `depfile` variable available to the recipe body.
scope.set(
Symbol::from("depfile"),
sym!("depfile"),
Eval::inherent(Value::String(depfile.clone())),
);

Expand Down
2 changes: 1 addition & 1 deletion werk-runner/runner/task.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use futures::channel::oneshot;
use stringleton::Symbol;
use werk_fs::{Absolute, SymPath};
use werk_util::Symbol;

use crate::{Error, ir};

Expand Down
Loading