Skip to content

Commit

Permalink
chore: manually clone git modules instead of using submodules (#2274)
Browse files Browse the repository at this point in the history
closes #2231

Submodules are a blocker for beginners, we should make it clone on
demand.

It is also a blocker for people who wants to target this repo as a crate
for testing purposes, cargo will do a full clone if you specify
oxc_parser = { git = "this repo" } in Cargo.toml
  • Loading branch information
Boshen authored Feb 2, 2024
1 parent 28daf83 commit d2f7ea2
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 41 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true # Pull submodules for `cargo coverage`

- name: Install Rust Toolchain
uses: ./.github/actions/rustup

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
uses: taiki-e/install-action
with:
tool: cargo-llvm-cov,just

- name: Clone modules
run: just submodules

- name: Install llvm-tools-preview for llvm-cov
run: rustup component add llvm-tools-preview
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,18 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true # Pull submodules for `cargo coverage`

- name: Install Rust Toolchain
uses: ./.github/actions/rustup

- name: Install just
uses: taiki-e/install-action
with:
tool: just

- name: Clone modules
run: just submodules

- name: Set up Bun
uses: oven-sh/setup-bun@v1

Expand Down
20 changes: 0 additions & 20 deletions .gitmodules

This file was deleted.

18 changes: 10 additions & 8 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ ready:
just lint
git status

# Update our local branch with the remote branch (this is for you to sync the git submodules)
update:
git submodule sync
git submodule update --init --recursive
# Clone or update submodules
submodules:
just clone-submodule tasks/coverage/test262 [email protected]:tc39/test262.git 17ba9aea47e496f5b2bc6ce7405b3f32e3cfbf7a
just clone-submodule tasks/coverage/babel [email protected]:babel/babel.git eccbd203383487f6957dcf086aa83d773691560b
just clone-submodule tasks/coverage/typescript [email protected]:microsoft/TypeScript.git 64d2eeea7b9c7f1a79edf42cb99f302535136a2e
just clone-submodule tasks/prettier_conformance/prettier [email protected]:prettier/prettier.git ff83d55d05e92ceef10ec0cb1c0272ab894a00a0

# --no-vcs-ignores: cargo-watch has a bug loading all .gitignores, including the ones listed in .gitignore
# use .ignore file getting the ignore list
Expand Down Expand Up @@ -115,10 +117,10 @@ new-react-perf-rule name:
new-n-rule name:
cargo run -p rulegen {{name}} n

# Sync all submodules with their own remote repos (this is for Boshen updating the submodules)
sync-submodules:
git submodule update --init --remote

# Upgrade all Rust dependencies
upgrade:
cargo upgrade --incompatible

clone-submodule dir url sha:
git clone --depth=1 {{url}} {{dir}} || true
cd {{dir}} && git fetch origin {{sha}} && git reset --hard {{sha}}
1 change: 0 additions & 1 deletion tasks/coverage/babel
Submodule babel deleted from eccbd2
8 changes: 4 additions & 4 deletions tasks/coverage/src/suite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ pub trait Suite<T: Case> {
if paths.is_empty() {
println!("-------------------------------------------------------");
println!("git submodule is empty for {name}");
println!("Running `git submodule update --init`");
println!("Running `just submodules` to clone the submodules");
println!("This may take a while.");
println!("-------------------------------------------------------");
Command::new("git")
.args(["submodule", "update", "--init", "--progress"])
Command::new("just")
.args(["submodules"])
.stdout(Stdio::inherit())
.stderr(Stdio::inherit())
.output()
.expect("failed to execute `git submodule update --init`");
.expect("failed to execute `just submodules`");
paths = get_paths();
}

Expand Down
1 change: 0 additions & 1 deletion tasks/coverage/test262
Submodule test262 deleted from 17ba9a
1 change: 0 additions & 1 deletion tasks/coverage/typescript
Submodule typescript deleted from 64d2ee
1 change: 0 additions & 1 deletion tasks/prettier_conformance/prettier
Submodule prettier deleted from ff83d5

0 comments on commit d2f7ea2

Please sign in to comment.