+
+
+
+
+
From ff935cce160023231983cee115f2493c32b09257 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Wed, 3 Sep 2014 15:15:38 -0700
Subject: [PATCH 21/68] Bug 1061970 followup: roll back "for...of" change, to
fix test failures / crashes. CLOSED TREE
---
toolkit/components/contentprefs/ContentPrefService2.jsm | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/toolkit/components/contentprefs/ContentPrefService2.jsm b/toolkit/components/contentprefs/ContentPrefService2.jsm
index f6c3866fdcb..1b4343edb72 100644
--- a/toolkit/components/contentprefs/ContentPrefService2.jsm
+++ b/toolkit/components/contentprefs/ContentPrefService2.jsm
@@ -655,7 +655,7 @@ ContentPrefService2.prototype = {
destroy: function CPS2_destroy() {
if (this._statements) {
- for (let stmt of this._statements) {
+ for each (let stmt in this._statements) {
stmt.finalize();
}
}
From fc99c53ae510693c2caae7d26c9b4fe1a7f1f974 Mon Sep 17 00:00:00 2001
From: Mike Hommey
Date: Wed, 3 Sep 2014 14:10:54 +0900
Subject: [PATCH 22/68] Bug 1041941 - Use templates for programs, simple
programs, libraries and C++ unit tests. r=gps
---
accessible/interfaces/ia2/moz.build | 2 +-
accessible/interfaces/msaa/moz.build | 2 +-
b2g/app/moz.build | 4 +-
b2g/gaia/moz.build | 2 +-
browser/app/moz.build | 2 +-
.../shell/commandexecutehandler/moz.build | 2 +-
browser/metro/shell/linktool/moz.build | 2 +-
browser/metro/shell/testing/moz.build | 2 +-
build/docs/defining-binaries.rst | 63 ++++++-----
build/stlport/moz.build | 2 +-
build/templates.mozbuild | 51 +++++++++
build/unix/elfhack/moz.build | 2 +-
build/unix/stdc++compat/moz.build | 4 +-
build/win32/crashinjectdll/moz.build | 2 +-
build/win32/moz.build | 2 +-
build/win32/vmwarerecordinghelper/moz.build | 2 +-
config/external/ffi/moz.build | 2 +-
config/external/freetype2/moz.build | 2 +-
config/external/icu/moz.build | 2 +-
config/external/nspr/moz.build | 2 +-
config/external/nss/crmf/moz.build | 2 +-
config/external/nss/moz.build | 2 +-
config/external/sqlite/moz.build | 2 +-
config/external/zlib/moz.build | 2 +-
config/moz.build | 2 +-
content/base/test/moz.build | 4 +-
content/media/compiledtest/moz.build | 4 +-
content/media/webaudio/compiledtest/moz.build | 4 +-
dom/audiochannel/tests/moz.build | 4 +-
dom/bindings/test/moz.build | 2 +-
dom/canvas/compiledtest/moz.build | 4 +-
dom/media/gmp-plugin/moz.build | 2 +-
dom/plugins/ipc/hangui/moz.build | 2 +-
dom/plugins/ipc/interpose/moz.build | 2 +-
.../test/testplugin/javaplugin/moz.build | 2 +-
dom/plugins/test/testplugin/moz.build | 2 +-
.../test/testplugin/secondplugin/moz.build | 2 +-
editor/txmgr/tests/moz.build | 4 +-
embedding/tests/winEmbed/moz.build | 2 +-
gfx/angle/src/libEGL/moz.build | 2 +-
gfx/angle/src/libGLESv2/moz.build | 2 +-
intl/lwbrk/tests/moz.build | 4 +-
intl/uconv/tools/moz.build | 4 +-
intl/unicharutil/tests/moz.build | 4 +-
intl/unicharutil/tools/moz.build | 2 +-
intl/unicharutil/util/moz.build | 2 +-
ipc/app/moz.build | 2 +-
ipc/contentproc/moz.build | 2 +-
ipc/ipdl/test/cxx/app/moz.build | 2 +-
js/src/editline/moz.build | 2 +-
js/src/gdb/moz.build | 2 +-
js/src/jsapi-tests/moz.build | 2 +-
js/src/moz.build | 6 +-
js/src/shell/moz.build | 2 +-
js/xpconnect/shell/moz.build | 2 +-
layout/media/moz.build | 2 +-
layout/media/webrtc/moz.build | 2 +-
layout/style/test/moz.build | 4 +-
media/libcubeb/src/moz.build | 2 +-
media/libcubeb/tests/moz.build | 8 +-
media/libpng/moz.build | 2 +-
media/libspeex_resampler/src/moz.build | 2 +-
media/libvpx/moz.build | 2 +-
media/mtransport/standalone/moz.build | 2 +-
media/mtransport/test/moz.build | 8 +-
media/omx-plugin/froyo/moz.build | 2 +-
media/omx-plugin/gb/moz.build | 2 +-
media/omx-plugin/gb235/moz.build | 2 +-
media/omx-plugin/hc/moz.build | 2 +-
media/omx-plugin/kk/moz.build | 2 +-
.../lib/froyo/libstagefright/moz.build | 2 +-
.../lib/gb/libstagefright/moz.build | 2 +-
.../libstagefright_color_conversion/moz.build | 2 +-
media/omx-plugin/lib/gb/libutils/moz.build | 2 +-
.../lib/gb235/libstagefright/moz.build | 2 +-
.../lib/hc/libstagefright/moz.build | 2 +-
.../lib/ics/libstagefright/moz.build | 2 +-
media/omx-plugin/lib/ics/libutils/moz.build | 2 +-
.../lib/ics/libvideoeditorplayer/moz.build | 2 +-
media/omx-plugin/moz.build | 2 +-
media/webrtc/signaling/test/moz.build | 4 +-
memory/build/moz.build | 2 +-
memory/jemalloc/moz.build | 2 +-
memory/mozalloc/moz.build | 2 +-
memory/mozalloc/tests/moz.build | 4 +-
memory/mozjemalloc/moz.build | 2 +-
memory/replace/dmd/moz.build | 2 +-
memory/replace/dummy/moz.build | 2 +-
memory/replace/jemalloc/moz.build | 2 +-
mfbt/moz.build | 2 +-
mfbt/tests/moz.build | 8 +-
modules/libbz2/src/moz.build | 4 +-
modules/libmar/sign/moz.build | 2 +-
modules/libmar/src/moz.build | 4 +-
modules/libmar/tool/moz.build | 4 +-
modules/libmar/verify/moz.build | 2 +-
mozglue/build/moz.build | 2 +-
mozglue/linker/moz.build | 4 +-
mozglue/linker/tests/moz.build | 4 +-
mozglue/tests/moz.build | 4 +-
netwerk/sctp/src/moz.build | 2 +-
netwerk/srtp/src/moz.build | 2 +-
netwerk/streamconv/test/moz.build | 2 +-
netwerk/test/moz.build | 8 +-
other-licenses/bsdiff/moz.build | 2 +-
profile/dirserviceprovider/moz.build | 2 +-
python/mozbuild/mozbuild/frontend/context.py | 107 +++++++++++++++++-
.../mozbuild/mozbuild/frontend/gyp_reader.py | 7 +-
python/mozbuild/mozbuild/frontend/reader.py | 12 +-
.../test/backend/data/visual-studio/moz.build | 2 +-
.../test/frontend/data/program/moz.build | 13 ++-
rdf/tests/rdfcat/moz.build | 2 +-
rdf/tests/rdfpoll/moz.build | 2 +-
rdf/tests/triplescat/moz.build | 2 +-
rdf/util/moz.build | 2 +-
security/manager/ssl/tests/compiled/moz.build | 4 +-
.../ssl/tests/unit/pkcs11testmodule/moz.build | 2 +-
.../ssl/tests/unit/tlsserver/cmd/moz.build | 4 +-
.../ssl/tests/unit/tlsserver/lib/moz.build | 2 +-
security/pkix/moz.build | 2 +-
security/pkix/test/lib/moz.build | 2 +-
security/sandbox/linux/moz.build | 2 +-
security/sandbox/moz.build | 2 +-
security/sandbox/staticruntime/moz.build | 2 +-
.../sandbox/win/src/sandboxbroker/moz.build | 2 +-
startupcache/test/moz.build | 4 +-
storage/test/moz.build | 8 +-
testing/gtest/moz.build | 2 +-
testing/mochitest/ssltunnel/moz.build | 2 +-
testing/tools/screenshot/moz.build | 4 +-
toolkit/components/ctypes/tests/moz.build | 2 +-
.../components/maintenanceservice/moz.build | 2 +-
toolkit/components/places/tests/cpp/moz.build | 4 +-
.../breakpad-windows-libxul/moz.build | 2 +-
.../staticruntime/moz.build | 2 +-
toolkit/crashreporter/client/moz.build | 2 +-
.../src/common/dwarf/moz.build | 2 +-
.../src/common/linux/moz.build | 4 +-
.../google-breakpad/src/common/mac/moz.build | 4 +-
.../google-breakpad/src/common/moz.build | 4 +-
.../src/common/solaris/moz.build | 4 +-
.../src/tools/linux/dump_syms/moz.build | 2 +-
.../src/tools/mac/dump_syms/moz.build | 2 +-
.../src/tools/solaris/dump_syms/moz.build | 2 +-
toolkit/crashreporter/injector/moz.build | 2 +-
toolkit/crashreporter/test/moz.build | 2 +-
.../library/StaticXULComponentsEnd/moz.build | 2 +-
toolkit/library/gtest/moz.build | 2 +-
toolkit/library/moz.build | 2 +-
toolkit/mozapps/plugins/tests/moz.build | 4 +-
.../update/common-standalone/moz.build | 2 +-
toolkit/mozapps/update/common/moz.build | 2 +-
toolkit/mozapps/update/tests/moz.build | 4 +-
toolkit/mozapps/update/updater/moz.build | 2 +-
toolkit/webapps/tests/moz.build | 2 +-
toolkit/xre/test/win/moz.build | 8 +-
tools/jprof/moz.build | 2 +-
tools/jprof/stub/moz.build | 2 +-
tools/trace-malloc/moz.build | 6 +-
uriloader/exthandler/tests/moz.build | 4 +-
webapprt/gtk/moz.build | 2 +-
webapprt/mac/moz.build | 2 +-
webapprt/win/moz.build | 2 +-
widget/gonk/libdisplay/moz.build | 2 +-
widget/gtk/mozgtk/gtk2/moz.build | 2 +-
widget/gtk/mozgtk/gtk3/moz.build | 2 +-
widget/gtk/mozgtk/stub/moz.build | 2 +-
widget/tests/moz.build | 4 +-
widget/xremoteclient/moz.build | 2 +-
xpcom/glue/moz.build | 2 +-
xpcom/glue/nomozalloc/moz.build | 2 +-
xpcom/glue/standalone/moz.build | 2 +-
xpcom/glue/standalone/staticruntime/moz.build | 2 +-
xpcom/glue/staticruntime/moz.build | 2 +-
xpcom/reflect/xptcall/md/test/moz.build | 4 +-
xpcom/reflect/xptcall/tests/moz.build | 4 +-
xpcom/reflect/xptinfo/tests/moz.build | 4 +-
xpcom/sample/program/moz.build | 4 +-
xpcom/tests/external/moz.build | 4 +-
xpcom/tests/moz.build | 24 ++--
xpcom/tests/windows/moz.build | 4 +-
xpcom/typelib/xpt/moz.build | 2 +-
xpcom/typelib/xpt/tests/moz.build | 4 +-
xpcom/windbgdlg/moz.build | 4 +-
xulrunner/app/moz.build | 2 +-
xulrunner/stub/moz.build | 2 +-
xulrunner/tools/redit/moz.build | 2 +-
187 files changed, 468 insertions(+), 295 deletions(-)
diff --git a/accessible/interfaces/ia2/moz.build b/accessible/interfaces/ia2/moz.build
index 6c73a1a2bf5..3aae77cd38b 100644
--- a/accessible/interfaces/ia2/moz.build
+++ b/accessible/interfaces/ia2/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'IA2Marshal'
+Library('IA2Marshal')
FORCE_SHARED_LIB = True
diff --git a/accessible/interfaces/msaa/moz.build b/accessible/interfaces/msaa/moz.build
index 94ed2889cc4..e6d5f2f0937 100644
--- a/accessible/interfaces/msaa/moz.build
+++ b/accessible/interfaces/msaa/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'AccessibleMarshal'
+Library('AccessibleMarshal')
GENERATED_SOURCES += [
'dlldata.c',
diff --git a/b2g/app/moz.build b/b2g/app/moz.build
index abc17ee4512..948e70a00e8 100644
--- a/b2g/app/moz.build
+++ b/b2g/app/moz.build
@@ -6,9 +6,9 @@
if not CONFIG['LIBXUL_SDK']:
if CONFIG['GAIADIR']:
- PROGRAM = CONFIG['MOZ_APP_NAME'] + "-bin"
+ Program(CONFIG['MOZ_APP_NAME'] + "-bin")
else:
- PROGRAM = CONFIG['MOZ_APP_NAME']
+ Program(CONFIG['MOZ_APP_NAME'])
if CONFIG['MOZ_B2G_LOADER']:
SOURCES += [
'B2GLoader.cpp',
diff --git a/b2g/gaia/moz.build b/b2g/gaia/moz.build
index 282c716c25f..c0c06424909 100644
--- a/b2g/gaia/moz.build
+++ b/b2g/gaia/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = CONFIG['MOZ_APP_NAME']
+Program(CONFIG['MOZ_APP_NAME'])
if CONFIG['OS_ARCH'] == 'WINNT':
SOURCES += [
diff --git a/browser/app/moz.build b/browser/app/moz.build
index 0e78b951500..3d22eab10b0 100644
--- a/browser/app/moz.build
+++ b/browser/app/moz.build
@@ -6,7 +6,7 @@
DIRS += ['profile/extensions']
-PROGRAM = CONFIG['MOZ_APP_NAME']
+Program(CONFIG['MOZ_APP_NAME'])
SOURCES += [
'nsBrowserApp.cpp',
diff --git a/browser/metro/shell/commandexecutehandler/moz.build b/browser/metro/shell/commandexecutehandler/moz.build
index 9e671d8ff17..fb47441be41 100644
--- a/browser/metro/shell/commandexecutehandler/moz.build
+++ b/browser/metro/shell/commandexecutehandler/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'CommandExecuteHandler'
+Program('CommandExecuteHandler')
SOURCES += [
'CEHHelper.cpp',
diff --git a/browser/metro/shell/linktool/moz.build b/browser/metro/shell/linktool/moz.build
index 20b154e1e9b..223928bf18c 100644
--- a/browser/metro/shell/linktool/moz.build
+++ b/browser/metro/shell/linktool/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'linktool'
+Program('linktool')
SOURCES += [
'linktool.cpp',
diff --git a/browser/metro/shell/testing/moz.build b/browser/metro/shell/testing/moz.build
index 8ff0f896bf6..151d98bf1ff 100644
--- a/browser/metro/shell/testing/moz.build
+++ b/browser/metro/shell/testing/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'metrotestharness'
+Program('metrotestharness')
SOURCES += [
'metrotestharness.cpp',
diff --git a/build/docs/defining-binaries.rst b/build/docs/defining-binaries.rst
index 1cfd855e8c5..fd155917a18 100644
--- a/build/docs/defining-binaries.rst
+++ b/build/docs/defining-binaries.rst
@@ -39,20 +39,20 @@ Static Libraries
================
To build a static library, other than defining the source files (see above), one
-just needs to define a library name with the ``LIBRARY_NAME`` variable.
+just needs to define a library name with the ``Library`` template.
- LIBRARY_NAME = 'foo'
+ Library('foo')
The library file name will be ``libfoo.a`` on UNIX systems and ``foo.lib`` on
Windows.
If the static library needs to aggregate other static libraries, a list of
-``LIBRARY_NAME`` can be added to the ``USE_LIBS`` variable. Like ``SOURCES``, it
+``Library`` names can be added to the ``USE_LIBS`` variable. Like ``SOURCES``, it
requires the appended list to be alphanumerically ordered.
USE_LIBS += ['bar', 'baz']
-If there are multiple directories containing the same ``LIBRARY_NAME``, it is
+If there are multiple directories containing the same ``Library`` name, it is
possible to disambiguate by prefixing with the path to the wanted one (relative
or absolute):
@@ -61,7 +61,7 @@ or absolute):
'../relative/baz',
]
-Note that the leaf name in those paths is the ``LIBRARY_NAME``, not an actual
+Note that the leaf name in those paths is the ``Library`` name, not an actual
file name.
Note that currently, the build system may not create an actual library for
@@ -84,10 +84,10 @@ be linked to that bigger library, with the ``FINAL_LIBRARY`` variable.
FINAL_LIBRARY = 'xul'
-The ``FINAL_LIBRARY`` value must match a unique ``LIBRARY_NAME`` somewhere
+The ``FINAL_LIBRARY`` value must match a unique ``Library`` name somewhere
in the tree.
-As a special rule, those intermediate libraries don't need a ``LIBRARY_NAME``
+As a special rule, those intermediate libraries don't need a ``Library`` name
for themselves.
@@ -103,7 +103,7 @@ the ``FORCE_SHARED_LIB`` boolean variable:
When this variable is set, no static library is built. See further below to
build both types of libraries.
-With a ``LIBRARY_NAME`` of ``foo``, the library file name will be
+With a ``Library`` name of ``foo``, the library file name will be
``libfoo.dylib`` on OSX, ``libfoo.so`` on ELF systems (Linux, etc.), and
``foo.dll`` on Windows. On Windows, there is also an import library named
``foo.lib``, used on the linker command line. ``libfoo.dylib`` and
@@ -115,7 +115,7 @@ This is done with the ``IS_FRAMEWORK`` boolean variable.
IS_FRAMEWORK = True
-With a ``LIBRARY_NAME`` of ``foo``, the framework file name will be ``foo``.
+With a ``Library`` name of ``foo``, the framework file name will be ``foo``.
This variable however affects the behavior on all platforms, so it needs to
be set only on OSX.
@@ -129,23 +129,24 @@ Executables
===========
Executables, a.k.a. programs, are, in the simplest form, defined with the
-``PROGRAM`` variable.
+``Program`` template.
- PROGRAM = 'foobar'
+ Program('foobar')
On UNIX systems, the executable file name will be ``foobar``, while on Windows,
it will be ``foobar.exe``.
Like static and shared libraries, the build system can be instructed to link
-libraries to the executable with ``USE_LIBS``, listing various ``LIBRARY_NAME``.
+libraries to the executable with ``USE_LIBS``, listing various ``Library``
+names.
In some cases, we want to create an executable per source file in the current
-directory, in which case we can use the ``SIMPLE_PROGRAMS`` list:
+directory, in which case we can use the ``SimplePrograms`` template
- SIMPLE_PROGRAMS = [
+ SimplePrograms([
'FirstProgram',
'SecondProgram',
- ]
+ ])
The corresponding ``SOURCES`` must match:
@@ -154,8 +155,8 @@ The corresponding ``SOURCES`` must match:
'SecondProgram.c',
]
-Similar to ``SIMPLE_PROGRAMS``, is ``CPP_UNIT_TESTS``, which defines, with the
-same rules, C++ unit tests programs.
+Similar to ``SimplePrograms``, is the ``CppUnitTests`` template, which defines,
+with the same rules, C++ unit tests programs.
Linking with system libraries
@@ -189,10 +190,10 @@ Libraries from third party build system
=======================================
Some libraries in the tree are not built by the moz.build-governed build
-system, and there is no ``LIBRARY_NAME`` corresponding to them.
+system, and there is no ``Library`` corresponding to them.
However, ``USE_LIBS`` allows to reference such libraries by giving a full
-path (like when disambiguating identical ``LIBRARY_NAME``). The same naming
+path (like when disambiguating identical ``Library`` names). The same naming
rules apply as other uses of ``USE_LIBS``, so only the library name without
prefix and suffix shall be given.
@@ -217,12 +218,12 @@ When both types of libraries are required, one needs to set both
But because static libraries and Windows import libraries have the same file
names, either the static or the shared library name needs to be different
-than ``LIBRARY_NAME``.
+than the name given to the ``Library`` template.
The ``STATIC_LIBRARY_NAME`` and ``SHARED_LIBRARY_NAME`` variables can be used
to change either the static or the shared library name.
- LIBRARY_NAME = 'foo'
+ Library('foo')
STATIC_LIBRARY_NAME = 'foo_s'
With the above, on Windows, ``foo_s.lib`` will be the static library,
@@ -231,25 +232,25 @@ With the above, on Windows, ``foo_s.lib`` will be the static library,
In some cases, for convenience, it is possible to set both
``STATIC_LIBRARY_NAME`` and ``SHARED_LIBRARY_NAME``. For example:
- LIBRARY_NAME = 'mylib'
+ Library('mylib')
STATIC_LIBRARY_NAME = 'mylib_s'
SHARED_LIBRARY_NAME = CONFIG['SHARED_NAME']
This allows to use ``mylib`` in the ``USE_LIBS`` of another library or
executable.
-When refering to a ``LIBRARY_NAME`` building both types of libraries in
+When refering to a ``Library`` name building both types of libraries in
``USE_LIBS``, the shared library is chosen to be linked. But sometimes,
-it is wanted to link the static version, in which case the ``LIBRARY_NAME``
+it is wanted to link the static version, in which case the ``Library`` name
needs to be prefixed with ``static:`` in ``USE_LIBS``
a/moz.build:
- LIBRARY_NAME = 'mylib'
+ Library('mylib')
FORCE_SHARED_LIB = True
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'mylib_s'
b/moz.build:
- PROGRAM = 'myprog'
+ Program('myprog')
USE_LIBS += [
'static:mylib',
]
@@ -262,18 +263,18 @@ The ``SDK_LIBRARY`` boolean variable defines whether the library in the current
directory is going to be installed in the SDK.
The ``SONAME`` variable declares a "shared object name" for the library. It
-defaults to the ``LIBRARY_NAME`` or the ``SHARED_LIBRARY_NAME`` if set. When
+defaults to the ``Library`` name or the ``SHARED_LIBRARY_NAME`` if set. When
linking to a library with a ``SONAME``, the resulting library or program will
have a dependency on the library with the name corresponding to the ``SONAME``
-instead of ``LIBRARY_NAME``. This only impacts ELF systems.
+instead of the ``Library`` name. This only impacts ELF systems.
a/moz.build:
- LIBRARY_NAME = 'mylib'
+ Library('mylib')
b/moz.build:
- LIBRARY_NAME = 'otherlib'
+ Library('otherlib')
SONAME = 'foo'
c/moz.build:
- PROGRAM = 'myprog'
+ Program('myprog')
USE_LIBS += [
'mylib',
'otherlib',
diff --git a/build/stlport/moz.build b/build/stlport/moz.build
index af9be36a0fa..649ce0b27f7 100644
--- a/build/stlport/moz.build
+++ b/build/stlport/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'stlport_static'
+Library('stlport_static')
FORCE_STATIC_LIB = True
diff --git a/build/templates.mozbuild b/build/templates.mozbuild
index 0dff49d667e..6df5f1411e3 100644
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -4,6 +4,57 @@
# 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/.
+@template
+def Program(name):
+ '''Template for program executables.'''
+ PROGRAM = name
+
+
+@template
+def SimplePrograms(names):
+ '''Template for simple program executables.
+
+ Those have a single source with the same base name as the executable.
+ '''
+ SIMPLE_PROGRAMS += names
+
+
+@template
+def CppUnitTests(names):
+ '''Template for C++ unit tests.
+
+ Those have a single source with the same base name as the executable.
+ '''
+ CPP_UNIT_TESTS += names
+
+
+@template
+def Library(name):
+ '''Template for libraries.'''
+ LIBRARY_NAME = name
+
+
+@template
+def HostProgram(name):
+ '''Template for build tools executables.'''
+ HOST_PROGRAM = name
+
+
+@template
+def HostSimplePrograms(names):
+ '''Template for simple build tools executables.
+
+ Those have a single source with the same base name as the executable.
+ '''
+ HOST_SIMPLE_PROGRAMS += names
+
+
+@template
+def HostLibrary(name):
+ '''Template for build tools libraries.'''
+ HOST_LIBRARY_NAME = name
+
+
@template
def GeckoBinary():
'''Template for binaries using Gecko.
diff --git a/build/unix/elfhack/moz.build b/build/unix/elfhack/moz.build
index 65a968bf394..a3cb69c9b18 100644
--- a/build/unix/elfhack/moz.build
+++ b/build/unix/elfhack/moz.build
@@ -19,7 +19,7 @@ HOST_SOURCES += [
'elfhack.cpp',
]
-HOST_PROGRAM = 'elfhack'
+HostProgram('elfhack')
DEFINES['ELFHACK_BUILD'] = True
diff --git a/build/unix/stdc++compat/moz.build b/build/unix/stdc++compat/moz.build
index d9247607920..73f4e22e1d9 100644
--- a/build/unix/stdc++compat/moz.build
+++ b/build/unix/stdc++compat/moz.build
@@ -5,11 +5,11 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
- LIBRARY_NAME = 'stdc++compat'
+ Library('stdc++compat')
SOURCES += ['stdc++compat.cpp']
if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
- HOST_LIBRARY_NAME = 'host_stdc++compat'
+ HostLibrary('host_stdc++compat')
HOST_SOURCES += [
'stdc++compat.cpp',
]
diff --git a/build/win32/crashinjectdll/moz.build b/build/win32/crashinjectdll/moz.build
index 24655529ab6..6f1fc4cab12 100644
--- a/build/win32/crashinjectdll/moz.build
+++ b/build/win32/crashinjectdll/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'crashinjectdll.cpp',
]
-LIBRARY_NAME = 'crashinjectdll'
+Library('crashinjectdll')
FORCE_SHARED_LIB = True
diff --git a/build/win32/moz.build b/build/win32/moz.build
index ece8f8067db..0d14f247d28 100644
--- a/build/win32/moz.build
+++ b/build/win32/moz.build
@@ -10,7 +10,7 @@ if CONFIG['_MSC_VER'] and CONFIG['OS_TEST'] != 'x86_64':
TEST_DIRS += ['crashinjectdll']
if CONFIG['ENABLE_TESTS']:
- PROGRAM = 'crashinject'
+ Program('crashinject')
SOURCES += [
'crashinject.cpp',
]
diff --git a/build/win32/vmwarerecordinghelper/moz.build b/build/win32/vmwarerecordinghelper/moz.build
index 4cfdc4f64f6..55e842e2b98 100644
--- a/build/win32/vmwarerecordinghelper/moz.build
+++ b/build/win32/vmwarerecordinghelper/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'vmwarerecordinghelper.cpp',
]
-LIBRARY_NAME = 'vmwarerecordinghelper'
+Library('vmwarerecordinghelper')
FORCE_SHARED_LIB = True
diff --git a/config/external/ffi/moz.build b/config/external/ffi/moz.build
index 130e35b39e5..725b483153f 100644
--- a/config/external/ffi/moz.build
+++ b/config/external/ffi/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'ffi'
+Library('ffi')
if CONFIG['MOZ_NATIVE_FFI']:
OS_LIBS += CONFIG['MOZ_FFI_LIBS']
diff --git a/config/external/freetype2/moz.build b/config/external/freetype2/moz.build
index 1c9b09e8762..fc52d25bda7 100644
--- a/config/external/freetype2/moz.build
+++ b/config/external/freetype2/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'freetype'
+Library('freetype')
if CONFIG['MOZ_TREE_FREETYPE']:
USE_LIBS += [
diff --git a/config/external/icu/moz.build b/config/external/icu/moz.build
index 32422d4bb20..eda9c4c561c 100644
--- a/config/external/icu/moz.build
+++ b/config/external/icu/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'icu'
+Library('icu')
if CONFIG['MOZ_NATIVE_ICU']:
OS_LIBS += CONFIG['MOZ_ICU_LIBS']
diff --git a/config/external/nspr/moz.build b/config/external/nspr/moz.build
index 34e0369bafa..424119e8a63 100644
--- a/config/external/nspr/moz.build
+++ b/config/external/nspr/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'nspr'
+Library('nspr')
if CONFIG['MOZ_FOLD_LIBS']:
# When folding libraries, nspr is actually in the nss library.
diff --git a/config/external/nss/crmf/moz.build b/config/external/nss/crmf/moz.build
index d0ceb4bd9cf..9b8005f96e2 100644
--- a/config/external/nss/crmf/moz.build
+++ b/config/external/nss/crmf/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'crmf'
+Library('crmf')
if CONFIG['MOZ_NATIVE_NSS']:
OS_LIBS += [l for l in CONFIG['NSS_LIBS'] if l.startswith('-L')]
diff --git a/config/external/nss/moz.build b/config/external/nss/moz.build
index 2ebfa800657..b7b69e7017b 100644
--- a/config/external/nss/moz.build
+++ b/config/external/nss/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'nss'
+Library('nss')
DIRS += ['crmf']
diff --git a/config/external/sqlite/moz.build b/config/external/sqlite/moz.build
index b765049d06c..9826ced3f77 100644
--- a/config/external/sqlite/moz.build
+++ b/config/external/sqlite/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'sqlite'
+Library('sqlite')
if CONFIG['MOZ_NATIVE_SQLITE']:
OS_LIBS += CONFIG['SQLITE_LIBS']
diff --git a/config/external/zlib/moz.build b/config/external/zlib/moz.build
index e6c14a73f4a..f1efe437af3 100644
--- a/config/external/zlib/moz.build
+++ b/config/external/zlib/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'zlib'
+Library('zlib')
if CONFIG['MOZ_NATIVE_ZLIB']:
OS_LIBS += CONFIG['MOZ_ZLIB_LIBS']
diff --git a/config/moz.build b/config/moz.build
index d355cb5e79e..9e6ab581bc6 100644
--- a/config/moz.build
+++ b/config/moz.build
@@ -21,7 +21,7 @@ if CONFIG['HOST_OS_ARCH'] != 'WINNT':
'nsinstall.c',
'pathsub.c',
]
- HOST_PROGRAM = 'nsinstall_real'
+ HostProgram('nsinstall_real')
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
DEFINES['GKMEDIAS_SHARED_LIBRARY'] = True
diff --git a/content/base/test/moz.build b/content/base/test/moz.build
index f4fd51a587f..ec05b17e996 100644
--- a/content/base/test/moz.build
+++ b/content/base/test/moz.build
@@ -10,12 +10,12 @@ XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
if CONFIG['OS_ARCH'] != 'Darwin':
XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestCSPParser',
'TestGetURL',
'TestNativeXMLHttpRequest',
'TestPlainTextSerializer',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/content/media/compiledtest/moz.build b/content/media/compiledtest/moz.build
index a8ea07907d9..0da44099221 100644
--- a/content/media/compiledtest/moz.build
+++ b/content/media/compiledtest/moz.build
@@ -4,10 +4,10 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestAudioBuffers',
'TestAudioMixer'
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/content/media/webaudio/compiledtest/moz.build b/content/media/webaudio/compiledtest/moz.build
index 55c96401da1..e584c2016a5 100644
--- a/content/media/webaudio/compiledtest/moz.build
+++ b/content/media/webaudio/compiledtest/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestAudioEventTimeline',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/dom/audiochannel/tests/moz.build b/dom/audiochannel/tests/moz.build
index ffa7abe72a0..64304545b10 100644
--- a/dom/audiochannel/tests/moz.build
+++ b/dom/audiochannel/tests/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestAudioChannelService',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/dom/bindings/test/moz.build b/dom/bindings/test/moz.build
index f5fe25f3a99..afa87cc7e4e 100644
--- a/dom/bindings/test/moz.build
+++ b/dom/bindings/test/moz.build
@@ -12,7 +12,7 @@ DEFINES.update({
# Do NOT export this library. We don't actually want our test code
# being added to libxul or anything.
-LIBRARY_NAME = 'dombindings_test_s'
+Library('dombindings_test_s')
EXTRA_COMPONENTS += [
'TestInterfaceJS.js',
diff --git a/dom/canvas/compiledtest/moz.build b/dom/canvas/compiledtest/moz.build
index 376b321970b..6e3a66ea13c 100644
--- a/dom/canvas/compiledtest/moz.build
+++ b/dom/canvas/compiledtest/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestWebGLElementArrayCache',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/dom/media/gmp-plugin/moz.build b/dom/media/gmp-plugin/moz.build
index 2b066082bd9..27774758ff2 100644
--- a/dom/media/gmp-plugin/moz.build
+++ b/dom/media/gmp-plugin/moz.build
@@ -9,7 +9,7 @@ SOURCES += [
'gmp-fake.cpp'
]
-LIBRARY_NAME = "fake"
+Library("fake")
USE_STATIC_LIBS = True
FORCE_SHARED_LIB = True
diff --git a/dom/plugins/ipc/hangui/moz.build b/dom/plugins/ipc/hangui/moz.build
index 15e41686853..8b803c961dd 100644
--- a/dom/plugins/ipc/hangui/moz.build
+++ b/dom/plugins/ipc/hangui/moz.build
@@ -6,7 +6,7 @@
FAIL_ON_WARNINGS = True
-PROGRAM = 'plugin-hang-ui'
+Program('plugin-hang-ui')
UNIFIED_SOURCES += [
'MiniShmChild.cpp',
diff --git a/dom/plugins/ipc/interpose/moz.build b/dom/plugins/ipc/interpose/moz.build
index 3818e1ece36..e80b868b419 100644
--- a/dom/plugins/ipc/interpose/moz.build
+++ b/dom/plugins/ipc/interpose/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'plugin_child_interpose'
+Library('plugin_child_interpose')
UNIFIED_SOURCES += [ "%s.mm" % (LIBRARY_NAME) ]
diff --git a/dom/plugins/test/testplugin/javaplugin/moz.build b/dom/plugins/test/testplugin/javaplugin/moz.build
index 4dd056fcd0e..2c7f6a0f73c 100644
--- a/dom/plugins/test/testplugin/javaplugin/moz.build
+++ b/dom/plugins/test/testplugin/javaplugin/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'nptestjava'
+Library('nptestjava')
relative_path = '..'
include('../testplugin.mozbuild')
diff --git a/dom/plugins/test/testplugin/moz.build b/dom/plugins/test/testplugin/moz.build
index 678c75f2b66..705995b20cd 100644
--- a/dom/plugins/test/testplugin/moz.build
+++ b/dom/plugins/test/testplugin/moz.build
@@ -6,7 +6,7 @@
DIRS += ['secondplugin', 'javaplugin']
-LIBRARY_NAME = 'nptest'
+Library('nptest')
FAIL_ON_WARNINGS = not CONFIG['_MSC_VER']
diff --git a/dom/plugins/test/testplugin/secondplugin/moz.build b/dom/plugins/test/testplugin/secondplugin/moz.build
index a9e6cca1e70..c9c6215ee2e 100644
--- a/dom/plugins/test/testplugin/secondplugin/moz.build
+++ b/dom/plugins/test/testplugin/secondplugin/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'npsecondtest'
+Library('npsecondtest')
relative_path = '..'
include('../testplugin.mozbuild')
diff --git a/editor/txmgr/tests/moz.build b/editor/txmgr/tests/moz.build
index e113d7309d7..316d7a80b5b 100644
--- a/editor/txmgr/tests/moz.build
+++ b/editor/txmgr/tests/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestTXMgr',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/embedding/tests/winEmbed/moz.build b/embedding/tests/winEmbed/moz.build
index 74a8adc7d43..e7ff37a2374 100644
--- a/embedding/tests/winEmbed/moz.build
+++ b/embedding/tests/winEmbed/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'winEmbed'
+Program('winEmbed')
SOURCES += [
'WebBrowserChrome.cpp',
diff --git a/gfx/angle/src/libEGL/moz.build b/gfx/angle/src/libEGL/moz.build
index 4dc7ba8ee2a..96f105e7652 100644
--- a/gfx/angle/src/libEGL/moz.build
+++ b/gfx/angle/src/libEGL/moz.build
@@ -54,7 +54,7 @@ DISABLE_STL_WRAPPING = True
LOCAL_INCLUDES += [ '../../include', '../../src' ]
USE_LIBS += [ 'libGLESv2' ]
-LIBRARY_NAME = 'libEGL'
+Library('libEGL')
FORCE_SHARED_LIB = True
RCFILE = SRCDIR + '/libEGL.rc'
diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build
index 3704ba8c94a..131868dd09f 100644
--- a/gfx/angle/src/libGLESv2/moz.build
+++ b/gfx/angle/src/libGLESv2/moz.build
@@ -204,7 +204,7 @@ else:
'\'%s/lib/%s/dxguid.lib\'' % (CONFIG['MOZ_DIRECTX_SDK_PATH'], CONFIG['MOZ_D3D_CPU_SUFFIX']),
]
-LIBRARY_NAME = 'libGLESv2'
+Library('libGLESv2')
FORCE_SHARED_LIB = True
RCFILE = SRCDIR + '/libGLESv2.rc'
diff --git a/intl/lwbrk/tests/moz.build b/intl/lwbrk/tests/moz.build
index 795aacb3fa2..8beb091cf2c 100644
--- a/intl/lwbrk/tests/moz.build
+++ b/intl/lwbrk/tests/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestLineBreak',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/intl/uconv/tools/moz.build b/intl/uconv/tools/moz.build
index c8086e62032..fa7756ae9a9 100644
--- a/intl/uconv/tools/moz.build
+++ b/intl/uconv/tools/moz.build
@@ -4,9 +4,9 @@
# 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/.
-SIMPLE_PROGRAMS += [
+SimplePrograms([
'umaptable',
-]
+])
SOURCES += [
'%s.c' % s for s in SIMPLE_PROGRAMS
diff --git a/intl/unicharutil/tests/moz.build b/intl/unicharutil/tests/moz.build
index 8a5ff8f0680..9820a2de05e 100644
--- a/intl/unicharutil/tests/moz.build
+++ b/intl/unicharutil/tests/moz.build
@@ -11,9 +11,9 @@ SOURCES += [
'UnicharSelfTest.cpp',
]
-SIMPLE_PROGRAMS += [
+SimplePrograms([
"%s" % (fyl[0:-4]) for fyl in SOURCES
-]
+])
USE_STATIC_LIBS = True
diff --git a/intl/unicharutil/tools/moz.build b/intl/unicharutil/tools/moz.build
index cbd55a1f230..a46688a2532 100644
--- a/intl/unicharutil/tools/moz.build
+++ b/intl/unicharutil/tools/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'ucgendat'
+Program('ucgendat')
SOURCES += [
'ucgendat.c',
diff --git a/intl/unicharutil/util/moz.build b/intl/unicharutil/util/moz.build
index 8e87514378c..e9bf0ed4b04 100644
--- a/intl/unicharutil/util/moz.build
+++ b/intl/unicharutil/util/moz.build
@@ -21,7 +21,7 @@ include('objs.mozbuild')
UNIFIED_SOURCES += intl_unicharutil_util_cppsrcs
-LIBRARY_NAME = 'unicharutil_external_s'
+Library('unicharutil_external_s')
FORCE_STATIC_LIB = True
diff --git a/ipc/app/moz.build b/ipc/app/moz.build
index fc4a3f846c4..e72c3f26258 100644
--- a/ipc/app/moz.build
+++ b/ipc/app/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = CONFIG['MOZ_CHILD_PROCESS_NAME']
+Program(CONFIG['MOZ_CHILD_PROCESS_NAME'])
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
SOURCES += [
diff --git a/ipc/contentproc/moz.build b/ipc/contentproc/moz.build
index 39b5d327379..2a6756346e7 100644
--- a/ipc/contentproc/moz.build
+++ b/ipc/contentproc/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'plugin-container'
+Library('plugin-container')
if CONFIG['MOZ_B2G_LOADER']:
FINAL_LIBRARY = 'xul'
diff --git a/ipc/ipdl/test/cxx/app/moz.build b/ipc/ipdl/test/cxx/app/moz.build
index 848ad2ada5b..4f6a7b48ca9 100644
--- a/ipc/ipdl/test/cxx/app/moz.build
+++ b/ipc/ipdl/test/cxx/app/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'ipdlunittest'
+Program('ipdlunittest')
SOURCES += [
'TestIPDL.cpp',
diff --git a/js/src/editline/moz.build b/js/src/editline/moz.build
index 63afd7f4042..ab3841f7ccb 100644
--- a/js/src/editline/moz.build
+++ b/js/src/editline/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'editline'
+Library('editline')
UNIFIED_SOURCES += [
'editline.c',
diff --git a/js/src/gdb/moz.build b/js/src/gdb/moz.build
index 27b15ea7b2d..119e9eb7373 100644
--- a/js/src/gdb/moz.build
+++ b/js/src/gdb/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'gdb-tests'
+Program('gdb-tests')
UNIFIED_SOURCES += [
'gdb-tests.cpp',
diff --git a/js/src/jsapi-tests/moz.build b/js/src/jsapi-tests/moz.build
index 3e485bf5c6e..099da704b2b 100644
--- a/js/src/jsapi-tests/moz.build
+++ b/js/src/jsapi-tests/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'jsapi-tests'
+Program('jsapi-tests')
UNIFIED_SOURCES += [
'selfTest.cpp',
diff --git a/js/src/moz.build b/js/src/moz.build
index 31a0d4cfe6f..6eb7736b19d 100644
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -427,9 +427,9 @@ HOST_SOURCES += [
'jskwgen.cpp',
]
-HOST_SIMPLE_PROGRAMS += [
+HostSimplePrograms([
'host_%s' % f.replace('.cpp', '') for f in HOST_SOURCES
-]
+])
# JavaScript must be built shared, even for static builds, as it is used by
# other modules which are always built shared. Failure to do so results in
@@ -439,7 +439,7 @@ HOST_SIMPLE_PROGRAMS += [
# In fact, we now build both a static and a shared library, as the
# JS shell would like to link to the static library.
-LIBRARY_NAME = 'js'
+Library('js')
if CONFIG['JS_SHARED_LIBRARY']:
FORCE_SHARED_LIB = True
diff --git a/js/src/shell/moz.build b/js/src/shell/moz.build
index 10a930cba58..b88334f1548 100644
--- a/js/src/shell/moz.build
+++ b/js/src/shell/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['JS_SHELL_NAME']:
- PROGRAM = CONFIG['JS_SHELL_NAME']
+ Program(CONFIG['JS_SHELL_NAME'])
if CONFIG['JS_BUNDLED_EDITLINE']:
USE_LIBS += ['editline']
USE_LIBS += ['static:js']
diff --git a/js/xpconnect/shell/moz.build b/js/xpconnect/shell/moz.build
index 36b19bb16dc..289b5d17d81 100644
--- a/js/xpconnect/shell/moz.build
+++ b/js/xpconnect/shell/moz.build
@@ -6,7 +6,7 @@
FAIL_ON_WARNINGS = True
-PROGRAM = 'xpcshell'
+Program('xpcshell')
SOURCES += [
'xpcshell.cpp',
diff --git a/layout/media/moz.build b/layout/media/moz.build
index a10875dd15c..fd2101cf99f 100644
--- a/layout/media/moz.build
+++ b/layout/media/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'gkmedias'
+Library('gkmedias')
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
FORCE_SHARED_LIB = True
diff --git a/layout/media/webrtc/moz.build b/layout/media/webrtc/moz.build
index 8a0701f6382..32f5e78d335 100644
--- a/layout/media/webrtc/moz.build
+++ b/layout/media/webrtc/moz.build
@@ -4,5 +4,5 @@
# 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/.
-LIBRARY_NAME = 'webrtc'
+Library('webrtc')
FINAL_LIBRARY = 'xul'
diff --git a/layout/style/test/moz.build b/layout/style/test/moz.build
index bc62ec5cb0f..96f7636f3c4 100644
--- a/layout/style/test/moz.build
+++ b/layout/style/test/moz.build
@@ -8,9 +8,9 @@ HOST_SOURCES += [
'ListCSSProperties.cpp',
]
-HOST_SIMPLE_PROGRAMS += [
+HostSimplePrograms([
'host_%s' % f.replace('.cpp', '') for f in HOST_SOURCES
-]
+])
MOCHITEST_MANIFESTS += [
'chrome/mochitest.ini',
diff --git a/media/libcubeb/src/moz.build b/media/libcubeb/src/moz.build
index 944744d07eb..8b7a0dd1b03 100644
--- a/media/libcubeb/src/moz.build
+++ b/media/libcubeb/src/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'cubeb'
+Library('cubeb')
SOURCES += [
'cubeb.c',
diff --git a/media/libcubeb/tests/moz.build b/media/libcubeb/tests/moz.build
index 08e6b94d15c..e7869a529ca 100644
--- a/media/libcubeb/tests/moz.build
+++ b/media/libcubeb/tests/moz.build
@@ -4,16 +4,16 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'test_tone'
-]
+])
if CONFIG['OS_TARGET'] != 'Android':
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'test_audio',
'test_latency',
'test_sanity'
- ]
+ ])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/media/libpng/moz.build b/media/libpng/moz.build
index 330f5ff7515..b95c00779a9 100644
--- a/media/libpng/moz.build
+++ b/media/libpng/moz.build
@@ -38,7 +38,7 @@ if CONFIG['MOZ_PNG_ARM_NEON']:
'arm/filter_neon.S'
]
-LIBRARY_NAME = 'mozpng'
+Library('mozpng')
MSVC_ENABLE_PGO = True
diff --git a/media/libspeex_resampler/src/moz.build b/media/libspeex_resampler/src/moz.build
index 850cd926023..5ab9d06825b 100644
--- a/media/libspeex_resampler/src/moz.build
+++ b/media/libspeex_resampler/src/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'speex'
+Library('speex')
EXPORTS.speex += [
'speex_resampler.h',
diff --git a/media/libvpx/moz.build b/media/libvpx/moz.build
index 4e97a486568..03aa3edd5aa 100644
--- a/media/libvpx/moz.build
+++ b/media/libvpx/moz.build
@@ -13,7 +13,7 @@ if CONFIG['VPX_NEED_OBJ_INT_EXTRACT']:
'build/make/obj_int_extract.c',
]
- HOST_PROGRAM = 'host_obj_int_extract'
+ HostProgram('host_obj_int_extract')
# Unify fewer files together to reduce the chance of name collision
FILES_PER_UNIFIED_FILE = 8
diff --git a/media/mtransport/standalone/moz.build b/media/mtransport/standalone/moz.build
index e15cc713638..e9f28d5507e 100644
--- a/media/mtransport/standalone/moz.build
+++ b/media/mtransport/standalone/moz.build
@@ -9,7 +9,7 @@ include('../objs.mozbuild')
# These files cannot be built in unified mode because they force NSPR logging.
SOURCES += mtransport_cppsrcs
-LIBRARY_NAME = 'mtransport_s'
+Library('mtransport_s')
LOCAL_INCLUDES += [
'/media/mtransport/',
diff --git a/media/mtransport/test/moz.build b/media/mtransport/test/moz.build
index cd08fbfc869..fd2c8fb29e8 100644
--- a/media/mtransport/test/moz.build
+++ b/media/mtransport/test/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'buffered_stun_socket_unittest',
'ice_unittest',
'nrappkit_unittest',
@@ -16,12 +16,12 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'TestSyncRunnable',
'transport_unittests',
'turn_unittest',
- ]
+ ])
if CONFIG['MOZ_SCTP']:
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'sctp_unittest',
- ]
+ ])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/media/omx-plugin/froyo/moz.build b/media/omx-plugin/froyo/moz.build
index 6faa233c2d2..dc530b2134c 100644
--- a/media/omx-plugin/froyo/moz.build
+++ b/media/omx-plugin/froyo/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'OmxPluginFroyo.cpp',
]
-LIBRARY_NAME = 'omxpluginfroyo'
+Library('omxpluginfroyo')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/gb/moz.build b/media/omx-plugin/gb/moz.build
index 755b92870e9..c7616aaa8dd 100644
--- a/media/omx-plugin/gb/moz.build
+++ b/media/omx-plugin/gb/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'OmxPlugin236.cpp',
]
-LIBRARY_NAME = 'omxplugingb'
+Library('omxplugingb')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/gb235/moz.build b/media/omx-plugin/gb235/moz.build
index 8cae2d6dcfe..c25bed8b144 100644
--- a/media/omx-plugin/gb235/moz.build
+++ b/media/omx-plugin/gb235/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'OmxPlugin235.cpp',
]
-LIBRARY_NAME = 'omxplugingb235'
+Library('omxplugingb235')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/hc/moz.build b/media/omx-plugin/hc/moz.build
index 4de7ee83fff..9ad3794f7e2 100644
--- a/media/omx-plugin/hc/moz.build
+++ b/media/omx-plugin/hc/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'OmxPluginHoneycomb.cpp',
]
-LIBRARY_NAME = 'omxpluginhc'
+Library('omxpluginhc')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/kk/moz.build b/media/omx-plugin/kk/moz.build
index 974b057a7a6..4667493d803 100644
--- a/media/omx-plugin/kk/moz.build
+++ b/media/omx-plugin/kk/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'OmxPluginKitKat.cpp',
]
-LIBRARY_NAME = 'omxpluginkk'
+Library('omxpluginkk')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/froyo/libstagefright/moz.build b/media/omx-plugin/lib/froyo/libstagefright/moz.build
index 2061ad10a8d..0632ae65f5b 100644
--- a/media/omx-plugin/lib/froyo/libstagefright/moz.build
+++ b/media/omx-plugin/lib/froyo/libstagefright/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-LIBRARY_NAME = 'stagefright'
+Library('stagefright')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/gb/libstagefright/moz.build b/media/omx-plugin/lib/gb/libstagefright/moz.build
index 3d9a3da02e0..209ceb46d1b 100644
--- a/media/omx-plugin/lib/gb/libstagefright/moz.build
+++ b/media/omx-plugin/lib/gb/libstagefright/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-LIBRARY_NAME = 'stagefright'
+Library('stagefright')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build b/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build
index f2deef9aa55..efbd44f49e8 100644
--- a/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build
+++ b/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright_color_conversion.cpp',
]
-LIBRARY_NAME = 'stagefright_color_conversion'
+Library('stagefright_color_conversion')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/gb/libutils/moz.build b/media/omx-plugin/lib/gb/libutils/moz.build
index f1d6f969eac..a131edf0ad6 100644
--- a/media/omx-plugin/lib/gb/libutils/moz.build
+++ b/media/omx-plugin/lib/gb/libutils/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libutils.cpp',
]
-LIBRARY_NAME = 'utils'
+Library('utils')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/gb235/libstagefright/moz.build b/media/omx-plugin/lib/gb235/libstagefright/moz.build
index 3d9a3da02e0..209ceb46d1b 100644
--- a/media/omx-plugin/lib/gb235/libstagefright/moz.build
+++ b/media/omx-plugin/lib/gb235/libstagefright/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-LIBRARY_NAME = 'stagefright'
+Library('stagefright')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/hc/libstagefright/moz.build b/media/omx-plugin/lib/hc/libstagefright/moz.build
index 3d9a3da02e0..209ceb46d1b 100644
--- a/media/omx-plugin/lib/hc/libstagefright/moz.build
+++ b/media/omx-plugin/lib/hc/libstagefright/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-LIBRARY_NAME = 'stagefright'
+Library('stagefright')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/ics/libstagefright/moz.build b/media/omx-plugin/lib/ics/libstagefright/moz.build
index 3f95e12fc84..c22b723f5cc 100644
--- a/media/omx-plugin/lib/ics/libstagefright/moz.build
+++ b/media/omx-plugin/lib/ics/libstagefright/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-LIBRARY_NAME = 'stagefright'
+Library('stagefright')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/ics/libutils/moz.build b/media/omx-plugin/lib/ics/libutils/moz.build
index b5c914d5162..409b4e712ba 100644
--- a/media/omx-plugin/lib/ics/libutils/moz.build
+++ b/media/omx-plugin/lib/ics/libutils/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libutils.cpp',
]
-LIBRARY_NAME = 'utils'
+Library('utils')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build b/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build
index 99859c8fe80..b250510128d 100644
--- a/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build
+++ b/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build
@@ -10,7 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libvideoeditorplayer.cpp',
]
-LIBRARY_NAME = 'videoeditorplayer'
+Library('videoeditorplayer')
FORCE_SHARED_LIB = True
diff --git a/media/omx-plugin/moz.build b/media/omx-plugin/moz.build
index 05bc4c20f4f..1507a4094c0 100644
--- a/media/omx-plugin/moz.build
+++ b/media/omx-plugin/moz.build
@@ -18,7 +18,7 @@ SOURCES += [
'OmxPlugin.cpp',
]
-LIBRARY_NAME = 'omxplugin'
+Library('omxplugin')
FORCE_SHARED_LIB = True
diff --git a/media/webrtc/signaling/test/moz.build b/media/webrtc/signaling/test/moz.build
index 5e32f53f872..5ce5002546b 100644
--- a/media/webrtc/signaling/test/moz.build
+++ b/media/webrtc/signaling/test/moz.build
@@ -5,12 +5,12 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'mediaconduit_unittests',
'mediapipeline_unittest',
'sdp_unittests',
'signaling_unittests',
- ]
+ ])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/memory/build/moz.build b/memory/build/moz.build
index 447d02f85a4..73ce1ac955a 100644
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -36,7 +36,7 @@ if CONFIG['MOZ_REPLACE_MALLOC']:
'replace_malloc.c',
]
-LIBRARY_NAME = 'memory'
+Library('memory')
if CONFIG['MOZ_JEMALLOC3']:
if not CONFIG['MOZ_NATIVE_JEMALLOC']:
diff --git a/memory/jemalloc/moz.build b/memory/jemalloc/moz.build
index 310a55a4988..0ab76125157 100644
--- a/memory/jemalloc/moz.build
+++ b/memory/jemalloc/moz.build
@@ -36,7 +36,7 @@ if CONFIG['OS_TARGET'] == 'Darwin' and not CONFIG['MOZ_REPLACE_MALLOC']:
'src/src/zone.c',
]
-LIBRARY_NAME = 'jemalloc'
+Library('jemalloc')
FORCE_STATIC_LIB = True
diff --git a/memory/mozalloc/moz.build b/memory/mozalloc/moz.build
index 704ce673d98..d279faaedf0 100644
--- a/memory/mozalloc/moz.build
+++ b/memory/mozalloc/moz.build
@@ -57,7 +57,7 @@ else:
'VolatileBufferFallback.cpp',
]
-LIBRARY_NAME = 'mozalloc'
+Library('mozalloc')
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
FORCE_STATIC_LIB = True
diff --git a/memory/mozalloc/tests/moz.build b/memory/mozalloc/tests/moz.build
index b7a99656703..6b265f5beb9 100644
--- a/memory/mozalloc/tests/moz.build
+++ b/memory/mozalloc/tests/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestVolatileBuffer',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/memory/mozjemalloc/moz.build b/memory/mozjemalloc/moz.build
index d5b58e5ea5d..f887ae1903a 100644
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -12,7 +12,7 @@ if not CONFIG['MOZ_JEMALLOC3']:
SOURCES += [
'jemalloc.c',
]
- LIBRARY_NAME = 'mozjemalloc'
+ Library('mozjemalloc')
STATIC_LIBRARY_NAME = 'jemalloc'
FORCE_STATIC_LIB = True
diff --git a/memory/replace/dmd/moz.build b/memory/replace/dmd/moz.build
index acf4c2ebe06..c8f15f2dae3 100644
--- a/memory/replace/dmd/moz.build
+++ b/memory/replace/dmd/moz.build
@@ -18,7 +18,7 @@ SOURCES += [
'../../../nsprpub/lib/libc/src/strcpy.c',
]
-LIBRARY_NAME = 'dmd'
+Library('dmd')
FORCE_SHARED_LIB = True
diff --git a/memory/replace/dummy/moz.build b/memory/replace/dummy/moz.build
index 7d2c185c85e..2aeda4fb26c 100644
--- a/memory/replace/dummy/moz.build
+++ b/memory/replace/dummy/moz.build
@@ -9,7 +9,7 @@ SOURCES += [
'dummy_replace_malloc.c',
]
-LIBRARY_NAME = 'replace_malloc'
+Library('replace_malloc')
FORCE_SHARED_LIB = True
diff --git a/memory/replace/jemalloc/moz.build b/memory/replace/jemalloc/moz.build
index 1759d60cab0..65c5999f6c8 100644
--- a/memory/replace/jemalloc/moz.build
+++ b/memory/replace/jemalloc/moz.build
@@ -17,7 +17,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
'pthread_atfork.c',
]
-LIBRARY_NAME = 'replace_jemalloc'
+Library('replace_jemalloc')
USE_LIBS += [
'jemalloc',
diff --git a/mfbt/moz.build b/mfbt/moz.build
index 90ef1aae540..b51eac53c0f 100644
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -6,7 +6,7 @@
TEST_DIRS += ['tests']
-LIBRARY_NAME = 'mfbt'
+Library('mfbt')
EXPORTS.mozilla = [
'Alignment.h',
diff --git a/mfbt/tests/moz.build b/mfbt/tests/moz.build
index 9520369fe90..48c2fde8e71 100644
--- a/mfbt/tests/moz.build
+++ b/mfbt/tests/moz.build
@@ -4,7 +4,7 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestArrayUtils',
'TestAtomics',
'TestBinarySearch',
@@ -30,12 +30,12 @@ CPP_UNIT_TESTS += [
'TestTypeTraits',
'TestUniquePtr',
'TestWeakPtr',
-]
+])
if not CONFIG['MOZ_ASAN']:
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'TestPoisonArea',
- ]
+ ])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/modules/libbz2/src/moz.build b/modules/libbz2/src/moz.build
index fade621e6b9..68f46a9998b 100644
--- a/modules/libbz2/src/moz.build
+++ b/modules/libbz2/src/moz.build
@@ -20,9 +20,9 @@ csrcs = [
]
HOST_SOURCES += csrcs
-HOST_LIBRARY_NAME = 'hostbz2'
+HostLibrary('hostbz2')
-LIBRARY_NAME = 'bz2'
+Library('bz2')
UNIFIED_SOURCES += [
'blocksort.c',
diff --git a/modules/libmar/sign/moz.build b/modules/libmar/sign/moz.build
index a6d0308e0f0..d7b8d1f8b30 100644
--- a/modules/libmar/sign/moz.build
+++ b/modules/libmar/sign/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'signmar'
+Library('signmar')
UNIFIED_SOURCES += [
'mar_sign.c',
diff --git a/modules/libmar/src/moz.build b/modules/libmar/src/moz.build
index e40ed05673e..2d25e0849af 100644
--- a/modules/libmar/src/moz.build
+++ b/modules/libmar/src/moz.build
@@ -14,9 +14,9 @@ HOST_SOURCES += [
'mar_extract.c',
'mar_read.c',
]
-HOST_LIBRARY_NAME = 'hostmar'
+HostLibrary('hostmar')
-LIBRARY_NAME = 'mar'
+Library('mar')
UNIFIED_SOURCES += [
'mar_create.c',
diff --git a/modules/libmar/tool/moz.build b/modules/libmar/tool/moz.build
index 638c8ea744d..7cb27da298d 100644
--- a/modules/libmar/tool/moz.build
+++ b/modules/libmar/tool/moz.build
@@ -8,14 +8,14 @@ HOST_SOURCES += [
'mar.c',
]
-HOST_PROGRAM = 'mar'
+HostProgram('mar')
HOST_USE_LIBS += [
'hostmar',
]
if CONFIG['MOZ_ENABLE_SIGNMAR']:
- PROGRAM = 'signmar'
+ Program('signmar')
SOURCES += HOST_SOURCES
diff --git a/modules/libmar/verify/moz.build b/modules/libmar/verify/moz.build
index eea09b9cc47..7a6a1422730 100644
--- a/modules/libmar/verify/moz.build
+++ b/modules/libmar/verify/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'verifymar'
+Library('verifymar')
UNIFIED_SOURCES += [
'cryptox.c',
diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build
index d0e90f0b71d..e97a8f258d2 100644
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -69,7 +69,7 @@ if CONFIG['MOZ_ASAN']:
]
-LIBRARY_NAME = 'mozglue'
+Library('mozglue')
USE_LIBS += [
'mfbt',
diff --git a/mozglue/linker/moz.build b/mozglue/linker/moz.build
index 4b7ccdcf3ad..c44bd429fd2 100644
--- a/mozglue/linker/moz.build
+++ b/mozglue/linker/moz.build
@@ -12,14 +12,14 @@ SOURCES += [
'Zip.cpp',
]
-LIBRARY_NAME = 'linker'
+Library('linker')
HOST_SOURCES += [
'SeekableZStream.cpp',
'szip.cpp',
]
-HOST_PROGRAM = 'szip'
+HostProgram('szip')
FINAL_LIBRARY = 'mozglue'
diff --git a/mozglue/linker/tests/moz.build b/mozglue/linker/tests/moz.build
index 73c4585ebe8..4d1468bcfa0 100644
--- a/mozglue/linker/tests/moz.build
+++ b/mozglue/linker/tests/moz.build
@@ -9,9 +9,9 @@ NO_DIST_INSTALL = True
SOURCES += [
'TestZip.cpp',
]
-SIMPLE_PROGRAMS += [
+SimplePrograms([
'TestZip',
-]
+])
LOCAL_INCLUDES += ['..']
USE_LIBS += [
'linker',
diff --git a/mozglue/tests/moz.build b/mozglue/tests/moz.build
index 01fb5234f39..7b8d5ef7376 100644
--- a/mozglue/tests/moz.build
+++ b/mozglue/tests/moz.build
@@ -10,6 +10,6 @@ SOURCES += [
'ShowSSEConfig.cpp',
]
-CPP_UNIT_TESTS += [
+CppUnitTests([
'ShowSSEConfig',
-]
+])
diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build
index 39fc3176f4a..95c058250b5 100644
--- a/netwerk/sctp/src/moz.build
+++ b/netwerk/sctp/src/moz.build
@@ -40,7 +40,7 @@ if CONFIG['OS_TARGET'] == 'Android':
'ifaddrs_android.cpp',
]
-LIBRARY_NAME = 'nksctp_s'
+Library('nksctp_s')
include('/ipc/chromium/chromium-config.mozbuild')
diff --git a/netwerk/srtp/src/moz.build b/netwerk/srtp/src/moz.build
index 3fe725ab3c8..ff564203140 100644
--- a/netwerk/srtp/src/moz.build
+++ b/netwerk/srtp/src/moz.build
@@ -31,7 +31,7 @@ UNIFIED_SOURCES += [
'srtp/srtp.c',
]
-LIBRARY_NAME = 'nksrtp_s'
+Library('nksrtp_s')
include('/ipc/chromium/chromium-config.mozbuild')
diff --git a/netwerk/streamconv/test/moz.build b/netwerk/streamconv/test/moz.build
index b5a9f98b2f4..d62d4669197 100644
--- a/netwerk/streamconv/test/moz.build
+++ b/netwerk/streamconv/test/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'TestStreamConv'
+Program('TestStreamConv')
UNIFIED_SOURCES += [
'Converters.cpp',
diff --git a/netwerk/test/moz.build b/netwerk/test/moz.build
index 5a6e7d370ac..c86196ed4ae 100644
--- a/netwerk/test/moz.build
+++ b/netwerk/test/moz.build
@@ -16,7 +16,7 @@ XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
if CONFIG['OS_ARCH'] != 'Darwin':
XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'PropertiesTest',
'ReadNTLM',
'TestBlockingSocket',
@@ -32,7 +32,7 @@ SIMPLE_PROGRAMS = [
'TestUpload',
'TestURLParser',
'urltest',
-]
+])
# XXX Make this work in libxul builds.
#SIMPLE_PROGRAMS += [
@@ -50,11 +50,11 @@ SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestCookie',
'TestSTSParser',
'TestUDPSocket',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/other-licenses/bsdiff/moz.build b/other-licenses/bsdiff/moz.build
index a341e449613..e12a40f8853 100644
--- a/other-licenses/bsdiff/moz.build
+++ b/other-licenses/bsdiff/moz.build
@@ -8,7 +8,7 @@ HOST_SOURCES += [
'bsdiff.c',
]
-HOST_PROGRAM = 'mbsdiff'
+HostProgram('mbsdiff')
if CONFIG['MOZ_NATIVE_BZ2']:
HOST_OS_LIBS += CONFIG['MOZ_BZ2_LIBS']
diff --git a/profile/dirserviceprovider/moz.build b/profile/dirserviceprovider/moz.build
index b576c8da6c6..a55af7f5086 100644
--- a/profile/dirserviceprovider/moz.build
+++ b/profile/dirserviceprovider/moz.build
@@ -15,7 +15,7 @@ if CONFIG['MOZ_PROFILELOCKING']:
UNIFIED_SOURCES += ['ProfileUnlockerWin.cpp']
EXPORTS.mozilla += ['ProfileUnlockerWin.h']
-LIBRARY_NAME = 'profdirserviceprovidersa_s'
+Library('profdirserviceprovidersa_s')
FORCE_STATIC_LIB = True
diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py
index 339ab7610dd..346cae03ccd 100644
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -122,14 +122,14 @@ class Context(KeyedDefaultDict):
else:
return default()
- def _validate(self, key, value):
+ def _validate(self, key, value, is_template=False):
"""Validates whether the key is allowed and if the value's type
matches.
"""
stored_type, input_type, docs, tier = \
self._allowed_variables.get(key, (None, None, None, None))
- if stored_type is None:
+ if stored_type is None or not is_template and key in TEMPLATE_VARIABLES:
raise KeyError('global_ns', 'set_unknown', key, value)
# If the incoming value is not the type we store, we try to convert
@@ -182,6 +182,11 @@ class Context(KeyedDefaultDict):
return set(tier for tier in tiers if tier)
+class TemplateContext(Context):
+ def _validate(self, key, value):
+ return Context._validate(self, key, value, True)
+
+
class FinalTargetValue(ContextDerivedValue, unicode):
def __new__(cls, context, value=""):
if not value:
@@ -946,6 +951,27 @@ for name, (storage_type, input_types, docs, tier) in VARIABLES.items():
raise RuntimeError('%s has a "list" storage type. Use "List" instead.'
% name)
+# Set of variables that are only allowed in templates:
+TEMPLATE_VARIABLES = {
+ 'CPP_UNIT_TESTS',
+ 'HOST_PROGRAM',
+ 'HOST_LIBRARY_NAME',
+ 'HOST_SIMPLE_PROGRAMS',
+ 'LIBRARY_NAME',
+ 'PROGRAM',
+ 'SIMPLE_PROGRAMS',
+}
+
+# Add a note to template variable documentation.
+for name in TEMPLATE_VARIABLES:
+ if name not in VARIABLES:
+ raise RuntimeError('%s is in TEMPLATE_VARIABLES but not in VARIABLES.'
+ % name)
+ storage_type, input_types, docs, tier = VARIABLES[name]
+ docs += 'This variable is only available in templates.\n'
+ VARIABLES[name] = (storage_type, input_types, docs, tier)
+
+
# The set of functions exposed to the sandbox.
#
# Each entry is a tuple of:
@@ -1211,7 +1237,84 @@ SPECIAL_VARIABLES = {
# Deprecation hints.
DEPRECATION_HINTS = {
+ 'CPP_UNIT_TESTS': '''
+ Please use'
+
+ CppUnitTests(['foo', 'bar'])
+
+ instead of
+
+ CPP_UNIT_TESTS += ['foo', 'bar']
+ ''',
+
+ 'HOST_PROGRAM': '''
+ Please use
+
+ HostProgram('foo')
+
+ instead of
+
+ HOST_PROGRAM = 'foo'
+ ''',
+
+ 'HOST_LIBRARY_NAME': '''
+ Please use
+
+ HostLibrary('foo')
+
+ instead of
+
+ HOST_LIBRARY_NAME = 'foo'
+ ''',
+
+ 'HOST_SIMPLE_PROGRAMS': '''
+ Please use
+
+ HostSimplePrograms(['foo', 'bar'])
+
+ instead of
+
+ HOST_SIMPLE_PROGRAMS += ['foo', 'bar']"
+ ''',
+
+ 'LIBRARY_NAME': '''
+ Please use
+
+ Library('foo')
+
+ instead of
+
+ LIBRARY_NAME = 'foo'
+ ''',
+
+ 'PROGRAM': '''
+ Please use
+
+ Program('foo')
+
+ instead of
+
+ PROGRAM = 'foo'"
+ ''',
+
+ 'SIMPLE_PROGRAMS': '''
+ Please use
+
+ SimplePrograms(['foo', 'bar'])
+
+ instead of
+
+ SIMPLE_PROGRAMS += ['foo', 'bar']"
+ ''',
+
'TOOL_DIRS': 'Please use the DIRS variable instead.',
+
'TEST_TOOL_DIRS': 'Please use the TEST_DIRS variable instead.',
+
'PARALLEL_DIRS': 'Please use the DIRS variable instead.',
}
+
+# Make sure that all template variables have a deprecation hint.
+for name in TEMPLATE_VARIABLES:
+ if name not in DEPRECATION_HINTS:
+ raise RuntimeError('Missing deprecation hint for %s' % name)
diff --git a/python/mozbuild/mozbuild/frontend/gyp_reader.py b/python/mozbuild/mozbuild/frontend/gyp_reader.py
index 63a335d175a..4e9b6a16bc7 100644
--- a/python/mozbuild/mozbuild/frontend/gyp_reader.py
+++ b/python/mozbuild/mozbuild/frontend/gyp_reader.py
@@ -11,7 +11,7 @@ import mozpack.path as mozpath
from mozpack.files import FileFinder
from .sandbox import alphabetical_sorted
from .context import (
- Context,
+ TemplateContext,
VARIABLES,
)
from mozbuild.util import (
@@ -52,7 +52,7 @@ for unused in ['RULE_INPUT_PATH', 'RULE_INPUT_ROOT', 'RULE_INPUT_NAME',
generator_default_variables[unused] = b''
-class GypContext(Context):
+class GypContext(TemplateContext):
"""Specialized Context for use with data extracted from Gyp.
config is the ConfigEnvironment for this context.
@@ -61,7 +61,8 @@ class GypContext(Context):
"""
def __init__(self, config, relobjdir):
self._relobjdir = relobjdir
- Context.__init__(self, allowed_variables=self.VARIABLES(), config=config)
+ TemplateContext.__init__(self, allowed_variables=self.VARIABLES(),
+ config=config)
@classmethod
@memoize
diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py
index 17f187e3b17..d6a731ffa9e 100644
--- a/python/mozbuild/mozbuild/frontend/reader.py
+++ b/python/mozbuild/mozbuild/frontend/reader.py
@@ -22,6 +22,7 @@ import inspect
import logging
import os
import sys
+import textwrap
import time
import tokenize
import traceback
@@ -59,6 +60,7 @@ from .context import (
VARIABLES,
DEPRECATION_HINTS,
SPECIAL_VARIABLES,
+ TemplateContext,
)
if sys.version_info.major == 2:
@@ -379,7 +381,7 @@ class MozbuildSandbox(Sandbox):
func, code, path = template
def template_function(*args, **kwargs):
- context = Context(VARIABLES, self._context.config)
+ context = TemplateContext(VARIABLES, self._context.config)
context.add_source(self._execution_stack[-1])
for p in self._context.all_paths:
context.add_source(p)
@@ -390,6 +392,10 @@ class MozbuildSandbox(Sandbox):
sandbox.exec_source(code, path)
+ # This is gross, but allows the merge to happen. Eventually, the
+ # merging will go away and template contexts emitted independently.
+ klass = self._context.__class__
+ self._context.__class__ = TemplateContext
# The sandbox will do all the necessary checks for these merges.
for key, value in context.items():
if isinstance(value, dict):
@@ -398,6 +404,7 @@ class MozbuildSandbox(Sandbox):
self[key] += value
else:
self[key] = value
+ self._context.__class__ = klass
for p in context.all_paths:
self._context.add_source(p)
@@ -668,7 +675,8 @@ class BuildReaderError(Exception):
s.write('\n')
if inner.args[2] in DEPRECATION_HINTS:
- s.write('%s\n' % DEPRECATION_HINTS[inner.args[2]])
+ s.write('%s\n' %
+ textwrap.dedent(DEPRECATION_HINTS[inner.args[2]]).strip())
return
s.write('Please change the file to not use this variable.\n')
diff --git a/python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build b/python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build
index e52acb3794f..ae3153f2aa0 100644
--- a/python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build
+++ b/python/mozbuild/mozbuild/test/backend/data/visual-studio/moz.build
@@ -4,4 +4,4 @@
add_tier_dir('libs', ['dir1'])
-LIBRARY_NAME = 'test'
+Library('test')
diff --git a/python/mozbuild/mozbuild/test/frontend/data/program/moz.build b/python/mozbuild/mozbuild/test/frontend/data/program/moz.build
index 4f315a4619a..4c19b90cd54 100644
--- a/python/mozbuild/mozbuild/test/frontend/data/program/moz.build
+++ b/python/mozbuild/mozbuild/test/frontend/data/program/moz.build
@@ -1,6 +1,15 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/
-PROGRAM = 'test_program'
+@template
+def Program(name):
+ PROGRAM = name
-SIMPLE_PROGRAMS = [ 'test_program1', 'test_program2' ]
+
+@template
+def SimplePrograms(names):
+ SIMPLE_PROGRAMS += names
+
+Program('test_program')
+
+SimplePrograms([ 'test_program1', 'test_program2' ])
diff --git a/rdf/tests/rdfcat/moz.build b/rdf/tests/rdfcat/moz.build
index f4b730ad887..56b2f877539 100644
--- a/rdf/tests/rdfcat/moz.build
+++ b/rdf/tests/rdfcat/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'rdfcat'
+Program('rdfcat')
SOURCES += [
'rdfcat.cpp',
diff --git a/rdf/tests/rdfpoll/moz.build b/rdf/tests/rdfpoll/moz.build
index 7367378dbcc..41ef0fd2579 100644
--- a/rdf/tests/rdfpoll/moz.build
+++ b/rdf/tests/rdfpoll/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'rdfpoll'
+Program('rdfpoll')
SOURCES += [
'rdfpoll.cpp',
diff --git a/rdf/tests/triplescat/moz.build b/rdf/tests/triplescat/moz.build
index 13953e1714e..f1d0cfb0a7d 100644
--- a/rdf/tests/triplescat/moz.build
+++ b/rdf/tests/triplescat/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'triplescat'
+Program('triplescat')
SOURCES += [
'triplescat.cpp',
diff --git a/rdf/util/moz.build b/rdf/util/moz.build
index 917916bd220..b99bea462c0 100644
--- a/rdf/util/moz.build
+++ b/rdf/util/moz.build
@@ -14,7 +14,7 @@ include('objs.mozbuild')
SOURCES += rdf_util_src_cppsrcs
-LIBRARY_NAME = 'rdfutil_external_s'
+Library('rdfutil_external_s')
# we don't want the shared lib, but we want to force the creation of a static lib.
FORCE_STATIC_LIB = True
diff --git a/security/manager/ssl/tests/compiled/moz.build b/security/manager/ssl/tests/compiled/moz.build
index 4c201f0b035..6ed376dd9da 100644
--- a/security/manager/ssl/tests/compiled/moz.build
+++ b/security/manager/ssl/tests/compiled/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestCertDB',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build b/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build
index 5f9716aee57..9543ee60073 100644
--- a/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build
+++ b/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build
@@ -8,7 +8,7 @@ UNIFIED_SOURCES += [
'pkcs11testmodule.cpp',
]
-LIBRARY_NAME = 'pkcs11testmodule'
+Library('pkcs11testmodule')
FORCE_SHARED_LIB = True
# C_GetFunctionList needs to be exported. As it turns out, it's much easier to
diff --git a/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build b/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
index a679f8a0b90..416fb35a1c4 100644
--- a/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
+++ b/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
@@ -6,12 +6,12 @@
FAIL_ON_WARNINGS = True
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'BadCertServer',
'ClientAuthServer',
'GenerateOCSPResponse',
'OCSPStaplingServer',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/security/manager/ssl/tests/unit/tlsserver/lib/moz.build b/security/manager/ssl/tests/unit/tlsserver/lib/moz.build
index d2ce36eca6e..28df99a529c 100644
--- a/security/manager/ssl/tests/unit/tlsserver/lib/moz.build
+++ b/security/manager/ssl/tests/unit/tlsserver/lib/moz.build
@@ -14,4 +14,4 @@ LOCAL_INCLUDES += [
'../../../../../../pkix/test/lib',
]
-LIBRARY_NAME = 'tlsserver'
+Library('tlsserver')
diff --git a/security/pkix/moz.build b/security/pkix/moz.build
index 5e8570429c3..3c3a4dbf541 100644
--- a/security/pkix/moz.build
+++ b/security/pkix/moz.build
@@ -37,6 +37,6 @@ if CONFIG['_MSC_VER']:
FAIL_ON_WARNINGS = True
-LIBRARY_NAME = 'mozillapkix'
+Library('mozillapkix')
FINAL_LIBRARY = 'xul'
diff --git a/security/pkix/test/lib/moz.build b/security/pkix/test/lib/moz.build
index cfaa1f3fff2..9374ea43302 100644
--- a/security/pkix/test/lib/moz.build
+++ b/security/pkix/test/lib/moz.build
@@ -24,7 +24,7 @@ SOURCES += [
'pkixtestutil.cpp',
]
-LIBRARY_NAME = 'pkixtestutil'
+Library('pkixtestutil')
LOCAL_INCLUDES += [
'../../include',
diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build
index 9aa1e0b1b8b..74c1736a4b4 100644
--- a/security/sandbox/linux/moz.build
+++ b/security/sandbox/linux/moz.build
@@ -6,7 +6,7 @@
FAIL_ON_WARNINGS = True
-LIBRARY_NAME = 'mozsandbox'
+Library('mozsandbox')
FORCE_SHARED_LIB = True
EXPORTS.mozilla += [
diff --git a/security/sandbox/moz.build b/security/sandbox/moz.build
index 716fc22630b..113a143724a 100644
--- a/security/sandbox/moz.build
+++ b/security/sandbox/moz.build
@@ -9,7 +9,7 @@ if CONFIG['OS_ARCH'] == 'Linux':
elif CONFIG['OS_ARCH'] == 'Darwin':
DIRS += ['mac']
elif CONFIG['OS_ARCH'] == 'WINNT':
- LIBRARY_NAME = 'sandbox_s'
+ Library('sandbox_s')
FORCE_STATIC_LIB = True
DIRS += [
diff --git a/security/sandbox/staticruntime/moz.build b/security/sandbox/staticruntime/moz.build
index 33775efd1c8..ad6ddfe976f 100644
--- a/security/sandbox/staticruntime/moz.build
+++ b/security/sandbox/staticruntime/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_ARCH'] == 'WINNT':
- LIBRARY_NAME = 'sandbox_staticruntime_s'
+ Library('sandbox_staticruntime_s')
FORCE_STATIC_LIB = True
USE_STATIC_LIBS = True
diff --git a/security/sandbox/win/src/sandboxbroker/moz.build b/security/sandbox/win/src/sandboxbroker/moz.build
index f95623820e5..eed82492d5a 100644
--- a/security/sandbox/win/src/sandboxbroker/moz.build
+++ b/security/sandbox/win/src/sandboxbroker/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'sandboxbroker'
+Library('sandboxbroker')
USE_LIBS += [
'nspr',
diff --git a/startupcache/test/moz.build b/startupcache/test/moz.build
index 2347e19ec73..7d6a4e7f7cc 100644
--- a/startupcache/test/moz.build
+++ b/startupcache/test/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestStartupCache',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/storage/test/moz.build b/storage/test/moz.build
index f8ea008dad0..02d25832bab 100644
--- a/storage/test/moz.build
+++ b/storage/test/moz.build
@@ -6,7 +6,7 @@
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
-CPP_UNIT_TESTS += [
+CppUnitTests([
'test_AsXXX_helpers',
'test_async_callbacks_with_spun_event_loops',
'test_asyncStatementExecution_transaction',
@@ -19,14 +19,14 @@ CPP_UNIT_TESTS += [
'test_transaction_helper',
'test_true_async',
'test_unlock_notify',
-]
+])
if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT', 'Darwin'):
# FIXME bug 523392: test_deadlock_detector doesn't like Windows
# FIXME bug 523378: also fails on OS X
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'test_deadlock_detector',
- ]
+ ])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/testing/gtest/moz.build b/testing/gtest/moz.build
index ac4de39e011..fb19ada2451 100644
--- a/testing/gtest/moz.build
+++ b/testing/gtest/moz.build
@@ -62,7 +62,7 @@ if CONFIG['ENABLE_TESTS']:
'mozilla/GTestRunner.cpp',
]
- LIBRARY_NAME = 'gtest'
+ Library('gtest')
SOURCES += [
'mozilla/SanityTest.cpp',
diff --git a/testing/mochitest/ssltunnel/moz.build b/testing/mochitest/ssltunnel/moz.build
index 863d26128f2..dae73aff7c9 100644
--- a/testing/mochitest/ssltunnel/moz.build
+++ b/testing/mochitest/ssltunnel/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'ssltunnel'
+Program('ssltunnel')
SOURCES += [
'ssltunnel.cpp',
diff --git a/testing/tools/screenshot/moz.build b/testing/tools/screenshot/moz.build
index 67970cda79d..50732236ee4 100644
--- a/testing/tools/screenshot/moz.build
+++ b/testing/tools/screenshot/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_WIDGET_GTK'] and CONFIG['MOZ_X11']:
- PROGRAM = 'screentopng'
+ Program('screentopng')
SOURCES += [
'gdk-screenshot.cpp',
]
@@ -13,7 +13,7 @@ if CONFIG['MOZ_WIDGET_GTK'] and CONFIG['MOZ_X11']:
OS_LIBS += CONFIG['TK_LIBS']
OS_LIBS += CONFIG['XSS_LIBS']
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
- PROGRAM = 'screenshot'
+ Program('screenshot')
SOURCES += [
'win32-screenshot.cpp',
]
diff --git a/toolkit/components/ctypes/tests/moz.build b/toolkit/components/ctypes/tests/moz.build
index 2db986b2572..749ccd4622c 100644
--- a/toolkit/components/ctypes/tests/moz.build
+++ b/toolkit/components/ctypes/tests/moz.build
@@ -14,7 +14,7 @@ UNIFIED_SOURCES += [
'jsctypes-test.cpp',
]
-LIBRARY_NAME = 'jsctypes-test'
+Library('jsctypes-test')
FORCE_SHARED_LIB = True
diff --git a/toolkit/components/maintenanceservice/moz.build b/toolkit/components/maintenanceservice/moz.build
index 05045542b05..c2e5921b1f2 100644
--- a/toolkit/components/maintenanceservice/moz.build
+++ b/toolkit/components/maintenanceservice/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'maintenanceservice'
+Program('maintenanceservice')
SOURCES += [
'certificatecheck.cpp',
diff --git a/toolkit/components/places/tests/cpp/moz.build b/toolkit/components/places/tests/cpp/moz.build
index 9aa5a2a93cb..c5488e751fe 100644
--- a/toolkit/components/places/tests/cpp/moz.build
+++ b/toolkit/components/places/tests/cpp/moz.build
@@ -4,9 +4,9 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'test_IHistory',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/toolkit/crashreporter/breakpad-windows-libxul/moz.build b/toolkit/crashreporter/breakpad-windows-libxul/moz.build
index 8e8f4ae0529..d638b4ef0f1 100644
--- a/toolkit/crashreporter/breakpad-windows-libxul/moz.build
+++ b/toolkit/crashreporter/breakpad-windows-libxul/moz.build
@@ -12,7 +12,7 @@ SOURCES += [
'../google-breakpad/src/common/windows/http_upload.cc',
]
-LIBRARY_NAME = 'google_breakpad_libxul_s'
+Library('google_breakpad_libxul_s')
FINAL_LIBRARY = 'xul'
diff --git a/toolkit/crashreporter/breakpad-windows-libxul/staticruntime/moz.build b/toolkit/crashreporter/breakpad-windows-libxul/staticruntime/moz.build
index 4ab4f8ac6f0..f7b45f2ecb2 100644
--- a/toolkit/crashreporter/breakpad-windows-libxul/staticruntime/moz.build
+++ b/toolkit/crashreporter/breakpad-windows-libxul/staticruntime/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'../../google-breakpad/src/common/windows/http_upload.cc',
]
-LIBRARY_NAME = 'google_breakpad_libxul_staticruntime_s'
+Library('google_breakpad_libxul_staticruntime_s')
for var in ('UNICODE', 'UNICODE_', 'BREAKPAD_NO_TERMINATE_THREAD', 'NOMINMAX'):
DEFINES[var] = True
diff --git a/toolkit/crashreporter/client/moz.build b/toolkit/crashreporter/client/moz.build
index 3762ebf93cb..865d3d73f88 100644
--- a/toolkit/crashreporter/client/moz.build
+++ b/toolkit/crashreporter/client/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_TARGET'] != 'Android':
- PROGRAM = 'crashreporter'
+ Program('crashreporter')
UNIFIED_SOURCES += [
'crashreporter.cpp',
diff --git a/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build b/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
index 496c2e0183c..58f958beb28 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/dwarf/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['MOZ_CRASHREPORTER']:
- HOST_LIBRARY_NAME = 'host_breakpad_dwarf_s'
+ HostLibrary('host_breakpad_dwarf_s')
HOST_SOURCES += [
'bytereader.cc',
'dwarf2diehandler.cc',
diff --git a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
index 396a22f3ae4..13446dd3387 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/linux/moz.build
@@ -23,7 +23,7 @@ if CONFIG['OS_TARGET'] != 'Android':
]
if CONFIG['MOZ_CRASHREPORTER']:
- HOST_LIBRARY_NAME = 'host_breakpad_linux_common_s'
+ HostLibrary('host_breakpad_linux_common_s')
HOST_SOURCES += [
'dump_symbols.cc',
'elf_symbols_to_module.cc',
@@ -34,7 +34,7 @@ if CONFIG['MOZ_CRASHREPORTER']:
'memory_mapped_file.cc',
]
-LIBRARY_NAME = 'breakpad_linux_common_s'
+Library('breakpad_linux_common_s')
FINAL_LIBRARY = 'xul'
diff --git a/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build b/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
index e896b44694d..7d2860b82d5 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/mac/moz.build
@@ -23,14 +23,14 @@ if CONFIG['MOZ_CRASHREPORTER']:
HOST_SOURCES += [
'dump_syms.mm',
]
- HOST_LIBRARY_NAME = 'host_breakpad_mac_common_s'
+ HostLibrary('host_breakpad_mac_common_s')
SOURCES += [
'HTTPMultipartUpload.m',
'MachIPC.mm',
]
-LIBRARY_NAME = 'breakpad_mac_common_s'
+Library('breakpad_mac_common_s')
FINAL_LIBRARY = 'xul'
diff --git a/toolkit/crashreporter/google-breakpad/src/common/moz.build b/toolkit/crashreporter/google-breakpad/src/common/moz.build
index a0ce6d1cbfc..be0a02cc572 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/moz.build
@@ -47,7 +47,7 @@ else:
if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_CRASHREPORTER']:
HOST_SOURCES += [ 'convert_UTF.c' ]
- HOST_LIBRARY_NAME = 'host_breakpad_common_s'
+ HostLibrary('host_breakpad_common_s')
HOST_SOURCES += [
'arm_ex_reader.cc',
'arm_ex_to_module.cc',
@@ -76,7 +76,7 @@ if CONFIG['OS_TARGET'] == 'Android':
'android/breakpad_getcontext.S',
]
-LIBRARY_NAME = 'breakpad_common_s'
+Library('breakpad_common_s')
MSVC_ENABLE_PGO = True
diff --git a/toolkit/crashreporter/google-breakpad/src/common/solaris/moz.build b/toolkit/crashreporter/google-breakpad/src/common/solaris/moz.build
index cb3e39956d8..d3286166eda 100644
--- a/toolkit/crashreporter/google-breakpad/src/common/solaris/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/common/solaris/moz.build
@@ -10,9 +10,9 @@ UNIFIED_SOURCES += [
'guid_creator.cc',
]
-HOST_LIBRARY_NAME = 'host_breakpad_solaris_common_s'
+HostLibrary('host_breakpad_solaris_common_s')
-LIBRARY_NAME = 'breakpad_solaris_common_s'
+Library('breakpad_solaris_common_s')
# not compiling http_upload.cc currently
# since it depends on libcurl
diff --git a/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build b/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build
index 2689c37a940..4a1d11fbd34 100644
--- a/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/linux/dump_syms/moz.build
@@ -8,7 +8,7 @@ HOST_SOURCES += [
'dump_syms.cc',
]
-HOST_PROGRAM = 'dump_syms'
+HostProgram('dump_syms')
# host_breakpad_linux_common_s needs to come first
HOST_USE_LIBS += [
diff --git a/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build b/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
index 0d766f9c0e8..385f8980da2 100644
--- a/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/mac/dump_syms/moz.build
@@ -8,7 +8,7 @@ HOST_SOURCES += [
'dump_syms_tool.mm',
]
-HOST_PROGRAM = 'dump_syms'
+HostProgram('dump_syms')
HOST_USE_LIBS += [
'host_breakpad_common_s',
diff --git a/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build b/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build
index 5ce6cd5b1e4..203c8d762cd 100644
--- a/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build
+++ b/toolkit/crashreporter/google-breakpad/src/tools/solaris/dump_syms/moz.build
@@ -8,7 +8,7 @@ HOST_SOURCES += [
'dump_syms.cc',
]
-HOST_PROGRAM = 'dump_syms'
+HostProgram('dump_syms')
HOST_USE_LIBS += [
'host_breakpad_common_s',
diff --git a/toolkit/crashreporter/injector/moz.build b/toolkit/crashreporter/injector/moz.build
index 1f706d20ec1..83d02b14c30 100644
--- a/toolkit/crashreporter/injector/moz.build
+++ b/toolkit/crashreporter/injector/moz.build
@@ -8,7 +8,7 @@ SOURCES += [
'injector.cpp',
]
-LIBRARY_NAME = 'breakpadinjector'
+Library('breakpadinjector')
include('/ipc/chromium/chromium-config.mozbuild')
diff --git a/toolkit/crashreporter/test/moz.build b/toolkit/crashreporter/test/moz.build
index 0fc93e03ceb..9d93cbf94d4 100644
--- a/toolkit/crashreporter/test/moz.build
+++ b/toolkit/crashreporter/test/moz.build
@@ -17,7 +17,7 @@ UNIFIED_SOURCES += [
'nsTestCrasher.cpp',
]
-LIBRARY_NAME = 'testcrasher'
+Library('testcrasher')
EXTRA_JS_MODULES += [
'CrashTestUtils.jsm',
diff --git a/toolkit/library/StaticXULComponentsEnd/moz.build b/toolkit/library/StaticXULComponentsEnd/moz.build
index 752d50000e5..67989edd490 100644
--- a/toolkit/library/StaticXULComponentsEnd/moz.build
+++ b/toolkit/library/StaticXULComponentsEnd/moz.build
@@ -10,6 +10,6 @@ SOURCES += [
if '-flto' in CONFIG['OS_CXXFLAGS']:
SOURCES['StaticXULComponentsEnd.cpp'].flags += ['-fno-lto']
-LIBRARY_NAME = 'StaticXULComponentsEnd'
+Library('StaticXULComponentsEnd')
DEFINES['MOZILLA_INTERNAL_API'] = True
diff --git a/toolkit/library/gtest/moz.build b/toolkit/library/gtest/moz.build
index f8538df8ce0..04dc296bcb4 100644
--- a/toolkit/library/gtest/moz.build
+++ b/toolkit/library/gtest/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'xul-gtest'
+Library('xul-gtest')
FINAL_TARGET = 'dist/bin/gtest'
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index b1b0472afb6..f3784c5eb1a 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'xul'
+Library('xul')
SDK_LIBRARY = True
diff --git a/toolkit/mozapps/plugins/tests/moz.build b/toolkit/mozapps/plugins/tests/moz.build
index 5f32668cc03..ab0d7f17dd7 100644
--- a/toolkit/mozapps/plugins/tests/moz.build
+++ b/toolkit/mozapps/plugins/tests/moz.build
@@ -4,10 +4,10 @@
# 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/.
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'BadPlugin',
'GoodPlugin',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/toolkit/mozapps/update/common-standalone/moz.build b/toolkit/mozapps/update/common-standalone/moz.build
index 34d543df730..dbc787b437b 100644
--- a/toolkit/mozapps/update/common-standalone/moz.build
+++ b/toolkit/mozapps/update/common-standalone/moz.build
@@ -2,7 +2,7 @@
# 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/.
-LIBRARY_NAME = 'updatecommon-standalone'
+Library('updatecommon-standalone')
srcdir = '../common'
diff --git a/toolkit/mozapps/update/common/moz.build b/toolkit/mozapps/update/common/moz.build
index 46ad07746e4..2e9b89d747b 100644
--- a/toolkit/mozapps/update/common/moz.build
+++ b/toolkit/mozapps/update/common/moz.build
@@ -18,7 +18,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
'updatehelper.h',
]
-LIBRARY_NAME = 'updatecommon'
+Library('updatecommon')
srcdir = '.'
diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build
index f3764fc7fbe..49688d73e71 100644
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -13,10 +13,10 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
if CONFIG['MOZ_MAINTENANCE_SERVICE'] and not CONFIG['HAVE_64BIT_BUILD']:
XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini']
- SIMPLE_PROGRAMS = [
+ SimplePrograms([
'TestAUSHelper',
'TestAUSReadStrings',
- ]
+ ])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/toolkit/mozapps/update/updater/moz.build b/toolkit/mozapps/update/updater/moz.build
index fb69758993d..153217539d6 100644
--- a/toolkit/mozapps/update/updater/moz.build
+++ b/toolkit/mozapps/update/updater/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'updater'
+Program('updater')
SOURCES += [
'archivereader.cpp',
diff --git a/toolkit/webapps/tests/moz.build b/toolkit/webapps/tests/moz.build
index b39ce28c6f8..943219eb9da 100644
--- a/toolkit/webapps/tests/moz.build
+++ b/toolkit/webapps/tests/moz.build
@@ -6,4 +6,4 @@
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
SOURCES += ['TestWebappRT.cpp' ]
-SIMPLE_PROGRAMS += ['TestWebappRT']
+SimplePrograms(['TestWebappRT'])
diff --git a/toolkit/xre/test/win/moz.build b/toolkit/xre/test/win/moz.build
index d69dbf6d7aa..e99c6d2cf97 100644
--- a/toolkit/xre/test/win/moz.build
+++ b/toolkit/xre/test/win/moz.build
@@ -4,17 +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/.
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'TestXREMakeCommandLineWin',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestDllInterceptor',
-]
+])
SOURCES += [
'%s.cpp' % s for s in CPP_UNIT_TESTS
diff --git a/tools/jprof/moz.build b/tools/jprof/moz.build
index 5074e7a81c4..4410e2de61c 100644
--- a/tools/jprof/moz.build
+++ b/tools/jprof/moz.build
@@ -6,7 +6,7 @@
DIRS += ['stub']
-PROGRAM = 'jprof'
+Program('jprof')
SOURCES += [
'bfd.cpp',
diff --git a/tools/jprof/stub/moz.build b/tools/jprof/stub/moz.build
index 169b08076aa..1ed19f49227 100644
--- a/tools/jprof/stub/moz.build
+++ b/tools/jprof/stub/moz.build
@@ -12,7 +12,7 @@ SOURCES += [
'libmalloc.cpp',
]
-LIBRARY_NAME = 'jprof'
+Library('jprof')
FORCE_SHARED_LIB = True
diff --git a/tools/trace-malloc/moz.build b/tools/trace-malloc/moz.build
index 2d662c4a543..9c754913242 100644
--- a/tools/trace-malloc/moz.build
+++ b/tools/trace-malloc/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['MOZ_PROFILE_GENERATE']:
- PROGRAM = 'spacetrace'
+ Program('spacetrace')
SOURCES += [
'formdata.c',
'spacecategory.c',
@@ -27,7 +27,7 @@ SOURCES += [
'tmreader.c',
]
-SIMPLE_PROGRAMS += simple_c_sources
+SimplePrograms(simple_c_sources)
simple_cpp_sources = [
'bloatblame',
@@ -38,7 +38,7 @@ SOURCES += [
'%s.cpp' % s for s in simple_cpp_sources
]
-SIMPLE_PROGRAMS += simple_cpp_sources
+SimplePrograms(simple_cpp_sources)
RESOURCE_FILES += [
'spacetrace.css'
diff --git a/uriloader/exthandler/tests/moz.build b/uriloader/exthandler/tests/moz.build
index e0a7c7ad3b8..057d93da396 100644
--- a/uriloader/exthandler/tests/moz.build
+++ b/uriloader/exthandler/tests/moz.build
@@ -16,9 +16,9 @@ if CONFIG['OS_ARCH'] != 'Darwin':
if not CONFIG['MOZ_JSDOWNLOADS']:
XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'WriteArgument',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/webapprt/gtk/moz.build b/webapprt/gtk/moz.build
index 4aff81f7934..da4cc6fec4c 100644
--- a/webapprt/gtk/moz.build
+++ b/webapprt/gtk/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'webapprt-stub'
+Program('webapprt-stub')
SOURCES += [
'webapprt.cpp',
diff --git a/webapprt/mac/moz.build b/webapprt/mac/moz.build
index f91b9db48d2..774971dcca2 100644
--- a/webapprt/mac/moz.build
+++ b/webapprt/mac/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'webapprt-stub'
+Program('webapprt-stub')
SOURCES += [
'webapprt.mm',
diff --git a/webapprt/win/moz.build b/webapprt/win/moz.build
index beda2248b7a..7695e2ef291 100644
--- a/webapprt/win/moz.build
+++ b/webapprt/win/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'webapprt-stub'
+Program('webapprt-stub')
SOURCES += [
'webapprt.cpp',
diff --git a/widget/gonk/libdisplay/moz.build b/widget/gonk/libdisplay/moz.build
index 94f825a57bc..1fd69b1a106 100644
--- a/widget/gonk/libdisplay/moz.build
+++ b/widget/gonk/libdisplay/moz.build
@@ -36,7 +36,7 @@ elif CONFIG['ANDROID_VERSION'] == '15':
elif CONFIG['ANDROID_VERSION'] and CONFIG['COMPILE_ENVIRONMENT']:
error('Unsupported platform version: %s' % (CONFIG['ANDROID_VERSION']))
-LIBRARY_NAME = 'display'
+Library('display')
include('/ipc/chromium/chromium-config.mozbuild')
diff --git a/widget/gtk/mozgtk/gtk2/moz.build b/widget/gtk/mozgtk/gtk2/moz.build
index b21d9062f5f..b9f7d2f6237 100644
--- a/widget/gtk/mozgtk/gtk2/moz.build
+++ b/widget/gtk/mozgtk/gtk2/moz.build
@@ -10,7 +10,7 @@ SOURCES += [
DEFINES['GTK3_SYMBOLS'] = True
-LIBRARY_NAME = 'mozgtk2'
+Library('mozgtk2')
SONAME = 'mozgtk'
diff --git a/widget/gtk/mozgtk/gtk3/moz.build b/widget/gtk/mozgtk/gtk3/moz.build
index 3355e3a3bdc..c8b5c3b7c91 100644
--- a/widget/gtk/mozgtk/gtk3/moz.build
+++ b/widget/gtk/mozgtk/gtk3/moz.build
@@ -10,7 +10,7 @@ SOURCES += [
DEFINES['GTK2_SYMBOLS'] = True
-LIBRARY_NAME = 'mozgtk'
+Library('mozgtk')
SONAME = 'mozgtk'
diff --git a/widget/gtk/mozgtk/stub/moz.build b/widget/gtk/mozgtk/stub/moz.build
index 02675c98ff1..c1611acbbf9 100644
--- a/widget/gtk/mozgtk/stub/moz.build
+++ b/widget/gtk/mozgtk/stub/moz.build
@@ -11,7 +11,7 @@ SOURCES += [
for var in ('COMMON_SYMBOLS', 'GTK2_SYMBOLS', 'GTK3_SYMBOLS'):
DEFINES[var] = True
-LIBRARY_NAME = 'mozgtk_stub'
+Library('mozgtk_stub')
SONAME = 'mozgtk'
diff --git a/widget/tests/moz.build b/widget/tests/moz.build
index 576a2817ba5..31e6c40c177 100644
--- a/widget/tests/moz.build
+++ b/widget/tests/moz.build
@@ -8,9 +8,9 @@ XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
MOCHITEST_MANIFESTS += ['mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestAppShellSteadyState',
-]
+])
FAIL_ON_WARNINGS = True
diff --git a/widget/xremoteclient/moz.build b/widget/xremoteclient/moz.build
index 0888a6bc294..a5813d7cc85 100644
--- a/widget/xremoteclient/moz.build
+++ b/widget/xremoteclient/moz.build
@@ -4,7 +4,7 @@
# 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/.
-PROGRAM = 'mozilla-xremote-client'
+Program('mozilla-xremote-client')
FINAL_LIBRARY = 'xul'
diff --git a/xpcom/glue/moz.build b/xpcom/glue/moz.build
index 4d68d8242dc..9a43c7436d1 100644
--- a/xpcom/glue/moz.build
+++ b/xpcom/glue/moz.build
@@ -95,7 +95,7 @@ UNIFIED_SOURCES += [
'nsStringAPI.cpp',
]
-LIBRARY_NAME = 'xpcomglue_s'
+Library('xpcomglue_s')
SDK_LIBRARY = True
diff --git a/xpcom/glue/nomozalloc/moz.build b/xpcom/glue/nomozalloc/moz.build
index 7a8c7abff54..179ccfa0ed9 100644
--- a/xpcom/glue/nomozalloc/moz.build
+++ b/xpcom/glue/nomozalloc/moz.build
@@ -14,7 +14,7 @@ UNIFIED_SOURCES += [
'../nsStringAPI.cpp',
]
-LIBRARY_NAME = 'xpcomglue_s_nomozalloc'
+Library('xpcomglue_s_nomozalloc')
SDK_LIBRARY = True
diff --git a/xpcom/glue/standalone/moz.build b/xpcom/glue/standalone/moz.build
index fe526307f7a..84c9da2fa8d 100644
--- a/xpcom/glue/standalone/moz.build
+++ b/xpcom/glue/standalone/moz.build
@@ -18,7 +18,7 @@ SOURCES += [
'nsXPCOMGlue.cpp',
]
-LIBRARY_NAME = 'xpcomglue'
+Library('xpcomglue')
EXPORTS += [
'nsXPCOMGlue.h',
diff --git a/xpcom/glue/standalone/staticruntime/moz.build b/xpcom/glue/standalone/staticruntime/moz.build
index 3aac7b504b2..caf31001553 100644
--- a/xpcom/glue/standalone/staticruntime/moz.build
+++ b/xpcom/glue/standalone/staticruntime/moz.build
@@ -13,7 +13,7 @@ SOURCES += [
'../nsXPCOMGlue.cpp',
]
-LIBRARY_NAME = 'xpcomglue_staticruntime'
+Library('xpcomglue_staticruntime')
SDK_LIBRARY = True
diff --git a/xpcom/glue/staticruntime/moz.build b/xpcom/glue/staticruntime/moz.build
index f2bb031a4ec..33cba07ec67 100644
--- a/xpcom/glue/staticruntime/moz.build
+++ b/xpcom/glue/staticruntime/moz.build
@@ -14,7 +14,7 @@ UNIFIED_SOURCES += [
'../nsStringAPI.cpp',
]
-LIBRARY_NAME = 'xpcomglue_staticruntime_s'
+Library('xpcomglue_staticruntime_s')
SDK_LIBRARY = True
diff --git a/xpcom/reflect/xptcall/md/test/moz.build b/xpcom/reflect/xptcall/md/test/moz.build
index 363100af847..65da3214d49 100644
--- a/xpcom/reflect/xptcall/md/test/moz.build
+++ b/xpcom/reflect/xptcall/md/test/moz.build
@@ -8,6 +8,6 @@ SOURCES += [
'stub_test.cpp',
]
-SIMPLE_PROGRAMS += [
+SimplePrograms([
'stub_test',
-]
+])
diff --git a/xpcom/reflect/xptcall/tests/moz.build b/xpcom/reflect/xptcall/tests/moz.build
index 13962035047..5297e3e6dd2 100644
--- a/xpcom/reflect/xptcall/tests/moz.build
+++ b/xpcom/reflect/xptcall/tests/moz.build
@@ -4,9 +4,9 @@
# 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/.
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'TestXPTCInvoke',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/xpcom/reflect/xptinfo/tests/moz.build b/xpcom/reflect/xptinfo/tests/moz.build
index 56d651d04b5..d3d3428bdcb 100644
--- a/xpcom/reflect/xptinfo/tests/moz.build
+++ b/xpcom/reflect/xptinfo/tests/moz.build
@@ -8,9 +8,9 @@ SOURCES += [
'TestInterfaceInfo.cpp',
]
-SIMPLE_PROGRAMS += [
+SimplePrograms([
'TestInterfaceInfo'
-]
+])
USE_LIBS += [
'mozalloc',
diff --git a/xpcom/sample/program/moz.build b/xpcom/sample/program/moz.build
index 065967ecdd9..0ada27f5d2e 100644
--- a/xpcom/sample/program/moz.build
+++ b/xpcom/sample/program/moz.build
@@ -11,9 +11,9 @@ SOURCES += [
]
# SIMPLE_PROGRAMS compiles a single .cpp file into an executable
-SIMPLE_PROGRAMS += [
+SimplePrograms([
'nsTestSample'
-]
+])
# Whatever code is going to be linked with the *standalone* glue must be
# built with the XPCOM_GLUE define set.
diff --git a/xpcom/tests/external/moz.build b/xpcom/tests/external/moz.build
index b6cd6b94559..5de235bb470 100644
--- a/xpcom/tests/external/moz.build
+++ b/xpcom/tests/external/moz.build
@@ -4,9 +4,9 @@
# 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/.
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'TestMinStringAPI',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/xpcom/tests/moz.build b/xpcom/tests/moz.build
index 011891f38ff..d677d8fd99c 100644
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -23,7 +23,7 @@ EXPORTS.testing += [
'TestHarness.h',
]
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'nsIFileEnumerator',
'TestArguments',
'TestBlockingProcess',
@@ -36,17 +36,17 @@ SIMPLE_PROGRAMS = [
'TestThreadPoolListener',
'TestTimers',
'TestUnicodeArguments',
-]
+])
if CONFIG['OS_TARGET'] == 'WINNT':
- SIMPLE_PROGRAMS += [
+ SimplePrograms([
'TestBase64',
- ]
+ ])
if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
- SIMPLE_PROGRAMS += [
+ SimplePrograms([
'TestSTLWrappers',
- ]
+ ])
SOURCES += [
'%s.cpp' % s for s in sorted(SIMPLE_PROGRAMS)
@@ -54,7 +54,7 @@ SOURCES += [
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
-CPP_UNIT_TESTS += [
+CppUnitTests([
'ShowAlignments',
'TestAutoPtr',
'TestAutoRef',
@@ -74,12 +74,12 @@ CPP_UNIT_TESTS += [
'TestTArray',
'TestTextFormatter',
'TestThreadUtils'
-]
+])
if CONFIG['MOZ_MEMORY']:
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'TestJemalloc',
- ]
+ ])
# XXX Make these tests work in libxul builds.
#CPP_UNIT_TESTS += [
@@ -109,10 +109,10 @@ if CONFIG['MOZ_MEMORY']:
if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT'):
# FIXME bug 523392: TestDeadlockDetector doesn't like Windows
# FIXME bug 523378: also fails on OS X
- CPP_UNIT_TESTS += [
+ CppUnitTests([
'TestDeadlockDetector',
'TestDeadlockDetectorScalability',
- ]
+ ])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/xpcom/tests/windows/moz.build b/xpcom/tests/windows/moz.build
index d8ff402c102..5214490f2d1 100644
--- a/xpcom/tests/windows/moz.build
+++ b/xpcom/tests/windows/moz.build
@@ -4,10 +4,10 @@
# 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/.
-CPP_UNIT_TESTS += [
+CppUnitTests([
'TestCOM',
'TestNtPathToDosPath',
-]
+])
SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
diff --git a/xpcom/typelib/xpt/moz.build b/xpcom/typelib/xpt/moz.build
index 16a4495ff54..34624102607 100644
--- a/xpcom/typelib/xpt/moz.build
+++ b/xpcom/typelib/xpt/moz.build
@@ -4,7 +4,7 @@
# 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/.
-LIBRARY_NAME = 'xpt'
+Library('xpt')
DIRS += ['tools']
diff --git a/xpcom/typelib/xpt/tests/moz.build b/xpcom/typelib/xpt/tests/moz.build
index 4acd0a3d858..e00c19f7b72 100644
--- a/xpcom/typelib/xpt/tests/moz.build
+++ b/xpcom/typelib/xpt/tests/moz.build
@@ -4,10 +4,10 @@
# 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/.
-SIMPLE_PROGRAMS = [
+SimplePrograms([
'PrimitiveTest',
'SimpleTypeLib',
-]
+])
SOURCES += [
'%s.cpp' % s for s in SIMPLE_PROGRAMS
diff --git a/xpcom/windbgdlg/moz.build b/xpcom/windbgdlg/moz.build
index e62523f8095..744ecca5d9a 100644
--- a/xpcom/windbgdlg/moz.build
+++ b/xpcom/windbgdlg/moz.build
@@ -8,6 +8,6 @@ SOURCES += [
'windbgdlg.cpp',
]
-SIMPLE_PROGRAMS += [
+SimplePrograms([
'windbgdlg'
-]
+])
diff --git a/xulrunner/app/moz.build b/xulrunner/app/moz.build
index d3a8ea64367..798be4d8216 100644
--- a/xulrunner/app/moz.build
+++ b/xulrunner/app/moz.build
@@ -6,7 +6,7 @@
DIRS += ['profile']
-PROGRAM = 'xulrunner'
+Program('xulrunner')
SOURCES += [
'nsXULRunnerApp.cpp',
diff --git a/xulrunner/stub/moz.build b/xulrunner/stub/moz.build
index 907c7d10ece..1110c6d0b5f 100644
--- a/xulrunner/stub/moz.build
+++ b/xulrunner/stub/moz.build
@@ -8,7 +8,7 @@
# apps to override it using the --with-xulrunner-stub-name= argument.
# If this configure argument is not present then the default name is
# 'xulrunner-stub'.
-PROGRAM = CONFIG['XULRUNNER_STUB_NAME']
+Program(CONFIG['XULRUNNER_STUB_NAME'])
SOURCES += [
'nsXULStub.cpp',
diff --git a/xulrunner/tools/redit/moz.build b/xulrunner/tools/redit/moz.build
index 00fe698fa69..2d83032f1a9 100644
--- a/xulrunner/tools/redit/moz.build
+++ b/xulrunner/tools/redit/moz.build
@@ -5,7 +5,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if CONFIG['OS_ARCH'] == 'WINNT':
- PROGRAM = 'redit'
+ Program('redit')
SOURCES += [
'redit.cpp',
]
From 6258dd8523ebee39dc560d2c4ec03215bd15fd31 Mon Sep 17 00:00:00 2001
From: Mike Hommey
Date: Wed, 3 Sep 2014 14:16:37 +0900
Subject: [PATCH 23/68] Bug 1059090 - Don't require SOURCES to be set for
CPP_UNIT_TESTS and SIMPLE_PROGRAMS. r=mshal
---
build/docs/defining-binaries.rst | 21 ++++++++++++-----
build/templates.mozbuild | 10 +++++---
content/base/test/moz.build | 2 --
content/media/compiledtest/moz.build | 2 --
content/media/webaudio/compiledtest/moz.build | 2 --
dom/audiochannel/tests/moz.build | 2 --
dom/canvas/compiledtest/moz.build | 2 --
editor/txmgr/tests/moz.build | 2 --
intl/lwbrk/tests/moz.build | 2 --
intl/uconv/tools/moz.build | 6 +----
intl/unicharutil/tests/moz.build | 8 ++-----
js/src/moz.build | 6 +----
layout/style/test/moz.build | 6 +----
media/libcubeb/tests/moz.build | 2 --
media/mtransport/test/moz.build | 2 --
media/webrtc/signaling/test/moz.build | 2 --
memory/mozalloc/tests/moz.build | 2 --
mfbt/tests/moz.build | 2 --
mozglue/linker/tests/moz.build | 3 ---
mozglue/tests/moz.build | 4 ----
netwerk/test/moz.build | 6 -----
security/manager/ssl/tests/compiled/moz.build | 2 --
.../ssl/tests/unit/tlsserver/cmd/moz.build | 4 ----
startupcache/test/moz.build | 2 --
storage/test/moz.build | 2 --
toolkit/components/places/tests/cpp/moz.build | 2 --
toolkit/mozapps/plugins/tests/moz.build | 4 ----
toolkit/mozapps/update/tests/moz.build | 4 ----
toolkit/webapps/tests/moz.build | 1 -
toolkit/xre/test/win/moz.build | 8 -------
tools/trace-malloc/moz.build | 23 +++++--------------
uriloader/exthandler/tests/moz.build | 4 ----
widget/tests/moz.build | 2 --
xpcom/reflect/xptcall/md/test/moz.build | 4 ----
xpcom/reflect/xptcall/tests/moz.build | 4 ----
xpcom/reflect/xptinfo/tests/moz.build | 4 ----
xpcom/sample/program/moz.build | 6 -----
xpcom/tests/external/moz.build | 4 ----
xpcom/tests/moz.build | 6 -----
xpcom/tests/windows/moz.build | 2 --
xpcom/typelib/xpt/tests/moz.build | 4 ----
xpcom/windbgdlg/moz.build | 4 ----
42 files changed, 33 insertions(+), 157 deletions(-)
diff --git a/build/docs/defining-binaries.rst b/build/docs/defining-binaries.rst
index fd155917a18..cb52870cbc7 100644
--- a/build/docs/defining-binaries.rst
+++ b/build/docs/defining-binaries.rst
@@ -148,15 +148,24 @@ directory, in which case we can use the ``SimplePrograms`` template
'SecondProgram',
])
-The corresponding ``SOURCES`` must match:
+Contrary to ``Program``, which requires corresponding ``SOURCES``, when using
+``SimplePrograms``, the corresponding ``SOURCES`` are implied. If the
+corresponding ``sources`` have an extension different from ``.cpp``, it is
+possible to specify the proper extension:
- SOURCES += [
- 'FirstProgram.cpp',
- 'SecondProgram.c',
- ]
+ SimplePrograms([
+ 'ThirdProgram',
+ 'FourthProgram',
+ ], ext='.c')
+
+Please note this construct was added for compatibility with what already lives
+in the mozilla tree ; it is recommended not to add new simple programs with
+sources with a different extension than ``.cpp``.
Similar to ``SimplePrograms``, is the ``CppUnitTests`` template, which defines,
-with the same rules, C++ unit tests programs.
+with the same rules, C++ unit tests programs. Like ``SimplePrograms``, it takes
+an ``ext`` argument to specify the extension for the corresponding ``SOURCES``,
+if it's different from ``.cpp``.
Linking with system libraries
diff --git a/build/templates.mozbuild b/build/templates.mozbuild
index 6df5f1411e3..0a347091ce9 100644
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -11,21 +11,23 @@ def Program(name):
@template
-def SimplePrograms(names):
+def SimplePrograms(names, ext='.cpp'):
'''Template for simple program executables.
Those have a single source with the same base name as the executable.
'''
SIMPLE_PROGRAMS += names
+ SOURCES += ['%s%s' % (name, ext) for name in names]
@template
-def CppUnitTests(names):
+def CppUnitTests(names, ext='.cpp'):
'''Template for C++ unit tests.
Those have a single source with the same base name as the executable.
'''
CPP_UNIT_TESTS += names
+ SOURCES += ['%s%s' % (name, ext) for name in names]
@template
@@ -41,12 +43,14 @@ def HostProgram(name):
@template
-def HostSimplePrograms(names):
+def HostSimplePrograms(names, ext='.cpp'):
'''Template for simple build tools executables.
Those have a single source with the same base name as the executable.
'''
HOST_SIMPLE_PROGRAMS += names
+ HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
+ for name in names]
@template
diff --git a/content/base/test/moz.build b/content/base/test/moz.build
index ec05b17e996..881e0fab9b0 100644
--- a/content/base/test/moz.build
+++ b/content/base/test/moz.build
@@ -17,8 +17,6 @@ CppUnitTests([
'TestPlainTextSerializer',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
MOCHITEST_MANIFESTS += [
'chrome/mochitest.ini',
'csp/mochitest.ini',
diff --git a/content/media/compiledtest/moz.build b/content/media/compiledtest/moz.build
index 0da44099221..cd818e4de6d 100644
--- a/content/media/compiledtest/moz.build
+++ b/content/media/compiledtest/moz.build
@@ -9,8 +9,6 @@ CppUnitTests([
'TestAudioMixer'
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
diff --git a/content/media/webaudio/compiledtest/moz.build b/content/media/webaudio/compiledtest/moz.build
index e584c2016a5..1cb059d6f48 100644
--- a/content/media/webaudio/compiledtest/moz.build
+++ b/content/media/webaudio/compiledtest/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestAudioEventTimeline',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
diff --git a/dom/audiochannel/tests/moz.build b/dom/audiochannel/tests/moz.build
index 64304545b10..51ad846ebb8 100644
--- a/dom/audiochannel/tests/moz.build
+++ b/dom/audiochannel/tests/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestAudioChannelService',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
if CONFIG['OS_ARCH'] == 'WINNT':
DEFINES['NOMINMAX'] = True
diff --git a/dom/canvas/compiledtest/moz.build b/dom/canvas/compiledtest/moz.build
index 6e3a66ea13c..062adb39637 100644
--- a/dom/canvas/compiledtest/moz.build
+++ b/dom/canvas/compiledtest/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestWebGLElementArrayCache',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
FAIL_ON_WARNINGS = True
LOCAL_INCLUDES += [
diff --git a/editor/txmgr/tests/moz.build b/editor/txmgr/tests/moz.build
index 316d7a80b5b..e2c223466c5 100644
--- a/editor/txmgr/tests/moz.build
+++ b/editor/txmgr/tests/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestTXMgr',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
FAIL_ON_WARNINGS = True
USE_LIBS += [
diff --git a/intl/lwbrk/tests/moz.build b/intl/lwbrk/tests/moz.build
index 8beb091cf2c..1770e50da27 100644
--- a/intl/lwbrk/tests/moz.build
+++ b/intl/lwbrk/tests/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestLineBreak',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/intl/uconv/tools/moz.build b/intl/uconv/tools/moz.build
index fa7756ae9a9..a10820eb333 100644
--- a/intl/uconv/tools/moz.build
+++ b/intl/uconv/tools/moz.build
@@ -6,8 +6,4 @@
SimplePrograms([
'umaptable',
-])
-
-SOURCES += [
- '%s.c' % s for s in SIMPLE_PROGRAMS
-]
+], ext='.c')
diff --git a/intl/unicharutil/tests/moz.build b/intl/unicharutil/tests/moz.build
index 9820a2de05e..80fc3b2bc41 100644
--- a/intl/unicharutil/tests/moz.build
+++ b/intl/unicharutil/tests/moz.build
@@ -6,13 +6,9 @@
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
-SOURCES += [
- 'NormalizationTest.cpp',
- 'UnicharSelfTest.cpp',
-]
-
SimplePrograms([
- "%s" % (fyl[0:-4]) for fyl in SOURCES
+ 'NormalizationTest',
+ 'UnicharSelfTest',
])
USE_STATIC_LIBS = True
diff --git a/js/src/moz.build b/js/src/moz.build
index 6eb7736b19d..82ff6ff3669 100644
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -423,12 +423,8 @@ else:
if CONFIG['_MSC_VER'] != '1600':
MSVC_ENABLE_PGO = True
-HOST_SOURCES += [
- 'jskwgen.cpp',
-]
-
HostSimplePrograms([
- 'host_%s' % f.replace('.cpp', '') for f in HOST_SOURCES
+ 'host_jskwgen',
])
# JavaScript must be built shared, even for static builds, as it is used by
diff --git a/layout/style/test/moz.build b/layout/style/test/moz.build
index 96f7636f3c4..9f9b80fc883 100644
--- a/layout/style/test/moz.build
+++ b/layout/style/test/moz.build
@@ -4,12 +4,8 @@
# 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/.
-HOST_SOURCES += [
- 'ListCSSProperties.cpp',
-]
-
HostSimplePrograms([
- 'host_%s' % f.replace('.cpp', '') for f in HOST_SOURCES
+ 'host_ListCSSProperties',
])
MOCHITEST_MANIFESTS += [
diff --git a/media/libcubeb/tests/moz.build b/media/libcubeb/tests/moz.build
index e7869a529ca..7bf057a1b1b 100644
--- a/media/libcubeb/tests/moz.build
+++ b/media/libcubeb/tests/moz.build
@@ -15,8 +15,6 @@ if CONFIG['OS_TARGET'] != 'Android':
'test_sanity'
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
LOCAL_INCLUDES += [
'../include'
]
diff --git a/media/mtransport/test/moz.build b/media/mtransport/test/moz.build
index fd2c8fb29e8..e30a3da583c 100644
--- a/media/mtransport/test/moz.build
+++ b/media/mtransport/test/moz.build
@@ -23,8 +23,6 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'sctp_unittest',
])
- SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
FAIL_ON_WARNINGS = True
for var in ('HAVE_STRDUP', 'NR_SOCKET_IS_VOID_PTR', 'SCTP_DEBUG', 'INET'):
diff --git a/media/webrtc/signaling/test/moz.build b/media/webrtc/signaling/test/moz.build
index 5ce5002546b..e2af3824e4b 100644
--- a/media/webrtc/signaling/test/moz.build
+++ b/media/webrtc/signaling/test/moz.build
@@ -12,8 +12,6 @@ if CONFIG['OS_TARGET'] != 'WINNT' and CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'signaling_unittests',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['OS_TARGET'] in ('Darwin', 'Android'):
diff --git a/memory/mozalloc/tests/moz.build b/memory/mozalloc/tests/moz.build
index 6b265f5beb9..fc540a1d587 100644
--- a/memory/mozalloc/tests/moz.build
+++ b/memory/mozalloc/tests/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestVolatileBuffer',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/mfbt/tests/moz.build b/mfbt/tests/moz.build
index 48c2fde8e71..f7eb7db4b5f 100644
--- a/mfbt/tests/moz.build
+++ b/mfbt/tests/moz.build
@@ -37,8 +37,6 @@ if not CONFIG['MOZ_ASAN']:
'TestPoisonArea',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
# Since we link directly with MFBT object files, define IMPL_MFBT
DEFINES['IMPL_MFBT'] = True
diff --git a/mozglue/linker/tests/moz.build b/mozglue/linker/tests/moz.build
index 4d1468bcfa0..a42f3c9505c 100644
--- a/mozglue/linker/tests/moz.build
+++ b/mozglue/linker/tests/moz.build
@@ -6,9 +6,6 @@
NO_DIST_INSTALL = True
-SOURCES += [
- 'TestZip.cpp',
-]
SimplePrograms([
'TestZip',
])
diff --git a/mozglue/tests/moz.build b/mozglue/tests/moz.build
index 7b8d5ef7376..47c4c333aff 100644
--- a/mozglue/tests/moz.build
+++ b/mozglue/tests/moz.build
@@ -6,10 +6,6 @@
DISABLE_STL_WRAPPING = True
-SOURCES += [
- 'ShowSSEConfig.cpp',
-]
-
CppUnitTests([
'ShowSSEConfig',
])
diff --git a/netwerk/test/moz.build b/netwerk/test/moz.build
index c86196ed4ae..75e4ced440d 100644
--- a/netwerk/test/moz.build
+++ b/netwerk/test/moz.build
@@ -46,18 +46,12 @@ SimplePrograms([
# TestUDPSocketProvider',
#]
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
CppUnitTests([
'TestCookie',
'TestSTSParser',
'TestUDPSocket',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
RESOURCE_FILES += [
'urlparse.dat',
'urlparse_unx.dat',
diff --git a/security/manager/ssl/tests/compiled/moz.build b/security/manager/ssl/tests/compiled/moz.build
index 6ed376dd9da..7aaae8b3df5 100644
--- a/security/manager/ssl/tests/compiled/moz.build
+++ b/security/manager/ssl/tests/compiled/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestCertDB',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build b/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
index 416fb35a1c4..dd91bbbd0b0 100644
--- a/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
+++ b/security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
@@ -13,10 +13,6 @@ SimplePrograms([
'OCSPStaplingServer',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
LOCAL_INCLUDES += [
'../lib',
]
diff --git a/startupcache/test/moz.build b/startupcache/test/moz.build
index 7d6a4e7f7cc..6531d0dc022 100644
--- a/startupcache/test/moz.build
+++ b/startupcache/test/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'TestStartupCache',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
EXTRA_COMPONENTS += [
'TestStartupCacheTelemetry.js',
'TestStartupCacheTelemetry.manifest',
diff --git a/storage/test/moz.build b/storage/test/moz.build
index 02d25832bab..8bcd80a1951 100644
--- a/storage/test/moz.build
+++ b/storage/test/moz.build
@@ -28,8 +28,6 @@ if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT', 'Darwin'):
'test_deadlock_detector',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
LOCAL_INCLUDES += [
'../src',
]
diff --git a/toolkit/components/places/tests/cpp/moz.build b/toolkit/components/places/tests/cpp/moz.build
index c5488e751fe..b7935de0d26 100644
--- a/toolkit/components/places/tests/cpp/moz.build
+++ b/toolkit/components/places/tests/cpp/moz.build
@@ -8,8 +8,6 @@ CppUnitTests([
'test_IHistory',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
FAIL_ON_WARNINGS = True
USE_LIBS += [
diff --git a/toolkit/mozapps/plugins/tests/moz.build b/toolkit/mozapps/plugins/tests/moz.build
index ab0d7f17dd7..f54b170f1fb 100644
--- a/toolkit/mozapps/plugins/tests/moz.build
+++ b/toolkit/mozapps/plugins/tests/moz.build
@@ -9,9 +9,5 @@ SimplePrograms([
'GoodPlugin',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
BROWSER_CHROME_MANIFESTS += ['browser.ini']
USE_STATIC_LIBS = True
diff --git a/toolkit/mozapps/update/tests/moz.build b/toolkit/mozapps/update/tests/moz.build
index 49688d73e71..4d7ba65816e 100644
--- a/toolkit/mozapps/update/tests/moz.build
+++ b/toolkit/mozapps/update/tests/moz.build
@@ -18,10 +18,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
'TestAUSReadStrings',
])
- SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
- ]
-
LOCAL_INCLUDES += [
'/toolkit/mozapps/update',
'/toolkit/mozapps/update/common',
diff --git a/toolkit/webapps/tests/moz.build b/toolkit/webapps/tests/moz.build
index 943219eb9da..fff331de0c9 100644
--- a/toolkit/webapps/tests/moz.build
+++ b/toolkit/webapps/tests/moz.build
@@ -5,5 +5,4 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
MOCHITEST_CHROME_MANIFESTS += ['chrome.ini']
-SOURCES += ['TestWebappRT.cpp' ]
SimplePrograms(['TestWebappRT'])
diff --git a/toolkit/xre/test/win/moz.build b/toolkit/xre/test/win/moz.build
index e99c6d2cf97..8771a63e672 100644
--- a/toolkit/xre/test/win/moz.build
+++ b/toolkit/xre/test/win/moz.build
@@ -8,18 +8,10 @@ SimplePrograms([
'TestXREMakeCommandLineWin',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
CppUnitTests([
'TestDllInterceptor',
])
-SOURCES += [
- '%s.cpp' % s for s in CPP_UNIT_TESTS
-]
-
DEFINES['NS_NO_XPCOM'] = True
LOCAL_INCLUDES += [
diff --git a/tools/trace-malloc/moz.build b/tools/trace-malloc/moz.build
index 9c754913242..f602d44d516 100644
--- a/tools/trace-malloc/moz.build
+++ b/tools/trace-malloc/moz.build
@@ -15,30 +15,19 @@ if not CONFIG['MOZ_PROFILE_GENERATE']:
bin_suffix = CONFIG['BIN_SUFFIX']
-simple_c_sources = [
- 'leakstats',
- 'tmstats',
-]
-
-SOURCES += [
- '%s.c' % s for s in simple_c_sources
-]
SOURCES += [
'tmreader.c',
]
-SimplePrograms(simple_c_sources)
+SimplePrograms([
+ 'leakstats',
+ 'tmstats',
+], ext='.c')
-simple_cpp_sources = [
+SimplePrograms([
'bloatblame',
'leaksoup',
-]
-
-SOURCES += [
- '%s.cpp' % s for s in simple_cpp_sources
-]
-
-SimplePrograms(simple_cpp_sources)
+])
RESOURCE_FILES += [
'spacetrace.css'
diff --git a/uriloader/exthandler/tests/moz.build b/uriloader/exthandler/tests/moz.build
index 057d93da396..0f940e82341 100644
--- a/uriloader/exthandler/tests/moz.build
+++ b/uriloader/exthandler/tests/moz.build
@@ -20,10 +20,6 @@ SimplePrograms([
'WriteArgument',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
USE_LIBS += [
'nspr',
]
diff --git a/widget/tests/moz.build b/widget/tests/moz.build
index 31e6c40c177..ab93b2f7778 100644
--- a/widget/tests/moz.build
+++ b/widget/tests/moz.build
@@ -24,8 +24,6 @@ FAIL_ON_WARNINGS = True
# is bug 652123.
# CPP_UNIT_TESTS += ['TestChromeMargin']
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/xpcom/reflect/xptcall/md/test/moz.build b/xpcom/reflect/xptcall/md/test/moz.build
index 65da3214d49..ebb47903c81 100644
--- a/xpcom/reflect/xptcall/md/test/moz.build
+++ b/xpcom/reflect/xptcall/md/test/moz.build
@@ -4,10 +4,6 @@
# 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/.
-SOURCES += [
- 'stub_test.cpp',
-]
-
SimplePrograms([
'stub_test',
])
diff --git a/xpcom/reflect/xptcall/tests/moz.build b/xpcom/reflect/xptcall/tests/moz.build
index 5297e3e6dd2..7bc7e8d8b9e 100644
--- a/xpcom/reflect/xptcall/tests/moz.build
+++ b/xpcom/reflect/xptcall/tests/moz.build
@@ -8,10 +8,6 @@ SimplePrograms([
'TestXPTCInvoke',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/xpcom/reflect/xptinfo/tests/moz.build b/xpcom/reflect/xptinfo/tests/moz.build
index d3d3428bdcb..6022da61589 100644
--- a/xpcom/reflect/xptinfo/tests/moz.build
+++ b/xpcom/reflect/xptinfo/tests/moz.build
@@ -4,10 +4,6 @@
# 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/.
-SOURCES += [
- 'TestInterfaceInfo.cpp',
-]
-
SimplePrograms([
'TestInterfaceInfo'
])
diff --git a/xpcom/sample/program/moz.build b/xpcom/sample/program/moz.build
index 0ada27f5d2e..d00630c0475 100644
--- a/xpcom/sample/program/moz.build
+++ b/xpcom/sample/program/moz.build
@@ -4,12 +4,6 @@
# 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/.
-# We must specify CPP_SOURCES in order to link using the proper c++ linker
-# on certain platforms.
-SOURCES += [
- 'nsTestSample.cpp',
-]
-
# SIMPLE_PROGRAMS compiles a single .cpp file into an executable
SimplePrograms([
'nsTestSample'
diff --git a/xpcom/tests/external/moz.build b/xpcom/tests/external/moz.build
index 5de235bb470..9999fd2c29f 100644
--- a/xpcom/tests/external/moz.build
+++ b/xpcom/tests/external/moz.build
@@ -8,10 +8,6 @@ SimplePrograms([
'TestMinStringAPI',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/xpcom/tests/moz.build b/xpcom/tests/moz.build
index d677d8fd99c..320ba050987 100644
--- a/xpcom/tests/moz.build
+++ b/xpcom/tests/moz.build
@@ -48,10 +48,6 @@ if CONFIG['WRAP_STL_INCLUDES'] and not CONFIG['CLANG_CL']:
'TestSTLWrappers',
])
-SOURCES += [
- '%s.cpp' % s for s in sorted(SIMPLE_PROGRAMS)
-]
-
XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
CppUnitTests([
@@ -114,8 +110,6 @@ if CONFIG['MOZ_DEBUG'] and CONFIG['OS_ARCH'] not in ('WINNT'):
'TestDeadlockDetectorScalability',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
LOCAL_INCLUDES += [
'../ds',
]
diff --git a/xpcom/tests/windows/moz.build b/xpcom/tests/windows/moz.build
index 5214490f2d1..0f06c8f8d1c 100644
--- a/xpcom/tests/windows/moz.build
+++ b/xpcom/tests/windows/moz.build
@@ -9,8 +9,6 @@ CppUnitTests([
'TestNtPathToDosPath',
])
-SOURCES += sorted('%s.cpp' % t for t in CPP_UNIT_TESTS)
-
USE_LIBS += [
'mozalloc',
'nspr',
diff --git a/xpcom/typelib/xpt/tests/moz.build b/xpcom/typelib/xpt/tests/moz.build
index e00c19f7b72..6fe20a8b6cf 100644
--- a/xpcom/typelib/xpt/tests/moz.build
+++ b/xpcom/typelib/xpt/tests/moz.build
@@ -9,10 +9,6 @@ SimplePrograms([
'SimpleTypeLib',
])
-SOURCES += [
- '%s.cpp' % s for s in SIMPLE_PROGRAMS
-]
-
FAIL_ON_WARNINGS = True
USE_LIBS += [
diff --git a/xpcom/windbgdlg/moz.build b/xpcom/windbgdlg/moz.build
index 744ecca5d9a..e5a9c0859d0 100644
--- a/xpcom/windbgdlg/moz.build
+++ b/xpcom/windbgdlg/moz.build
@@ -4,10 +4,6 @@
# 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/.
-SOURCES += [
- 'windbgdlg.cpp',
-]
-
SimplePrograms([
'windbgdlg'
])
From 37614d55483e5dae828d8c8637ed9b78f5b3cfea Mon Sep 17 00:00:00 2001
From: Mike Hommey
Date: Wed, 3 Sep 2014 14:19:55 +0900
Subject: [PATCH 24/68] Bug 1059126 - Always allow to add a
StrictOrderingOnAppendList to another. r=gps
---
python/mozbuild/mozbuild/test/test_util.py | 10 ++++++++++
python/mozbuild/mozbuild/util.py | 3 +++
2 files changed, 13 insertions(+)
diff --git a/python/mozbuild/mozbuild/test/test_util.py b/python/mozbuild/mozbuild/test/test_util.py
index ecd5f103556..5e3a6e5c4db 100644
--- a/python/mozbuild/mozbuild/test/test_util.py
+++ b/python/mozbuild/mozbuild/test/test_util.py
@@ -337,6 +337,16 @@ class TestStrictOrderingOnAppendList(unittest.TestCase):
self.assertEqual(len(l), 2)
+ def test_add_StrictOrderingOnAppendList(self):
+ l = StrictOrderingOnAppendList()
+ l += ['c', 'd']
+ l += ['a', 'b']
+ l2 = StrictOrderingOnAppendList()
+ with self.assertRaises(UnsortedError):
+ l2 += list(l)
+ # Adding a StrictOrderingOnAppendList to another shouldn't throw
+ l2 += l
+
class TestStrictOrderingOnAppendListWithFlagsFactory(unittest.TestCase):
def test_strict_ordering_on_append_list_with_flags_factory(self):
diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py
index e2b0bd478ac..6ebc13f8a50 100644
--- a/python/mozbuild/mozbuild/util.py
+++ b/python/mozbuild/mozbuild/util.py
@@ -304,6 +304,9 @@ class StrictOrderingOnAppendList(list):
"""
@staticmethod
def ensure_sorted(l):
+ if isinstance(l, StrictOrderingOnAppendList):
+ return
+
srtd = sorted(l, key=lambda x: x.lower())
if srtd != l:
From a653121671279d67212775da56cb8054c0af3037 Mon Sep 17 00:00:00 2001
From: Mike Hommey
Date: Thu, 4 Sep 2014 09:04:45 +0900
Subject: [PATCH 25/68] Bug 1059113 - Use templates for shared libraries and
frameworks. r=gps
Also force to use the existing template for XPCOM components.
---
accessible/interfaces/ia2/moz.build | 4 +-
accessible/interfaces/msaa/moz.build | 4 +-
build/docs/defining-binaries.rst | 22 ++++----
build/templates.mozbuild | 16 ++++++
build/win32/crashinjectdll/moz.build | 4 +-
build/win32/vmwarerecordinghelper/moz.build | 4 +-
config/external/nss/moz.build | 6 +--
config/external/sqlite/moz.build | 6 +--
dom/media/gmp-plugin/moz.build | 3 +-
dom/plugins/ipc/interpose/moz.build | 4 +-
.../test/testplugin/javaplugin/moz.build | 2 +-
dom/plugins/test/testplugin/moz.build | 2 +-
.../test/testplugin/secondplugin/moz.build | 2 +-
.../test/testplugin/testplugin.mozbuild | 2 -
gfx/angle/src/libEGL/moz.build | 3 +-
gfx/angle/src/libGLESv2/moz.build | 3 +-
js/src/moz.build | 6 +--
layout/media/moz.build | 7 +--
media/omx-plugin/froyo/moz.build | 4 +-
media/omx-plugin/gb/moz.build | 4 +-
media/omx-plugin/gb235/moz.build | 4 +-
media/omx-plugin/hc/moz.build | 4 +-
media/omx-plugin/kk/moz.build | 4 +-
.../lib/froyo/libstagefright/moz.build | 4 +-
.../lib/gb/libstagefright/moz.build | 4 +-
.../libstagefright_color_conversion/moz.build | 4 +-
media/omx-plugin/lib/gb/libutils/moz.build | 4 +-
.../lib/gb235/libstagefright/moz.build | 4 +-
.../lib/hc/libstagefright/moz.build | 4 +-
.../lib/ics/libstagefright/moz.build | 4 +-
media/omx-plugin/lib/ics/libutils/moz.build | 4 +-
.../lib/ics/libvideoeditorplayer/moz.build | 4 +-
media/omx-plugin/moz.build | 4 +-
memory/mozalloc/moz.build | 6 +--
memory/replace/dmd/moz.build | 4 +-
memory/replace/dummy/moz.build | 4 +-
memory/replace/jemalloc/moz.build | 4 +-
mozglue/build/moz.build | 7 +--
python/mozbuild/mozbuild/frontend/context.py | 36 +++++++++++++
python/mozbuild/mozbuild/frontend/emitter.py | 12 -----
.../ssl/tests/unit/pkcs11testmodule/moz.build | 3 +-
security/sandbox/linux/moz.build | 3 +-
.../sandbox/win/src/sandboxbroker/moz.build | 4 +-
toolkit/components/ctypes/tests/moz.build | 4 +-
toolkit/crashreporter/injector/moz.build | 4 +-
toolkit/crashreporter/test/moz.build | 4 +-
toolkit/library/gtest/moz.build | 4 +-
toolkit/library/libxul.mozbuild | 52 -------------------
toolkit/library/moz.build | 52 +++++++++++++++++--
tools/jprof/stub/moz.build | 4 +-
widget/gtk/mozgtk/gtk2/moz.build | 4 +-
widget/gtk/mozgtk/gtk3/moz.build | 4 +-
widget/gtk/mozgtk/stub/moz.build | 4 +-
53 files changed, 169 insertions(+), 210 deletions(-)
delete mode 100644 toolkit/library/libxul.mozbuild
diff --git a/accessible/interfaces/ia2/moz.build b/accessible/interfaces/ia2/moz.build
index 3aae77cd38b..08ce9733f2d 100644
--- a/accessible/interfaces/ia2/moz.build
+++ b/accessible/interfaces/ia2/moz.build
@@ -4,9 +4,7 @@
# 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/.
-Library('IA2Marshal')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('IA2Marshal')
DEFINES['REGISTER_PROXY_DLL'] = True
diff --git a/accessible/interfaces/msaa/moz.build b/accessible/interfaces/msaa/moz.build
index e6d5f2f0937..ff37abd0a07 100644
--- a/accessible/interfaces/msaa/moz.build
+++ b/accessible/interfaces/msaa/moz.build
@@ -4,7 +4,7 @@
# 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/.
-Library('AccessibleMarshal')
+SharedLibrary('AccessibleMarshal')
GENERATED_SOURCES += [
'dlldata.c',
@@ -16,8 +16,6 @@ GENERATED_SOURCES += [
'ISimpleDOMText_p.c',
]
-FORCE_SHARED_LIB = True
-
DEFINES['REGISTER_PROXY_DLL'] = True
DEFFILE = SRCDIR + '/AccessibleMarshal.def'
diff --git a/build/docs/defining-binaries.rst b/build/docs/defining-binaries.rst
index cb52870cbc7..a4501f8557a 100644
--- a/build/docs/defining-binaries.rst
+++ b/build/docs/defining-binaries.rst
@@ -95,15 +95,15 @@ Shared Libraries
================
Sometimes, we want shared libraries, a.k.a. dynamic libraries. Such libraries
-are defined with the same variables as static libraries, with the addition of
-the ``FORCE_SHARED_LIB`` boolean variable:
+are defined similarly to static libraries, using the ``SharedLibrary`` template
+instead of ``Library``.
- FORCE_SHARED_LIB = True
+ SharedLibrary('foo')
-When this variable is set, no static library is built. See further below to
+When this template is used, no static library is built. See further below to
build both types of libraries.
-With a ``Library`` name of ``foo``, the library file name will be
+With a ``SharedLibrary`` name of ``foo``, the library file name will be
``libfoo.dylib`` on OSX, ``libfoo.so`` on ELF systems (Linux, etc.), and
``foo.dll`` on Windows. On Windows, there is also an import library named
``foo.lib``, used on the linker command line. ``libfoo.dylib`` and
@@ -111,18 +111,18 @@ With a ``Library`` name of ``foo``, the library file name will be
systems.
On OSX, one may want to create a special kind of dynamic library: frameworks.
-This is done with the ``IS_FRAMEWORK`` boolean variable.
+This is done with the ``Framework`` template.
- IS_FRAMEWORK = True
+ Framework('foo')
-With a ``Library`` name of ``foo``, the framework file name will be ``foo``.
-This variable however affects the behavior on all platforms, so it needs to
+With a ``Framework`` name of ``foo``, the framework file name will be ``foo``.
+This template however affects the behavior on all platforms, so it needs to
be set only on OSX.
Another special kind of library, XPCOM-specific, are XPCOM components. One can
-build such a component with the ``IS_COMPONENT`` boolean variable.
+build such a component with the ``XPCOMBinaryComponent`` template.
- IS_COMPONENT = True
+ XPCOMBinaryComponent('foo')
Executables
diff --git a/build/templates.mozbuild b/build/templates.mozbuild
index 0a347091ce9..3abcb807f9f 100644
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -36,6 +36,22 @@ def Library(name):
LIBRARY_NAME = name
+@template
+def SharedLibrary(name):
+ '''Template for shared libraries.'''
+ Library(name)
+
+ FORCE_SHARED_LIB = True
+
+
+@template
+def Framework(name):
+ '''Template for OSX Frameworks.'''
+ Library(name)
+
+ IS_FRAMEWORK = True
+
+
@template
def HostProgram(name):
'''Template for build tools executables.'''
diff --git a/build/win32/crashinjectdll/moz.build b/build/win32/crashinjectdll/moz.build
index 6f1fc4cab12..6670f6a43a3 100644
--- a/build/win32/crashinjectdll/moz.build
+++ b/build/win32/crashinjectdll/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'crashinjectdll.cpp',
]
-Library('crashinjectdll')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('crashinjectdll')
DEFFILE = SRCDIR + '/crashinjectdll.def'
diff --git a/build/win32/vmwarerecordinghelper/moz.build b/build/win32/vmwarerecordinghelper/moz.build
index 55e842e2b98..61e40fe8bf0 100644
--- a/build/win32/vmwarerecordinghelper/moz.build
+++ b/build/win32/vmwarerecordinghelper/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'vmwarerecordinghelper.cpp',
]
-Library('vmwarerecordinghelper')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('vmwarerecordinghelper')
DEFFILE = '%s/%s.def' % (SRCDIR, LIBRARY_NAME)
diff --git a/config/external/nss/moz.build b/config/external/nss/moz.build
index b7b69e7017b..dc7a8d757da 100644
--- a/config/external/nss/moz.build
+++ b/config/external/nss/moz.build
@@ -4,17 +4,16 @@
# 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/.
-Library('nss')
-
DIRS += ['crmf']
if CONFIG['MOZ_NATIVE_NSS']:
+ Library('nss')
OS_LIBS += CONFIG['NSS_LIBS']
elif CONFIG['MOZ_FOLD_LIBS']:
+ SharedLibrary('nss')
# TODO: The library name can be changed when bug 845217 is fixed.
SHARED_LIBRARY_NAME = 'nss3'
- FORCE_SHARED_LIB = True
SDK_LIBRARY = True
# Normally, there should be /something/ to ensure nspr is built
@@ -38,6 +37,7 @@ elif CONFIG['MOZ_FOLD_LIBS']:
if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['GCC_USE_GNU_LD']:
LD_VERSION_SCRIPT = 'nss3.def'
else:
+ Library('nss')
USE_LIBS += [
'/security/nss/lib/nss/nss3',
'/security/nss/lib/smime/smime3',
diff --git a/config/external/sqlite/moz.build b/config/external/sqlite/moz.build
index 9826ced3f77..b6f500727f4 100644
--- a/config/external/sqlite/moz.build
+++ b/config/external/sqlite/moz.build
@@ -4,19 +4,19 @@
# 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/.
-Library('sqlite')
-
if CONFIG['MOZ_NATIVE_SQLITE']:
+ Library('sqlite')
OS_LIBS += CONFIG['SQLITE_LIBS']
else:
DIRS += ['../../../db/sqlite3/src']
if CONFIG['MOZ_FOLD_LIBS']:
+ Library('sqlite')
# When folding libraries, sqlite is actually in the nss library.
USE_LIBS += [
'nss',
]
else:
- FORCE_SHARED_LIB = True
+ SharedLibrary('sqlite')
SHARED_LIBRARY_NAME = 'mozsqlite3'
if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['GCC_USE_GNU_LD']:
diff --git a/dom/media/gmp-plugin/moz.build b/dom/media/gmp-plugin/moz.build
index 27774758ff2..1d497a87f6f 100644
--- a/dom/media/gmp-plugin/moz.build
+++ b/dom/media/gmp-plugin/moz.build
@@ -9,10 +9,9 @@ SOURCES += [
'gmp-fake.cpp'
]
-Library("fake")
+SharedLibrary("fake")
USE_STATIC_LIBS = True
-FORCE_SHARED_LIB = True
NO_VISIBILITY_FLAGS = True
# Don't use STL wrappers; this isn't Gecko code
DISABLE_STL_WRAPPING = True
diff --git a/dom/plugins/ipc/interpose/moz.build b/dom/plugins/ipc/interpose/moz.build
index e80b868b419..66c6d561777 100644
--- a/dom/plugins/ipc/interpose/moz.build
+++ b/dom/plugins/ipc/interpose/moz.build
@@ -4,7 +4,7 @@
# 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/.
-Library('plugin_child_interpose')
+SharedLibrary('plugin_child_interpose')
UNIFIED_SOURCES += [ "%s.mm" % (LIBRARY_NAME) ]
@@ -12,6 +12,4 @@ UNIFIED_SOURCES += [
'plugin_child_quirks.mm',
]
-FORCE_SHARED_LIB = True
-
OS_LIBS += ['-framework Carbon']
diff --git a/dom/plugins/test/testplugin/javaplugin/moz.build b/dom/plugins/test/testplugin/javaplugin/moz.build
index 2c7f6a0f73c..e01c72aa6e6 100644
--- a/dom/plugins/test/testplugin/javaplugin/moz.build
+++ b/dom/plugins/test/testplugin/javaplugin/moz.build
@@ -4,7 +4,7 @@
# 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/.
-Library('nptestjava')
+SharedLibrary('nptestjava')
relative_path = '..'
include('../testplugin.mozbuild')
diff --git a/dom/plugins/test/testplugin/moz.build b/dom/plugins/test/testplugin/moz.build
index 705995b20cd..37e085cb95e 100644
--- a/dom/plugins/test/testplugin/moz.build
+++ b/dom/plugins/test/testplugin/moz.build
@@ -6,7 +6,7 @@
DIRS += ['secondplugin', 'javaplugin']
-Library('nptest')
+SharedLibrary('nptest')
FAIL_ON_WARNINGS = not CONFIG['_MSC_VER']
diff --git a/dom/plugins/test/testplugin/secondplugin/moz.build b/dom/plugins/test/testplugin/secondplugin/moz.build
index c9c6215ee2e..3bc2bfa966c 100644
--- a/dom/plugins/test/testplugin/secondplugin/moz.build
+++ b/dom/plugins/test/testplugin/secondplugin/moz.build
@@ -4,7 +4,7 @@
# 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/.
-Library('npsecondtest')
+SharedLibrary('npsecondtest')
relative_path = '..'
include('../testplugin.mozbuild')
diff --git a/dom/plugins/test/testplugin/testplugin.mozbuild b/dom/plugins/test/testplugin/testplugin.mozbuild
index 5bafddfa86d..e194773d6b2 100644
--- a/dom/plugins/test/testplugin/testplugin.mozbuild
+++ b/dom/plugins/test/testplugin/testplugin.mozbuild
@@ -40,8 +40,6 @@ elif toolkit == 'windows':
'msimg32',
]
-FORCE_SHARED_LIB = True
-
# must link statically with the CRT; nptest isn't Gecko code
USE_STATIC_LIBS = True
diff --git a/gfx/angle/src/libEGL/moz.build b/gfx/angle/src/libEGL/moz.build
index 96f105e7652..1542034fd06 100644
--- a/gfx/angle/src/libEGL/moz.build
+++ b/gfx/angle/src/libEGL/moz.build
@@ -54,8 +54,7 @@ DISABLE_STL_WRAPPING = True
LOCAL_INCLUDES += [ '../../include', '../../src' ]
USE_LIBS += [ 'libGLESv2' ]
-Library('libEGL')
-FORCE_SHARED_LIB = True
+SharedLibrary('libEGL')
RCFILE = SRCDIR + '/libEGL.rc'
DEFFILE = SRCDIR + '/libEGL.def'
diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build
index 131868dd09f..997d0562362 100644
--- a/gfx/angle/src/libGLESv2/moz.build
+++ b/gfx/angle/src/libGLESv2/moz.build
@@ -204,8 +204,7 @@ else:
'\'%s/lib/%s/dxguid.lib\'' % (CONFIG['MOZ_DIRECTX_SDK_PATH'], CONFIG['MOZ_D3D_CPU_SUFFIX']),
]
-Library('libGLESv2')
-FORCE_SHARED_LIB = True
+SharedLibrary('libGLESv2')
RCFILE = SRCDIR + '/libGLESv2.rc'
DEFFILE = SRCDIR + '/libGLESv2.def'
diff --git a/js/src/moz.build b/js/src/moz.build
index 82ff6ff3669..9a3fb6c2222 100644
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -435,12 +435,12 @@ HostSimplePrograms([
# In fact, we now build both a static and a shared library, as the
# JS shell would like to link to the static library.
-Library('js')
-
if CONFIG['JS_SHARED_LIBRARY']:
- FORCE_SHARED_LIB = True
+ SharedLibrary('js')
SHARED_LIBRARY_NAME = CONFIG['JS_LIBRARY_NAME']
SDK_LIBRARY = True
+else:
+ Library('js')
FORCE_STATIC_LIB = True
STATIC_LIBRARY_NAME = 'js_static'
diff --git a/layout/media/moz.build b/layout/media/moz.build
index fd2101cf99f..4fe8ea8fc76 100644
--- a/layout/media/moz.build
+++ b/layout/media/moz.build
@@ -4,14 +4,15 @@
# 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/.
-Library('gkmedias')
-
if CONFIG['GKMEDIAS_SHARED_LIBRARY']:
- FORCE_SHARED_LIB = True
+ SharedLibrary('gkmedias')
USE_LIBS += [
'mozalloc',
'nspr',
]
+else:
+ Library('gkmedias')
+
if CONFIG['MOZ_WEBRTC']:
DIRS += ['webrtc']
diff --git a/media/omx-plugin/froyo/moz.build b/media/omx-plugin/froyo/moz.build
index dc530b2134c..9e98c9e553d 100644
--- a/media/omx-plugin/froyo/moz.build
+++ b/media/omx-plugin/froyo/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'OmxPluginFroyo.cpp',
]
-Library('omxpluginfroyo')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('omxpluginfroyo')
LOCAL_INCLUDES += [
'../include/froyo',
diff --git a/media/omx-plugin/gb/moz.build b/media/omx-plugin/gb/moz.build
index c7616aaa8dd..27b0436d700 100644
--- a/media/omx-plugin/gb/moz.build
+++ b/media/omx-plugin/gb/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'OmxPlugin236.cpp',
]
-Library('omxplugingb')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('omxplugingb')
LOCAL_INCLUDES += [
'../include/gb',
diff --git a/media/omx-plugin/gb235/moz.build b/media/omx-plugin/gb235/moz.build
index c25bed8b144..b20ec04595b 100644
--- a/media/omx-plugin/gb235/moz.build
+++ b/media/omx-plugin/gb235/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'OmxPlugin235.cpp',
]
-Library('omxplugingb235')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('omxplugingb235')
LOCAL_INCLUDES += [
'../include/gb',
diff --git a/media/omx-plugin/hc/moz.build b/media/omx-plugin/hc/moz.build
index 9ad3794f7e2..9047a5100bc 100644
--- a/media/omx-plugin/hc/moz.build
+++ b/media/omx-plugin/hc/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'OmxPluginHoneycomb.cpp',
]
-Library('omxpluginhc')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('omxpluginhc')
LOCAL_INCLUDES += [
'../include/gb',
diff --git a/media/omx-plugin/kk/moz.build b/media/omx-plugin/kk/moz.build
index 4667493d803..e33f26aac0b 100644
--- a/media/omx-plugin/kk/moz.build
+++ b/media/omx-plugin/kk/moz.build
@@ -8,9 +8,7 @@ SOURCES += [
'OmxPluginKitKat.cpp',
]
-Library('omxpluginkk')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('omxpluginkk')
LOCAL_INCLUDES += [
'../include/ics',
diff --git a/media/omx-plugin/lib/froyo/libstagefright/moz.build b/media/omx-plugin/lib/froyo/libstagefright/moz.build
index 0632ae65f5b..a5562ab76aa 100644
--- a/media/omx-plugin/lib/froyo/libstagefright/moz.build
+++ b/media/omx-plugin/lib/froyo/libstagefright/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-Library('stagefright')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('stagefright')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/froyo',
diff --git a/media/omx-plugin/lib/gb/libstagefright/moz.build b/media/omx-plugin/lib/gb/libstagefright/moz.build
index 209ceb46d1b..273f530f362 100644
--- a/media/omx-plugin/lib/gb/libstagefright/moz.build
+++ b/media/omx-plugin/lib/gb/libstagefright/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-Library('stagefright')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('stagefright')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/gb',
diff --git a/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build b/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build
index efbd44f49e8..31bc2885bfc 100644
--- a/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build
+++ b/media/omx-plugin/lib/gb/libstagefright_color_conversion/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright_color_conversion.cpp',
]
-Library('stagefright_color_conversion')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('stagefright_color_conversion')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/gb',
diff --git a/media/omx-plugin/lib/gb/libutils/moz.build b/media/omx-plugin/lib/gb/libutils/moz.build
index a131edf0ad6..5c5ce7c3cbb 100644
--- a/media/omx-plugin/lib/gb/libutils/moz.build
+++ b/media/omx-plugin/lib/gb/libutils/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libutils.cpp',
]
-Library('utils')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('utils')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/gb',
diff --git a/media/omx-plugin/lib/gb235/libstagefright/moz.build b/media/omx-plugin/lib/gb235/libstagefright/moz.build
index 209ceb46d1b..273f530f362 100644
--- a/media/omx-plugin/lib/gb235/libstagefright/moz.build
+++ b/media/omx-plugin/lib/gb235/libstagefright/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-Library('stagefright')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('stagefright')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/gb',
diff --git a/media/omx-plugin/lib/hc/libstagefright/moz.build b/media/omx-plugin/lib/hc/libstagefright/moz.build
index 209ceb46d1b..273f530f362 100644
--- a/media/omx-plugin/lib/hc/libstagefright/moz.build
+++ b/media/omx-plugin/lib/hc/libstagefright/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-Library('stagefright')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('stagefright')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/gb',
diff --git a/media/omx-plugin/lib/ics/libstagefright/moz.build b/media/omx-plugin/lib/ics/libstagefright/moz.build
index c22b723f5cc..f5aebaca8c4 100644
--- a/media/omx-plugin/lib/ics/libstagefright/moz.build
+++ b/media/omx-plugin/lib/ics/libstagefright/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libstagefright.cpp',
]
-Library('stagefright')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('stagefright')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/ics',
diff --git a/media/omx-plugin/lib/ics/libutils/moz.build b/media/omx-plugin/lib/ics/libutils/moz.build
index 409b4e712ba..04aedf67043 100644
--- a/media/omx-plugin/lib/ics/libutils/moz.build
+++ b/media/omx-plugin/lib/ics/libutils/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libutils.cpp',
]
-Library('utils')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('utils')
LOCAL_INCLUDES += [
'/media/omx-plugin/include/ics',
diff --git a/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build b/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build
index b250510128d..a65d24f489e 100644
--- a/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build
+++ b/media/omx-plugin/lib/ics/libvideoeditorplayer/moz.build
@@ -10,9 +10,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gonk':
'libvideoeditorplayer.cpp',
]
-Library('videoeditorplayer')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('videoeditorplayer')
# Don't use STL wrappers; this isn't Gecko code
DISABLE_STL_WRAPPING = True
diff --git a/media/omx-plugin/moz.build b/media/omx-plugin/moz.build
index 1507a4094c0..490a40501bb 100644
--- a/media/omx-plugin/moz.build
+++ b/media/omx-plugin/moz.build
@@ -18,9 +18,7 @@ SOURCES += [
'OmxPlugin.cpp',
]
-Library('omxplugin')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('omxplugin')
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
pass
diff --git a/memory/mozalloc/moz.build b/memory/mozalloc/moz.build
index d279faaedf0..ccbbf2ac4c9 100644
--- a/memory/mozalloc/moz.build
+++ b/memory/mozalloc/moz.build
@@ -57,12 +57,10 @@ else:
'VolatileBufferFallback.cpp',
]
-Library('mozalloc')
-
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
- FORCE_STATIC_LIB = True
+ Library('mozalloc')
else:
- FORCE_SHARED_LIB = True
+ SharedLibrary('mozalloc')
SDK_LIBRARY = True
# The strndup declaration in string.h is in an ifdef __USE_GNU section
diff --git a/memory/replace/dmd/moz.build b/memory/replace/dmd/moz.build
index c8f15f2dae3..d50d631ae88 100644
--- a/memory/replace/dmd/moz.build
+++ b/memory/replace/dmd/moz.build
@@ -18,9 +18,7 @@ SOURCES += [
'../../../nsprpub/lib/libc/src/strcpy.c',
]
-Library('dmd')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('dmd')
DEFINES['MOZ_NO_MOZALLOC'] = True
diff --git a/memory/replace/dummy/moz.build b/memory/replace/dummy/moz.build
index 2aeda4fb26c..88b7d6fb612 100644
--- a/memory/replace/dummy/moz.build
+++ b/memory/replace/dummy/moz.build
@@ -9,8 +9,6 @@ SOURCES += [
'dummy_replace_malloc.c',
]
-Library('replace_malloc')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('replace_malloc')
DISABLE_STL_WRAPPING = True
diff --git a/memory/replace/jemalloc/moz.build b/memory/replace/jemalloc/moz.build
index 65c5999f6c8..74d03e99c39 100644
--- a/memory/replace/jemalloc/moz.build
+++ b/memory/replace/jemalloc/moz.build
@@ -17,14 +17,12 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
'pthread_atfork.c',
]
-Library('replace_jemalloc')
+SharedLibrary('replace_jemalloc')
USE_LIBS += [
'jemalloc',
]
-FORCE_SHARED_LIB = True
-
DEFINES['MOZ_JEMALLOC3'] = True
DEFINES['MOZ_REPLACE_JEMALLOC'] = True
diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build
index e97a8f258d2..ee209e73a00 100644
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -7,10 +7,9 @@
# Build mozglue as a shared lib on Windows, OSX and Android.
# If this is ever changed, update MOZ_SHARED_MOZGLUE in browser/installer/Makefile.in
if CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
- FORCE_SHARED_LIB = True
+ SharedLibrary('mozglue')
else:
- FORCE_SHARED_LIB = False
- FORCE_STATIC_LIB = True
+ Library('mozglue')
SDK_LIBRARY = True
@@ -69,8 +68,6 @@ if CONFIG['MOZ_ASAN']:
]
-Library('mozglue')
-
USE_LIBS += [
'mfbt',
]
diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py
index 346cae03ccd..7d1fdac124c 100644
--- a/python/mozbuild/mozbuild/frontend/context.py
+++ b/python/mozbuild/mozbuild/frontend/context.py
@@ -954,9 +954,12 @@ for name, (storage_type, input_types, docs, tier) in VARIABLES.items():
# Set of variables that are only allowed in templates:
TEMPLATE_VARIABLES = {
'CPP_UNIT_TESTS',
+ 'FORCE_SHARED_LIB',
'HOST_PROGRAM',
'HOST_LIBRARY_NAME',
'HOST_SIMPLE_PROGRAMS',
+ 'IS_COMPONENT',
+ 'IS_FRAMEWORK',
'LIBRARY_NAME',
'PROGRAM',
'SIMPLE_PROGRAMS',
@@ -1307,6 +1310,39 @@ DEPRECATION_HINTS = {
SIMPLE_PROGRAMS += ['foo', 'bar']"
''',
+ 'FORCE_SHARED_LIB': '''
+ Please use
+
+ SharedLibrary('foo')
+
+ instead of
+
+ Library('foo') [ or LIBRARY_NAME = 'foo' ]
+ FORCE_SHARED_LIB = True
+ ''',
+
+ 'IS_COMPONENT': '''
+ Please use
+
+ XPCOMBinaryComponent('foo')
+
+ instead of
+
+ Library('foo') [ or LIBRARY_NAME = 'foo' ]
+ IS_COMPONENT = True
+ ''',
+
+ 'IS_FRAMEWORK': '''
+ Please use
+
+ Framework('foo')
+
+ instead of
+
+ Library('foo') [ or LIBRARY_NAME = 'foo' ]
+ IS_FRAMEWORK = True
+ ''',
+
'TOOL_DIRS': 'Please use the DIRS variable instead.',
'TEST_TOOL_DIRS': 'Please use the TEST_DIRS variable instead.',
diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
index 34513fa6380..3ad348323a2 100644
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -638,14 +638,6 @@ class TreeMetadataEmitter(LoggingMixin):
if libname:
if is_component:
- if shared_lib:
- raise SandboxValidationError(
- 'IS_COMPONENT implies FORCE_SHARED_LIB. '
- 'Please remove the latter.', context)
- if is_framework:
- raise SandboxValidationError(
- 'IS_COMPONENT conflicts with IS_FRAMEWORK. '
- 'Please remove one.', context)
if static_lib:
raise SandboxValidationError(
'IS_COMPONENT conflicts with FORCE_STATIC_LIB. '
@@ -654,10 +646,6 @@ class TreeMetadataEmitter(LoggingMixin):
shared_args['variant'] = SharedLibrary.COMPONENT
if is_framework:
- if shared_lib:
- raise SandboxValidationError(
- 'IS_FRAMEWORK implies FORCE_SHARED_LIB. '
- 'Please remove the latter.', context)
if soname:
raise SandboxValidationError(
'IS_FRAMEWORK conflicts with SONAME. '
diff --git a/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build b/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build
index 9543ee60073..7f2f079a4f8 100644
--- a/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build
+++ b/security/manager/ssl/tests/unit/pkcs11testmodule/moz.build
@@ -8,9 +8,8 @@ UNIFIED_SOURCES += [
'pkcs11testmodule.cpp',
]
-Library('pkcs11testmodule')
+SharedLibrary('pkcs11testmodule')
-FORCE_SHARED_LIB = True
# C_GetFunctionList needs to be exported. As it turns out, it's much easier to
# just export all the symbols.
NO_VISIBILITY_FLAGS = True
diff --git a/security/sandbox/linux/moz.build b/security/sandbox/linux/moz.build
index 74c1736a4b4..2cbbccf3bf4 100644
--- a/security/sandbox/linux/moz.build
+++ b/security/sandbox/linux/moz.build
@@ -6,8 +6,7 @@
FAIL_ON_WARNINGS = True
-Library('mozsandbox')
-FORCE_SHARED_LIB = True
+SharedLibrary('mozsandbox')
EXPORTS.mozilla += [
'Sandbox.h',
diff --git a/security/sandbox/win/src/sandboxbroker/moz.build b/security/sandbox/win/src/sandboxbroker/moz.build
index eed82492d5a..0164e8e4ad9 100644
--- a/security/sandbox/win/src/sandboxbroker/moz.build
+++ b/security/sandbox/win/src/sandboxbroker/moz.build
@@ -4,7 +4,7 @@
# 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/.
-Library('sandboxbroker')
+SharedLibrary('sandboxbroker')
USE_LIBS += [
'nspr',
@@ -19,8 +19,6 @@ EXPORTS += [
'sandboxBroker.h',
]
-FORCE_SHARED_LIB = True
-
for var in ('UNICODE', '_UNICODE', 'NS_NO_XPCOM', 'NOMINMAX',
'SANDBOX_EXPORTS'):
DEFINES[var] = True
diff --git a/toolkit/components/ctypes/tests/moz.build b/toolkit/components/ctypes/tests/moz.build
index 749ccd4622c..7085c9df8a3 100644
--- a/toolkit/components/ctypes/tests/moz.build
+++ b/toolkit/components/ctypes/tests/moz.build
@@ -14,9 +14,7 @@ UNIFIED_SOURCES += [
'jsctypes-test.cpp',
]
-Library('jsctypes-test')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('jsctypes-test')
LOCAL_INCLUDES += [
'/js/src/ctypes',
diff --git a/toolkit/crashreporter/injector/moz.build b/toolkit/crashreporter/injector/moz.build
index 83d02b14c30..53af1e12818 100644
--- a/toolkit/crashreporter/injector/moz.build
+++ b/toolkit/crashreporter/injector/moz.build
@@ -8,12 +8,10 @@ SOURCES += [
'injector.cpp',
]
-Library('breakpadinjector')
+SharedLibrary('breakpadinjector')
include('/ipc/chromium/chromium-config.mozbuild')
-FORCE_SHARED_LIB = True
-
LOCAL_INCLUDES += [
'/toolkit/crashreporter/google-breakpad/src',
]
diff --git a/toolkit/crashreporter/test/moz.build b/toolkit/crashreporter/test/moz.build
index 9d93cbf94d4..5334228684b 100644
--- a/toolkit/crashreporter/test/moz.build
+++ b/toolkit/crashreporter/test/moz.build
@@ -17,14 +17,12 @@ UNIFIED_SOURCES += [
'nsTestCrasher.cpp',
]
-Library('testcrasher')
+SharedLibrary('testcrasher')
EXTRA_JS_MODULES += [
'CrashTestUtils.jsm',
]
-FORCE_SHARED_LIB = True
-
DEFINES['SHARED_LIBRARY'] = '%s%s%s' % (
CONFIG['DLL_PREFIX'],
LIBRARY_NAME,
diff --git a/toolkit/library/gtest/moz.build b/toolkit/library/gtest/moz.build
index 04dc296bcb4..0d0fd939c1b 100644
--- a/toolkit/library/gtest/moz.build
+++ b/toolkit/library/gtest/moz.build
@@ -4,12 +4,10 @@
# 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/.
-Library('xul-gtest')
+Libxul('xul-gtest')
FINAL_TARGET = 'dist/bin/gtest'
USE_LIBS += [
'static:xul',
]
-
-include('../libxul.mozbuild')
diff --git a/toolkit/library/libxul.mozbuild b/toolkit/library/libxul.mozbuild
deleted file mode 100644
index fcb2ec435d8..00000000000
--- a/toolkit/library/libxul.mozbuild
+++ /dev/null
@@ -1,52 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# 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/.
-
-MSVC_ENABLE_PGO = True
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- # This is going to be a framework named "XUL", not an ordinary library named
- # "libxul.dylib"
- SHARED_LIBRARY_NAME = 'XUL'
- IS_FRAMEWORK = True
-else:
- SHARED_LIBRARY_NAME = 'xul'
- FORCE_SHARED_LIB = True
-
-
-DELAYLOAD_DLLS += [
- 'comdlg32.dll',
- 'dbghelp.dll',
- 'psapi.dll',
- 'rasapi32.dll',
- 'rasdlg.dll',
- 'secur32.dll',
- 'wininet.dll',
- 'winspool.drv'
-]
-
-if CONFIG['MOZ_METRO']:
- DELAYLOAD_DLLS += [
- 'API-MS-WIN-CORE-WINRT-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
- 'API-MS-WIN-CORE-WINRT-STRING-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
- 'uiautomationcore.dll'
- ]
-
-if CONFIG['ACCESSIBILITY']:
- DELAYLOAD_DLLS += ['oleacc.dll']
-
-if CONFIG['MOZ_WEBRTC']:
- DELAYLOAD_DLLS += ['msdmo.dll']
-
-if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
- LOCAL_INCLUDES += [
- '/widget/windows',
- '/xpcom/base',
- ]
- # config/version.mk says $(srcdir)/$(RCINCLUDE), and this needs to
- # be valid in both toolkit/library and toolkit/library/gtest.
- # Eventually, the make backend would do its own path canonicalization
- # and config/version.mk would lift the $(srcdir)
- RCINCLUDE = '$(DEPTH)/toolkit/library/xulrunner.rc'
diff --git a/toolkit/library/moz.build b/toolkit/library/moz.build
index f3784c5eb1a..8ace917aa5a 100644
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -4,7 +4,55 @@
# 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/.
-Library('xul')
+@template
+def Libxul(name):
+ MSVC_ENABLE_PGO = True
+
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ # This is going to be a framework named "XUL", not an ordinary library named
+ # "libxul.dylib"
+ Framework(name)
+ SHARED_LIBRARY_NAME = 'XUL'
+ else:
+ SharedLibrary(name)
+ SHARED_LIBRARY_NAME = 'xul'
+
+ DELAYLOAD_DLLS += [
+ 'comdlg32.dll',
+ 'dbghelp.dll',
+ 'psapi.dll',
+ 'rasapi32.dll',
+ 'rasdlg.dll',
+ 'secur32.dll',
+ 'wininet.dll',
+ 'winspool.drv'
+ ]
+
+ if CONFIG['MOZ_METRO']:
+ DELAYLOAD_DLLS += [
+ 'API-MS-WIN-CORE-WINRT-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
+ 'API-MS-WIN-CORE-WINRT-STRING-L' + CONFIG['CRTEXPDLLVERSION'] + '.DLL',
+ 'uiautomationcore.dll'
+ ]
+
+ if CONFIG['ACCESSIBILITY']:
+ DELAYLOAD_DLLS += ['oleacc.dll']
+
+ if CONFIG['MOZ_WEBRTC']:
+ DELAYLOAD_DLLS += ['msdmo.dll']
+
+ if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
+ LOCAL_INCLUDES += [
+ '/widget/windows',
+ '/xpcom/base',
+ ]
+ # config/version.mk says $(srcdir)/$(RCINCLUDE), and this needs to
+ # be valid in both toolkit/library and toolkit/library/gtest.
+ # Eventually, the make backend would do its own path canonicalization
+ # and config/version.mk would lift the $(srcdir)
+ RCINCLUDE = '$(DEPTH)/toolkit/library/xulrunner.rc'
+
+Libxul('xul')
SDK_LIBRARY = True
@@ -46,8 +94,6 @@ FAIL_ON_WARNINGS = True
DIRS += ['gtest']
-include('libxul.mozbuild')
-
# js needs to come after xul for now, because it is an archive and its content
# is discarded when it comes first.
USE_LIBS += [
diff --git a/tools/jprof/stub/moz.build b/tools/jprof/stub/moz.build
index 1ed19f49227..9a56e0efd90 100644
--- a/tools/jprof/stub/moz.build
+++ b/tools/jprof/stub/moz.build
@@ -12,8 +12,6 @@ SOURCES += [
'libmalloc.cpp',
]
-Library('jprof')
-
-FORCE_SHARED_LIB = True
+SharedLibrary('jprof')
DEFINES['_IMPL_JPROF_API'] = True
diff --git a/widget/gtk/mozgtk/gtk2/moz.build b/widget/gtk/mozgtk/gtk2/moz.build
index b9f7d2f6237..acc9fbf76dd 100644
--- a/widget/gtk/mozgtk/gtk2/moz.build
+++ b/widget/gtk/mozgtk/gtk2/moz.build
@@ -10,12 +10,10 @@ SOURCES += [
DEFINES['GTK3_SYMBOLS'] = True
-Library('mozgtk2')
+SharedLibrary('mozgtk2')
SONAME = 'mozgtk'
-FORCE_SHARED_LIB = True
-
# If LDFLAGS contains -Wl,--as-needed, we need to add -Wl,--no-as-needed
# before the gtk libraries, otherwise the linker will drop those dependencies
# because no symbols are used from them. But those dependencies need to be
diff --git a/widget/gtk/mozgtk/gtk3/moz.build b/widget/gtk/mozgtk/gtk3/moz.build
index c8b5c3b7c91..fb62856b1ee 100644
--- a/widget/gtk/mozgtk/gtk3/moz.build
+++ b/widget/gtk/mozgtk/gtk3/moz.build
@@ -10,12 +10,10 @@ SOURCES += [
DEFINES['GTK2_SYMBOLS'] = True
-Library('mozgtk')
+SharedLibrary('mozgtk')
SONAME = 'mozgtk'
-FORCE_SHARED_LIB = True
-
# If LDFLAGS contains -Wl,--as-needed, we need to add -Wl,--no-as-needed
# before the gtk libraries, otherwise the linker will drop those dependencies
# because no symbols are used from them. But those dependencies need to be
diff --git a/widget/gtk/mozgtk/stub/moz.build b/widget/gtk/mozgtk/stub/moz.build
index c1611acbbf9..245136426a6 100644
--- a/widget/gtk/mozgtk/stub/moz.build
+++ b/widget/gtk/mozgtk/stub/moz.build
@@ -11,8 +11,6 @@ SOURCES += [
for var in ('COMMON_SYMBOLS', 'GTK2_SYMBOLS', 'GTK3_SYMBOLS'):
DEFINES[var] = True
-Library('mozgtk_stub')
+SharedLibrary('mozgtk_stub')
SONAME = 'mozgtk'
-
-FORCE_SHARED_LIB = True
From 22206d6d183124a29cd5813b49e4da2c035e4446 Mon Sep 17 00:00:00 2001
From: Mike Hommey
Date: Thu, 4 Sep 2014 09:05:12 +0900
Subject: [PATCH 26/68] Bug 1059129 - Move the addition of stdc++compat to
templates. r=mshal
---
build/templates.mozbuild | 32 ++++++++++++++++++--
python/mozbuild/mozbuild/frontend/emitter.py | 12 +-------
2 files changed, 31 insertions(+), 13 deletions(-)
diff --git a/build/templates.mozbuild b/build/templates.mozbuild
index 3abcb807f9f..bfc67c80c42 100644
--- a/build/templates.mozbuild
+++ b/build/templates.mozbuild
@@ -4,11 +4,21 @@
# 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/.
+@template
+def StdCppCompat():
+ '''Template for libstdc++ compatibility for target binaries.'''
+
+ if CONFIG['MOZ_LIBSTDCXX_TARGET_VERSION']:
+ USE_LIBS += ['stdc++compat']
+
+
@template
def Program(name):
'''Template for program executables.'''
PROGRAM = name
+ StdCppCompat()
+
@template
def SimplePrograms(names, ext='.cpp'):
@@ -19,6 +29,8 @@ def SimplePrograms(names, ext='.cpp'):
SIMPLE_PROGRAMS += names
SOURCES += ['%s%s' % (name, ext) for name in names]
+ StdCppCompat()
+
@template
def CppUnitTests(names, ext='.cpp'):
@@ -29,6 +41,8 @@ def CppUnitTests(names, ext='.cpp'):
CPP_UNIT_TESTS += names
SOURCES += ['%s%s' % (name, ext) for name in names]
+ StdCppCompat()
+
@template
def Library(name):
@@ -43,20 +57,32 @@ def SharedLibrary(name):
FORCE_SHARED_LIB = True
+ StdCppCompat()
+
@template
def Framework(name):
'''Template for OSX Frameworks.'''
- Library(name)
+ SharedLibrary(name)
IS_FRAMEWORK = True
+@template
+def HostStdCppCompat():
+ '''Template for libstdc++ compatibility for host binaries.'''
+
+ if CONFIG['MOZ_LIBSTDCXX_HOST_VERSION']:
+ HOST_USE_LIBS += ['host_stdc++compat']
+
+
@template
def HostProgram(name):
'''Template for build tools executables.'''
HOST_PROGRAM = name
+ HostStdCppCompat()
+
@template
def HostSimplePrograms(names, ext='.cpp'):
@@ -68,6 +94,8 @@ def HostSimplePrograms(names, ext='.cpp'):
HOST_SOURCES += ['%s%s' % (name.replace('host_', ''), ext)
for name in names]
+ HostStdCppCompat()
+
@template
def HostLibrary(name):
@@ -95,7 +123,7 @@ def XPCOMBinaryComponent(name):
name is the name of the component.
'''
- LIBRARY_NAME = name
+ SharedLibrary(name)
GeckoBinary()
diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py
index 3ad348323a2..5e1ab2a3629 100644
--- a/python/mozbuild/mozbuild/frontend/emitter.py
+++ b/python/mozbuild/mozbuild/frontend/emitter.py
@@ -240,17 +240,7 @@ class TreeMetadataEmitter(LoggingMixin):
"""Add linkage declarations to a given object."""
assert isinstance(obj, Linkable)
- extra = []
- # Add stdc++compat library when wanted and needed
- compat_varname = 'MOZ_LIBSTDCXX_%s_VERSION' % obj.KIND.upper()
- if context.config.substs.get(compat_varname) \
- and not isinstance(obj, (StaticLibrary, HostLibrary)):
- extra.append({
- 'target': 'stdc++compat',
- 'host': 'host_stdc++compat',
- }[obj.KIND])
-
- for path in context.get(variable, []) + extra:
+ for path in context.get(variable, []):
force_static = path.startswith('static:') and obj.KIND == 'target'
if force_static:
path = path[7:]
From b6bb51e10402fe7f1b87b8ae27c57afb077ab548 Mon Sep 17 00:00:00 2001
From: Botond Ballo
Date: Wed, 3 Sep 2014 12:54:26 -0400
Subject: [PATCH 27/68] Bug 1062411 - Make FrameMetrics::mContentDescription an
nsCString so there is no limit to its length. r=BenWa
---
gfx/layers/FrameMetrics.h | 30 ++++++++++---------
gfx/layers/apz/src/AsyncPanZoomController.cpp | 2 +-
2 files changed, 17 insertions(+), 15 deletions(-)
diff --git a/gfx/layers/FrameMetrics.h b/gfx/layers/FrameMetrics.h
index ea4e72f0bf3..2763c5bfcf3 100644
--- a/gfx/layers/FrameMetrics.h
+++ b/gfx/layers/FrameMetrics.h
@@ -60,10 +60,6 @@ namespace layers {
* time of a layer-tree transaction. These metrics are especially
* useful for shadow layers, because the metrics values are updated
* atomically with new pixels.
- *
- * Note that the FrameMetrics struct is sometimes stored in shared
- * memory and shared across processes, so it should be a "Plain Old
- * Data (POD)" type with no members that use dynamic memory.
*/
struct FrameMetrics {
friend struct IPC::ParamTraits;
@@ -101,7 +97,6 @@ public:
, mViewport(0, 0, 0, 0)
, mBackgroundColor(0, 0, 0, 0)
{
- mContentDescription[0] = '\0';
}
// Default copy ctor and operator= are fine
@@ -128,8 +123,7 @@ public:
mScrollOffset == aOther.mScrollOffset &&
mHasScrollgrab == aOther.mHasScrollgrab &&
mUpdateScrollOffset == aOther.mUpdateScrollOffset &&
- mBackgroundColor == aOther.mBackgroundColor &&
- !strcmp(mContentDescription, aOther.mContentDescription);
+ mBackgroundColor == aOther.mBackgroundColor;
}
bool operator!=(const FrameMetrics& aOther) const
{
@@ -247,6 +241,16 @@ public:
mScrollGeneration = aOther.mScrollGeneration;
}
+ // Make a copy of this FrameMetrics object which does not have any pointers
+ // to heap-allocated memory (i.e. is Plain Old Data, or 'POD'), and is
+ // therefore safe to be placed into shared memory.
+ FrameMetrics MakePODObject() const
+ {
+ FrameMetrics copy = *this;
+ copy.mContentDescription.Truncate();
+ return copy;
+ }
+
// ---------------------------------------------------------------------------
// The following metrics are all in widget space/device pixels.
//
@@ -484,16 +488,14 @@ public:
mBackgroundColor = aBackgroundColor;
}
- nsCString GetContentDescription() const
+ const nsCString& GetContentDescription() const
{
- return nsCString(mContentDescription);
+ return mContentDescription;
}
void SetContentDescription(const nsCString& aContentDescription)
{
- strncpy(mContentDescription, aContentDescription.get(),
- sizeof(mContentDescription));
- mContentDescription[sizeof(mContentDescription) - 1] = 0;
+ mContentDescription = aContentDescription;
}
private:
@@ -569,9 +571,9 @@ private:
gfxRGBA mBackgroundColor;
// A description of the content element corresponding to this frame.
- // This is empty unless this is a scrollable ContainerLayer and the
+ // This is empty unless this is a scrollable layer and the
// apz.printtree pref is turned on.
- char mContentDescription[20];
+ nsCString mContentDescription;
};
/**
diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp
index d397afa4fc4..817894b7713 100644
--- a/gfx/layers/apz/src/AsyncPanZoomController.cpp
+++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp
@@ -2868,7 +2868,7 @@ void AsyncPanZoomController::UpdateSharedCompositorFrameMetrics()
if (frame && mSharedLock && gfxPrefs::UseProgressiveTilePainting()) {
mSharedLock->Lock();
- *frame = mFrameMetrics;
+ *frame = mFrameMetrics.MakePODObject();
mSharedLock->Unlock();
}
}
From 27f6269f74f229bae0f2b79ab3894e1448ca577f Mon Sep 17 00:00:00 2001
From: Catalin Badea
Date: Wed, 27 Aug 2014 10:24:09 -0700
Subject: [PATCH 28/68] Bug 982726 - Patch 1 - Service Worker:
ServiceWorkerClients and Client interfaces with getServiced(). r=baku
--HG--
extra : rebase_source : f8dd649fd30cfffb2a361aa24868e83413e7b54c
---
dom/bindings/Bindings.conf | 10 +
dom/webidl/ServiceWorkerClient.webidl | 14 ++
dom/webidl/ServiceWorkerClients.webidl | 19 ++
dom/webidl/ServiceWorkerGlobalScope.webidl | 5 +-
dom/webidl/moz.build | 2 +
dom/workers/ServiceWorkerClient.cpp | 29 +++
dom/workers/ServiceWorkerClient.h | 59 +++++
dom/workers/ServiceWorkerClients.cpp | 229 ++++++++++++++++++
dom/workers/ServiceWorkerClients.h | 56 +++++
dom/workers/ServiceWorkerManager.cpp | 51 ++++
dom/workers/ServiceWorkerManager.h | 4 +
dom/workers/WorkerScope.cpp | 8 +
dom/workers/WorkerScope.h | 16 ++
dom/workers/moz.build | 4 +
.../serviceworkers/get_serviced_worker.js | 16 ++
dom/workers/test/serviceworkers/mochitest.ini | 3 +
.../serviceworkers/sw_clients/simple.html | 25 ++
.../serviceworkers/test_get_serviced.html | 57 +++++
18 files changed, 603 insertions(+), 4 deletions(-)
create mode 100644 dom/webidl/ServiceWorkerClient.webidl
create mode 100644 dom/webidl/ServiceWorkerClients.webidl
create mode 100644 dom/workers/ServiceWorkerClient.cpp
create mode 100644 dom/workers/ServiceWorkerClient.h
create mode 100644 dom/workers/ServiceWorkerClients.cpp
create mode 100644 dom/workers/ServiceWorkerClients.h
create mode 100644 dom/workers/test/serviceworkers/get_serviced_worker.js
create mode 100644 dom/workers/test/serviceworkers/sw_clients/simple.html
create mode 100644 dom/workers/test/serviceworkers/test_get_serviced.html
diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf
index 969b3e7809d..0bb7f8dbb8b 100644
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -1058,6 +1058,16 @@ DOMInterfaces = {
'headerFile': 'mozilla/dom/workers/bindings/ServiceWorker.h',
},
+'ServiceWorkerClient': {
+ 'nativeType': 'mozilla::dom::workers::ServiceWorkerClient',
+ 'headerFile': 'mozilla/dom/workers/bindings/ServiceWorkerClient.h',
+},
+
+'ServiceWorkerClients': {
+ 'nativeType': 'mozilla::dom::workers::ServiceWorkerClients',
+ 'headerFile': 'mozilla/dom/workers/bindings/ServiceWorkerClients.h',
+},
+
'ServiceWorkerGlobalScope': {
'headerFile': 'mozilla/dom/WorkerScope.h',
'workers': True,
diff --git a/dom/webidl/ServiceWorkerClient.webidl b/dom/webidl/ServiceWorkerClient.webidl
new file mode 100644
index 00000000000..2473fb572fe
--- /dev/null
+++ b/dom/webidl/ServiceWorkerClient.webidl
@@ -0,0 +1,14 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ *
+ * The origin of this IDL file is
+ * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
+ *
+ */
+
+[Exposed=ServiceWorker]
+interface ServiceWorkerClient {
+ readonly attribute unsigned long id;
+};
diff --git a/dom/webidl/ServiceWorkerClients.webidl b/dom/webidl/ServiceWorkerClients.webidl
new file mode 100644
index 00000000000..8d88181ddc0
--- /dev/null
+++ b/dom/webidl/ServiceWorkerClients.webidl
@@ -0,0 +1,19 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ *
+ * The origin of this IDL file is
+ * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html
+ *
+ */
+
+[Exposed=ServiceWorker]
+interface ServiceWorkerClients {
+ // A list of client objects, identifiable by ID, that correspond to windows
+ // (or workers) that are "controlled" by this SW
+ [Throws]
+ Promise?> getServiced();
+ [Throws]
+ Promise reloadAll();
+};
diff --git a/dom/webidl/ServiceWorkerGlobalScope.webidl b/dom/webidl/ServiceWorkerGlobalScope.webidl
index 5f2518a4f70..6fa74e66f62 100644
--- a/dom/webidl/ServiceWorkerGlobalScope.webidl
+++ b/dom/webidl/ServiceWorkerGlobalScope.webidl
@@ -16,10 +16,7 @@ interface ServiceWorkerGlobalScope : WorkerGlobalScope {
// FIXME(nsm): Bug 982725
// readonly attribute CacheList caches;
- // FIXME(nsm): Bug 982726
- // A container for a list of window objects, identifiable by ID, that
- // correspond to windows (or workers) that are "controlled" by this SW
- // readonly attribute ServiceWorkerClients clients;
+ readonly attribute ServiceWorkerClients clients;
[Unforgeable] readonly attribute DOMString scope;
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
index 7959d65243b..565b9f2dff3 100644
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -331,6 +331,8 @@ WEBIDL_FILES = [
'ScrollAreaEvent.webidl',
'Selection.webidl',
'ServiceWorker.webidl',
+ 'ServiceWorkerClient.webidl',
+ 'ServiceWorkerClients.webidl',
'ServiceWorkerContainer.webidl',
'ServiceWorkerGlobalScope.webidl',
'ServiceWorkerRegistration.webidl',
diff --git a/dom/workers/ServiceWorkerClient.cpp b/dom/workers/ServiceWorkerClient.cpp
new file mode 100644
index 00000000000..2a2e1c28b3e
--- /dev/null
+++ b/dom/workers/ServiceWorkerClient.cpp
@@ -0,0 +1,29 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+#include "ServiceWorkerClient.h"
+
+#include "mozilla/dom/ServiceWorkerClientBinding.h"
+
+using namespace mozilla::dom;
+using namespace mozilla::dom::workers;
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ServiceWorkerClient, mOwner)
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ServiceWorkerClient)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ServiceWorkerClient)
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerClient)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+JSObject*
+ServiceWorkerClient::WrapObject(JSContext* aCx)
+{
+ return ServiceWorkerClientBinding::Wrap(aCx, this);
+}
+
diff --git a/dom/workers/ServiceWorkerClient.h b/dom/workers/ServiceWorkerClient.h
new file mode 100644
index 00000000000..7ad4c4aff80
--- /dev/null
+++ b/dom/workers/ServiceWorkerClient.h
@@ -0,0 +1,59 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+#ifndef mozilla_dom_workers_serviceworkerclient_h
+#define mozilla_dom_workers_serviceworkerclient_h
+
+#include "nsCOMPtr.h"
+#include "nsWrapperCache.h"
+
+namespace mozilla {
+namespace dom {
+
+class Promise;
+
+namespace workers {
+
+class ServiceWorkerClient MOZ_FINAL : public nsISupports,
+ public nsWrapperCache
+{
+public:
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClient)
+
+ ServiceWorkerClient(nsISupports* aOwner, uint64_t aId)
+ : mOwner(aOwner),
+ mId(aId)
+ {
+ SetIsDOMBinding();
+ }
+
+ uint32_t Id() const
+ {
+ return mId;
+ }
+
+ nsISupports* GetParentObject() const
+ {
+ return mOwner;
+ }
+
+ JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
+
+private:
+ ~ServiceWorkerClient()
+ {
+ }
+
+ nsCOMPtr mOwner;
+ uint64_t mId;
+};
+
+} // namespace workers
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_workers_serviceworkerclient_h
diff --git a/dom/workers/ServiceWorkerClients.cpp b/dom/workers/ServiceWorkerClients.cpp
new file mode 100644
index 00000000000..cc2129cf875
--- /dev/null
+++ b/dom/workers/ServiceWorkerClients.cpp
@@ -0,0 +1,229 @@
+/* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/. */
+
+#include "ServiceWorkerClient.h"
+#include "ServiceWorkerClients.h"
+#include "ServiceWorkerManager.h"
+
+#include "WorkerPrivate.h"
+#include "WorkerRunnable.h"
+#include "WorkerScope.h"
+
+#include "mozilla/dom/Promise.h"
+#include "mozilla/dom/ServiceWorkerClientsBinding.h"
+
+using namespace mozilla;
+using namespace mozilla::dom;
+using namespace mozilla::dom::workers;
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ServiceWorkerClients)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ServiceWorkerClients)
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ServiceWorkerClients, mWorkerScope)
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ServiceWorkerClients)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+ServiceWorkerClients::ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope)
+ : mWorkerScope(aWorkerScope)
+{
+ MOZ_ASSERT(mWorkerScope);
+ SetIsDOMBinding();
+}
+
+JSObject*
+ServiceWorkerClients::WrapObject(JSContext* aCx)
+{
+ return ServiceWorkerClientsBinding::Wrap(aCx, this);
+}
+
+namespace {
+
+// Helper class used for passing the promise between threads while
+// keeping the worker alive.
+class PromiseHolder MOZ_FINAL : public WorkerFeature
+{
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PromiseHolder)
+
+public:
+ PromiseHolder(WorkerPrivate* aWorkerPrivate,
+ Promise* aPromise)
+ : mWorkerPrivate(aWorkerPrivate),
+ mPromise(aPromise),
+ mClean(false)
+ {
+ MOZ_ASSERT(mWorkerPrivate);
+ mWorkerPrivate->AssertIsOnWorkerThread();
+ MOZ_ASSERT(mPromise);
+
+ if (NS_WARN_IF(!mWorkerPrivate->AddFeature(mWorkerPrivate->GetJSContext(), this))) {
+ // Worker has been canceled and will go away.
+ // The ResolvePromiseWorkerRunnable won't run, so we can set mPromise to
+ // nullptr.
+ mPromise = nullptr;
+ mClean = true;
+ }
+ }
+
+ Promise*
+ Get() const
+ {
+ return mPromise;
+ }
+
+ void
+ Clean()
+ {
+ mWorkerPrivate->AssertIsOnWorkerThread();
+
+ if (mClean) {
+ return;
+ }
+
+ mPromise = nullptr;
+ mWorkerPrivate->RemoveFeature(mWorkerPrivate->GetJSContext(), this);
+ mClean = true;
+ }
+
+ bool
+ Notify(JSContext* aCx, Status aStatus)
+ {
+ mWorkerPrivate->AssertIsOnWorkerThread();
+
+ if (aStatus > Running) {
+ Clean();
+ }
+
+ return true;
+ }
+
+private:
+ ~PromiseHolder()
+ {
+ MOZ_ASSERT(mClean);
+ }
+
+ WorkerPrivate* mWorkerPrivate;
+ nsRefPtr mPromise;
+
+ bool mClean;
+};
+
+class ResolvePromiseWorkerRunnable MOZ_FINAL : public WorkerRunnable
+{
+ nsRefPtr mPromiseHolder;
+ nsAutoPtr> mValue;
+
+public:
+ ResolvePromiseWorkerRunnable(WorkerPrivate* aWorkerPrivate,
+ PromiseHolder* aPromiseHolder,
+ nsAutoPtr>& aValue)
+ : WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount),
+ mPromiseHolder(aPromiseHolder),
+ mValue(aValue)
+ {
+ AssertIsOnMainThread();
+ }
+
+ bool
+ WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
+ {
+ MOZ_ASSERT(aWorkerPrivate);
+ aWorkerPrivate->AssertIsOnWorkerThread();
+
+ Promise* promise = mPromiseHolder->Get();
+ MOZ_ASSERT(promise);
+
+ nsTArray> ret;
+ for (size_t i = 0; i < mValue->Length(); i++) {
+ ret.AppendElement(nsRefPtr(
+ new ServiceWorkerClient(promise->GetParentObject(),
+ mValue->ElementAt(i))));
+ }
+ promise->MaybeResolve(ret);
+
+ // release the reference on the worker thread.
+ mPromiseHolder->Clean();
+
+ return true;
+ }
+};
+
+class GetServicedRunnable MOZ_FINAL : public nsRunnable
+{
+ WorkerPrivate* mWorkerPrivate;
+ nsCString mScope;
+ nsRefPtr mPromiseHolder;
+public:
+ GetServicedRunnable(WorkerPrivate* aWorkerPrivate,
+ Promise* aPromise,
+ const nsCString& aScope)
+ : mWorkerPrivate(aWorkerPrivate),
+ mScope(aScope)
+ {
+ MOZ_ASSERT(aWorkerPrivate);
+ aWorkerPrivate->AssertIsOnWorkerThread();
+ mPromiseHolder = new PromiseHolder(aWorkerPrivate, aPromise);
+ }
+
+ NS_IMETHOD
+ Run() MOZ_OVERRIDE
+ {
+ AssertIsOnMainThread();
+
+ nsRefPtr swm = ServiceWorkerManager::GetInstance();
+ nsAutoPtr> result(new nsTArray());
+
+ swm->GetServicedClients(mScope, result);
+ nsRefPtr r =
+ new ResolvePromiseWorkerRunnable(mWorkerPrivate, mPromiseHolder, result);
+
+ AutoSafeJSContext cx;
+ r->Dispatch(cx);
+ return NS_OK;
+ }
+};
+
+} // anonymous namespace
+
+already_AddRefed
+ServiceWorkerClients::GetServiced(ErrorResult& aRv)
+{
+ WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
+ MOZ_ASSERT(workerPrivate);
+ workerPrivate->AssertIsOnWorkerThread();
+
+ DOMString scope;
+ mWorkerScope->GetScope(scope);
+
+ nsRefPtr promise = Promise::Create(mWorkerScope, aRv);
+ if (NS_WARN_IF(aRv.Failed())) {
+ return nullptr;
+ }
+
+ nsRefPtr r =
+ new GetServicedRunnable(workerPrivate, promise, NS_ConvertUTF16toUTF8(scope));
+ nsresult rv = NS_DispatchToMainThread(r);
+
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
+ }
+
+ return promise.forget();
+}
+
+// FIXME(catalinb): Bug 1045257 - Implement ReloadAll
+already_AddRefed
+ServiceWorkerClients::ReloadAll(ErrorResult& aRv)
+{
+ nsRefPtr promise = Promise::Create(mWorkerScope, aRv);
+ if (NS_WARN_IF(aRv.Failed())) {
+ return nullptr;
+ }
+ promise->MaybeReject(NS_ERROR_NOT_AVAILABLE);
+ return promise.forget();
+}
+
diff --git a/dom/workers/ServiceWorkerClients.h b/dom/workers/ServiceWorkerClients.h
new file mode 100644
index 00000000000..39cf03a6dab
--- /dev/null
+++ b/dom/workers/ServiceWorkerClients.h
@@ -0,0 +1,56 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * 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/.
+ */
+
+#ifndef mozilla_dom_workers_serviceworkerclients_h
+#define mozilla_dom_workers_serviceworkerclients_h
+
+#include "nsAutoPtr.h"
+#include "nsWrapperCache.h"
+
+namespace mozilla {
+
+class ErrorResult;
+
+namespace dom {
+
+class Promise;
+
+namespace workers {
+
+class ServiceWorkerGlobalScope;
+
+class ServiceWorkerClients MOZ_FINAL : public nsISupports,
+ public nsWrapperCache
+{
+public:
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ServiceWorkerClients)
+
+ ServiceWorkerClients(ServiceWorkerGlobalScope* aWorkerScope);
+
+ already_AddRefed GetServiced(ErrorResult& aRv);
+ already_AddRefed ReloadAll(ErrorResult& aRv);
+
+ JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
+
+ ServiceWorkerGlobalScope* GetParentObject() const
+ {
+ return mWorkerScope;
+ }
+
+private:
+ ~ServiceWorkerClients()
+ {
+ }
+
+ nsRefPtr mWorkerScope;
+};
+
+} // namespace workers
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_workers_serviceworkerclients_h
diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp
index 32aa670c4f4..15b40cedc5f 100644
--- a/dom/workers/ServiceWorkerManager.cpp
+++ b/dom/workers/ServiceWorkerManager.cpp
@@ -24,6 +24,7 @@
#include "RuntimeService.h"
#include "ServiceWorker.h"
+#include "ServiceWorkerClient.h"
#include "ServiceWorkerRegistration.h"
#include "ServiceWorkerEvents.h"
#include "WorkerInlines.h"
@@ -2173,4 +2174,54 @@ ServiceWorkerManager::InvalidateServiceWorkerRegistrationWorker(ServiceWorkerReg
}
}
+namespace {
+
+class MOZ_STACK_CLASS FilterRegistrationData
+{
+public:
+ FilterRegistrationData(nsTArray* aDocuments,
+ ServiceWorkerRegistrationInfo* aRegistration)
+ : mDocuments(aDocuments),
+ mRegistration(aRegistration)
+ {
+ }
+
+ nsTArray* mDocuments;
+ nsRefPtr mRegistration;
+};
+
+static PLDHashOperator
+EnumControlledDocuments(nsISupports* aKey,
+ ServiceWorkerRegistrationInfo* aRegistration,
+ void* aData)
+{
+ FilterRegistrationData* data = static_cast(aData);
+ if (data->mRegistration != aRegistration) {
+ return PL_DHASH_NEXT;
+ }
+ nsCOMPtr document = do_QueryInterface(aKey);
+ if (!document || !document->GetInnerWindow()) {
+ return PL_DHASH_NEXT;
+ }
+
+ data->mDocuments->AppendElement(document->GetInnerWindow()->WindowID());
+ return PL_DHASH_NEXT;
+}
+
+} // anonymous namespace
+
+void
+ServiceWorkerManager::GetServicedClients(const nsCString& aScope,
+ nsTArray* aControlledDocuments)
+{
+ nsRefPtr domainInfo = GetDomainInfo(aScope);
+ nsRefPtr registration =
+ domainInfo->GetRegistration(aScope);
+ MOZ_ASSERT(registration);
+ FilterRegistrationData data(aControlledDocuments, registration);
+
+ domainInfo->mControlledDocuments.EnumerateRead(EnumControlledDocuments,
+ &data);
+}
+
END_WORKERS_NAMESPACE
diff --git a/dom/workers/ServiceWorkerManager.h b/dom/workers/ServiceWorkerManager.h
index 68f80165479..2fb58bb63ca 100644
--- a/dom/workers/ServiceWorkerManager.h
+++ b/dom/workers/ServiceWorkerManager.h
@@ -318,6 +318,10 @@ public:
uint32_t aColumnNumber,
uint32_t aFlags);
+ void
+ GetServicedClients(const nsCString& aScope,
+ nsTArray* aControlledDocuments);
+
static already_AddRefed
GetInstance();
diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp
index ef2475ad3e5..d353cbf55a2 100644
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -346,6 +346,14 @@ SharedWorkerGlobalScope::WrapGlobalObject(JSContext* aCx)
true);
}
+NS_IMPL_CYCLE_COLLECTION_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope,
+ mClients)
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(ServiceWorkerGlobalScope)
+NS_INTERFACE_MAP_END_INHERITING(WorkerGlobalScope)
+
+NS_IMPL_ADDREF_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope)
+NS_IMPL_RELEASE_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope)
+
ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
const nsACString& aScope)
: WorkerGlobalScope(aWorkerPrivate),
diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h
index ea4918d5805..eed5fb4592e 100644
--- a/dom/workers/WorkerScope.h
+++ b/dom/workers/WorkerScope.h
@@ -8,6 +8,7 @@
#include "Workers.h"
#include "mozilla/DOMEventTargetHelper.h"
+#include "ServiceWorkerClients.h"
namespace mozilla {
namespace dom {
@@ -163,9 +164,15 @@ public:
class ServiceWorkerGlobalScope MOZ_FINAL : public WorkerGlobalScope
{
const nsString mScope;
+ nsRefPtr mClients;
+
~ServiceWorkerGlobalScope() { }
public:
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(ServiceWorkerGlobalScope,
+ WorkerGlobalScope)
+
ServiceWorkerGlobalScope(WorkerPrivate* aWorkerPrivate, const nsACString& aScope);
virtual JSObject*
@@ -195,6 +202,15 @@ public:
// FIXME(nsm): Bug 982728
}
+ ServiceWorkerClients*
+ Clients() {
+ if (!mClients) {
+ mClients = new ServiceWorkerClients(this);
+ }
+
+ return mClients;
+ }
+
IMPL_EVENT_HANDLER(activate)
IMPL_EVENT_HANDLER(beforeevicted)
IMPL_EVENT_HANDLER(evicted)
diff --git a/dom/workers/moz.build b/dom/workers/moz.build
index 1502dc5a605..305cfc3b913 100644
--- a/dom/workers/moz.build
+++ b/dom/workers/moz.build
@@ -29,6 +29,8 @@ EXPORTS.mozilla.dom.workers.bindings += [
'Navigator.h',
'Performance.h',
'ServiceWorker.h',
+ 'ServiceWorkerClient.h',
+ 'ServiceWorkerClients.h',
'SharedWorker.h',
'URL.h',
'WorkerFeature.h',
@@ -51,6 +53,8 @@ SOURCES += [
'RuntimeService.cpp',
'ScriptLoader.cpp',
'ServiceWorker.cpp',
+ 'ServiceWorkerClient.cpp',
+ 'ServiceWorkerClients.cpp',
'ServiceWorkerContainer.cpp',
'ServiceWorkerEvents.cpp',
'ServiceWorkerManager.cpp',
diff --git a/dom/workers/test/serviceworkers/get_serviced_worker.js b/dom/workers/test/serviceworkers/get_serviced_worker.js
new file mode 100644
index 00000000000..b97e4145034
--- /dev/null
+++ b/dom/workers/test/serviceworkers/get_serviced_worker.js
@@ -0,0 +1,16 @@
+function loop() {
+ self.clients.getServiced().then(function(result) {
+ setTimeout(loop, 0);
+ });
+}
+
+onactivate = function(e) {
+ // spam getServiced until the worker is closed.
+ loop();
+}
+
+onclose = function(e) {
+ for (var i = 0; i < 100; ++i) {
+ self.clients.getServiced();
+ }
+}
diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini
index 20da13ab8a9..c8e7660cc5b 100644
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -10,7 +10,10 @@ support-files =
simpleregister/ready.html
controller/index.html
unregister/index.html
+ sw_clients/simple.html
+ get_serviced_worker.js
+[test_get_serviced.html]
[test_installation_simple.html]
[test_install_event.html]
[test_navigator.html]
diff --git a/dom/workers/test/serviceworkers/sw_clients/simple.html b/dom/workers/test/serviceworkers/sw_clients/simple.html
new file mode 100644
index 00000000000..6b1551928d3
--- /dev/null
+++ b/dom/workers/test/serviceworkers/sw_clients/simple.html
@@ -0,0 +1,25 @@
+
+
+
+
+ Bug 982726 - test get_serviced not crashing
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/workers/test/serviceworkers/test_get_serviced.html b/dom/workers/test/serviceworkers/test_get_serviced.html
new file mode 100644
index 00000000000..8c47401a079
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_get_serviced.html
@@ -0,0 +1,57 @@
+
+
+
+
+ Bug 982726 - test get_serviced not crashing
+
+
+
+
+
+
+
+
+
+
+
+
From 9ab95e5bd70b7ec48dae8c5d9b1242f40773940d Mon Sep 17 00:00:00 2001
From: Catalin Badea
Date: Fri, 15 Aug 2014 00:43:00 -0700
Subject: [PATCH 29/68] Bug 982726 - Patch 2 - Add postMessage to service
worker. r=baku
--HG--
extra : rebase_source : 55474dcece43eb53a99829ec0a076f2f1e09ce22
extra : amend_source : 39daf21dd3187542754f82115d75eaca20b838b5
---
dom/webidl/ServiceWorker.webidl | 6 ++++--
dom/workers/ServiceWorker.cpp | 12 ++++++++++++
dom/workers/ServiceWorker.h | 5 +++++
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/dom/webidl/ServiceWorker.webidl b/dom/webidl/ServiceWorker.webidl
index ad0b02ea83a..a4fe588b783 100644
--- a/dom/webidl/ServiceWorker.webidl
+++ b/dom/webidl/ServiceWorker.webidl
@@ -8,8 +8,6 @@
*
*/
-// Still unclear what should be subclassed.
-// https://github.com/slightlyoff/ServiceWorker/issues/189
[Pref="dom.serviceWorkers.enabled",
// XXXbz I have no idea where this should be exposed. The spec makes
// no sense. But since it's got a pref, let's say window.
@@ -20,6 +18,10 @@ interface ServiceWorker : EventTarget {
readonly attribute ServiceWorkerState state;
attribute EventHandler onstatechange;
+
+ // FIXME(catalinb): Bug 1053483 - This should be inherited from MessageUtils
+ [Throws]
+ void postMessage(any message, optional sequence transferable);
};
ServiceWorker implements AbstractWorker;
diff --git a/dom/workers/ServiceWorker.cpp b/dom/workers/ServiceWorker.cpp
index ee2eab96a4a..f9cbf3820ab 100644
--- a/dom/workers/ServiceWorker.cpp
+++ b/dom/workers/ServiceWorker.cpp
@@ -11,6 +11,7 @@
#include "mozilla/dom/Promise.h"
+using mozilla::ErrorResult;
using namespace mozilla::dom;
USING_WORKERS_NAMESPACE
@@ -46,6 +47,17 @@ ServiceWorker::WrapObject(JSContext* aCx)
return ServiceWorkerBinding::Wrap(aCx, this);
}
+void
+ServiceWorker::PostMessage(JSContext* aCx, JS::Handle aMessage,
+ const Optional>& aTransferable,
+ ErrorResult& aRv)
+{
+ WorkerPrivate* workerPrivate = GetWorkerPrivate();
+ MOZ_ASSERT(workerPrivate);
+
+ workerPrivate->PostMessage(aCx, aMessage, aTransferable, aRv);
+}
+
WorkerPrivate*
ServiceWorker::GetWorkerPrivate() const
{
diff --git a/dom/workers/ServiceWorker.h b/dom/workers/ServiceWorker.h
index 0883ad525b8..3c3b7e612ab 100644
--- a/dom/workers/ServiceWorker.h
+++ b/dom/workers/ServiceWorker.h
@@ -52,6 +52,11 @@ public:
aURL = mURL;
}
+ void
+ PostMessage(JSContext* aCx, JS::Handle aMessage,
+ const Optional>& aTransferable,
+ ErrorResult& aRv);
+
WorkerPrivate*
GetWorkerPrivate() const;
From 0f93dac9a31c26336037cb2e37850bbbbd45f7e9 Mon Sep 17 00:00:00 2001
From: Catalin Badea
Date: Sun, 24 Aug 2014 21:17:21 -0700
Subject: [PATCH 30/68] Bug 982726 - Patch 3 - Implement client.postMessage and
add tests for getServiced(). r=baku
--HG--
extra : rebase_source : 0062dc40cd5cb1248bdce4c70b8abf389eed073d
extra : amend_source : 615bc61390c7e323ddca5a16352387bd4a7c920a
---
dom/webidl/ServiceWorkerClient.webidl | 2 +
dom/workers/ServiceWorkerClient.cpp | 130 ++++++++++++++++++
dom/workers/ServiceWorkerClient.h | 9 ++
.../get_serviced_worker_advanced.js | 12 ++
.../get_serviced_worker_enumerate.js | 7 +
.../serviceworkers/message_posting_worker.js | 9 ++
dom/workers/test/serviceworkers/mochitest.ini | 7 +
.../sw_clients/service_worker_controlled.html | 39 ++++++
.../test_get_serviced_advanced.html | 80 +++++++++++
.../test_get_serviced_enumerate.html | 82 +++++++++++
.../serviceworkers/test_post_message.html | 62 +++++++++
11 files changed, 439 insertions(+)
create mode 100644 dom/workers/test/serviceworkers/get_serviced_worker_advanced.js
create mode 100644 dom/workers/test/serviceworkers/get_serviced_worker_enumerate.js
create mode 100644 dom/workers/test/serviceworkers/message_posting_worker.js
create mode 100644 dom/workers/test/serviceworkers/sw_clients/service_worker_controlled.html
create mode 100644 dom/workers/test/serviceworkers/test_get_serviced_advanced.html
create mode 100644 dom/workers/test/serviceworkers/test_get_serviced_enumerate.html
create mode 100644 dom/workers/test/serviceworkers/test_post_message.html
diff --git a/dom/webidl/ServiceWorkerClient.webidl b/dom/webidl/ServiceWorkerClient.webidl
index 2473fb572fe..3543b4b49f8 100644
--- a/dom/webidl/ServiceWorkerClient.webidl
+++ b/dom/webidl/ServiceWorkerClient.webidl
@@ -11,4 +11,6 @@
[Exposed=ServiceWorker]
interface ServiceWorkerClient {
readonly attribute unsigned long id;
+ [Throws]
+ void postMessage(any message, optional sequence transfer);
};
diff --git a/dom/workers/ServiceWorkerClient.cpp b/dom/workers/ServiceWorkerClient.cpp
index 2a2e1c28b3e..f183b593611 100644
--- a/dom/workers/ServiceWorkerClient.cpp
+++ b/dom/workers/ServiceWorkerClient.cpp
@@ -6,8 +6,13 @@
#include "ServiceWorkerClient.h"
+#include "mozilla/dom/MessageEvent.h"
+#include "nsGlobalWindow.h"
+#include "WorkerPrivate.h"
+
#include "mozilla/dom/ServiceWorkerClientBinding.h"
+using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::dom::workers;
@@ -27,3 +32,128 @@ ServiceWorkerClient::WrapObject(JSContext* aCx)
return ServiceWorkerClientBinding::Wrap(aCx, this);
}
+namespace {
+
+class ServiceWorkerClientPostMessageRunnable MOZ_FINAL : public nsRunnable
+{
+ uint64_t mId;
+ JSAutoStructuredCloneBuffer mBuffer;
+ nsTArray> mClonedObjects;
+
+public:
+ ServiceWorkerClientPostMessageRunnable(uint64_t aId,
+ JSAutoStructuredCloneBuffer&& aData,
+ nsTArray>& aClonedObjects)
+ : mId(aId),
+ mBuffer(Move(aData))
+ {
+ mClonedObjects.SwapElements(aClonedObjects);
+ }
+
+ NS_IMETHOD
+ Run()
+ {
+ AssertIsOnMainThread();
+ nsGlobalWindow* window = nsGlobalWindow::GetInnerWindowWithId(mId);
+ if (!window) {
+ return NS_ERROR_FAILURE;
+ }
+
+ AutoJSAPI jsapi;
+ jsapi.Init(window);
+ JSContext* cx = jsapi.cx();
+
+ return DispatchDOMEvent(cx, window);
+ }
+
+private:
+ NS_IMETHOD
+ DispatchDOMEvent(JSContext* aCx, nsGlobalWindow* aTargetWindow)
+ {
+ AssertIsOnMainThread();
+
+ // Release reference to objects that were AddRef'd for
+ // cloning into worker when array goes out of scope.
+ nsTArray> clonedObjects;
+ clonedObjects.SwapElements(mClonedObjects);
+
+ JS::Rooted messageData(aCx);
+ if (!mBuffer.read(aCx, &messageData,
+ WorkerStructuredCloneCallbacks(true))) {
+ xpc::Throw(aCx, NS_ERROR_DOM_DATA_CLONE_ERR);
+ return NS_ERROR_FAILURE;
+ }
+
+ nsCOMPtr event = new MessageEvent(aTargetWindow,
+ nullptr, nullptr);
+ nsresult rv =
+ event->InitMessageEvent(NS_LITERAL_STRING("message"),
+ false /* non-bubbling */,
+ false /* not cancelable */,
+ messageData,
+ EmptyString(),
+ EmptyString(),
+ nullptr);
+ if (NS_FAILED(rv)) {
+ xpc::Throw(aCx, rv);
+ return NS_ERROR_FAILURE;
+ }
+
+ event->SetTrusted(true);
+ bool status = false;
+ aTargetWindow->DispatchEvent(event, &status);
+
+ if (!status) {
+ return NS_ERROR_FAILURE;
+ }
+
+ return NS_OK;
+ }
+};
+
+} // anonymous namespace
+
+void
+ServiceWorkerClient::PostMessage(JSContext* aCx, JS::Handle aMessage,
+ const Optional>& aTransferable,
+ ErrorResult& aRv)
+{
+ WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
+ MOZ_ASSERT(workerPrivate);
+ workerPrivate->AssertIsOnWorkerThread();
+
+ JS::Rooted transferable(aCx, JS::UndefinedValue());
+ if (aTransferable.WasPassed()) {
+ const Sequence& realTransferable = aTransferable.Value();
+
+ JS::HandleValueArray elements =
+ JS::HandleValueArray::fromMarkedLocation(realTransferable.Length(),
+ realTransferable.Elements());
+
+ JSObject* array = JS_NewArrayObject(aCx, elements);
+ if (!array) {
+ aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
+ return;
+ }
+
+ transferable.setObject(*array);
+ }
+
+ JSStructuredCloneCallbacks* callbacks = WorkerStructuredCloneCallbacks(false);
+
+ nsTArray> clonedObjects;
+
+ JSAutoStructuredCloneBuffer buffer;
+ if (!buffer.write(aCx, aMessage, transferable, callbacks, &clonedObjects)) {
+ aRv.Throw(NS_ERROR_DOM_DATA_CLONE_ERR);
+ return;
+ }
+
+ nsRefPtr runnable =
+ new ServiceWorkerClientPostMessageRunnable(mId, Move(buffer), clonedObjects);
+ nsresult rv = NS_DispatchToMainThread(runnable);
+ if (NS_FAILED(rv)) {
+ aRv.Throw(NS_ERROR_FAILURE);
+ }
+}
+
diff --git a/dom/workers/ServiceWorkerClient.h b/dom/workers/ServiceWorkerClient.h
index 7ad4c4aff80..438f0ce7a11 100644
--- a/dom/workers/ServiceWorkerClient.h
+++ b/dom/workers/ServiceWorkerClient.h
@@ -11,9 +11,14 @@
#include "nsWrapperCache.h"
namespace mozilla {
+
+class ErrorResult;
+
namespace dom {
class Promise;
+template class Optional;
+template class Sequence;
namespace workers {
@@ -36,6 +41,10 @@ public:
return mId;
}
+ void PostMessage(JSContext* aCx, JS::Handle aMessage,
+ const Optional>& aTransferable,
+ ErrorResult& aRv);
+
nsISupports* GetParentObject() const
{
return mOwner;
diff --git a/dom/workers/test/serviceworkers/get_serviced_worker_advanced.js b/dom/workers/test/serviceworkers/get_serviced_worker_advanced.js
new file mode 100644
index 00000000000..28e4e4e3112
--- /dev/null
+++ b/dom/workers/test/serviceworkers/get_serviced_worker_advanced.js
@@ -0,0 +1,12 @@
+onmessage = function(e) {
+ if (!e.data) {
+ dump("ERROR: message has no data.\n");
+ }
+
+ self.clients.getServiced().then(function(res) {
+ if (res.length === 0) {
+ dump("ERROR: no client is currently being controlled.\n");
+ }
+ res[res.length - 1].postMessage(res.length);
+ });
+};
diff --git a/dom/workers/test/serviceworkers/get_serviced_worker_enumerate.js b/dom/workers/test/serviceworkers/get_serviced_worker_enumerate.js
new file mode 100644
index 00000000000..42be6681abe
--- /dev/null
+++ b/dom/workers/test/serviceworkers/get_serviced_worker_enumerate.js
@@ -0,0 +1,7 @@
+onmessage = function() {
+ self.clients.getServiced().then(function(result) {
+ for (i = 0; i < result.length; i++) {
+ result[i].postMessage(i);
+ }
+ });
+};
diff --git a/dom/workers/test/serviceworkers/message_posting_worker.js b/dom/workers/test/serviceworkers/message_posting_worker.js
new file mode 100644
index 00000000000..f4b0b09979f
--- /dev/null
+++ b/dom/workers/test/serviceworkers/message_posting_worker.js
@@ -0,0 +1,9 @@
+onmessage = function(e) {
+ self.clients.getServiced().then(function(res) {
+ if (!res.length) {
+ dump("ERROR: no clients are currently controlled.\n");
+ }
+ res[0].postMessage(e.data);
+ });
+};
+
diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini
index c8e7660cc5b..f141a3bcd06 100644
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -12,11 +12,18 @@ support-files =
unregister/index.html
sw_clients/simple.html
get_serviced_worker.js
+ get_serviced_worker_advanced.js
+ message_posting_worker.js
+ sw_clients/service_worker_controlled.html
+ get_serviced_worker_enumerate.js
[test_get_serviced.html]
+[test_get_serviced_advanced.html]
+[test_get_serviced_enumerate.html]
[test_installation_simple.html]
[test_install_event.html]
[test_navigator.html]
+[test_post_message.html]
[test_scopes.html]
[test_controller.html]
[test_unregister.html]
diff --git a/dom/workers/test/serviceworkers/sw_clients/service_worker_controlled.html b/dom/workers/test/serviceworkers/sw_clients/service_worker_controlled.html
new file mode 100644
index 00000000000..a67679ee7d2
--- /dev/null
+++ b/dom/workers/test/serviceworkers/sw_clients/service_worker_controlled.html
@@ -0,0 +1,39 @@
+
+
+
+
+ controlled page
+
+
+
+
+
+
+
+
diff --git a/dom/workers/test/serviceworkers/test_get_serviced_advanced.html b/dom/workers/test/serviceworkers/test_get_serviced_advanced.html
new file mode 100644
index 00000000000..539a3f1f10e
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_get_serviced_advanced.html
@@ -0,0 +1,80 @@
+
+
+
+
+ Bug 982726 - test get_serviced
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/workers/test/serviceworkers/test_get_serviced_enumerate.html b/dom/workers/test/serviceworkers/test_get_serviced_enumerate.html
new file mode 100644
index 00000000000..7ba0d190f8e
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_get_serviced_enumerate.html
@@ -0,0 +1,82 @@
+
+
+
+
+ Bug 982726 - test get_serviced
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/dom/workers/test/serviceworkers/test_post_message.html b/dom/workers/test/serviceworkers/test_post_message.html
new file mode 100644
index 00000000000..e9c8c0f916a
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_post_message.html
@@ -0,0 +1,62 @@
+
+
+
+
+ Bug 982726 - Test service worker post message
+
+
+
+
+
+
+
+
+
+
+
+
From c77f513ba7e646631c08925f257b2a0ded2c0572 Mon Sep 17 00:00:00 2001
From: Catalin Badea
Date: Fri, 15 Aug 2014 00:52:00 -0700
Subject: [PATCH 31/68] Bug 982726 - Patch 4 - Extensive testing of
postMessage. r=baku
--HG--
extra : rebase_source : c2a5b3e61cd314c995cc1935aa928247301cb9c5
extra : amend_source : a970a4e351b2b7064fbccbed6b74dedec609f878
---
dom/workers/ServiceWorkerClient.cpp | 4 +-
dom/workers/test/serviceworkers/mochitest.ini | 1 +
.../test_post_message_advanced.html | 91 +++++++++++++++++++
3 files changed, 94 insertions(+), 2 deletions(-)
create mode 100644 dom/workers/test/serviceworkers/test_post_message_advanced.html
diff --git a/dom/workers/ServiceWorkerClient.cpp b/dom/workers/ServiceWorkerClient.cpp
index f183b593611..ef5e0ad5722 100644
--- a/dom/workers/ServiceWorkerClient.cpp
+++ b/dom/workers/ServiceWorkerClient.cpp
@@ -42,8 +42,8 @@ class ServiceWorkerClientPostMessageRunnable MOZ_FINAL : public nsRunnable
public:
ServiceWorkerClientPostMessageRunnable(uint64_t aId,
- JSAutoStructuredCloneBuffer&& aData,
- nsTArray>& aClonedObjects)
+ JSAutoStructuredCloneBuffer&& aData,
+ nsTArray>& aClonedObjects)
: mId(aId),
mBuffer(Move(aData))
{
diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini
index f141a3bcd06..36cf0912420 100644
--- a/dom/workers/test/serviceworkers/mochitest.ini
+++ b/dom/workers/test/serviceworkers/mochitest.ini
@@ -24,6 +24,7 @@ support-files =
[test_install_event.html]
[test_navigator.html]
[test_post_message.html]
+[test_post_message_advanced.html]
[test_scopes.html]
[test_controller.html]
[test_unregister.html]
diff --git a/dom/workers/test/serviceworkers/test_post_message_advanced.html b/dom/workers/test/serviceworkers/test_post_message_advanced.html
new file mode 100644
index 00000000000..b48d991ae9c
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_post_message_advanced.html
@@ -0,0 +1,91 @@
+
+
+
+
+ Bug 982726 - Test service worker post message advanced
+
+
+
+
+
+
+
+
+
+
+
+
From ad714344d2b129bbddf94b1047078e580b110955 Mon Sep 17 00:00:00 2001
From: Daniel Holbert
Date: Wed, 3 Sep 2014 17:22:37 -0700
Subject: [PATCH 32/68] Backing out 8dc381124409 (bug 1056459) for apparently
causing crashes in B2G-on-OS-X "Gip" test runs.
---
accessible/base/SelectionManager.cpp | 3 +-
accessible/tests/mochitest/events.js | 11 +--
accessible/tests/mochitest/events/a11y.ini | 1 -
accessible/tests/mochitest/events/scroll.html | 58 ------------
.../mochitest/events/test_scroll_caret.xul | 91 -------------------
5 files changed, 4 insertions(+), 160 deletions(-)
delete mode 100644 accessible/tests/mochitest/events/test_scroll_caret.xul
diff --git a/accessible/base/SelectionManager.cpp b/accessible/base/SelectionManager.cpp
index 32a721f765d..d846e356bc8 100644
--- a/accessible/base/SelectionManager.cpp
+++ b/accessible/base/SelectionManager.cpp
@@ -179,7 +179,8 @@ SelectionManager::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
logging::SelChange(aSelection, document, aReason);
#endif
- if (document) {
+ // Don't fire events until document is loaded.
+ if (document && document->IsContentLoaded()) {
// Selection manager has longer lifetime than any document accessible,
// so that we are guaranteed that the notification is processed before
// the selection manager is destroyed.
diff --git a/accessible/tests/mochitest/events.js b/accessible/tests/mochitest/events.js
index 06935d48a4d..7782ceffb30 100644
--- a/accessible/tests/mochitest/events.js
+++ b/accessible/tests/mochitest/events.js
@@ -1743,11 +1743,10 @@ function textChangeChecker(aID, aStart, aEnd, aTextOrFunc, aIsInserted, aFromUse
/**
* Caret move events checker.
*/
-function caretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg,
- aIsAsync)
+function caretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg)
{
this.__proto__ = new invokerChecker(EVENT_TEXT_CARET_MOVED,
- aTargetOrFunc, aTargetFuncArg, aIsAsync);
+ aTargetOrFunc, aTargetFuncArg);
this.check = function caretMoveChecker_check(aEvent)
{
@@ -1757,12 +1756,6 @@ function caretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg,
}
}
-function asyncCaretMoveChecker(aCaretOffset, aTargetOrFunc, aTargetFuncArg)
-{
- this.__proto__ = new caretMoveChecker(aCaretOffset, aTargetOrFunc,
- aTargetFuncArg, true);
-}
-
/**
* Text selection change checker.
*/
diff --git a/accessible/tests/mochitest/events/a11y.ini b/accessible/tests/mochitest/events/a11y.ini
index 6b549c854ab..50dd2e8060d 100644
--- a/accessible/tests/mochitest/events/a11y.ini
+++ b/accessible/tests/mochitest/events/a11y.ini
@@ -46,7 +46,6 @@ skip-if = os == 'win' || os == 'linux'
[test_namechange.xul]
[test_namechange.html]
[test_scroll.xul]
-[test_scroll_caret.xul]
[test_selection.html]
skip-if = buildapp == 'mulet'
[test_selection.xul]
diff --git a/accessible/tests/mochitest/events/scroll.html b/accessible/tests/mochitest/events/scroll.html
index 562e0a38259..df71fd45946 100644
--- a/accessible/tests/mochitest/events/scroll.html
+++ b/accessible/tests/mochitest/events/scroll.html
@@ -119,63 +119,5 @@
text text text text text text text text text text text text text text
text text text text text text text text text text text text text text
-
-
heading 1
-
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
- text text text text text text text text text text text text text text
-