From 76ef1a88292bca840999c653bef04a4fe8cbcfed Mon Sep 17 00:00:00 2001 From: raskad <32105367+raskad@users.noreply.github.com> Date: Thu, 31 Mar 2022 14:02:20 +0000 Subject: [PATCH] Remove `git2` and `hex` dependencies (#1992) This removes the only use of the `git2` and `hex` dependencies by reading the test262 submodule commit id directly from the `.git` directory. Because `git2` depends on a lot of other crates, this removes a bunch of dependencies. --- Cargo.lock | 157 -------------------------------------- boa_tester/Cargo.toml | 2 - boa_tester/src/results.rs | 21 ++--- 3 files changed, 5 insertions(+), 175 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a9cbf5c87b..e4232916df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,8 +161,6 @@ dependencies = [ "colored", "fxhash", "gc", - "git2", - "hex", "num-format", "once_cell", "rayon", @@ -227,9 +225,6 @@ name = "cc" version = "1.0.73" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fff2a6927b3bb87f9595d67196a70493f627687a71d87a0d692242c33f58c11" -dependencies = [ - "jobserver", -] [[package]] name = "cfg-if" @@ -515,16 +510,6 @@ dependencies = [ "num-traits", ] -[[package]] -name = "form_urlencoded" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" -dependencies = [ - "matches", - "percent-encoding", -] - [[package]] name = "fs_extra" version = "1.2.0" @@ -574,21 +559,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "git2" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c" -dependencies = [ - "bitflags", - "libc", - "libgit2-sys", - "log", - "openssl-probe", - "openssl-sys", - "url", -] - [[package]] name = "half" version = "1.8.2" @@ -628,23 +598,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "idna" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418a0a6fab821475f634efe3ccc45c013f742efe03d853e8d3355d5cb850ecf8" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "indexmap" version = "1.8.0" @@ -715,15 +668,6 @@ dependencies = [ "libc", ] -[[package]] -name = "jobserver" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af25a77299a7f711a01975c35a6a424eb6862092cc2d6c72c4ed6cbc56dfc1fa" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.55" @@ -745,46 +689,6 @@ version = "0.2.121" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "efaa7b300f3b5fe8eb6bf21ce3895e1751d9665086af2d64b42f19701015ff4f" -[[package]] -name = "libgit2-sys" -version = "0.13.2+1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b" -dependencies = [ - "cc", - "libc", - "libssh2-sys", - "libz-sys", - "openssl-sys", - "pkg-config", -] - -[[package]] -name = "libssh2-sys" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b094a36eb4b8b8c8a7b4b8ae43b2944502be3e59cd87687595cf6b0a71b3f4ca" -dependencies = [ - "cc", - "libc", - "libz-sys", - "openssl-sys", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "libz-sys" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5435b8549c16d423ed0c03dbaafe57cf6c3344744f1242520d59c9d8ecec66" -dependencies = [ - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "linked-hash-map" version = "0.5.4" @@ -815,12 +719,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "matches" -version = "0.1.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a3e378b66a060d48947b590737b30a1be76706c8dd7b8ba0f2fe3989c68a853f" - [[package]] name = "measureme" version = "10.0.0" @@ -950,25 +848,6 @@ version = "11.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575" -[[package]] -name = "openssl-probe" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" - -[[package]] -name = "openssl-sys" -version = "0.9.72" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e46109c383602735fa0a2e48dd2b7c892b048e1bf69e5c3b1d804b7d9c203cb" -dependencies = [ - "autocfg", - "cc", - "libc", - "pkg-config", - "vcpkg", -] - [[package]] name = "os_str_bytes" version = "6.0.0" @@ -1003,12 +882,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "percent-encoding" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" - [[package]] name = "perf-event-open-sys" version = "1.0.1" @@ -1062,12 +935,6 @@ dependencies = [ "siphasher", ] -[[package]] -name = "pkg-config" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58893f751c9b0412871a09abd62ecd2a00298c6c83befa223ef98c52aef40cbe" - [[package]] name = "plotters" version = "0.3.1" @@ -1569,12 +1436,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" -[[package]] -name = "unicode-bidi" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a01404663e3db436ed2746d9fefef640d868edae3cceb81c3b8d5732fda678f" - [[package]] name = "unicode-general-category" version = "0.5.1" @@ -1608,30 +1469,12 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ccb82d61f80a663efe1f787a51b16b5a51e3314d6ac365b08639f52387b33f3" -[[package]] -name = "url" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507c383b2d33b5fc35d1861e77e6b383d158b2da5e14fe51b83dfedf6fd578c" -dependencies = [ - "form_urlencoded", - "idna", - "matches", - "percent-encoding", -] - [[package]] name = "utf8parse" version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "936e4b492acfd135421d8dca4b1aa80a7bfc26e702ef3af710e0752684df5372" -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - [[package]] name = "vec_map" version = "0.8.2" diff --git a/boa_tester/Cargo.toml b/boa_tester/Cargo.toml index 4a68eeb73b..911f96c090 100644 --- a/boa_tester/Cargo.toml +++ b/boa_tester/Cargo.toml @@ -22,8 +22,6 @@ regex = "1.5.5" once_cell = "1.10.0" colored = "2.0.0" fxhash = "0.2.1" -git2 = "0.14.2" -hex = "0.4.3" num-format = "0.4.0" gc = { version = "0.4.1", features = ["derive"] } rayon = "1.5.1" diff --git a/boa_tester/src/results.rs b/boa_tester/src/results.rs index 3f369c4f50..1e2856c49d 100644 --- a/boa_tester/src/results.rs +++ b/boa_tester/src/results.rs @@ -1,6 +1,4 @@ use super::SuiteResult; -use git2::Repository; -use hex::ToHex; use serde::{Deserialize, Serialize}; use std::{ env, fs, @@ -175,20 +173,11 @@ pub(crate) fn write_json( /// Gets the commit OID of the test262 submodule. fn get_test262_commit() -> Box { - let repo = Repository::open(".").expect("could not open git repository in current directory"); - - let submodule = repo - .submodules() - .expect("could not get the list of submodules of the repo") - .into_iter() - .find(|sub| sub.path() == Path::new("test262")) - .expect("test262 submodule not found"); - - submodule - .index_id() - .expect("could not get the commit OID") - .encode_hex::() - .into_boxed_str() + let mut commit_id = fs::read_to_string(".git/modules/test262/HEAD") + .expect("did not find git submodule ref at '.git/modules/test262/HEAD'"); + // Remove newline. + commit_id.pop(); + commit_id.into_boxed_str() } /// Updates the GitHub pages repository by pulling latest changes before writing the new things.