Skip to content

Commit

Permalink
Bug 862986 - Part 2: Migrate PROGRAM from Makefile.in to moz.build. r…
Browse files Browse the repository at this point in the history
…=gps
  • Loading branch information
Brian O'Keefe committed May 1, 2013
1 parent 807111e commit 0c62c20
Show file tree
Hide file tree
Showing 77 changed files with 134 additions and 69 deletions.
5 changes: 0 additions & 5 deletions b2g/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ DEFINES += -DENABLE_MARIONETTE=1
endif

ifndef LIBXUL_SDK
ifneq ($(GAIADIR),)
PROGRAM=$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
else
PROGRAM=$(MOZ_APP_NAME)$(BIN_SUFFIX)
endif

CPPSRCS = nsBrowserApp.cpp

Expand Down
5 changes: 5 additions & 0 deletions b2g/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

if not CONFIG['LIBXUL_SDK']:
if CONFIG['GAIADIR']:
PROGRAM = CONFIG['MOZ_APP_NAME'] + "-bin"
else:
PROGRAM = CONFIG['MOZ_APP_NAME']
2 changes: 0 additions & 2 deletions b2g/gaia/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ include $(DEPTH)/config/autoconf.mk

GAIA_PATH := gaia/profile

PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)

ifeq ($(OS_ARCH),WINNT)
CPPSRCS = run-b2g.cpp
DEFINES += \
Expand Down
2 changes: 2 additions & 0 deletions b2g/gaia/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = CONFIG['MOZ_APP_NAME']

2 changes: 0 additions & 2 deletions browser/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ endif #} LIBXUL_SDK

# Build a binary bootstrapping with XRE_main

PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)

CPPSRCS = nsBrowserApp.cpp

LOCAL_INCLUDES += \
Expand Down
3 changes: 3 additions & 0 deletions browser/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

DIRS += ['profile/extensions']

PROGRAM = CONFIG['MOZ_APP_NAME']

1 change: 0 additions & 1 deletion browser/metro/shell/commandexecutehandler/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ include $(topsrcdir)/config/config.mk
# We want this exe in dist/bin
DIST_SUBDIR =

PROGRAM = CommandExecuteHandler$(BIN_SUFFIX)
DIST_PROGRAM = CommandExecuteHandler$(BIN_SUFFIX)

# Don't link against mozglue.dll
Expand Down
1 change: 1 addition & 0 deletions browser/metro/shell/commandexecutehandler/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
# 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'
2 changes: 0 additions & 2 deletions browser/metro/shell/linktool/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ include $(topsrcdir)/config/config.mk

DIST_SUBDIR = metro/install

PROGRAM = linktool$(BIN_SUFFIX)

CPPSRCS = linktool.cpp

OS_LIBS = \
Expand Down
2 changes: 2 additions & 0 deletions browser/metro/shell/linktool/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = 'linktool'

2 changes: 0 additions & 2 deletions browser/metro/shell/testing/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ include $(topsrcdir)/config/config.mk
# We want this exe in dist/bin
DIST_SUBDIR =

PROGRAM = metrotestharness$(BIN_SUFFIX)

CPPSRCS = \
metrotestharness.cpp \
$(NULL)
Expand Down
2 changes: 2 additions & 0 deletions browser/metro/shell/testing/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = 'metrotestharness'

1 change: 0 additions & 1 deletion build/win32/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ NO_PROFILE_GUIDED_OPTIMIZE = 1

ifdef ENABLE_TESTS

PROGRAM = crashinject$(BIN_SUFFIX)
USE_STATIC_LIBS = 1
CPPSRCS = crashinject.cpp

Expand Down
2 changes: 2 additions & 0 deletions build/win32/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ if CONFIG['_MSC_VER'] and CONFIG['OS_TEST'] != 'x86_64':

TEST_DIRS += ['crashinjectdll']

if CONFIG['ENABLE_TESTS']:
PROGRAM = 'crashinject'
2 changes: 0 additions & 2 deletions dom/plugins/ipc/hangui/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ CPPSRCS = \
PluginHangUIChild.cpp \
$(NULL)

PROGRAM = plugin-hang-ui$(BIN_SUFFIX)

OS_LIBS = $(call EXPAND_LIBNAME,comctl32)

RCINCLUDE = HangUIDlg.rc
Expand Down
2 changes: 2 additions & 0 deletions dom/plugins/ipc/hangui/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = 'plugin-hang-ui'

1 change: 0 additions & 1 deletion embedding/tests/winEmbed/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ include $(DEPTH)/config/autoconf.mk

XPI_NAME = winembed

PROGRAM = winEmbed$(BIN_SUFFIX)
RESFILE = winEmbed.res

CPPSRCS = \
Expand Down
2 changes: 2 additions & 0 deletions embedding/tests/winEmbed/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'winEmbed'

PROGRAM = 'winEmbed'

2 changes: 0 additions & 2 deletions intl/unicharutil/tools/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

PROGRAM = ucgendat

CSRCS = ucgendat.c

# XXX need configure test
Expand Down
2 changes: 2 additions & 0 deletions intl/unicharutil/tools/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'ucgendat'

PROGRAM = 'ucgendat'

2 changes: 0 additions & 2 deletions ipc/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

PROGRAM = $(MOZ_CHILD_PROCESS_NAME)

ifneq ($(dir $(PROGRAM)),./)
GENERATED_DIRS = $(dir $(PROGRAM))
endif
Expand Down
2 changes: 2 additions & 0 deletions ipc/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'ipc'

PROGRAM = CONFIG['MOZ_CHILD_PROCESS_NAME']

2 changes: 0 additions & 2 deletions ipc/ipdl/test/cxx/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

PROGRAM = $(MODULE)$(BIN_SUFFIX)

NSDISTMODE = copy

LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
Expand Down
2 changes: 2 additions & 0 deletions ipc/ipdl/test/cxx/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'ipdlunittest'

PROGRAM = 'ipdlunittest'

1 change: 0 additions & 1 deletion js/src/gdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ VPATH = @srcdir@ @srcdir@/tests

include $(DEPTH)/config/autoconf.mk

PROGRAM = gdb-tests$(BIN_SUFFIX)
CPPSRCS = \
gdb-tests.cpp \
test-jsid.cpp \
Expand Down
2 changes: 2 additions & 0 deletions js/src/gdb/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = 'gdb-tests'

2 changes: 0 additions & 2 deletions js/src/jsapi-tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

PROGRAM = jsapi-tests$(BIN_SUFFIX)

CPPSRCS = \
tests.cpp \
selfTest.cpp \
Expand Down
2 changes: 2 additions & 0 deletions js/src/jsapi-tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = 'jsapi-tests'

1 change: 0 additions & 1 deletion js/src/shell/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

PROGRAM = $(JS_SHELL_NAME)$(BIN_SUFFIX)
CPPSRCS = \
js.cpp \
jsoptparse.cpp \
Expand Down
2 changes: 2 additions & 0 deletions js/src/shell/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

PROGRAM = CONFIG['JS_SHELL_NAME']

1 change: 0 additions & 1 deletion js/xpconnect/shell/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ VPATH = @srcdir@

include $(DEPTH)/config/autoconf.mk

PROGRAM = xpcshell$(BIN_SUFFIX)
SDK_BINARY = $(PROGRAM)

CPPSRCS = xpcshell.cpp
Expand Down
2 changes: 2 additions & 0 deletions js/xpconnect/shell/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'xpcshell'

PROGRAM = 'xpcshell'

1 change: 0 additions & 1 deletion mobile/android/app/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DIST_FILES = recommended-addons.json

ifndef LIBXUL_SDK
ifneq (Android,$(OS_TARGET))
PROGRAM=$(MOZ_APP_NAME)$(BIN_SUFFIX)

LOCAL_INCLUDES += -I$(topsrcdir)/toolkit/xre
LOCAL_INCLUDES += -I$(topsrcdir)/xpcom/base
Expand Down
3 changes: 3 additions & 0 deletions mobile/android/app/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +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/.

if not CONFIG['LIBXUL_SDK']:
if CONFIG['OS_TARGET'] != 'Android':
PROGRAM = CONFIG['MOZ_APP_NAME']
4 changes: 0 additions & 4 deletions modules/libmar/tool/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,6 @@ endif
# Mozilla distribution.
HOST_PROGRAM = mar$(HOST_BIN_SUFFIX)

ifdef MOZ_ENABLE_SIGNMAR
PROGRAM = signmar$(BIN_SUFFIX)
endif

# Don't link the against libmozglue because we don't need it.
MOZ_GLUE_LDFLAGS =
MOZ_GLUE_PROGRAM_LDFLAGS =
Expand Down
2 changes: 2 additions & 0 deletions modules/libmar/tool/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'mar'

if CONFIG['MOZ_ENABLE_SIGNMAR']:
PROGRAM = 'signmar'
2 changes: 0 additions & 2 deletions netwerk/streamconv/test/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ FAIL_ON_WARNINGS := 1

include $(DEPTH)/config/autoconf.mk

PROGRAM = TestStreamConv$(BIN_SUFFIX)

CPPSRCS = \
Converters.cpp \
TestStreamConv.cpp \
Expand Down
2 changes: 2 additions & 0 deletions netwerk/streamconv/test/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@

MODULE = 'TestStreamConv'

PROGRAM = 'TestStreamConv'

7 changes: 7 additions & 0 deletions python/mozbuild/mozbuild/backend/recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
SandboxDerived,
VariablePassthru,
Exports,
Program,
XpcshellManifests,
)
from ..util import FileAvoidWrite
Expand Down Expand Up @@ -214,6 +215,9 @@ def consume_object(self, obj):
elif isinstance(obj, Exports):
self._process_exports(obj.exports, backend_file)

elif isinstance(obj, Program):
self._process_program(obj.program, backend_file)

elif isinstance(obj, XpcshellManifests):
self._process_xpcshell_manifests(obj.xpcshell_manifests, backend_file)

Expand Down Expand Up @@ -325,5 +329,8 @@ def _process_exports(self, exports, backend_file, namespace=""):
self._process_exports(children[subdir], backend_file,
namespace=namespace + subdir)

def _process_program(self, program, backend_file):
backend_file.write('PROGRAM = %s\n' % program)

def _process_xpcshell_manifests(self, manifest, backend_file, namespace=""):
backend_file.write('XPCSHELL_TESTS += %s\n' % os.path.dirname(manifest))
18 changes: 18 additions & 0 deletions python/mozbuild/mozbuild/frontend/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,24 @@ def __init__(self, sandbox, exports):
SandboxDerived.__init__(self, sandbox)
self.exports = exports

class Program(SandboxDerived):
"""Sandbox container object for PROGRAM, which is a unicode string.
This class handles automatically appending BIN_SUFFIX to the PROGRAM value.
If BIN_SUFFIX is not defined, PROGRAM is unchanged.
Otherwise, if PROGRAM ends in BIN_SUFFIX, it is unchanged
Otherwise, BIN_SUFFIX is appended to PROGRAM
"""
__slots__ = ('program')

def __init__(self, sandbox, program, bin_suffix):
SandboxDerived.__init__(self, sandbox)

bin_suffix = bin_suffix or ''
if not program.endswith(bin_suffix):
program += bin_suffix
self.program = program

class XpcshellManifests(SandboxDerived):
"""Build object container for XPCSHELL_TESTS_MANIFESTS (was: XPCSHELL_TESTS).
Expand Down
8 changes: 8 additions & 0 deletions python/mozbuild/mozbuild/frontend/sandbox_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,14 @@ def doc_to_paragraphs(doc):
EXPORTS.mozilla.dom += ['bar.h']
"""),

'PROGRAM' : (unicode, "",
"""Compiled executable name.
If the configuration token 'BIN_SUFFIX' is set, its value will be
automatically appended to PROGRAM. If PROGRAM already ends with
BIN_SUFFIX, PROGRAM will remain unchanged.
"""),

# IDL Generation.
'XPIDL_SOURCES': (list, [],
"""XPCOM Interface Definition Files (xpidl).
Expand Down
4 changes: 4 additions & 0 deletions python/mozbuild/mozbuild/test/frontend/data/program/moz.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Any copyright is dedicated to the Public Domain.
# http://creativecommons.org/publicdomain/zero/1.0/

PROGRAM = 'test_program'
13 changes: 13 additions & 0 deletions python/mozbuild/mozbuild/test/frontend/test_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ReaderSummary,
VariablePassthru,
Exports,
Program,
XpcshellManifests,
)
from mozbuild.frontend.emitter import TreeMetadataEmitter
Expand All @@ -31,6 +32,7 @@ class TestEmitterBasic(unittest.TestCase):
def reader(self, name):
config = MockConfig(os.path.join(data_path, name))
config.substs['ENABLE_TESTS'] = '1'
config.substs['BIN_SUFFIX'] = '.prog'

return BuildReader(config)

Expand Down Expand Up @@ -170,6 +172,17 @@ def test_exports(self):
overwrite = exports._children['overwrite']
self.assertEqual(overwrite.get_strings(), ['new.h'])

def test_program(self):
reader = self.reader('program')
objs = self.read_topsrcdir(reader)

self.assertEqual(len(objs), 2)
self.assertIsInstance(objs[0], DirectoryTraversal)
self.assertIsInstance(objs[1], Program)

program = objs[1].program
self.assertEqual(program, 'test_program.prog')

def test_xpcshell_manifests(self):
reader = self.reader('xpcshell_manifests')
objs = self.read_topsrcdir(reader)
Expand Down
Loading

0 comments on commit 0c62c20

Please sign in to comment.