From 5ee348b75fca86e96bb9a345e313879dd5da2599 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Wed, 4 Oct 2023 19:35:15 +1300 Subject: [PATCH 01/10] Add xtask pattern as alternative to shell script. --- .cargo/config.toml | 3 ++ .gitattributes | 2 +- Cargo.lock | 100 ++++++++------------------------------------- Cargo.toml | 2 +- xtask/Cargo.toml | 9 ++++ xtask/src/main.rs | 72 ++++++++++++++++++++++++++++++++ 6 files changed, 103 insertions(+), 85 deletions(-) create mode 100644 xtask/Cargo.toml create mode 100644 xtask/src/main.rs diff --git a/.cargo/config.toml b/.cargo/config.toml index ac27f31b81..a408d1358b 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -1,3 +1,6 @@ +[alias] +xtask = "run --package xtask --" + [build] rustflags = ["-Z", "thinlto=no", "-Z", "share-generics=y"] diff --git a/.gitattributes b/.gitattributes index 139ff131a0..e4ebe56425 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Auto detect text files and perform LF normalization -* text=auto +* text=auto eol=lf *.ts text eol=lf merge=union diff --git a/Cargo.lock b/Cargo.lock index eb8becddc5..9482bb79ee 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -96,16 +96,15 @@ dependencies = [ [[package]] name = "anstream" -version = "0.3.2" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" +checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", - "is-terminal", "utf8parse", ] @@ -135,9 +134,9 @@ dependencies = [ [[package]] name = "anstyle-wincon" -version = "1.0.1" +version = "3.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" +checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" dependencies = [ "anstyle", "windows-sys 0.48.0", @@ -344,33 +343,31 @@ dependencies = [ [[package]] name = "clap" -version = "4.3.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93aae7a4192245f70fe75dd9157fc7b4a5bf53e88d30bd4396f7d8f9284d5acc" +checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" dependencies = [ "clap_builder", "clap_derive", - "once_cell", ] [[package]] name = "clap_builder" -version = "4.3.0" +version = "4.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f423e341edefb78c9caba2d9c7f7687d0e72e89df3ce3394554754393ac3990" +checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" dependencies = [ "anstream", "anstyle", - "bitflags", "clap_lex", "strsim", ] [[package]] name = "clap_derive" -version = "4.3.0" +version = "4.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "191d9573962933b4027f932c600cd252ce27a8ad5979418fe78e43c07996f27b" +checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" dependencies = [ "heck", "proc-macro2", @@ -637,27 +634,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "errno" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" -dependencies = [ - "errno-dragonfly", - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "errno-dragonfly" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" -dependencies = [ - "cc", - "libc", -] - [[package]] name = "eyre" version = "0.6.8" @@ -902,12 +878,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" - [[package]] name = "httparse" version = "1.8.0" @@ -1005,17 +975,6 @@ version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dc51180a9b377fd75814d0cc02199c20f8e99433d6762f650d39cdbbd3b56f" -[[package]] -name = "io-lifetimes" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" -dependencies = [ - "hermit-abi 0.3.1", - "libc", - "windows-sys 0.48.0", -] - [[package]] name = "is-macro" version = "0.1.9" @@ -1042,18 +1001,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "is-terminal" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" -dependencies = [ - "hermit-abi 0.3.1", - "io-lifetimes", - "rustix", - "windows-sys 0.48.0", -] - [[package]] name = "is_ci" version = "1.1.1" @@ -1198,12 +1145,6 @@ version = "0.2.144" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" -[[package]] -name = "linux-raw-sys" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" - [[package]] name = "lock_api" version = "0.4.9" @@ -1901,20 +1842,6 @@ dependencies = [ "semver", ] -[[package]] -name = "rustix" -version = "0.37.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d" -dependencies = [ - "bitflags", - "errno", - "io-lifetimes", - "libc", - "linux-raw-sys", - "windows-sys 0.48.0", -] - [[package]] name = "ryu" version = "1.0.13" @@ -3848,6 +3775,13 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "xtask" +version = "0.1.0" +dependencies = [ + "clap", +] + [[package]] name = "yansi" version = "0.5.1" diff --git a/Cargo.toml b/Cargo.toml index c6651ed34e..8f687075a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace] -members = ["crates/stc", "crates/binding_wasm"] +members = ["crates/stc", "crates/binding_wasm", "xtask"] resolver = "2" [profile.release] diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml new file mode 100644 index 0000000000..741efdb992 --- /dev/null +++ b/xtask/Cargo.toml @@ -0,0 +1,9 @@ +[package] +name = "xtask" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +clap = "4.4.6" diff --git a/xtask/src/main.rs b/xtask/src/main.rs new file mode 100644 index 0000000000..298abd6e1b --- /dev/null +++ b/xtask/src/main.rs @@ -0,0 +1,72 @@ +fn main() { + let matches = clap::Command::new("xtask") + .subcommand_required(true) + .subcommand(clap::Command::new("check")) + .get_matches(); + + #[allow(clippy::single_match)] + match matches.subcommand() { + Some(("check", matches)) => check(matches), + _ => { + unreachable!("unhandled subcommand"); + } + } +} + +fn check(_: &clap::ArgMatches) { + println!("test base"); + let status = cargo_test() + .env("UPDATE", "1") + .env("RUST_LOG", "off") + .arg("--lib") + .arg("--test") + .arg("base") + .arg("--package") + .arg("stc_ts_file_analyzer") + .status() + .unwrap(); + assert!(status.success(), "test base failed: {status}"); + + println!("test conformance"); + let output = cargo_test() + .env("RUST_LOG", "error") + .env("TEST", "") + .env("DO_NOT_PRINT_MATCHED", "1") + .arg("--test") + .arg("tsc") + .stdin(std::process::Stdio::null()) + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::inherit()) + .output() + .unwrap(); + let mut lines = String::from_utf8_lossy(&output.stdout) + .lines() + .filter(|line| line.ends_with(".ts ... ok")) + .map(|line| { + line.replace("test conformance::", "") + .replace(" ... ok", "") + .replace("::", "/") + .replace("test ", "") + .replace('\\', "/") + }) + .collect::>(); + lines.sort(); + use std::io::Write; + let mut file = std::fs::File::create("crates/stc_ts_type_checker/tests/conformance.pass.txt").unwrap(); + for line in &lines { + writeln!(file, "{line}").unwrap(); + } + assert!(status.success(), "test base failed: {status}"); +} + +fn cargo_test() -> std::process::Command { + let mut cmd = std::process::Command::new("cargo"); + cmd.env("RUST_BACKTRACE", "1") + .env("RUST_MIN_STACK", "8388608") + .arg("test") + .arg("--features") + .arg("no-threading") + .arg("--features") + .arg("tracing/max_level_off"); + cmd +} From 84679592fc2f04e342080ac13e7705f8cb55012d Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Thu, 5 Oct 2023 20:32:28 +1300 Subject: [PATCH 02/10] Migrate other scripts mentioned in contributing docs. --- xtask/Cargo.toml | 4 +- xtask/src/file_analyzer.rs | 75 ++++++++++++++++++++++ xtask/src/main.rs | 128 ++++++++++++++++++------------------- xtask/src/type_checker.rs | 91 ++++++++++++++++++++++++++ xtask/src/utils.rs | 46 +++++++++++++ 5 files changed, 278 insertions(+), 66 deletions(-) create mode 100644 xtask/src/file_analyzer.rs create mode 100644 xtask/src/type_checker.rs create mode 100644 xtask/src/utils.rs diff --git a/xtask/Cargo.toml b/xtask/Cargo.toml index 741efdb992..6f28e8599c 100644 --- a/xtask/Cargo.toml +++ b/xtask/Cargo.toml @@ -6,4 +6,6 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -clap = "4.4.6" +anyhow = "1.0.75" +clap = { version = "4.4.6", features = ["derive"] } +notify-rust = "4.9.0" diff --git a/xtask/src/file_analyzer.rs b/xtask/src/file_analyzer.rs new file mode 100644 index 0000000000..e5dddc5043 --- /dev/null +++ b/xtask/src/file_analyzer.rs @@ -0,0 +1,75 @@ +use std::path::Path; + +use anyhow::ensure; + +use crate::utils::{cargo_test, CargoTestArgs}; + +pub struct TestBaseArgs<'a> { + pub log: Option<&'a str>, + pub name: Option<&'a str>, + pub ignored: bool, +} + +pub fn test_base(args: &TestBaseArgs<'_>) -> anyhow::Result<()> { + println!("analyzer test base"); + let mut cmd = cargo_test(&CargoTestArgs { + log: args.log, + package: "stc_ts_file_analyzer", + test: Some("base"), + name: args.name, + }); + + if let Some(value) = args.log { + cmd.env("RUST_LOG", value); + } + + cmd.env("UPDATE", "1") + .arg("--lib") + .arg("--") + .arg("-Zunstable-options") + .arg("--report-time"); + + if args.ignored { + cmd.arg("--ignored"); + } + + let status = cmd.status()?; + ensure!(status.success(), "test base failed: {status}"); + Ok(()) +} + +pub fn auto_unignore() -> anyhow::Result<()> { + unignore_cleanup()?; + + // touch crates/stc_ts_file_analyzer/tests/base.rs + let _ = test_base(&TestBaseArgs { + log: None, + name: None, + ignored: true, + }); + + unignore_cleanup()?; + Ok(()) +} + +fn unignore_cleanup() -> anyhow::Result<()> { + println!("Deleting cache for ignored tests"); + // find ./tests/tsc -name '\.*.tsc-errors.json' -type f -delete + return walk(Path::new("crates/stc_ts_file_analyzer/tests/tsc")); + + fn walk(dir: &Path) -> anyhow::Result<()> { + for entry in std::fs::read_dir(dir)? { + let entry = entry?; + let path = entry.path(); + if entry.metadata()?.is_dir() { + walk(&path)?; + } else { + let name = path.file_name().expect("invalid path").to_str().expect("invalid file name"); + if name.starts_with('.') && name.ends_with(".tsc-errors.json") { + std::fs::remove_file(&path)?; + } + } + } + Ok(()) + } +} diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 298abd6e1b..b4205c2334 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,72 +1,70 @@ -fn main() { - let matches = clap::Command::new("xtask") - .subcommand_required(true) - .subcommand(clap::Command::new("check")) - .get_matches(); +use clap::{Parser, Subcommand}; - #[allow(clippy::single_match)] - match matches.subcommand() { - Some(("check", matches)) => check(matches), - _ => { - unreachable!("unhandled subcommand"); - } - } +mod file_analyzer; +mod type_checker; +mod utils; + +pub(crate) use utils::*; + +#[derive(Parser)] +/// Project task runner +struct Cli { + #[clap(subcommand)] + command: Command, } -fn check(_: &clap::ArgMatches) { - println!("test base"); - let status = cargo_test() - .env("UPDATE", "1") - .env("RUST_LOG", "off") - .arg("--lib") - .arg("--test") - .arg("base") - .arg("--package") - .arg("stc_ts_file_analyzer") - .status() - .unwrap(); - assert!(status.success(), "test base failed: {status}"); +#[derive(Subcommand)] +enum Command { + /// Run tests for stc_ts_file_analyzer + TestAnalyzer(TestAnalyzerArgs), + /// Automatically find a test to work on. + AutoUnignore, + /// Run tests for stc_ts_type_checker + TestChecker(TestCheckerArgs), +} - println!("test conformance"); - let output = cargo_test() - .env("RUST_LOG", "error") - .env("TEST", "") - .env("DO_NOT_PRINT_MATCHED", "1") - .arg("--test") - .arg("tsc") - .stdin(std::process::Stdio::null()) - .stdout(std::process::Stdio::piped()) - .stderr(std::process::Stdio::inherit()) - .output() - .unwrap(); - let mut lines = String::from_utf8_lossy(&output.stdout) - .lines() - .filter(|line| line.ends_with(".ts ... ok")) - .map(|line| { - line.replace("test conformance::", "") - .replace(" ... ok", "") - .replace("::", "/") - .replace("test ", "") - .replace('\\', "/") - }) - .collect::>(); - lines.sort(); - use std::io::Write; - let mut file = std::fs::File::create("crates/stc_ts_type_checker/tests/conformance.pass.txt").unwrap(); - for line in &lines { - writeln!(file, "{line}").unwrap(); - } - assert!(status.success(), "test base failed: {status}"); +#[derive(Parser)] +struct TestAnalyzerArgs { + #[clap(long)] + /// Run all base tests without output + fast: bool, + + #[clap(long)] + /// Run all tests + all: bool, + + /// Run test with the given name + name: Option, +} + +#[derive(Parser)] +struct TestCheckerArgs { + // filter to tests with the given name + name: Option, } -fn cargo_test() -> std::process::Command { - let mut cmd = std::process::Command::new("cargo"); - cmd.env("RUST_BACKTRACE", "1") - .env("RUST_MIN_STACK", "8388608") - .arg("test") - .arg("--features") - .arg("no-threading") - .arg("--features") - .arg("tracing/max_level_off"); - cmd +fn main() -> anyhow::Result<()> { + let args = Cli::parse(); + + match args.command { + Command::TestAnalyzer(args) => { + if !args.fast && !args.all && args.name.is_none() { + anyhow::bail!("must specify one of --fast, --all, or test name"); + } + if args.all && args.name.is_some() { + anyhow::bail!("cannot specify both --all and test name"); + } + + file_analyzer::test_base(&file_analyzer::TestBaseArgs { + log: args.fast.then_some("off"), + name: args.name.as_deref(), + ignored: false, + }) + } + Command::AutoUnignore => file_analyzer::auto_unignore(), + Command::TestChecker(args) => match args.name { + None => notify_result("Check", type_checker::check()), + Some(name) => notify_result("Test", type_checker::test(&name)), + }, + } } diff --git a/xtask/src/type_checker.rs b/xtask/src/type_checker.rs new file mode 100644 index 0000000000..69ea50ba71 --- /dev/null +++ b/xtask/src/type_checker.rs @@ -0,0 +1,91 @@ +use anyhow::ensure; + +use crate::utils::CargoTestArgs; + +pub fn check() -> anyhow::Result<()> { + test_regressions()?; + test_conformance()?; + Ok(()) +} + +pub fn test(test: &str) -> anyhow::Result<()> { + test_regressions()?; + println!("checker test {test:?}"); + let status = cargo_test_tsc("debug,swc_common=off", test).arg("--quiet").status()?; + ensure!(status.success(), "test checker {test:?} failed: {status}"); + Ok(()) +} + +fn test_regressions() -> anyhow::Result<()> { + use crate::file_analyzer::{test_base, TestBaseArgs}; + // Prevent regression using faster checks + test_base(&TestBaseArgs { + name: None, + log: Some("off"), + ignored: false, + }) +} + +fn cargo_test_tsc(log: &str, test: &str) -> std::process::Command { + let mut cmd = crate::cargo_test(&CargoTestArgs { + log: Some(log), + package: "stc_ts_type_checker", + test: Some("tsc"), + name: None, + }); + cmd.env("TEST", test); + cmd +} + +fn test_conformance() -> anyhow::Result<()> { + println!("test conformance"); + let mut child = cargo_test_tsc("error", "") + .env("DO_NOT_PRINT_MATCHED", "1") + .stdin(std::process::Stdio::null()) + .stdout(std::process::Stdio::piped()) + .stderr(std::process::Stdio::inherit()) + .spawn()?; + + // This is more complicated than using .output(), but there's a *lot* of + // output we throw out, so this is much better for memory. You could also use it + // for reporting progress, I guess? + let mut tests = Vec::new(); + let stdout = child.stdout.take().unwrap(); + std::thread::scope({ + // Avoid moving the Vec into the thread + let tests = &mut tests; + move |scope| { + scope.spawn(move || { + use std::io::BufRead; + let stdout = std::io::BufReader::new(stdout); + for line in stdout.lines() { + let line = line.unwrap(); + // fixme: there are some .tsx files...? + if line.ends_with(".ts ... ok") { + tests.push( + line.replace("test conformance::", "") + .replace(" ... ok", "") + .replace("::", "/") + .replace("test ", "") + .replace('\\', "/"), + ); + } + } + }); + } + }); + + let status = child.wait()?; + ensure!(status.success(), "test conformance failed: {status}"); + + tests.sort(); + + use std::io::Write; + let mut file = std::fs::File::create("crates/stc_ts_type_checker/tests/conformance.pass.txt")?; + for line in &tests { + writeln!(file, "{line}").unwrap(); + } + drop(file); + + Ok(()) +} diff --git a/xtask/src/utils.rs b/xtask/src/utils.rs new file mode 100644 index 0000000000..4dd4f25211 --- /dev/null +++ b/xtask/src/utils.rs @@ -0,0 +1,46 @@ +pub fn notify_result(prefix: &str, result: anyhow::Result<()>) -> anyhow::Result<()> { + match &result { + Ok(()) => { + notify_rust::Notification::new().summary(&format!("{prefix} done!")).show()?; + } + Err(err) => { + notify_rust::Notification::new() + .summary(&format!("{prefix} failed!")) + .body(&format!("{err}")) + .show()?; + } + } + result +} + +#[derive(Debug)] +pub struct CargoTestArgs<'a> { + pub log: Option<&'a str>, + pub package: &'a str, + pub test: Option<&'a str>, + pub name: Option<&'a str>, +} + +pub fn cargo_test(args: &CargoTestArgs<'_>) -> std::process::Command { + let mut cmd = std::process::Command::new("cargo"); + if let Some(log) = args.log { + cmd.env("RUST_LOG", log); + } + cmd.env("RUST_BACKTRACE", "1") + .env("RUST_MIN_STACK", "8388608") + .arg("--color") + .arg("always") + .arg("test") + .arg("--features") + .arg("no-threading") + .arg("--package") + .arg(args.package); + if let Some(test) = args.test { + cmd.arg("--test").arg(test); + } + if let Some(name) = args.name { + cmd.arg(name); + } + + cmd +} From 90d5dab93852f9d8b0aea2a2df616944bf742732 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Tue, 10 Oct 2023 21:53:21 +1300 Subject: [PATCH 03/10] Various cleanup-ey-ness, implement log max filter level. --- xtask/src/file_analyzer.rs | 124 ++++++++++++++++++++++++++---------- xtask/src/main.rs | 18 +++--- xtask/src/notify.rs | 14 +++++ xtask/src/run_cargo.rs | 125 +++++++++++++++++++++++++++++++++++++ xtask/src/type_checker.rs | 20 +++--- xtask/src/utils.rs | 46 -------------- 6 files changed, 249 insertions(+), 98 deletions(-) create mode 100644 xtask/src/notify.rs create mode 100644 xtask/src/run_cargo.rs delete mode 100644 xtask/src/utils.rs diff --git a/xtask/src/file_analyzer.rs b/xtask/src/file_analyzer.rs index e5dddc5043..66f68ccedf 100644 --- a/xtask/src/file_analyzer.rs +++ b/xtask/src/file_analyzer.rs @@ -1,54 +1,110 @@ +//! Provide helpers for crates/stc_ts_file_analyzer + use std::path::Path; use anyhow::ensure; -use crate::utils::{cargo_test, CargoTestArgs}; +use crate::run_cargo::{CargoTestArgs, LogFilterLevel}; +/// Command builder for running tests/base.rs pub struct TestBaseArgs<'a> { - pub log: Option<&'a str>, - pub name: Option<&'a str>, - pub ignored: bool, + inner: CargoTestArgs<'a>, + ignored: bool, } -pub fn test_base(args: &TestBaseArgs<'_>) -> anyhow::Result<()> { - println!("analyzer test base"); - let mut cmd = cargo_test(&CargoTestArgs { - log: args.log, - package: "stc_ts_file_analyzer", - test: Some("base"), - name: args.name, - }); - - if let Some(value) = args.log { - cmd.env("RUST_LOG", value); +impl<'a> TestBaseArgs<'a> { + /// Create an empty TestBaseArgs. + pub fn new() -> Self { + Self { + inner: CargoTestArgs::new("stc_ts_file_analyzer").with_test("base"), + ignored: false, + } + } + + /// Set the tracing static level filter. + #[must_use] + pub fn with_log_max_level(mut self, log_max_level: LogFilterLevel) -> Self { + self.inner = self.inner.with_log_max_level(log_max_level); + self } - cmd.env("UPDATE", "1") - .arg("--lib") - .arg("--") - .arg("-Zunstable-options") - .arg("--report-time"); + /// Set the tracing log directive. + #[must_use] + pub fn with_log(mut self, log: &'a str) -> Self { + self.inner = self.inner.with_log(log); + self + } - if args.ignored { - cmd.arg("--ignored"); + /// Set the test name to run. + #[must_use] + pub fn with_name(mut self, name: &'a str) -> Self { + self.inner = self.inner.with_name(name); + self } - let status = cmd.status()?; - ensure!(status.success(), "test base failed: {status}"); - Ok(()) + /// cargo test --ignored: Whether to run ignored tests. Used by + /// auto-unignore. + #[must_use] + pub fn with_ignored(mut self) -> Self { + self.ignored = true; + self + } + + /// Set the standard --fast options. + #[must_use] + pub fn fast(self) -> Self { + self.with_log_max_level(LogFilterLevel::Error).with_log("off") + } + + /// Return a Command that can be used to run the configured tests. + pub fn to_command(&self) -> std::process::Command { + let mut cmd = self.inner.to_command(); + + cmd.env("UPDATE", "1") + .arg("--lib") + .arg("--") + .arg("-Zunstable-options") + .arg("--report-time"); + + if self.ignored { + cmd.arg("--ignored"); + } + + cmd + } + + /// Run the tests using inherited stdio. + pub fn run(&self) -> anyhow::Result<()> { + println!("analyzer test base"); + + // Shell scripts did this here, presumably to force a fresh build: + // touch crates/stc_ts_file_analyzer/tests/base.rs + // I'm not sure why, it seems to work OK without it and to do it portably needs + // #[feature(file_set_times)]: https://github.com/rust-lang/rust/issues/98245 + // Add it if we need it, but it might be better with a build.rs with the + // appropriate println!("cargo:rerun-if-changed="); + + let mut cmd = self.to_command(); + + let status = cmd.status()?; + ensure!(status.success(), "test base failed: {status}"); + Ok(()) + } } +/// Implements xtask auto-unignore pub fn auto_unignore() -> anyhow::Result<()> { + // Remove any ignored tests cached outputs so they are re-run. + // (shouldn't all tests be re-run?) unignore_cleanup()?; - // touch crates/stc_ts_file_analyzer/tests/base.rs - let _ = test_base(&TestBaseArgs { - log: None, - name: None, - ignored: true, - }); + // Ignore the result of testing, we just want the updated .tsc-errors.json as a + // side-effect. + let _ = TestBaseArgs::new().with_ignored().run(); + // Remove failed tests caches again, only successful tests should be committed. unignore_cleanup()?; + Ok(()) } @@ -64,7 +120,11 @@ fn unignore_cleanup() -> anyhow::Result<()> { if entry.metadata()?.is_dir() { walk(&path)?; } else { - let name = path.file_name().expect("invalid path").to_str().expect("invalid file name"); + let name = path + .file_name() + .expect("missing file name in directory entry") + .to_str() + .expect("non-unicode test file name"); if name.starts_with('.') && name.ends_with(".tsc-errors.json") { std::fs::remove_file(&path)?; } diff --git a/xtask/src/main.rs b/xtask/src/main.rs index b4205c2334..79dfea70d8 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -1,10 +1,11 @@ use clap::{Parser, Subcommand}; mod file_analyzer; +mod notify; +mod run_cargo; mod type_checker; -mod utils; -pub(crate) use utils::*; +pub(crate) use notify::*; #[derive(Parser)] /// Project task runner @@ -55,11 +56,14 @@ fn main() -> anyhow::Result<()> { anyhow::bail!("cannot specify both --all and test name"); } - file_analyzer::test_base(&file_analyzer::TestBaseArgs { - log: args.fast.then_some("off"), - name: args.name.as_deref(), - ignored: false, - }) + let mut test_args = file_analyzer::TestBaseArgs::new(); + if args.fast { + test_args = test_args.fast(); + } + if let Some(test_name) = &args.name { + test_args = test_args.with_name(test_name); + } + test_args.run() } Command::AutoUnignore => file_analyzer::auto_unignore(), Command::TestChecker(args) => match args.name { diff --git a/xtask/src/notify.rs b/xtask/src/notify.rs new file mode 100644 index 0000000000..8d1c8424c6 --- /dev/null +++ b/xtask/src/notify.rs @@ -0,0 +1,14 @@ +pub fn notify_result(prefix: &str, result: anyhow::Result<()>) -> anyhow::Result<()> { + match &result { + Ok(()) => { + notify_rust::Notification::new().summary(&format!("{prefix} done!")).show()?; + } + Err(err) => { + notify_rust::Notification::new() + .summary(&format!("{prefix} failed!")) + .body(&format!("{err}")) + .show()?; + } + } + result +} diff --git a/xtask/src/run_cargo.rs b/xtask/src/run_cargo.rs new file mode 100644 index 0000000000..a0cc213737 --- /dev/null +++ b/xtask/src/run_cargo.rs @@ -0,0 +1,125 @@ +//! Provide general helpers to run a nested cargo command. + +/// tracing static filter level, to improve performance at the cost of needing +/// to rebuild. +#[derive(Debug)] +pub enum LogFilterLevel { + Off, + Error, + Warn, + Info, + Debug, + Trace, +} + +impl std::str::FromStr for LogFilterLevel { + type Err = anyhow::Error; + + fn from_str(s: &str) -> Result { + match s { + "off" => Ok(LogFilterLevel::Off), + "error" => Ok(LogFilterLevel::Error), + "warn" => Ok(LogFilterLevel::Warn), + "info" => Ok(LogFilterLevel::Info), + "debug" => Ok(LogFilterLevel::Debug), + "trace" => Ok(LogFilterLevel::Trace), + _ => anyhow::bail!("invalid log filter level: {s}"), + } + } +} + +impl LogFilterLevel { + fn as_max_level_feature(&self) -> &'static str { + match self { + LogFilterLevel::Off => "tracing/max_level_off", + LogFilterLevel::Error => "tracing/max_level_error", + LogFilterLevel::Warn => "tracing/max_level_warn", + LogFilterLevel::Info => "tracing/max_level_info", + LogFilterLevel::Debug => "tracing/max_level_debug", + LogFilterLevel::Trace => "tracing/max_level_trace", + } + } +} + +/// Build a basic cargo test command +#[derive(Debug)] +pub struct CargoTestArgs<'a> { + log_max_level: Option, + log: Option<&'a str>, + package: &'a str, + test: Option<&'a str>, + name: Option<&'a str>, +} + +impl<'a> CargoTestArgs<'a> { + /// Create an empty test command builder for the given package name. + /// + /// @param package + /// cargo --package to build (required), e.g. stc_ts_file_analyzer + pub fn new(package: &'a str) -> Self { + Self { + log_max_level: None, + log: None, + package, + test: None, + name: None, + } + } + + /// Set --features tracing/max_level_*, runs faster than with_log(), but + /// requires rebuilding + #[must_use] + pub fn with_log_max_level(mut self, log_max_level: LogFilterLevel) -> Self { + self.log_max_level = Some(log_max_level); + self + } + + /// Set RUST_LOG=*: does not require rebuild and can include fine-grained + /// directives, but is slower than with_log_max_level(). + #[must_use] + pub fn with_log(mut self, log: &'a str) -> Self { + self.log = Some(log); + self + } + + /// Set cargo test --test file to run, e.g. base or prof + #[must_use] + pub fn with_test(mut self, test: &'a str) -> Self { + self.test = Some(test); + self + } + + /// Set cargo test name to match, e.g. compare + #[must_use] + pub fn with_name(mut self, name: &'a str) -> Self { + self.name = Some(name); + self + } + + /// Return a Command that can be further configured and run. + pub fn to_command(&self) -> std::process::Command { + let mut cmd = std::process::Command::new("cargo"); + if let Some(log) = self.log { + cmd.env("RUST_LOG", log); + } + cmd.env("RUST_BACKTRACE", "1") + .env("RUST_MIN_STACK", "8388608") + .arg("--color") + .arg("always") + .arg("test") + .arg("--package") + .arg(self.package) + .arg("--features") + .arg("no-threading"); + if let Some(level) = &self.log_max_level { + cmd.arg("--features").arg(level.as_max_level_feature()); + } + if let Some(test) = self.test { + cmd.arg("--test").arg(test); + } + if let Some(name) = self.name { + cmd.arg(name); + } + cmd + } +} diff --git a/xtask/src/type_checker.rs b/xtask/src/type_checker.rs index 69ea50ba71..15f3cdf7ae 100644 --- a/xtask/src/type_checker.rs +++ b/xtask/src/type_checker.rs @@ -1,6 +1,6 @@ use anyhow::ensure; -use crate::utils::CargoTestArgs; +use crate::run_cargo::CargoTestArgs; pub fn check() -> anyhow::Result<()> { test_regressions()?; @@ -17,22 +17,16 @@ pub fn test(test: &str) -> anyhow::Result<()> { } fn test_regressions() -> anyhow::Result<()> { - use crate::file_analyzer::{test_base, TestBaseArgs}; + use crate::file_analyzer::TestBaseArgs; // Prevent regression using faster checks - test_base(&TestBaseArgs { - name: None, - log: Some("off"), - ignored: false, - }) + TestBaseArgs::new().fast().run() } fn cargo_test_tsc(log: &str, test: &str) -> std::process::Command { - let mut cmd = crate::cargo_test(&CargoTestArgs { - log: Some(log), - package: "stc_ts_type_checker", - test: Some("tsc"), - name: None, - }); + let mut cmd = CargoTestArgs::new("stc_ts_type_checker") + .with_log(log) + .with_test("tsc") + .to_command(); cmd.env("TEST", test); cmd } diff --git a/xtask/src/utils.rs b/xtask/src/utils.rs deleted file mode 100644 index 4dd4f25211..0000000000 --- a/xtask/src/utils.rs +++ /dev/null @@ -1,46 +0,0 @@ -pub fn notify_result(prefix: &str, result: anyhow::Result<()>) -> anyhow::Result<()> { - match &result { - Ok(()) => { - notify_rust::Notification::new().summary(&format!("{prefix} done!")).show()?; - } - Err(err) => { - notify_rust::Notification::new() - .summary(&format!("{prefix} failed!")) - .body(&format!("{err}")) - .show()?; - } - } - result -} - -#[derive(Debug)] -pub struct CargoTestArgs<'a> { - pub log: Option<&'a str>, - pub package: &'a str, - pub test: Option<&'a str>, - pub name: Option<&'a str>, -} - -pub fn cargo_test(args: &CargoTestArgs<'_>) -> std::process::Command { - let mut cmd = std::process::Command::new("cargo"); - if let Some(log) = args.log { - cmd.env("RUST_LOG", log); - } - cmd.env("RUST_BACKTRACE", "1") - .env("RUST_MIN_STACK", "8388608") - .arg("--color") - .arg("always") - .arg("test") - .arg("--features") - .arg("no-threading") - .arg("--package") - .arg(args.package); - if let Some(test) = args.test { - cmd.arg("--test").arg(test); - } - if let Some(name) = args.name { - cmd.arg(name); - } - - cmd -} From 5cae6915d9a1eaac0c1aeb137a1e5b57639dd889 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Tue, 10 Oct 2023 22:41:43 +1300 Subject: [PATCH 04/10] Fix some auto-unignore issues. --- xtask/src/file_analyzer.rs | 33 ++++++++++++++++++++++----------- xtask/src/main.rs | 2 +- xtask/src/run_cargo.rs | 25 +++++++++++++++++++++++++ 3 files changed, 48 insertions(+), 12 deletions(-) diff --git a/xtask/src/file_analyzer.rs b/xtask/src/file_analyzer.rs index 66f68ccedf..7038c08194 100644 --- a/xtask/src/file_analyzer.rs +++ b/xtask/src/file_analyzer.rs @@ -4,7 +4,10 @@ use std::path::Path; use anyhow::ensure; -use crate::run_cargo::{CargoTestArgs, LogFilterLevel}; +use crate::{ + run_cargo, + run_cargo::{CargoTestArgs, LogFilterLevel}, +}; /// Command builder for running tests/base.rs pub struct TestBaseArgs<'a> { @@ -16,7 +19,7 @@ impl<'a> TestBaseArgs<'a> { /// Create an empty TestBaseArgs. pub fn new() -> Self { Self { - inner: CargoTestArgs::new("stc_ts_file_analyzer").with_test("base"), + inner: CargoTestArgs::new("stc_ts_file_analyzer").with_test("base").with_lib(true), ignored: false, } } @@ -42,6 +45,13 @@ impl<'a> TestBaseArgs<'a> { self } + /// Set cargo test --lib to run the unit tests in the library + #[must_use] + pub fn with_lib(mut self, lib: bool) -> Self { + self.inner = self.inner.with_lib(lib); + self + } + /// cargo test --ignored: Whether to run ignored tests. Used by /// auto-unignore. #[must_use] @@ -60,11 +70,7 @@ impl<'a> TestBaseArgs<'a> { pub fn to_command(&self) -> std::process::Command { let mut cmd = self.inner.to_command(); - cmd.env("UPDATE", "1") - .arg("--lib") - .arg("--") - .arg("-Zunstable-options") - .arg("--report-time"); + cmd.env("UPDATE", "1").arg("--").arg("-Zunstable-options").arg("--report-time"); if self.ignored { cmd.arg("--ignored"); @@ -85,14 +91,15 @@ impl<'a> TestBaseArgs<'a> { // appropriate println!("cargo:rerun-if-changed="); let mut cmd = self.to_command(); + println!("{cmd:?}"); let status = cmd.status()?; - ensure!(status.success(), "test base failed: {status}"); + ensure!(status.success(), "analyzer test base failed: {status}"); Ok(()) } } -/// Implements xtask auto-unignore +/// Implements xtask auto-unignore: un-ignore tests that pass. pub fn auto_unignore() -> anyhow::Result<()> { // Remove any ignored tests cached outputs so they are re-run. // (shouldn't all tests be re-run?) @@ -100,7 +107,11 @@ pub fn auto_unignore() -> anyhow::Result<()> { // Ignore the result of testing, we just want the updated .tsc-errors.json as a // side-effect. - let _ = TestBaseArgs::new().with_ignored().run(); + let _ = TestBaseArgs::new() + .with_log_max_level(LogFilterLevel::Off) + .with_lib(false) + .with_ignored() + .run(); // Remove failed tests caches again, only successful tests should be committed. unignore_cleanup()?; @@ -111,7 +122,7 @@ pub fn auto_unignore() -> anyhow::Result<()> { fn unignore_cleanup() -> anyhow::Result<()> { println!("Deleting cache for ignored tests"); // find ./tests/tsc -name '\.*.tsc-errors.json' -type f -delete - return walk(Path::new("crates/stc_ts_file_analyzer/tests/tsc")); + return walk(&run_cargo::root_dir().join("crates/stc_ts_file_analyzer/tests/tsc")); fn walk(dir: &Path) -> anyhow::Result<()> { for entry in std::fs::read_dir(dir)? { diff --git a/xtask/src/main.rs b/xtask/src/main.rs index 79dfea70d8..98bdf9af67 100644 --- a/xtask/src/main.rs +++ b/xtask/src/main.rs @@ -18,7 +18,7 @@ struct Cli { enum Command { /// Run tests for stc_ts_file_analyzer TestAnalyzer(TestAnalyzerArgs), - /// Automatically find a test to work on. + /// Automatically unignore stc_ts_file_analyzer tests that pass. AutoUnignore, /// Run tests for stc_ts_type_checker TestChecker(TestCheckerArgs), diff --git a/xtask/src/run_cargo.rs b/xtask/src/run_cargo.rs index a0cc213737..96b4063573 100644 --- a/xtask/src/run_cargo.rs +++ b/xtask/src/run_cargo.rs @@ -1,5 +1,7 @@ //! Provide general helpers to run a nested cargo command. +use std::path::PathBuf; + /// tracing static filter level, to improve performance at the cost of needing /// to rebuild. #[derive(Debug)] @@ -47,6 +49,7 @@ pub struct CargoTestArgs<'a> { log_max_level: Option, log: Option<&'a str>, package: &'a str, + lib: bool, test: Option<&'a str>, name: Option<&'a str>, } @@ -61,6 +64,7 @@ impl<'a> CargoTestArgs<'a> { log_max_level: None, log: None, package, + lib: false, test: None, name: None, } @@ -82,6 +86,13 @@ impl<'a> CargoTestArgs<'a> { self } + /// Set cargo test --lib to run the unit tests in the library + #[must_use] + pub fn with_lib(mut self, lib: bool) -> Self { + self.lib = lib; + self + } + /// Set cargo test --test file to run, e.g. base or prof #[must_use] pub fn with_test(mut self, test: &'a str) -> Self { @@ -99,6 +110,9 @@ impl<'a> CargoTestArgs<'a> { /// Return a Command that can be further configured and run. pub fn to_command(&self) -> std::process::Command { let mut cmd = std::process::Command::new("cargo"); + // normalize working dir + cmd.current_dir(root_dir()); + if let Some(log) = self.log { cmd.env("RUST_LOG", log); } @@ -114,6 +128,9 @@ impl<'a> CargoTestArgs<'a> { if let Some(level) = &self.log_max_level { cmd.arg("--features").arg(level.as_max_level_feature()); } + if self.lib { + cmd.arg("--lib"); + } if let Some(test) = self.test { cmd.arg("--test").arg(test); } @@ -123,3 +140,11 @@ impl<'a> CargoTestArgs<'a> { cmd } } + +pub fn root_dir() -> PathBuf { + let mut manifest_dir = + PathBuf::from(std::env::var_os("CARGO_MANIFEST_DIR").expect("$CARGO_MANIFEST_DIR not set: are you using 'cargo xtask ...'?")); + // xtask manifest should be at: /xtask/Cargo.toml + manifest_dir.pop(); + manifest_dir +} From 6c9103d0e21b81202a65a854e1a48a25f92651cc Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Wed, 1 Nov 2023 20:04:20 +1300 Subject: [PATCH 05/10] Don't set UPDATE=1 on xtask auto-unignore --- xtask/src/file_analyzer.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/xtask/src/file_analyzer.rs b/xtask/src/file_analyzer.rs index 7038c08194..90b20e48ba 100644 --- a/xtask/src/file_analyzer.rs +++ b/xtask/src/file_analyzer.rs @@ -12,6 +12,7 @@ use crate::{ /// Command builder for running tests/base.rs pub struct TestBaseArgs<'a> { inner: CargoTestArgs<'a>, + update: bool, ignored: bool, } @@ -20,6 +21,7 @@ impl<'a> TestBaseArgs<'a> { pub fn new() -> Self { Self { inner: CargoTestArgs::new("stc_ts_file_analyzer").with_test("base").with_lib(true), + update: true, ignored: false, } } @@ -60,6 +62,13 @@ impl<'a> TestBaseArgs<'a> { self } + /// Whether to set UPDATE=1 environment variable + #[must_use] + pub fn with_update(mut self, value: bool) -> Self { + self.update = value; + self + } + /// Set the standard --fast options. #[must_use] pub fn fast(self) -> Self { @@ -70,7 +79,11 @@ impl<'a> TestBaseArgs<'a> { pub fn to_command(&self) -> std::process::Command { let mut cmd = self.inner.to_command(); - cmd.env("UPDATE", "1").arg("--").arg("-Zunstable-options").arg("--report-time"); + if self.update { + cmd.env("UPDATE", "1"); + } + + cmd.arg("--").arg("-Zunstable-options").arg("--report-time"); if self.ignored { cmd.arg("--ignored"); @@ -110,6 +123,7 @@ pub fn auto_unignore() -> anyhow::Result<()> { let _ = TestBaseArgs::new() .with_log_max_level(LogFilterLevel::Off) .with_lib(false) + .with_update(false) .with_ignored() .run(); From 83a37a33239c61dc79bd77cf655ea021bf7de8cc Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Wed, 1 Nov 2023 20:17:02 +1300 Subject: [PATCH 06/10] Update Cargo.lock --- Cargo.lock | 851 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 803 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9482bb79ee..abbe23511b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -144,9 +144,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.71" +version = "1.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c7d0618f0e0b7e8ff11427422b64564d5fb0be1940354bfe2e0529b18a9d9b8" +checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" [[package]] name = "arc-swap" @@ -174,6 +174,117 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "async-broadcast" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" +dependencies = [ + "event-listener", + "futures-core", +] + +[[package]] +name = "async-channel" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" +dependencies = [ + "concurrent-queue", + "event-listener", + "futures-core", +] + +[[package]] +name = "async-executor" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" +dependencies = [ + "async-lock", + "async-task", + "concurrent-queue", + "fastrand 2.0.1", + "futures-lite", + "slab", +] + +[[package]] +name = "async-fs" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" +dependencies = [ + "async-lock", + "autocfg", + "blocking", + "futures-lite", +] + +[[package]] +name = "async-io" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fc5b45d93ef0529756f812ca52e44c221b35341892d3dcc34132ac02f3dd2af" +dependencies = [ + "async-lock", + "autocfg", + "cfg-if 1.0.0", + "concurrent-queue", + "futures-lite", + "log", + "parking", + "polling", + "rustix 0.37.27", + "slab", + "socket2", + "waker-fn", +] + +[[package]] +name = "async-lock" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" +dependencies = [ + "event-listener", +] + +[[package]] +name = "async-process" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a9d28b1d97e08915212e2e45310d47854eafa69600756fc735fb788f75199c9" +dependencies = [ + "async-io", + "async-lock", + "autocfg", + "blocking", + "cfg-if 1.0.0", + "event-listener", + "futures-lite", + "rustix 0.37.27", + "signal-hook", + "windows-sys 0.48.0", +] + +[[package]] +name = "async-recursion" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.31", +] + +[[package]] +name = "async-task" +version = "4.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" + [[package]] name = "async-trait" version = "0.1.68" @@ -185,6 +296,12 @@ dependencies = [ "syn 2.0.31", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "atty" version = "0.2.14" @@ -274,6 +391,18 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + [[package]] name = "block-buffer" version = "0.10.4" @@ -283,6 +412,22 @@ dependencies = [ "generic-array", ] +[[package]] +name = "blocking" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" +dependencies = [ + "async-channel", + "async-lock", + "async-task", + "fastrand 2.0.1", + "futures-io", + "futures-lite", + "piper", + "tracing", +] + [[package]] name = "bstr" version = "1.5.0" @@ -387,6 +532,15 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +[[package]] +name = "concurrent-queue" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" +dependencies = [ + "crossbeam-utils", +] + [[package]] name = "const-random" version = "0.1.15" @@ -468,7 +622,7 @@ dependencies = [ "autocfg", "cfg-if 1.0.0", "crossbeam-utils", - "memoffset", + "memoffset 0.8.0", "scopeguard", ] @@ -582,6 +736,15 @@ version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" +[[package]] +name = "deranged" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +dependencies = [ + "powerfmt", +] + [[package]] name = "derivative" version = "2.2.0" @@ -615,12 +778,54 @@ dependencies = [ "crypto-common", ] +[[package]] +name = "dirs-next" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" +dependencies = [ + "cfg-if 1.0.0", + "dirs-sys-next", +] + +[[package]] +name = "dirs-sys-next" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" +dependencies = [ + "libc", + "redox_users", + "winapi", +] + [[package]] name = "either" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" +[[package]] +name = "enumflags2" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5998b4f30320c9d93aed72f63af821bfdac50465b75428fce77b48ec482c3939" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.31", +] + [[package]] name = "env_logger" version = "0.9.3" @@ -634,6 +839,28 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3e13f66a2f95e32a39eaa81f6b95d42878ca0e1db0c7543723dfe12557e860" +dependencies = [ + "libc", + "windows-sys 0.48.0", +] + +[[package]] +name = "event-listener" +version = "2.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" + [[package]] name = "eyre" version = "0.6.8" @@ -644,6 +871,21 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fastrand" +version = "1.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" +dependencies = [ + "instant", +] + +[[package]] +name = "fastrand" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" + [[package]] name = "fixedbitset" version = "0.4.2" @@ -731,6 +973,21 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +[[package]] +name = "futures-lite" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" +dependencies = [ + "fastrand 1.9.0", + "futures-core", + "futures-io", + "memchr", + "parking", + "pin-project-lite", + "waker-fn", +] + [[package]] name = "futures-macro" version = "0.3.28" @@ -845,6 +1102,12 @@ dependencies = [ "ahash 0.8.3", ] +[[package]] +name = "hashbrown" +version = "0.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" + [[package]] name = "hashlink" version = "0.8.2" @@ -878,6 +1141,18 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + [[package]] name = "httparse" version = "1.8.0" @@ -901,7 +1176,7 @@ dependencies = [ "iana-time-zone-haiku", "js-sys", "wasm-bindgen", - "windows", + "windows 0.48.0", ] [[package]] @@ -969,12 +1244,42 @@ dependencies = [ "serde", ] +[[package]] +name = "indexmap" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +dependencies = [ + "equivalent", + "hashbrown 0.14.2", +] + +[[package]] +name = "instant" +version = "0.1.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +dependencies = [ + "cfg-if 1.0.0", +] + [[package]] name = "integer-encoding" version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dc51180a9b377fd75814d0cc02199c20f8e99433d6762f650d39cdbbd3b56f" +[[package]] +name = "io-lifetimes" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" +dependencies = [ + "hermit-abi 0.3.3", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "is-macro" version = "0.1.9" @@ -1069,7 +1374,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6607c62aa161d23d17a9072cc5da0be67cdfc89d3afb1e8d9c842bebc2525ffe" dependencies = [ "arrayvec", - "bitflags", + "bitflags 1.3.2", "cfg-if 1.0.0", "ryu", "static_assertions", @@ -1141,9 +1446,21 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.144" +version = "0.2.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a08173bc88b7955d1b3145aa561539096c421ac8debde8cbc3612ec635fee29b" + +[[package]] +name = "linux-raw-sys" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" + +[[package]] +name = "linux-raw-sys" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "da2479e8c062e40bf0066ffa0bc823de0a9368974af99c9f6df941d2c231e03f" [[package]] name = "lock_api" @@ -1167,13 +1484,35 @@ version = "0.93.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9be6e9c7e2d18f651974370d7aff703f9513e0df6e464fd795660edc77e6ca51" dependencies = [ - "bitflags", + "bitflags 1.3.2", "serde", "serde_json", "serde_repr", "url", ] +[[package]] +name = "mac-notification-sys" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51fca4d74ff9dbaac16a01b924bc3693fa2bba0862c2c633abc73f9a8ea21f64" +dependencies = [ + "cc", + "dirs-next", + "objc-foundation", + "objc_id", + "time", +] + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + [[package]] name = "matchers" version = "0.0.1" @@ -1198,6 +1537,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memoffset" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" +dependencies = [ + "autocfg", +] + [[package]] name = "memoffset" version = "0.8.0" @@ -1265,6 +1613,31 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e4a24736216ec316047a1fc4252e27dabb04218aa4a3f37c6e7ddbf1f9782b54" +[[package]] +name = "nix" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" +dependencies = [ + "bitflags 1.3.2", + "cfg-if 1.0.0", + "libc", + "memoffset 0.7.1", +] + +[[package]] +name = "notify-rust" +version = "4.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d7b75c8958cb2eab3451538b32db8a7b74006abc33eb2e6a9a56d21e4775c2b" +dependencies = [ + "log", + "mac-notification-sys", + "serde", + "tauri-winrt-notification", + "zbus", +] + [[package]] name = "nu-ansi-term" version = "0.46.0" @@ -1316,6 +1689,35 @@ dependencies = [ "libc", ] +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "objc-foundation" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" +dependencies = [ + "block", + "objc", + "objc_id", +] + +[[package]] +name = "objc_id" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" +dependencies = [ + "objc", +] + [[package]] name = "object" version = "0.30.3" @@ -1380,6 +1782,16 @@ dependencies = [ "num-traits", ] +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + [[package]] name = "output_vt100" version = "0.1.3" @@ -1401,6 +1813,12 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "parking" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" + [[package]] name = "parking_lot" version = "0.12.1" @@ -1419,7 +1837,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -1455,7 +1873,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 1.9.3", ] [[package]] @@ -1534,6 +1952,17 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" +[[package]] +name = "piper" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +dependencies = [ + "atomic-waker", + "fastrand 2.0.1", + "futures-io", +] + [[package]] name = "pmutil" version = "0.5.3" @@ -1545,6 +1974,28 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "polling" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b2d323e8ca7996b3e23126511a523f7e62924d93ecd5ae73b333815b0eb3dce" +dependencies = [ + "autocfg", + "bitflags 1.3.2", + "cfg-if 1.0.0", + "concurrent-queue", + "libc", + "log", + "pin-project-lite", + "windows-sys 0.48.0", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + [[package]] name = "ppv-lite86" version = "0.2.17" @@ -1569,6 +2020,16 @@ dependencies = [ "yansi", ] +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit", +] + [[package]] name = "proc-macro-error" version = "1.0.4" @@ -1617,6 +2078,15 @@ dependencies = [ "cc", ] +[[package]] +name = "quick-xml" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eff6510e86862b57b210fd8cbe8ed3f0d7d600b9c2863cd4549a2e033c66e956" +dependencies = [ + "memchr", +] + [[package]] name = "quote" version = "1.0.28" @@ -1721,7 +2191,27 @@ version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" dependencies = [ - "bitflags", + "bitflags 1.3.2", +] + +[[package]] +name = "redox_syscall" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +dependencies = [ + "bitflags 1.3.2", +] + +[[package]] +name = "redox_users" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" +dependencies = [ + "getrandom", + "redox_syscall 0.2.16", + "thiserror", ] [[package]] @@ -1842,6 +2332,33 @@ dependencies = [ "semver", ] +[[package]] +name = "rustix" +version = "0.37.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea8ca367a3a01fe35e6943c400addf443c0f57670e6ec51196f71a4b8762dd2" +dependencies = [ + "bitflags 1.3.2", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys 0.3.8", + "windows-sys 0.48.0", +] + +[[package]] +name = "rustix" +version = "0.38.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +dependencies = [ + "bitflags 2.4.1", + "errno", + "libc", + "linux-raw-sys 0.4.10", + "windows-sys 0.48.0", +] + [[package]] name = "ryu" version = "1.0.13" @@ -1858,7 +2375,7 @@ dependencies = [ "crossbeam-utils", "dashmap 5.4.0", "hashlink", - "indexmap", + "indexmap 1.9.3", "log", "parking_lot", "rustc-hash", @@ -1987,6 +2504,16 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "signal-hook" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8621587d4798caf8eb44879d42e56b9a93ea5dcd315a6487c357130095b62801" +dependencies = [ + "libc", + "signal-hook-registry", +] + [[package]] name = "signal-hook-registry" version = "1.4.1" @@ -2034,6 +2561,16 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f67ad224767faa3c7d8b6d91985b78e70a1324408abcb1cfcc2be4c06bc06043" +[[package]] +name = "socket2" +version = "0.4.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" +dependencies = [ + "libc", + "winapi", +] + [[package]] name = "sourcemap" version = "6.2.3" @@ -2171,7 +2708,7 @@ name = "stc_ts_builtin_types" version = "0.0.0" dependencies = [ "fxhash", - "indexmap", + "indexmap 1.9.3", "once_cell", "rayon", "stc_ts_builtin_macro", @@ -2273,11 +2810,11 @@ dependencies = [ "ahash 0.7.6", "auto_impl 0.5.0", "backtrace", - "bitflags", + "bitflags 1.3.2", "dashmap 3.11.10", "derivative", "fxhash", - "indexmap", + "indexmap 1.9.3", "itertools", "lexical 5.2.2", "num-bigint", @@ -2428,7 +2965,7 @@ version = "0.1.0" dependencies = [ "either", "fxhash", - "indexmap", + "indexmap 1.9.3", "petgraph", "rayon", "rnode", @@ -2544,7 +3081,7 @@ dependencies = [ "dashmap 3.11.10", "fxhash", "ignore", - "indexmap", + "indexmap 1.9.3", "log", "once_cell", "parking_lot", @@ -2588,7 +3125,7 @@ dependencies = [ name = "stc_ts_type_ops" version = "0.1.0" dependencies = [ - "indexmap", + "indexmap 1.9.3", "rnode", "rustc-hash", "stc_ts_ast_rnode", @@ -2809,7 +3346,7 @@ version = "0.100.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93c69d8727a1057867a9e5da47cbd42cea3c9e2376c6d8160b03b2afa05c38f4" dependencies = [ - "bitflags", + "bitflags 1.3.2", "is-macro 0.2.2", "num-bigint", "scoped-tls", @@ -2907,8 +3444,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d4e773aa99f30c651232690b731f2f65641c817658b8457074dfce20f41705f" dependencies = [ "better_scoped_tls", - "bitflags", - "indexmap", + "bitflags 1.3.2", + "indexmap 1.9.3", "once_cell", "phf", "rustc-hash", @@ -2929,7 +3466,7 @@ version = "0.113.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63b7bb4af825cf96ad8761c8129fffa4fa417c3fda5ad913fc84518802d8f08b" dependencies = [ - "indexmap", + "indexmap 1.9.3", "num_cpus", "once_cell", "rustc-hash", @@ -2986,7 +3523,7 @@ version = "0.17.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1002e0d00c2716d18533f412b7ef447aca34a8363c6d470680442db58cf2c743" dependencies = [ - "indexmap", + "indexmap 1.9.3", "petgraph", "rustc-hash", "swc_common", @@ -3063,6 +3600,16 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "tauri-winrt-notification" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "006851c9ccefa3c38a7646b8cec804bb429def3da10497bfa977179869c3e8e2" +dependencies = [ + "quick-xml", + "windows 0.51.1", +] + [[package]] name = "tempdir" version = "0.3.7" @@ -3073,6 +3620,19 @@ dependencies = [ "remove_dir_all", ] +[[package]] +name = "tempfile" +version = "3.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +dependencies = [ + "cfg-if 1.0.0", + "fastrand 2.0.1", + "redox_syscall 0.4.1", + "rustix 0.38.21", + "windows-sys 0.48.0", +] + [[package]] name = "termcolor" version = "1.2.0" @@ -3191,6 +3751,24 @@ dependencies = [ "threadpool", ] +[[package]] +name = "time" +version = "0.3.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +dependencies = [ + "deranged", + "powerfmt", + "serde", + "time-core", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -3257,6 +3835,23 @@ dependencies = [ "tracing", ] +[[package]] +name = "toml_datetime" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.1.0", + "toml_datetime", + "winnow", +] + [[package]] name = "tower" version = "0.4.13" @@ -3459,6 +4054,16 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" +[[package]] +name = "uds_windows" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +dependencies = [ + "tempfile", + "winapi", +] + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -3532,6 +4137,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +[[package]] +name = "waker-fn" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" + [[package]] name = "walkdir" version = "2.3.3" @@ -3640,7 +4251,26 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" +dependencies = [ + "windows-core", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-core" +version = "0.51.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +dependencies = [ + "windows-targets 0.48.5", ] [[package]] @@ -3658,7 +4288,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.5", ] [[package]] @@ -3678,17 +4308,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", ] [[package]] @@ -3699,9 +4329,9 @@ checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_msvc" @@ -3711,9 +4341,9 @@ checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_i686_gnu" @@ -3723,9 +4353,9 @@ checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_msvc" @@ -3735,9 +4365,9 @@ checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_x86_64_gnu" @@ -3747,9 +4377,9 @@ checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnullvm" @@ -3759,9 +4389,9 @@ checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_msvc" @@ -3771,15 +4401,36 @@ checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.48.0" +version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "winnow" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32" +dependencies = [ + "memchr", +] + +[[package]] +name = "xdg-home" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2769203cd13a0c6015d515be729c526d041e9cf2c0cc478d57faee85f40c6dcd" +dependencies = [ + "nix", + "winapi", +] [[package]] name = "xtask" version = "0.1.0" dependencies = [ + "anyhow", "clap", + "notify-rust", ] [[package]] @@ -3787,3 +4438,107 @@ name = "yansi" version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" + +[[package]] +name = "zbus" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31de390a2d872e4cd04edd71b425e29853f786dc99317ed72d73d6fcf5ebb948" +dependencies = [ + "async-broadcast", + "async-executor", + "async-fs", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "byteorder", + "derivative", + "enumflags2", + "event-listener", + "futures-core", + "futures-sink", + "futures-util", + "hex", + "nix", + "once_cell", + "ordered-stream", + "rand 0.8.5", + "serde", + "serde_repr", + "sha1", + "static_assertions", + "tracing", + "uds_windows", + "winapi", + "xdg-home", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "3.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d1794a946878c0e807f55a397187c11fc7a038ba5d868e7db4f3bd7760bc9d" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "regex", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb80bb776dbda6e23d705cf0123c3b95df99c4ebeaec6c2599d4a5419902b4a9" +dependencies = [ + "serde", + "static_assertions", + "zvariant", +] + +[[package]] +name = "zvariant" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44b291bee0d960c53170780af148dca5fa260a63cdd24f1962fa82e03e53338c" +dependencies = [ + "byteorder", + "enumflags2", + "libc", + "serde", + "static_assertions", + "zvariant_derive", +] + +[[package]] +name = "zvariant_derive" +version = "3.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "934d7a7dfc310d6ee06c87ffe88ef4eca7d3e37bb251dece2ef93da8f17d8ecd" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7234f0d811589db492d16893e3f21e8e2fd282e6d01b0cddee310322062cc200" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] From 614cbb753cbee92b9c5ce5309a11ee991d8d6fb1 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Wed, 1 Nov 2023 20:25:28 +1300 Subject: [PATCH 07/10] Add xtask to cspell.json --- cspell.json | 1 + 1 file changed, 1 insertion(+) diff --git a/cspell.json b/cspell.json index 72dd8d7e69..026067007c 100644 --- a/cspell.json +++ b/cspell.json @@ -106,6 +106,7 @@ "vite", "walkdir", "wasi", + "xtask", "Zunstable" ], "ignorePaths": [ From 25e748d75c4f728765c6a5a9ab182f4319329bd4 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Tue, 14 Nov 2023 21:29:59 +1300 Subject: [PATCH 08/10] Remove scripts now implemented by xtasks. And use the xtasks in CI. --- .github/workflows/check-stats.yml | 10 +++--- .husky/pre-push | 2 +- .../scripts/auto-unignore.sh | 22 ------------ crates/stc_ts_file_analyzer/scripts/base.sh | 14 -------- crates/stc_ts_file_analyzer/scripts/fast.sh | 13 ------- crates/stc_ts_type_checker/scripts/base.sh | 14 -------- crates/stc_ts_type_checker/scripts/check.sh | 35 ------------------- crates/stc_ts_type_checker/scripts/sort.sh | 12 ------- crates/stc_ts_type_checker/scripts/test.sh | 22 ------------ 9 files changed, 5 insertions(+), 139 deletions(-) delete mode 100755 crates/stc_ts_file_analyzer/scripts/auto-unignore.sh delete mode 100755 crates/stc_ts_file_analyzer/scripts/base.sh delete mode 100755 crates/stc_ts_file_analyzer/scripts/fast.sh delete mode 100755 crates/stc_ts_type_checker/scripts/base.sh delete mode 100755 crates/stc_ts_type_checker/scripts/check.sh delete mode 100755 crates/stc_ts_type_checker/scripts/sort.sh delete mode 100755 crates/stc_ts_type_checker/scripts/test.sh diff --git a/.github/workflows/check-stats.yml b/.github/workflows/check-stats.yml index 84ac5622e2..139de41727 100644 --- a/.github/workflows/check-stats.yml +++ b/.github/workflows/check-stats.yml @@ -39,12 +39,10 @@ jobs: echo -n "Commit: " >> pr/comment.md echo '${{ github.event.pull_request.head.sha }}' >> pr/comment.md - - run: ./scripts/auto-unignore.sh - working-directory: crates/stc_ts_file_analyzer + - run: cargo xtask auto-unignore continue-on-error: true - - run: ./scripts/check.sh > /dev/null - working-directory: crates/stc_ts_type_checker + - run: cargo xtask test-checker > /dev/null continue-on-error: true - name: Write description @@ -53,8 +51,8 @@ jobs: echo -n 'These are files which is affected by the current PR, but not reflected. ' >> pr/comment.md echo "If there's no file below this message, please ignore this message." >> pr/comment.md echo '' >> pr/comment.md - echo -n 'You can run `./scripts/auto-unignore.sh` from `crates/stc_ts_file_analyzer` for typescript files, ' >> pr/comment.md - echo 'and `./scripts/check.sh` from `crates/stc_ts_type_checker` for `*.stats.rust-debug` files.' >> pr/comment.md + echo -n 'You can run `cargo xtask auto-unignore` for typescript files, ' >> pr/comment.md + echo 'and `cargo xtask test-checker` for `*.stats.rust-debug` files.' >> pr/comment.md echo '' >> pr/comment.md - name: Store changed files diff --git a/.husky/pre-push b/.husky/pre-push index 980eccd793..c68c439719 100755 --- a/.husky/pre-push +++ b/.husky/pre-push @@ -5,4 +5,4 @@ set -eu export HUSKY=1; # We don't use this anymore # export STC_IGNORE_WIP=1 -# (cd ./typescript/type_checker && ./scripts/test.sh) +# cargo xtask file-analyzer --all diff --git a/crates/stc_ts_file_analyzer/scripts/auto-unignore.sh b/crates/stc_ts_file_analyzer/scripts/auto-unignore.sh deleted file mode 100755 index a0c1bc9ca0..0000000000 --- a/crates/stc_ts_file_analyzer/scripts/auto-unignore.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -# This script un-ignores passing tests -set -eu -set -o pipefail - -export CARGO_TERM_COLOR=always -export RUST_BACKTRACE=1 -export RUST_MIN_STACK=$((8 * 1024 * 1024)) - -function cleanup { - echo "Deleting cache for ignored tests" - find ./tests/tsc -name '\.*.tsc-errors.json' -type f -delete -} - -cleanup - -# We prevent regression using faster checks -touch ../stc_ts_file_analyzer/tests/base.rs -cargo test -p stc_ts_file_analyzer --features tracing/max_level_off --features no-threading --color always --test base $@ -- -Zunstable-options --report-time --ignored || true - - -cleanup diff --git a/crates/stc_ts_file_analyzer/scripts/base.sh b/crates/stc_ts_file_analyzer/scripts/base.sh deleted file mode 100755 index 2ede91527e..0000000000 --- a/crates/stc_ts_file_analyzer/scripts/base.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# -# Usage: `./scripts/base.sh test_name_to_run`` -# -set -eu -set -o pipefail - -export CARGO_TERM_COLOR=always -export RUST_BACKTRACE=1 -export RUST_MIN_STACK=$((8 * 1024 * 1024)) - -# We prevent regression using faster checks -touch ../stc_ts_file_analyzer/tests/base.rs -UPDATE=1 cargo test -p stc_ts_file_analyzer $@ --color always --lib --test base --features no-threading -- -Zunstable-options --report-time diff --git a/crates/stc_ts_file_analyzer/scripts/fast.sh b/crates/stc_ts_file_analyzer/scripts/fast.sh deleted file mode 100755 index 3f0e0b33ef..0000000000 --- a/crates/stc_ts_file_analyzer/scripts/fast.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -# -# This scripts invokes all base tests but without logging, to make test faster. -# - -set -eu - -export CARGO_TERM_COLOR=always -export RUST_BACKTRACE=1 -export RUST_MIN_STACK=$((8 * 1024 * 1024)) - -# We prevent regression using faster checks -RUST_LOG=off ./scripts/base.sh --features tracing/max_level_error $@ diff --git a/crates/stc_ts_type_checker/scripts/base.sh b/crates/stc_ts_type_checker/scripts/base.sh deleted file mode 100755 index 2ede91527e..0000000000 --- a/crates/stc_ts_type_checker/scripts/base.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash -# -# Usage: `./scripts/base.sh test_name_to_run`` -# -set -eu -set -o pipefail - -export CARGO_TERM_COLOR=always -export RUST_BACKTRACE=1 -export RUST_MIN_STACK=$((8 * 1024 * 1024)) - -# We prevent regression using faster checks -touch ../stc_ts_file_analyzer/tests/base.rs -UPDATE=1 cargo test -p stc_ts_file_analyzer $@ --color always --lib --test base --features no-threading -- -Zunstable-options --report-time diff --git a/crates/stc_ts_type_checker/scripts/check.sh b/crates/stc_ts_type_checker/scripts/check.sh deleted file mode 100755 index c44812b572..0000000000 --- a/crates/stc_ts_type_checker/scripts/check.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash -# -# This scripts invokes all unignored tests, update pass list (append-only) -# and print the list of failing tests. -# -# - -set -eu - -err_handler () { - ./scripts/_/notify.sh 'Check failed!' - exit 1 -} - -trap err_handler ERR - -export CARGO_TERM_COLOR=always -export RUST_BACKTRACE=1 -export RUST_MIN_STACK=$((8 * 1024 * 1024)) - -# We prevent regression using faster checks -RUST_LOG=off ./scripts/base.sh --features tracing/max_level_off - -RUST_LOG=error TEST='' DO_NOT_PRINT_MATCHED=1 cargo test --test tsc --features tracing/max_level_off --features no-threading \ - | tee /dev/stderr \ - | grep 'ts .\.\. ok$' \ - | sed -e 's!test conformance::!!' \ - | sed -e 's! ... ok!!' \ - | sed -e 's!::!/!g' \ - | sed -e 's!test !!' \ - >> tests/conformance.pass.txt - -./scripts/sort.sh - -./scripts/_/notify.sh 'Check done!' diff --git a/crates/stc_ts_type_checker/scripts/sort.sh b/crates/stc_ts_type_checker/scripts/sort.sh deleted file mode 100755 index 7c838e4062..0000000000 --- a/crates/stc_ts_type_checker/scripts/sort.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -set -eu - -function sortFile { - cat $1 | awk NF | sort | uniq | awk '{$1=$1};1' | uniq | ./scripts/_/sort.py > tests/tmp.txt - mv tests/tmp.txt $1 -} - -sortFile tests/conformance.pass.txt -sortFile tests/compiler.pass.txt -sortFile tests/tsc.wip.txt -sortFile tests/tsc.ignored.txt \ No newline at end of file diff --git a/crates/stc_ts_type_checker/scripts/test.sh b/crates/stc_ts_type_checker/scripts/test.sh deleted file mode 100755 index 92d91f4e58..0000000000 --- a/crates/stc_ts_type_checker/scripts/test.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash -set -eu - -err_handler () { - ./scripts/_/notify.sh 'Test failed!' - exit 1 -} - -trap err_handler ERR - -./scripts/sort.sh - -export RUST_BACKTRACE=1 -export RUST_LOG=debug,swc_common=off -export RUST_MIN_STACK=$((8 * 1024 * 1024)) - -# We prevent regression using faster checks -RUST_LOG=error ./scripts/base.sh --features tracing/max_level_off - -TEST="$@" cargo test --color always -q --test tsc --features no-threading - -./scripts/_/notify.sh 'Test finished!' \ No newline at end of file From 767e1a1617804277d0b869ca471d1f2326e17567 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Tue, 14 Nov 2023 21:41:13 +1300 Subject: [PATCH 09/10] Cleanup writing test-checker output. --- xtask/src/type_checker.rs | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/xtask/src/type_checker.rs b/xtask/src/type_checker.rs index 15f3cdf7ae..a82c32176e 100644 --- a/xtask/src/type_checker.rs +++ b/xtask/src/type_checker.rs @@ -43,26 +43,27 @@ fn test_conformance() -> anyhow::Result<()> { // This is more complicated than using .output(), but there's a *lot* of // output we throw out, so this is much better for memory. You could also use it // for reporting progress, I guess? - let mut tests = Vec::new(); + let mut passed_test_lines = Vec::new(); let stdout = child.stdout.take().unwrap(); std::thread::scope({ // Avoid moving the Vec into the thread - let tests = &mut tests; + let passed_test_lines = &mut passed_test_lines; move |scope| { scope.spawn(move || { use std::io::BufRead; let stdout = std::io::BufReader::new(stdout); for line in stdout.lines() { - let line = line.unwrap(); + let mut line = line.unwrap(); // fixme: there are some .tsx files...? if line.ends_with(".ts ... ok") { - tests.push( - line.replace("test conformance::", "") - .replace(" ... ok", "") - .replace("::", "/") - .replace("test ", "") - .replace('\\', "/"), - ); + line = line + .replace("test conformance::", "") + .replace(" ... ok", "") + .replace("::", "/") + .replace("test ", "") + .replace('\\', "/"); + line.push('\n'); + passed_test_lines.push(line); } } }); @@ -72,14 +73,8 @@ fn test_conformance() -> anyhow::Result<()> { let status = child.wait()?; ensure!(status.success(), "test conformance failed: {status}"); - tests.sort(); - - use std::io::Write; - let mut file = std::fs::File::create("crates/stc_ts_type_checker/tests/conformance.pass.txt")?; - for line in &tests { - writeln!(file, "{line}").unwrap(); - } - drop(file); + passed_test_lines.sort(); + std::fs::write("crates/stc_ts_type_checker/tests/conformance.pass.txt", passed_test_lines.concat())?; Ok(()) } From b348e8d8f4dff1ac633689e4f4ecdebc2d75dc82 Mon Sep 17 00:00:00 2001 From: Simon Buchan Date: Tue, 14 Nov 2023 23:28:43 +1300 Subject: [PATCH 10/10] xtask test-checker should always update output. It's currently expected to fail. This also doesn't skip .tsx tests (free passing tests!) and prints dot-style test output progress. --- .../tests/conformance.pass.txt | 103 ++++++++++++++++-- xtask/src/type_checker.rs | 33 ++++-- 2 files changed, 116 insertions(+), 20 deletions(-) diff --git a/crates/stc_ts_type_checker/tests/conformance.pass.txt b/crates/stc_ts_type_checker/tests/conformance.pass.txt index e13517914a..d6ed084f24 100644 --- a/crates/stc_ts_type_checker/tests/conformance.pass.txt +++ b/crates/stc_ts_type_checker/tests/conformance.pass.txt @@ -1016,15 +1016,10 @@ es6/spread/iteratorSpreadInCall2.ts es6/spread/iteratorSpreadInCall3.ts es6/spread/iteratorSpreadInCall4.ts es6/spread/iteratorSpreadInCall5.ts -es6/tedirectives/ts-expect-error-nocheck.ts -es6/templates/taggedTemplateStrindirectives/ts-expect-error-nocheck.ts es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01.ts es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes01_ES6.ts es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02.ts es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.ts -es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02_ES6.tsdirectives/ts-expect-error-nocheck.ts -es6/templates/taggedTemplateStringsPlainCharactersThatArePartsOfEscapes02directives/ts-expect-error-nocheck.ts -es6/templates/taggedTemplateStringsPldirectives/ts-expect-error-nocheck.ts es6/templates/taggedTemplateStringsWithIncompatibleTypedTags.ts es6/templates/taggedTemplateStringsWithIncompatibleTypedTagsES6.ts es6/templates/taggedTemplateStringsWithManyCallAndMemberExpressions.ts @@ -1127,8 +1122,6 @@ es6/templates/templateStringWhitespaceEscapes2_ES6.ts es6/templates/templateStringWithBackslashEscapes01.ts es6/templates/templateStringWithBackslashEscapes01_ES6.ts es6/templates/templateStringWithCommentsInArrowFunction.ts -es6/templates/templateStringWithE -es6/templates/templateStringWithEdirectives/ts-expect-error-nocheck.ts es6/templates/templateStringWithEmbeddedAddition.ts es6/templates/templateStringWithEmbeddedAdditionES6.ts es6/templates/templateStringWithEmbeddedArray.ts @@ -1157,7 +1150,6 @@ es6/templates/templateStringWithEmbeddedObjectLiteral.ts es6/templates/templateStringWithEmbeddedObjectLiteralES6.ts es6/templates/templateStringWithEmbeddedTemplateString.ts es6/templates/templateStringWithEmbeddedTemplateStringES6.ts -es6/templates/templateStringWithEmbeddedTypdirectives/ts-expect-error-nocheck.ts es6/templates/templateStringWithEmbeddedTypeAssertionOnAddition.ts es6/templates/templateStringWithEmbeddedTypeAssertionOnAdditionES6.ts es6/templates/templateStringWithEmbeddedTypeOfOperator.ts @@ -1169,7 +1161,6 @@ es6/templates/templateStringWithEmptyLiteralPortions.ts es6/templates/templateStringWithEmptyLiteralPortionsES6.ts es6/templates/templateStringWithOpenCommentInStringPortion.ts es6/templates/templateStringWithOpenCommentInStringPortionES6.ts -es6/templates/templateStringWithPdirectives/ts-expect-error-nocheck.ts es6/templates/templateStringWithPropertyAccess.ts es6/templates/templateStringWithPropertyAccessES6.ts es6/templates/templateStringsWithTypeErrorInFunctionExpressionsInSubstitutionExpression.ts @@ -1821,7 +1812,100 @@ jsdoc/parseThrowsTag.ts jsdoc/seeTag1.ts jsdoc/seeTag2.ts jsdoc/typeParameterExtendsUnionConstraintDistributed.ts +jsx/checkJsxChildrenProperty1.tsx +jsx/checkJsxChildrenProperty10.tsx +jsx/checkJsxChildrenProperty11.tsx +jsx/checkJsxChildrenProperty12.tsx +jsx/checkJsxChildrenProperty3.tsx +jsx/checkJsxChildrenProperty6.tsx +jsx/checkJsxChildrenProperty8.tsx +jsx/checkJsxChildrenProperty9.tsx +jsx/commentEmittingInPreserveJsx1.tsx +jsx/correctlyMarkAliasAsReferences1.tsx +jsx/correctlyMarkAliasAsReferences2.tsx +jsx/correctlyMarkAliasAsReferences4.tsx +jsx/jsxReactTestSuite.tsx +jsx/tsxAttributeErrors.tsx +jsx/tsxAttributeResolution.tsx +jsx/tsxAttributeResolution13.tsx +jsx/tsxAttributeResolution16.tsx +jsx/tsxAttributeResolution7.tsx +jsx/tsxAttributeResolution8.tsx +jsx/tsxDefaultAttributesResolution1.tsx +jsx/tsxDefaultAttributesResolution2.tsx +jsx/tsxDynamicTagName1.tsx +jsx/tsxDynamicTagName4.tsx +jsx/tsxDynamicTagName5.tsx +jsx/tsxDynamicTagName6.tsx +jsx/tsxDynamicTagName8.tsx +jsx/tsxDynamicTagName9.tsx +jsx/tsxElementResolution.tsx +jsx/tsxElementResolution1.tsx +jsx/tsxElementResolution16.tsx +jsx/tsxElementResolution18.tsx +jsx/tsxElementResolution19.tsx +jsx/tsxElementResolution2.tsx +jsx/tsxElementResolution6.tsx +jsx/tsxElementResolution7.tsx +jsx/tsxEmit1.tsx +jsx/tsxEmit2.tsx jsx/tsxEmitSpreadAttribute.ts +jsx/tsxExternalModuleEmit1.tsx +jsx/tsxExternalModuleEmit2.tsx +jsx/tsxFragmentPreserveEmit.tsx +jsx/tsxFragmentReactEmit.tsx +jsx/tsxGenericAttributesType1.tsx +jsx/tsxGenericAttributesType2.tsx +jsx/tsxGenericAttributesType3.tsx +jsx/tsxGenericAttributesType4.tsx +jsx/tsxGenericAttributesType5.tsx +jsx/tsxGenericAttributesType6.tsx +jsx/tsxGenericAttributesType7.tsx +jsx/tsxGenericAttributesType8.tsx +jsx/tsxInArrowFunction.tsx +jsx/tsxIntrinsicAttributeErrors.tsx +jsx/tsxNoJsx.tsx +jsx/tsxParseTests1.tsx +jsx/tsxParseTests2.tsx +jsx/tsxPreserveEmit1.tsx +jsx/tsxPreserveEmit2.tsx +jsx/tsxPreserveEmit3.tsx +jsx/tsxReactComponentWithDefaultTypeParameter1.tsx +jsx/tsxReactComponentWithDefaultTypeParameter2.tsx +jsx/tsxReactEmit1.tsx +jsx/tsxReactEmit2.tsx +jsx/tsxReactEmit3.tsx +jsx/tsxReactEmit4.tsx +jsx/tsxReactEmit5.tsx +jsx/tsxReactEmit6.tsx +jsx/tsxReactEmitEntities.tsx +jsx/tsxReactEmitNesting.tsx +jsx/tsxReactEmitWhitespace.tsx +jsx/tsxReactEmitWhitespace2.tsx +jsx/tsxSfcReturnNull.tsx +jsx/tsxSfcReturnNullStrictNullChecks.tsx +jsx/tsxSpreadAttributesResolution1.tsx +jsx/tsxSpreadAttributesResolution11.tsx +jsx/tsxSpreadAttributesResolution13.tsx +jsx/tsxSpreadAttributesResolution15.tsx +jsx/tsxSpreadAttributesResolution3.tsx +jsx/tsxSpreadAttributesResolution7.tsx +jsx/tsxSpreadAttributesResolution8.tsx +jsx/tsxSpreadAttributesResolution9.tsx +jsx/tsxSpreadChildren.tsx +jsx/tsxSpreadChildrenInvalidType.tsx +jsx/tsxStatelessFunctionComponentOverload2.tsx +jsx/tsxStatelessFunctionComponentOverload3.tsx +jsx/tsxStatelessFunctionComponentOverload6.tsx +jsx/tsxStatelessFunctionComponentWithDefaultTypeParameter1.tsx +jsx/tsxStatelessFunctionComponents3.tsx +jsx/tsxStatelessFunctionComponentsWithTypeArguments1.tsx +jsx/tsxStatelessFunctionComponentsWithTypeArguments3.tsx +jsx/tsxStatelessFunctionComponentsWithTypeArguments5.tsx +jsx/tsxTypeArgumentsJsxPreserveOutput.tsx +jsx/tsxTypeErrors.tsx +jsx/tsxUnionElementType5.tsx +jsx/tsxUnionTypeComponent1.tsx moduleResolution/importFromDot.ts moduleResolution/packageJsonImportsExportsOptionCompat.ts nonjsExtensions/declarationFileForJsonImport.ts @@ -2330,6 +2414,7 @@ types/contextualTypes/asyncFunctions/contextuallyTypeAsyncFunctionReturnType.ts types/contextualTypes/commaOperator/contextuallyTypeCommaOperator01.ts types/contextualTypes/commaOperator/contextuallyTypeCommaOperator02.ts types/contextualTypes/commaOperator/contextuallyTypeCommaOperator03.ts +types/contextualTypes/jsxAttributes/contextuallyTypedStringLiteralsInJsxAttributes01.tsx types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd01.ts types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd02.ts types/contextualTypes/logicalAnd/contextuallyTypeLogicalAnd03.ts diff --git a/xtask/src/type_checker.rs b/xtask/src/type_checker.rs index a82c32176e..54ebb81546 100644 --- a/xtask/src/type_checker.rs +++ b/xtask/src/type_checker.rs @@ -54,27 +54,38 @@ fn test_conformance() -> anyhow::Result<()> { let stdout = std::io::BufReader::new(stdout); for line in stdout.lines() { let mut line = line.unwrap(); - // fixme: there are some .tsx files...? - if line.ends_with(".ts ... ok") { - line = line - .replace("test conformance::", "") - .replace(" ... ok", "") - .replace("::", "/") - .replace("test ", "") - .replace('\\', "/"); - line.push('\n'); - passed_test_lines.push(line); + if line.starts_with("test ") { + if line.ends_with(" ... ok") { + line = line + .replace("test conformance::", "") + .replace(" ... ok", "") + .replace("::", "/") + .replace("test ", "") + .replace('\\', "/"); + line.push('\n'); + passed_test_lines.push(line); + eprint!("."); + } else if line.ends_with(" ... FAILED") { + eprint!("F"); + } else if line.ends_with(" ... ignored") { + eprint!("i"); + } else { + eprintln!(); + eprintln!("{line}"); + } } } }); } }); + eprintln!(); let status = child.wait()?; - ensure!(status.success(), "test conformance failed: {status}"); passed_test_lines.sort(); std::fs::write("crates/stc_ts_type_checker/tests/conformance.pass.txt", passed_test_lines.concat())?; + ensure!(status.success(), "test conformance failed: {status}"); + Ok(()) }