mirror of
https://github.com/gorhill/uBlock.git
synced 2026-03-11 09:04:36 +00:00
Use "make mv3-edge" to build Edge package
This commit is contained in:
parent
c569f663ee
commit
e102a5ee06
3 changed files with 47 additions and 67 deletions
14
Makefile
14
Makefile
|
|
@ -2,12 +2,13 @@
|
||||||
run_options := $(filter-out $@,$(MAKECMDGOALS))
|
run_options := $(filter-out $@,$(MAKECMDGOALS))
|
||||||
|
|
||||||
.PHONY: all clean cleanassets test lint chromium opera firefox npm dig \
|
.PHONY: all clean cleanassets test lint chromium opera firefox npm dig \
|
||||||
mv3 mv3-quick mv3-chromium mv3-firefox \
|
mv3-chromium mv3-firefox mv3-edge \
|
||||||
compare maxcost medcost mincost modifiers record wasm
|
compare maxcost medcost mincost modifiers record wasm
|
||||||
|
|
||||||
sources := $(wildcard assets/* assets/*/* dist/version src/* src/*/* src/*/*/* src/*/*/*/*)
|
sources := $(wildcard assets/* assets/*/* dist/version src/* src/*/* src/*/*/* src/*/*/*/*)
|
||||||
platform := $(wildcard platform/* platform/*/* platform/*/*/* platform/*/*/*/* platform/*/*/*/*/*)
|
platform := $(wildcard platform/* platform/*/* platform/*/*/* platform/*/*/*/* platform/*/*/*/*/*)
|
||||||
assets := dist/build/uAssets
|
assets := dist/build/uAssets
|
||||||
|
mv3-assets := dist/build/mv3-data/*
|
||||||
|
|
||||||
all: chromium firefox npm
|
all: chromium firefox npm
|
||||||
|
|
||||||
|
|
@ -61,21 +62,20 @@ dig: dist/build/uBlock0.dig
|
||||||
dig-snfe: dig
|
dig-snfe: dig
|
||||||
cd dist/build/uBlock0.dig && npm run snfe $(run_options)
|
cd dist/build/uBlock0.dig && npm run snfe $(run_options)
|
||||||
|
|
||||||
dist/build/uBOLite.chromium: tools/make-mv3.sh $(sources) $(platform)
|
dist/build/uBOLite.chromium: tools/make-mv3.sh $(sources) $(platform) $(mv3-assets)
|
||||||
tools/make-mv3.sh chromium
|
tools/make-mv3.sh chromium
|
||||||
|
|
||||||
mv3-chromium: dist/build/uBOLite.chromium
|
mv3-chromium: dist/build/uBOLite.chromium
|
||||||
|
|
||||||
dist/build/uBOLite.firefox: tools/make-mv3.sh $(sources) $(platform)
|
dist/build/uBOLite.firefox: tools/make-mv3.sh $(sources) $(platform) $(mv3-assets)
|
||||||
tools/make-mv3.sh firefox
|
tools/make-mv3.sh firefox
|
||||||
|
|
||||||
mv3-firefox: dist/build/uBOLite.firefox
|
mv3-firefox: dist/build/uBOLite.firefox
|
||||||
|
|
||||||
mv3-quick: tools/make-mv3.sh $(sources) $(platform)
|
dist/build/uBOLite.edge: tools/make-mv3.sh tools/make-edge.mjs $(sources) $(platform) $(mv3-assets)
|
||||||
tools/make-mv3.sh quick
|
tools/make-mv3.sh edge
|
||||||
|
|
||||||
mv3-full: tools/make-mv3.sh $(sources) $(platform)
|
mv3-edge: dist/build/uBOLite.edge
|
||||||
tools/make-mv3.sh full
|
|
||||||
|
|
||||||
dist/build/uAssets:
|
dist/build/uAssets:
|
||||||
tools/pull-assets.sh
|
tools/pull-assets.sh
|
||||||
|
|
|
||||||
|
|
@ -1,24 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# This script assumes a linux environment
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
echo "*** uBOLite.edge: Creating web store package"
|
|
||||||
|
|
||||||
DES=dist/build/uBOLite.edge
|
|
||||||
rm -rf $DES
|
|
||||||
mkdir -p $DES
|
|
||||||
|
|
||||||
echo "*** uBOLite.edge: Copying reference chromium-based files"
|
|
||||||
cp -R dist/build/uBOLite.chromium/* $DES/
|
|
||||||
|
|
||||||
# Edge store requires that all DNR rulesets are at the root of the package
|
|
||||||
# https://learn.microsoft.com/answers/questions/918426/cant-update-extension-with-declarative-net-request
|
|
||||||
echo "*** uBOLite.edge: Modify reference implementation for Edge compatibility"
|
|
||||||
mv $DES/rulesets/main/* $DES/
|
|
||||||
rmdir $DES/rulesets/main
|
|
||||||
# Patch manifest.json
|
|
||||||
node tools/make-edge.mjs
|
|
||||||
|
|
||||||
echo "*** uBOLite.edge: Package done."
|
|
||||||
|
|
@ -11,9 +11,6 @@ PLATFORM="chromium"
|
||||||
|
|
||||||
for i in "$@"; do
|
for i in "$@"; do
|
||||||
case $i in
|
case $i in
|
||||||
quick)
|
|
||||||
QUICK="yes"
|
|
||||||
;;
|
|
||||||
full)
|
full)
|
||||||
FULL="yes"
|
FULL="yes"
|
||||||
;;
|
;;
|
||||||
|
|
@ -23,6 +20,9 @@ for i in "$@"; do
|
||||||
chromium)
|
chromium)
|
||||||
PLATFORM="chromium"
|
PLATFORM="chromium"
|
||||||
;;
|
;;
|
||||||
|
edge)
|
||||||
|
PLATFORM="edge"
|
||||||
|
;;
|
||||||
uBOLite_+([0-9]).+([0-9]).+([0-9]).+([0-9]))
|
uBOLite_+([0-9]).+([0-9]).+([0-9]).+([0-9]))
|
||||||
TAGNAME="$i"
|
TAGNAME="$i"
|
||||||
FULL="yes"
|
FULL="yes"
|
||||||
|
|
@ -39,9 +39,7 @@ echo "BEFORE=$BEFORE"
|
||||||
|
|
||||||
DES="dist/build/uBOLite.$PLATFORM"
|
DES="dist/build/uBOLite.$PLATFORM"
|
||||||
|
|
||||||
if [ "$QUICK" != "yes" ]; then
|
rm -rf $DES
|
||||||
rm -rf $DES
|
|
||||||
fi
|
|
||||||
|
|
||||||
mkdir -p $DES
|
mkdir -p $DES
|
||||||
cd $DES
|
cd $DES
|
||||||
|
|
@ -95,38 +93,44 @@ cp platform/mv3/extension/img/* "$DES"/img/
|
||||||
cp -R platform/mv3/extension/_locales "$DES"/
|
cp -R platform/mv3/extension/_locales "$DES"/
|
||||||
cp platform/mv3/README.md "$DES/"
|
cp platform/mv3/README.md "$DES/"
|
||||||
|
|
||||||
if [ "$QUICK" != "yes" ]; then
|
echo "*** uBOLite.mv3: Generating rulesets"
|
||||||
echo "*** uBOLite.mv3: Generating rulesets"
|
TMPDIR=$(mktemp -d)
|
||||||
TMPDIR=$(mktemp -d)
|
mkdir -p "$TMPDIR"
|
||||||
mkdir -p "$TMPDIR"
|
if [ "$PLATFORM" = "chromium" ] || [ "$PLATFORM" = "edge" ]; then
|
||||||
if [ "$PLATFORM" = "chromium" ]; then
|
cp platform/mv3/chromium/manifest.json "$DES"/
|
||||||
cp platform/mv3/chromium/manifest.json "$DES"/
|
elif [ "$PLATFORM" = "firefox" ]; then
|
||||||
elif [ "$PLATFORM" = "firefox" ]; then
|
cp platform/mv3/firefox/manifest.json "$DES"/
|
||||||
cp platform/mv3/firefox/manifest.json "$DES"/
|
fi
|
||||||
fi
|
./tools/make-nodejs.sh "$TMPDIR"
|
||||||
./tools/make-nodejs.sh "$TMPDIR"
|
cp platform/mv3/package.json "$TMPDIR"/
|
||||||
cp platform/mv3/package.json "$TMPDIR"/
|
cp platform/mv3/*.js "$TMPDIR"/
|
||||||
cp platform/mv3/*.js "$TMPDIR"/
|
cp platform/mv3/*.mjs "$TMPDIR"/
|
||||||
cp platform/mv3/*.mjs "$TMPDIR"/
|
cp platform/mv3/extension/js/utils.js "$TMPDIR"/js/
|
||||||
cp platform/mv3/extension/js/utils.js "$TMPDIR"/js/
|
cp -R "$UBO_DIR"/src/js/resources "$TMPDIR"/js/
|
||||||
cp -R "$UBO_DIR"/src/js/resources "$TMPDIR"/js/
|
cp "$UBO_DIR"/assets/assets.dev.json "$TMPDIR"/
|
||||||
cp "$UBO_DIR"/assets/assets.dev.json "$TMPDIR"/
|
cp -R platform/mv3/scriptlets "$TMPDIR"/
|
||||||
cp -R platform/mv3/scriptlets "$TMPDIR"/
|
mkdir -p "$TMPDIR"/web_accessible_resources
|
||||||
mkdir -p "$TMPDIR"/web_accessible_resources
|
cp "$UBO_DIR"/src/web_accessible_resources/* "$TMPDIR"/web_accessible_resources/
|
||||||
cp "$UBO_DIR"/src/web_accessible_resources/* "$TMPDIR"/web_accessible_resources/
|
cd "$TMPDIR"
|
||||||
cd "$TMPDIR"
|
node --no-warnings make-rulesets.js output="$DES" platform="$PLATFORM"
|
||||||
node --no-warnings make-rulesets.js output="$DES" platform="$PLATFORM"
|
if [ -n "$BEFORE" ]; then
|
||||||
if [ -n "$BEFORE" ]; then
|
echo "*** uBOLite.mv3: salvaging rule ids to minimize diff size"
|
||||||
echo "*** uBOLite.mv3: salvaging rule ids to minimize diff size"
|
echo " before=$BEFORE/$PLATFORM"
|
||||||
echo " before=$BEFORE/$PLATFORM"
|
echo " after=$DES"
|
||||||
echo " after=$DES"
|
node salvage-ruleids.mjs before="$BEFORE"/"$PLATFORM" after="$DES"
|
||||||
node salvage-ruleids.mjs before="$BEFORE"/"$PLATFORM" after="$DES"
|
fi
|
||||||
fi
|
cd - > /dev/null
|
||||||
cd - > /dev/null
|
rm -rf "$TMPDIR"
|
||||||
rm -rf "$TMPDIR"
|
|
||||||
|
# For Edge, declared rulesets must be at package root
|
||||||
|
if [ "$PLATFORM" = "edge" ]; then
|
||||||
|
echo "*** uBOLite.edge: Modify reference implementation for Edge compatibility"
|
||||||
|
mv "$DES"/rulesets/main/* "$DES/"
|
||||||
|
rmdir "$DES/rulesets/main"
|
||||||
|
node tools/make-edge.mjs
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "*** uBOLite.mv3: extension ready"
|
echo "*** uBOLite.$PLATFORM: extension ready"
|
||||||
echo "Extension location: $DES/"
|
echo "Extension location: $DES/"
|
||||||
|
|
||||||
# Local build
|
# Local build
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue