From 63591ef2aa818bced3dc5d7bd0bbb1c397e44e2f Mon Sep 17 00:00:00 2001 From: Manish Jethani Date: Thu, 29 Jul 2021 19:36:49 +0530 Subject: [PATCH] Make uAssets a submodule --- .github/workflows/main.yml | 4 +--- .gitmodules | 3 +++ submodules/uAssets | 1 + tools/make-assets.sh | 17 ++--------------- tools/make-browser.sh | 4 ++-- tools/make-nodejs.sh | 17 ++--------------- 6 files changed, 11 insertions(+), 35 deletions(-) create mode 100644 .gitmodules create mode 160000 submodules/uAssets diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2c61352db..c79a9e400 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,9 +19,7 @@ jobs: persist-credentials: false - name: Clone uAssets run: | - pushd .. - git clone --depth 1 https://github.com/uBlockOrigin/uAssets.git - popd + git submodule update --depth 1 --init # https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html - name: Get release information id: release_info diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..3c5855f81 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "submodules/uAssets"] + path = submodules/uAssets + url = https://github.com/uBlockOrigin/uAssets.git diff --git a/submodules/uAssets b/submodules/uAssets new file mode 160000 index 000000000..fabf04d2e --- /dev/null +++ b/submodules/uAssets @@ -0,0 +1 @@ +Subproject commit fabf04d2e6761a733cef539a57267e5133ffb6c9 diff --git a/tools/make-assets.sh b/tools/make-assets.sh index 2962a3e1e..1c1188abf 100755 --- a/tools/make-assets.sh +++ b/tools/make-assets.sh @@ -11,15 +11,8 @@ cp -R ./assets $DES/ mkdir $DES/thirdparties -# Use existing uAssets, or git-clone a temporary one -if [ -d "../uAssets" ]; then - UASSETS=../uAssets -else - echo "*** ../uAssets not present, git-cloning..." - TMPDIR=$(mktemp -d) - UASSETS=$TMPDIR/uAssets - git clone --depth=1 https://github.com/uBlockOrigin/uAssets.git $UASSETS -fi +git submodule update --depth 1 --init +UASSETS=submodules/uAssets cp -R $UASSETS/thirdparties/easylist-downloads.adblockplus.org $DES/thirdparties/ cp -R $UASSETS/thirdparties/pgl.yoyo.org $DES/thirdparties/ @@ -30,9 +23,3 @@ mkdir $DES/ublock cp -R $UASSETS/filters/* $DES/ublock/ # Optional filter lists: do not include in package rm $DES/ublock/annoyances.txt - -# Remove temporary git-clone uAssets -if [ -n "$TMPDIR" ]; then - echo "*** Removing temporary $TMPDIR" - rm -rf $TMPDIR -fi diff --git a/tools/make-browser.sh b/tools/make-browser.sh index 700157d19..4343d9f7d 100755 --- a/tools/make-browser.sh +++ b/tools/make-browser.sh @@ -25,9 +25,9 @@ cp -R src/lib/publicsuffixlist $DES/lib/ cp -R src/lib/regexanalyzer $DES/lib/ mkdir -p $DES/data -cp -R ../uAssets/thirdparties/publicsuffix.org/list/* \ +cp -R submodules/uAssets/thirdparties/publicsuffix.org/list/* \ $DES/data -cp -R ../uAssets/thirdparties/easylist-downloads.adblockplus.org/* \ +cp -R submodules/uAssets/thirdparties/easylist-downloads.adblockplus.org/* \ $DES/data cp platform/browser/*.html $DES/ diff --git a/tools/make-nodejs.sh b/tools/make-nodejs.sh index 91a4d36e2..186731650 100755 --- a/tools/make-nodejs.sh +++ b/tools/make-nodejs.sh @@ -21,15 +21,8 @@ cp -R src/lib/punycode.js $DES/lib/ cp -R src/lib/publicsuffixlist $DES/lib/ cp -R src/lib/regexanalyzer $DES/lib/ -# Use existing uAssets, or git-clone a temporary one -if [ -d "../uAssets" ]; then - UASSETS=../uAssets -else - echo "*** ../uAssets not present, git-cloning..." - TMPDIR=$(mktemp -d) - UASSETS=$TMPDIR/uAssets - git clone --depth=1 https://github.com/uBlockOrigin/uAssets.git $UASSETS -fi +git submodule update --depth 1 --init +UASSETS=submodules/uAssets # https://github.com/uBlockOrigin/uBlock-issues/issues/1664#issuecomment-888332409 THIRDPARTY=$UASSETS/thirdparties/publicsuffix.org @@ -42,12 +35,6 @@ node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easylist.txt', 'utf8'))" \ node -pe "JSON.stringify(fs.readFileSync('$THIRDPARTY/easyprivacy.txt', 'utf8'))" \ > $DES/data/easyprivacy.json -# Remove temporary git-clone uAssets -if [ -n "$TMPDIR" ]; then - echo "*** Removing temporary $TMPDIR" - rm -rf $TMPDIR -fi - cp platform/nodejs/*.js $DES/ cp platform/nodejs/*.json $DES/ cp LICENSE.txt $DES/