rename webext to webext-hybrid, add pure webext version

This commit is contained in:
gorhill 2017-08-04 18:19:55 -04:00
parent 8393e77ab0
commit e903752037
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
4 changed files with 77 additions and 8 deletions

View File

@ -43,7 +43,7 @@ for alpha2 in sorted(os.listdir(source_locale_dir)):
descriptions[alpha2] = strings['extShortDesc']['message']
webext_manifest['author'] = chromium_manifest['author'];
webext_manifest['name'] = chromium_manifest['name'] + '/webext';
webext_manifest['name'] = chromium_manifest['name'] + '/webext-hybrid'
webext_manifest['homepage'] = 'https://github.com/gorhill/uBlock'
webext_manifest['description'] = descriptions['en']
del descriptions['en']

View File

@ -2,10 +2,10 @@
#
# This script assumes a linux environment
echo "*** uBlock0.webext: Creating web store package"
echo "*** uBlock0.webext: Copying files"
echo "*** uBlock0.webext-hybrid: Creating web store package"
echo "*** uBlock0.webext-hybrid: Copying files"
DES=dist/build/uBlock0.webext
DES=dist/build/uBlock0.webext-hybrid
rm -rf $DES
mkdir -p $DES/webextension
@ -34,14 +34,14 @@ cp platform/webext/chrome.manifest $DES/
cp platform/webext/install.rdf $DES/
mv $DES/webextension/img/icon_128.png $DES/icon.png
echo "*** uBlock0.webext: Generating meta..."
python tools/make-webext-meta.py $DES/
echo "*** uBlock0.webext-hybrid: Generating meta..."
python tools/make-webext-hybrid-meta.py $DES/
if [ "$1" = all ]; then
echo "*** uBlock0.webext: Creating package..."
echo "*** uBlock0.webext-hybrid: Creating package..."
pushd $DES > /dev/null
zip ../$(basename $DES).xpi -qr *
popd > /dev/null
fi
echo "*** uBlock0.webext: Package done."
echo "*** uBlock0.webext-hybrid: Package done."

29
tools/make-webext-meta.py Normal file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python3
import os
import json
import sys
if len(sys.argv) == 1 or not sys.argv[1]:
raise SystemExit('Build dir missing.')
proj_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], '..')
build_dir = os.path.abspath(sys.argv[1])
# Import version number from chromium platform
chromium_manifest = {}
webext_manifest = {}
chromium_manifest_file = os.path.join(proj_dir, 'platform', 'chromium', 'manifest.json')
with open(chromium_manifest_file) as f1:
chromium_manifest = json.load(f1)
webext_manifest_file = os.path.join(build_dir, 'manifest.json')
with open(webext_manifest_file) as f2:
webext_manifest = json.load(f2)
webext_manifest['version'] = chromium_manifest['version']
with open(webext_manifest_file, 'w') as f2:
json.dump(webext_manifest, f2, indent=2, separators=(',', ': '), sort_keys=True)
f2.write('\n')

40
tools/make-webext.sh Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env bash
#
# This script assumes a linux environment
echo "*** uBlock0.webext: Creating web store package"
echo "*** uBlock0.webext: Copying files"
DES=dist/build/uBlock0.webext
rm -rf $DES
mkdir -p $DES
bash ./tools/make-assets.sh $DES
cp -R src/css $DES/
cp -R src/img $DES/
cp -R src/js $DES/
cp -R src/lib $DES/
cp -R src/_locales $DES/
cp -R $DES/_locales/nb $DES/_locales/no
cp src/*.html $DES/
cp platform/chromium/*.js $DES/js/
cp -R platform/chromium/img $DES/
cp platform/chromium/*.html $DES/
cp platform/chromium/*.json $DES/
cp platform/webext/polyfill.js $DES/js/
cp platform/webext/vapi-usercss.js $DES/js/
cp platform/webext/manifest.json $DES/
cp LICENSE.txt $DES/
echo "*** uBlock0.webext: Generating meta..."
python tools/make-webext-meta.py $DES/
if [ "$1" = all ]; then
echo "*** uBlock0.webext: Creating package..."
pushd $DES > /dev/null
zip ../$(basename $DES).xpi -qr *
popd > /dev/null
fi
echo "*** uBlock0.webext: Package done."