Bug 1620083 - Make web extensions re-bundle when dependent files change. r=glandium

Differential Revision: https://phabricator.services.mozilla.com/D65416

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brendan Dahl 2020-03-13 22:22:15 +00:00
parent bca21e5970
commit 1f6bb7fb21
2 changed files with 51 additions and 16 deletions

View File

@ -4,23 +4,52 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
addons = [
'tabs-activate-remove',
'tabs-activate-remove-2',
'update-1',
'update-2',
'update-postpone-1',
'update-postpone-2',
'update-with-perms-1',
'update-with-perms-2',
]
addons = {
'tabs-activate-remove': [
'background.js',
'manifest.json',
],
'tabs-activate-remove-2': [
'background.js',
'manifest.json',
],
'update-1': [
'borderify.js',
'manifest.json',
],
'update-2': [
'borderify.js',
'manifest.json',
],
'update-postpone-1': [
'background.js',
'borderify.js',
'manifest.json',
],
'update-postpone-2': [
'borderify.js',
'manifest.json',
],
'update-with-perms-1': [
'borderify.js',
'manifest.json',
],
'update-with-perms-2': [
'borderify.js',
'manifest.json',
],
}
for addon in addons:
for addon, files in addons.items():
indir = 'web_extensions/%s' % addon
xpi = '%s.xpi' % indir
inputs = [indir]
for file in files:
inputs.append('%s/%s' % (indir, file))
GENERATED_FILES += [xpi]
GENERATED_FILES[xpi].script = '../../../../../../toolkit/mozapps/extensions/test/create_xpi.py'
GENERATED_FILES[xpi].inputs = [indir]
GENERATED_FILES[xpi].script = '/toolkit/mozapps/extensions/test/create_xpi.py'
GENERATED_FILES[xpi].py2 = True
GENERATED_FILES[xpi].inputs = inputs
TEST_HARNESS_FILES.testing.mochitest.tests.junit += ['!%s' % xpi]

View File

@ -4,11 +4,17 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
from os.path import abspath
from os.path import abspath, relpath
from mozbuild.action.zip import main as create_zip
def main(output, input_dir):
def main(output, input_dir, *files):
output.close()
return create_zip(['-C', input_dir, abspath(output.name), '**'])
if files:
# The zip builder doesn't handle the files being an absolute path.
in_files = [relpath(file, input_dir) for file in files]
return create_zip(['-C', input_dir, abspath(output.name)] + in_files)
else:
return create_zip(['-C', input_dir, abspath(output.name), '**'])