Skip to content

Commit

Permalink
tools: recognize GN files in dep_updaters
Browse files Browse the repository at this point in the history
PR-URL: #50693
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Michael Dawson <midawson@redhat.com>
  • Loading branch information
zcbenz authored and UlisesGascon committed Dec 19, 2023
1 parent 22d729e commit 66764c5
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 23 deletions.
4 changes: 2 additions & 2 deletions tools/dep_updaters/update-ada.sh
Expand Up @@ -54,8 +54,8 @@ rm "$ADA_ZIP"

curl -sL -o "$ADA_LICENSE" "https://raw.githubusercontent.com/ada-url/ada/HEAD/LICENSE-MIT"

echo "Replacing existing ada (except GYP build files)"
mv "$DEPS_DIR/ada/"*.gyp "$DEPS_DIR/ada/README.md" "$WORKSPACE/"
echo "Replacing existing ada (except GYP and GN build files)"
mv "$DEPS_DIR/ada/"*.gyp "$DEPS_DIR/ada/"*.gn "$DEPS_DIR/ada/"*.gni "$DEPS_DIR/ada/README.md" "$WORKSPACE/"
rm -rf "$DEPS_DIR/ada"
mv "$WORKSPACE" "$DEPS_DIR/ada"

Expand Down
5 changes: 4 additions & 1 deletion tools/dep_updaters/update-brotli.sh
Expand Up @@ -60,12 +60,15 @@ mv "brotli-$NEW_VERSION" "brotli"
echo "Copying existing gyp file"
cp "$DEPS_DIR/brotli/brotli.gyp" "$WORKSPACE/brotli"

echo "Copying existing GN files"
cp "$DEPS_DIR/brotli/"*.gn "$DEPS_DIR/brotli/"*.gni "$WORKSPACE/brotli"

echo "Deleting existing brotli"
rm -rf "$DEPS_DIR/brotli"
mkdir "$DEPS_DIR/brotli"

echo "Update c and LICENSE"
mv "$WORKSPACE/brotli/c" "$WORKSPACE/brotli/LICENSE" "$WORKSPACE/brotli/brotli.gyp" "$DEPS_DIR/brotli"
mv "$WORKSPACE/brotli/"*.gn "$WORKSPACE/brotli/"*.gni "$WORKSPACE/brotli/c" "$WORKSPACE/brotli/LICENSE" "$WORKSPACE/brotli/brotli.gyp" "$DEPS_DIR/brotli"

# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need
Expand Down
3 changes: 2 additions & 1 deletion tools/dep_updaters/update-c-ares.sh
Expand Up @@ -56,10 +56,11 @@ mv "c-ares-$NEW_VERSION" cares
echo "Removing tests"
rm -rf "$WORKSPACE/cares/test"

echo "Copying existing .gitignore, config and gyp files"
echo "Copying existing .gitignore, config, gyp and gn files"
cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/"*.gn "$DEPS_DIR/cares/"*.gni "$WORKSPACE/cares"

echo "Replacing existing c-ares"
rm -rf "$DEPS_DIR/cares"
Expand Down
4 changes: 2 additions & 2 deletions tools/dep_updaters/update-libuv.sh
Expand Up @@ -59,8 +59,8 @@ gzip -dc "$LIBUV_TARBALL" | tar xf -
rm "$LIBUV_TARBALL"
mv libuv-libuv-* uv

echo "Replacing existing libuv (except GYP build files)"
mv "$DEPS_DIR/uv/"*.gyp "$DEPS_DIR/uv/"*.gypi "$WORKSPACE/uv/"
echo "Replacing existing libuv (except GYP and GN build files)"
mv "$DEPS_DIR/uv/"*.gyp "$DEPS_DIR/uv/"*.gypi "$DEPS_DIR/uv/"*.gn "$DEPS_DIR/uv/"*.gni "$WORKSPACE/uv/"
rm -rf "$DEPS_DIR/uv"
mv "$WORKSPACE/uv" "$DEPS_DIR/"

Expand Down
5 changes: 5 additions & 0 deletions tools/dep_updaters/update-llhttp.sh
Expand Up @@ -45,6 +45,9 @@ trap cleanup INT TERM EXIT

cd "$WORKSPACE"

echo "Replacing existing llhttp (except GYP and GN build files)"
mv "$DEPS_DIR/llhttp/"*.gn "$DEPS_DIR/llhttp/"*.gni "$WORKSPACE/"

if echo "$NEW_VERSION" | grep -qs "/" ; then # Download a release
REPO="git@github.com:$NEW_VERSION.git"
BRANCH=$2
Expand Down Expand Up @@ -74,6 +77,8 @@ else
cp -a "llhttp-release-v$NEW_VERSION" "$DEPS_DIR/llhttp"
fi

mv "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/llhttp"

# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need
# to add it to $GITHUB_ENV variable
Expand Down
3 changes: 3 additions & 0 deletions tools/dep_updaters/update-nghttp2.sh
Expand Up @@ -73,6 +73,9 @@ cp "$DEPS_DIR/nghttp2/lib/includes/config.h" "$WORKSPACE/nghttp2/lib/includes"
echo "Copying existing gyp files"
cp "$DEPS_DIR/nghttp2/nghttp2.gyp" "$WORKSPACE/nghttp2"

echo "Copying existing GN files"
cp "$DEPS_DIR/nghttp2/"*.gn "$DEPS_DIR/nghttp2/"*.gni "$WORKSPACE/nghttp2"

echo "Replacing existing nghttp2"
rm -rf "$DEPS_DIR/nghttp2"
mv "$WORKSPACE/nghttp2" "$DEPS_DIR/"
Expand Down
42 changes: 28 additions & 14 deletions tools/dep_updaters/update-postject.sh
Expand Up @@ -7,35 +7,49 @@

set -ex

ROOT=$(cd "$(dirname "$0")/../.." && pwd)
[ -z "$NODE" ] && NODE="$ROOT/out/Release/node"
BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd)
DEPS_DIR="$BASE_DIR/deps"
[ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node"
[ -x "$NODE" ] || NODE=$(command -v node)
NPM="$ROOT/deps/npm/bin/npm-cli.js"
NPM="$BASE_DIR/deps/npm/bin/npm-cli.js"

# shellcheck disable=SC1091
. "$ROOT/tools/dep_updaters/utils.sh"
. "$BASE_DIR/tools/dep_updaters/utils.sh"

NEW_VERSION=$("$NODE" "$NPM" view postject dist-tags.latest)
CURRENT_VERSION=$("$NODE" -p "require('./test/fixtures/postject-copy/node_modules/postject/package.json').version")

# This function exit with 0 if new version and current version are the same
compare_dependency_version "postject" "$NEW_VERSION" "$CURRENT_VERSION"

cd "$( dirname "$0" )/../.." || exit
rm -rf test/fixtures/postject-copy
mkdir test/fixtures/postject-copy
cd test/fixtures/postject-copy || exit
echo "Making temporary workspace..."

WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')

cleanup () {
EXIT_CODE=$?
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
exit $EXIT_CODE
}

trap cleanup INT TERM EXIT

cd "$WORKSPACE"

echo "Installing postject npm package..."

"$NODE" "$NPM" init --yes

"$NODE" "$NPM" install --no-bin-links --ignore-scripts "postject@$NEW_VERSION"

# TODO(RaisinTen): Replace following with $WORKSPACE
cd ../../..
rm -rf deps/postject
mkdir deps/postject
cp test/fixtures/postject-copy/node_modules/postject/LICENSE deps/postject
cp test/fixtures/postject-copy/node_modules/postject/dist/postject-api.h deps/postject
echo "Replacing existing postject (except GN build files)"

mv "$DEPS_DIR/postject/"*.gn "$DEPS_DIR/postject/"*.gni "$WORKSPACE/"
rm -rf "$DEPS_DIR/postject"
mkdir "$DEPS_DIR/postject"
mv "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/postject"
mv "$WORKSPACE/node_modules/postject/LICENSE" "$DEPS_DIR/postject"
mv "$WORKSPACE/node_modules/postject/dist/postject-api.h" "$DEPS_DIR/postject"

# Update the version number on maintaining-dependencies.md
# and print the new version as the last line of the script as we need
Expand Down
4 changes: 2 additions & 2 deletions tools/dep_updaters/update-simdutf.sh
Expand Up @@ -54,8 +54,8 @@ rm ./*_demo.cpp

curl -sL -o "$SIMDUTF_LICENSE" "https://raw.githubusercontent.com/simdutf/simdutf/HEAD/LICENSE-MIT"

echo "Replacing existing simdutf (except GYP build files)"
mv "$DEPS_DIR/simdutf/"*.gyp "$DEPS_DIR/simdutf/README.md" "$WORKSPACE/"
echo "Replacing existing simdutf (except GYP and GN build files)"
mv "$DEPS_DIR/simdutf/"*.gyp "$DEPS_DIR/simdutf/"*.gn "$DEPS_DIR/simdutf/"*.gni "$DEPS_DIR/simdutf/README.md" "$WORKSPACE/"
rm -rf "$DEPS_DIR/simdutf"
mv "$WORKSPACE" "$DEPS_DIR/simdutf"

Expand Down
6 changes: 5 additions & 1 deletion tools/dep_updaters/update-uvwasi.sh
Expand Up @@ -54,13 +54,17 @@ log_and_verify_sha256sum "uvwasi" "$UVWASI_ZIP.zip"

echo "Moving existing GYP build file"
mv "$DEPS_DIR/uvwasi/"*.gyp "$WORKSPACE/"

echo "Moving existing GN build file"
mv "$DEPS_DIR/uvwasi/"*.gn "$DEPS_DIR/uvwasi/"*.gni "$WORKSPACE/"

rm -rf "$DEPS_DIR/uvwasi/"

echo "Unzipping..."
unzip "$UVWASI_ZIP.zip" -d "$DEPS_DIR/uvwasi/"
rm "$UVWASI_ZIP.zip"

mv "$WORKSPACE/"*.gyp "$DEPS_DIR/uvwasi/"
mv "$WORKSPACE/"*.gyp "$WORKSPACE/"*.gn "$WORKSPACE/"*.gni "$DEPS_DIR/uvwasi/"
cd "$DEPS_DIR/uvwasi/"

echo "Copying new files to deps folder"
Expand Down

0 comments on commit 66764c5

Please sign in to comment.