From 4adca8a5e60b4f4547259669394de7f8209dcb65 Mon Sep 17 00:00:00 2001 From: Emanuele Stoppa Date: Tue, 4 Jun 2024 09:00:42 +0100 Subject: [PATCH] chore: remove git modules for better internal experience --- .gitmodules | 14 --------- Cargo.lock | 1 + xtask/coverage/.gitignore | 3 ++ xtask/coverage/Cargo.toml | 44 +++++++++++++-------------- xtask/coverage/Typescript | 1 - xtask/coverage/babel | 1 - xtask/coverage/src/js/test262.rs | 21 +++++++++++++ xtask/coverage/src/jsx/jsx_babel.rs | 20 ++++++++++++ xtask/coverage/src/runner.rs | 3 ++ xtask/coverage/src/symbols/msts.rs | 23 ++++++++++++++ xtask/coverage/src/ts/ts_babel.rs | 23 ++++++++++++++ xtask/coverage/src/ts/ts_microsoft.rs | 22 ++++++++++++++ xtask/coverage/test262 | 1 - 13 files changed, 138 insertions(+), 39 deletions(-) delete mode 100644 .gitmodules create mode 100644 xtask/coverage/.gitignore delete mode 160000 xtask/coverage/Typescript delete mode 160000 xtask/coverage/babel delete mode 160000 xtask/coverage/test262 diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 0b2db6446642..000000000000 --- a/.gitmodules +++ /dev/null @@ -1,14 +0,0 @@ -[submodule "xtask/coverage/test262"] - path = xtask/coverage/test262 - url = https://github.com/tc39/test262.git - shallow = true - -[submodule "xtask/coverage/Typescript"] - path = xtask/coverage/Typescript - url = https://github.com/microsoft/Typescript - shallow = true - -[submodule "xtask/coverage/babel"] - path = xtask/coverage/babel - url = https://github.com/babel/babel - shallow = true diff --git a/Cargo.lock b/Cargo.lock index 9621e48e0528..e219d037574f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4279,6 +4279,7 @@ dependencies = [ "biome_parser", "biome_rowan", "colored", + "git2", "indicatif", "once_cell", "pico-args", diff --git a/xtask/coverage/.gitignore b/xtask/coverage/.gitignore new file mode 100644 index 000000000000..013bd9bbba4b --- /dev/null +++ b/xtask/coverage/.gitignore @@ -0,0 +1,3 @@ +babel/ +test262/ +Typescript/ diff --git a/xtask/coverage/Cargo.toml b/xtask/coverage/Cargo.toml index 3b1ae4bf7865..0ac2a3a36968 100644 --- a/xtask/coverage/Cargo.toml +++ b/xtask/coverage/Cargo.toml @@ -1,32 +1,32 @@ [package] edition = "2021" -name = "xtask_coverage" +name = "xtask_coverage" publish = false version = "0.0.0" [dependencies] -ascii_table = "4.0.3" -backtrace = "0.3.71" -biome_console = { workspace = true } -biome_diagnostics = { workspace = true } -biome_js_parser = { workspace = true } -biome_js_semantic = { workspace = true } -biome_js_syntax = { workspace = true } -biome_parser = { workspace = true } -biome_rowan = { workspace = true } -colored = "2.1.0" -indicatif = { version = "0.17.8", features = ["improved_unicode"] } -once_cell = "1.19.0" -pico-args = { version = "0.5.0", features = ["eq-separator"] } -regex = { workspace = true } -serde = { workspace = true, features = ["derive"] } -serde_json = { workspace = true } -serde_yaml = "0.9.34" -tracing = { workspace = true } +ascii_table = "4.0.3" +backtrace = "0.3.71" +biome_console = { workspace = true } +biome_diagnostics = { workspace = true } +biome_js_parser = { workspace = true } +biome_js_semantic = { workspace = true } +biome_js_syntax = { workspace = true } +biome_parser = { workspace = true } +biome_rowan = { workspace = true } +colored = "2.1.0" +indicatif = { version = "0.17.8", features = ["improved_unicode"] } +once_cell = "1.19.0" +pico-args = { version = "0.5.0", features = ["eq-separator"] } +regex = { workspace = true } +serde = { workspace = true, features = ["derive"] } +serde_json = { workspace = true } +serde_yaml = "0.9.34" +tracing = { workspace = true } tracing-subscriber = { workspace = true, features = ["env-filter", "std"] } -walkdir = "2.5.0" -xtask = { path = '../', version = "0.0" } -yastl = "0.1.2" +walkdir = "2.5.0" +xtask = { path = '../', version = "0.0" } +yastl = "0.1.2" [lints] workspace = true diff --git a/xtask/coverage/Typescript b/xtask/coverage/Typescript deleted file mode 160000 index 61a96b1641ab..000000000000 --- a/xtask/coverage/Typescript +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 61a96b1641abe24c4adc3633eb936df89eb991f2 diff --git a/xtask/coverage/babel b/xtask/coverage/babel deleted file mode 160000 index 33a6be4e56b1..000000000000 --- a/xtask/coverage/babel +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 33a6be4e56b149647c15fd6c0157c1413456851d diff --git a/xtask/coverage/src/js/test262.rs b/xtask/coverage/src/js/test262.rs index 9240196fde6d..7ed8593e8286 100644 --- a/xtask/coverage/src/js/test262.rs +++ b/xtask/coverage/src/js/test262.rs @@ -9,6 +9,8 @@ use regex::Regex; use serde::Deserialize; use std::io; use std::path::Path; +use std::process::Command; +use xtask::project_root; const BASE_PATH: &str = "xtask/coverage/test262/test"; @@ -160,6 +162,25 @@ impl TestSuite for Test262TestSuite { BASE_PATH } + fn checkout(&self) -> io::Result<()> { + let base_path = project_root().join(BASE_PATH); + let mut command = Command::new("git"); + command + .arg("clone") + .arg("https://github.com/tc39/test262.git") + .arg("--depth") + .arg("1") + .arg(base_path.display().to_string()); + command.output()?; + let mut command = Command::new("git"); + command + .arg("reset") + .arg("--hard") + .arg("715dd1073bc060f4ee221e2e74770f5728e7b8a0"); + command.output()?; + Ok(()) + } + fn is_test(&self, path: &Path) -> bool { match path.extension() { None => false, diff --git a/xtask/coverage/src/jsx/jsx_babel.rs b/xtask/coverage/src/jsx/jsx_babel.rs index 26ddb788f57b..5d78e313abc7 100644 --- a/xtask/coverage/src/jsx/jsx_babel.rs +++ b/xtask/coverage/src/jsx/jsx_babel.rs @@ -6,7 +6,10 @@ use crate::{ use biome_js_parser::{parse, JsParserOptions}; use biome_js_syntax::{JsFileSource, ModuleKind}; use biome_rowan::SyntaxKind; +use std::io; use std::path::Path; +use std::process::Command; +use xtask::project_root; const OK_PATH: &str = "xtask/coverage/babel/packages/babel-parser/test/fixtures/jsx/basic"; @@ -88,4 +91,21 @@ impl TestSuite for BabelJsxTestSuite { let code = check_file_encoding(path)?; Some(Box::new(BabelJsxTestCase::new(path, code))) } + fn checkout(&self) -> io::Result<()> { + let base_path = project_root().join("xtask/coverage/babel"); + let mut command = Command::new("git"); + command + .arg("clone") + .arg("https://github.com/babel/babel.git") + .arg(base_path.display().to_string()); + command.output()?; + let mut command = Command::new("git"); + command + .arg("reset") + .arg("--hard") + .arg("33a6be4e56b149647c15fd6c0157c1413456851d"); + command.output()?; + + Ok(()) + } } diff --git a/xtask/coverage/src/runner.rs b/xtask/coverage/src/runner.rs index a659314e3559..79305fa4de8f 100644 --- a/xtask/coverage/src/runner.rs +++ b/xtask/coverage/src/runner.rs @@ -9,6 +9,7 @@ use biome_js_parser::{parse, JsParserOptions, Parse}; use biome_js_syntax::{AnyJsRoot, JsFileSource, JsSyntaxNode}; use biome_rowan::SyntaxKind; use std::fmt::Debug; +use std::io; use std::panic::RefUnwindSafe; use std::path::Path; use walkdir::WalkDir; @@ -183,6 +184,7 @@ pub(crate) trait TestSuite: Send + Sync { fn base_path(&self) -> &str; fn is_test(&self, path: &Path) -> bool; fn load_test(&self, path: &Path) -> Option>; + fn checkout(&self) -> io::Result<()>; } pub(crate) struct TestSuiteInstance { @@ -221,6 +223,7 @@ pub(crate) fn run_test_suite( test_suite: &dyn TestSuite, context: &mut TestRunContext, ) -> TestResults { + test_suite.checkout().expect("To checkout the repository"); context.reporter.test_suite_started(test_suite); let instance = load_tests(test_suite, context); context.reporter.test_suite_run_started(&instance); diff --git a/xtask/coverage/src/symbols/msts.rs b/xtask/coverage/src/symbols/msts.rs index 72352189e512..2e3248b1aaa1 100644 --- a/xtask/coverage/src/symbols/msts.rs +++ b/xtask/coverage/src/symbols/msts.rs @@ -8,8 +8,11 @@ use crate::runner::{TestCase, TestCaseFiles, TestRunOutcome, TestSuite}; use biome_js_parser::JsParserOptions; use std::collections::HashSet; use std::fmt::Write; +use std::io; use std::path::{Path, PathBuf}; +use std::process::Command; use std::str::FromStr; +use xtask::project_root; const CASES_PATH: &str = "xtask/coverage/Typescript/tests/baselines/reference"; const BASE_PATH: &str = "xtask/coverage/Typescript"; @@ -193,6 +196,26 @@ impl TestSuite for SymbolsMicrosoftTestSuite { } } + fn checkout(&self) -> io::Result<()> { + let base_path = project_root().join(BASE_PATH); + let mut command = Command::new("git"); + command + .arg("clone") + .arg("https://github.com/microsoft/Typescript.git") + .arg("--depth") + .arg("1") + .arg(base_path.display().to_string()); + command.output()?; + let mut command = Command::new("git"); + command + .arg("reset") + .arg("--hard") + .arg("61a96b1641abe24c4adc3633eb936df89eb991f2"); + command.output()?; + + Ok(()) + } + fn load_test(&self, path: &Path) -> Option> { Some(Box::new(SymbolsMicrosoftTestCase::new(path))) } diff --git a/xtask/coverage/src/ts/ts_babel.rs b/xtask/coverage/src/ts/ts_babel.rs index 1099f2a28eed..001c0f19d38d 100644 --- a/xtask/coverage/src/ts/ts_babel.rs +++ b/xtask/coverage/src/ts/ts_babel.rs @@ -6,7 +6,10 @@ use crate::{ use biome_js_parser::JsParserOptions; use biome_js_syntax::{JsFileSource, LanguageVariant}; use biome_rowan::SyntaxKind; +use std::io; use std::path::Path; +use std::process::Command; +use xtask::project_root; const CASES_PATH: &str = "xtask/coverage/babel/packages/babel-parser/test/fixtures/typescript"; @@ -89,6 +92,26 @@ impl TestSuite for BabelTypescriptTestSuite { CASES_PATH } + fn checkout(&self) -> io::Result<()> { + let base_path = project_root().join("xtask/coverage/babel"); + let mut command = Command::new("git"); + command + .arg("clone") + .arg("https://github.com/babel/babel.git") + .arg("--depth") + .arg("1") + .arg(base_path.display().to_string()); + command.output()?; + let mut command = Command::new("git"); + command + .arg("reset") + .arg("--hard") + .arg("33a6be4e56b149647c15fd6c0157c1413456851d"); + command.output()?; + + Ok(()) + } + fn is_test(&self, path: &std::path::Path) -> bool { path.extension().map_or(false, |x| x == "ts") } diff --git a/xtask/coverage/src/ts/ts_microsoft.rs b/xtask/coverage/src/ts/ts_microsoft.rs index 18f87f2fe734..4a0af034eb8d 100644 --- a/xtask/coverage/src/ts/ts_microsoft.rs +++ b/xtask/coverage/src/ts/ts_microsoft.rs @@ -8,7 +8,10 @@ use biome_rowan::{AstNode, SyntaxKind}; use regex::Regex; use std::convert::TryFrom; use std::fmt::Write; +use std::io; use std::path::Path; +use std::process::Command; +use xtask::project_root; const CASES_PATH: &str = "xtask/coverage/Typescript/tests/cases"; const REFERENCE_PATH: &str = "xtask/coverage/Typescript/tests/baselines/reference"; @@ -95,6 +98,25 @@ impl TestSuite for MicrosoftTypescriptTestSuite { let code = check_file_encoding(path)?; Some(Box::new(MicrosoftTypeScriptTestCase::new(path, code))) } + + fn checkout(&self) -> io::Result<()> { + let base_path = project_root().join("xtask/coverage/Typescript"); + let mut command = Command::new("git"); + command + .arg("clone") + .arg("https://github.com/microsoft/Typescript.git") + .arg("--depth") + .arg("1") + .arg(base_path.display().to_string()); + command.output()?; + let mut command = Command::new("git"); + command + .arg("reset") + .arg("--hard") + .arg("61a96b1641abe24c4adc3633eb936df89eb991f2"); + command.output()?; + Ok(()) + } } struct TestCaseMetadata { diff --git a/xtask/coverage/test262 b/xtask/coverage/test262 deleted file mode 160000 index 715dd1073bc0..000000000000 --- a/xtask/coverage/test262 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 715dd1073bc060f4ee221e2e74770f5728e7b8a0