Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove git modules for better internal experience #3054

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions .gitmodules

This file was deleted.

3 changes: 3 additions & 0 deletions xtask/coverage/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
babel/
test262/
Typescript/
1 change: 0 additions & 1 deletion xtask/coverage/Typescript
Submodule Typescript deleted from 61a96b
1 change: 0 additions & 1 deletion xtask/coverage/babel
Submodule babel deleted from 33a6be
21 changes: 21 additions & 0 deletions xtask/coverage/src/js/test262.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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,
Expand Down
20 changes: 20 additions & 0 deletions xtask/coverage/src/jsx/jsx_babel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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(())
}
}
3 changes: 3 additions & 0 deletions xtask/coverage/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<Box<dyn TestCase>>;
fn checkout(&self) -> io::Result<()>;
}

pub(crate) struct TestSuiteInstance {
Expand Down Expand Up @@ -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);
Expand Down
23 changes: 23 additions & 0 deletions xtask/coverage/src/symbols/msts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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<Box<dyn TestCase>> {
Some(Box::new(SymbolsMicrosoftTestCase::new(path)))
}
Expand Down
23 changes: 23 additions & 0 deletions xtask/coverage/src/ts/ts_babel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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")
}
Expand Down
22 changes: 22 additions & 0 deletions xtask/coverage/src/ts/ts_microsoft.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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 {
Expand Down
1 change: 0 additions & 1 deletion xtask/coverage/test262
Submodule test262 deleted from 715dd1
Loading