Skip to content

Commit

Permalink
Bug 933135 - Treat SIMPLE_PROGRAMS more like PROGRAM. r=mshal
Browse files Browse the repository at this point in the history
  • Loading branch information
glandium committed Nov 1, 2013
1 parent e230afd commit d6aecdb
Show file tree
Hide file tree
Showing 26 changed files with 79 additions and 124 deletions.
10 changes: 2 additions & 8 deletions intl/uconv/tools/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +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/.

sources = [
SIMPLE_PROGRAMS += [
'umaptable',
]

SOURCES += [
'%s.c' % s for s in sources
'%s.c' % s for s in SIMPLE_PROGRAMS
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
]

3 changes: 1 addition & 2 deletions intl/unicharutil/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ SOURCES += [
'UnicharSelfTest.cpp',
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
"%s%s" % (fyl[0:-4], bin_suffix) for fyl in SOURCES
"%s" % (fyl[0:-4]) for fyl in SOURCES
]
2 changes: 1 addition & 1 deletion mozglue/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ if CONFIG['MOZ_LINKER']:
'TestZip.cpp',
]
SIMPLE_PROGRAMS += [
'TestZip' + CONFIG['BIN_SUFFIX'],
'TestZip',
]
11 changes: 3 additions & 8 deletions netwerk/test/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini']
if CONFIG['OS_ARCH'] != 'Darwin':
XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']

sources = [
SIMPLE_PROGRAMS = [
'PropertiesTest',
'ReadNTLM',
'TestBlockingSocket',
Expand All @@ -36,7 +36,7 @@ sources = [
]

# XXX Make this work in libxul builds.
#sources += [
#SIMPLE_PROGRAMS += [
# TestIDN',
# TestIOThreads',
# TestPerf',
Expand All @@ -48,12 +48,7 @@ sources = [
#]

SOURCES += [
'%s.cpp' % s for s in sources
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]

CPP_UNIT_TESTS += [
Expand Down
7 changes: 7 additions & 0 deletions python/mozbuild/mozbuild/backend/recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
Program,
SandboxDerived,
SandboxWrapped,
SimpleProgram,
TestWebIDLFile,
VariablePassthru,
XPIDLFile,
Expand Down Expand Up @@ -413,6 +414,9 @@ def consume_object(self, obj):
elif isinstance(obj, Program):
self._process_program(obj.program, backend_file)

elif isinstance(obj, SimpleProgram):
self._process_simple_program(obj.program, backend_file)

elif isinstance(obj, TestManifest):
self._process_test_manifest(obj, backend_file)

Expand Down Expand Up @@ -968,6 +972,9 @@ def _handle_idl_manager(self, manager):
def _process_program(self, program, backend_file):
backend_file.write('PROGRAM = %s\n' % program)

def _process_simple_program(self, program, backend_file):
backend_file.write('SIMPLE_PROGRAMS += %s\n' % program)

def _process_webidl_basename(self, basename):
header = 'mozilla/dom/%sBinding.h' % os.path.splitext(basename)[0]
self._install_manifests['dist_include'].add_optional_exists(header)
Expand Down
23 changes: 16 additions & 7 deletions python/mozbuild/mozbuild/frontend/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,14 @@ def __init__(self, sandbox, path):

self.basename = path

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
class BaseProgram(SandboxDerived):
"""Sandbox container object for programs, which is a unicode string.
This class handles automatically appending a binary suffix to the program
name.
If the suffix is not defined, the program name is unchanged.
Otherwise, if the program name ends with the given suffix, it is unchanged
Otherwise, the suffix is appended to the program name.
"""
__slots__ = ('program')

Expand All @@ -298,6 +299,14 @@ def __init__(self, sandbox, program, bin_suffix):
self.program = program


class Program(BaseProgram):
"""Sandbox container object for PROGRAM"""


class SimpleProgram(BaseProgram):
"""Sandbox container object for each program in SIMPLE_PROGRAMS"""


class TestManifest(SandboxDerived):
"""Represents a manifest file containing information about tests."""

Expand Down
5 changes: 4 additions & 1 deletion python/mozbuild/mozbuild/frontend/emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
Program,
ReaderSummary,
SandboxWrapped,
SimpleProgram,
TestWebIDLFile,
TestManifest,
VariablePassthru,
Expand Down Expand Up @@ -164,7 +165,6 @@ def emit_from_sandbox(self, sandbox):
OS_LIBS='OS_LIBS',
SDK_LIBRARY='SDK_LIBRARY',
SHARED_LIBRARY_LIBS='SHARED_LIBRARY_LIBS',
SIMPLE_PROGRAMS='SIMPLE_PROGRAMS',
)
for mak, moz in varmap.items():
if sandbox[moz]:
Expand Down Expand Up @@ -232,6 +232,9 @@ def emit_from_sandbox(self, sandbox):
if program:
yield Program(sandbox, program, sandbox['CONFIG']['BIN_SUFFIX'])

for program in sandbox['SIMPLE_PROGRAMS']:
yield SimpleProgram(sandbox, program, sandbox['CONFIG']['BIN_SUFFIX'])

simple_lists = [
('GENERATED_EVENTS_WEBIDL_FILES', GeneratedEventWebIDLFile),
('GENERATED_WEBIDL_FILES', GeneratedWebIDLFile),
Expand Down
10 changes: 7 additions & 3 deletions python/mozbuild/mozbuild/frontend/sandbox_symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,14 @@ def compute_final_target(variables):
""", None),

'SIMPLE_PROGRAMS': (StrictOrderingOnAppendList, list, [],
"""Generate a list of binaries from source.
"""Compile a list of executable names.
A list of sources, one per program, to compile & link with libs
into standalone programs.
Each name in this variable corresponds to an executable built from the
corresponding source file with the same base name.
If the configuration token ``BIN_SUFFIX`` is set, its value will be
automatically appended to each name. If a name already ends with
``BIN_SUFFIX``, the name will remain unchanged.
""", 'binaries'),

'TOOL_DIRS': (list, list, [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ SDK_LIBRARY = ['bar.sdk', 'foo.sdk']

SHARED_LIBRARY_LIBS += ['bar.sll', 'foo.sll']

SIMPLE_PROGRAMS = ['bar.x', 'foo.x']

SOURCES += ['bar.c', 'foo.c']

SOURCES += ['bar.mm', 'foo.mm']
Expand Down
4 changes: 0 additions & 4 deletions python/mozbuild/mozbuild/test/backend/test_recursivemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,6 @@ def test_variable_passthru(self):
'SHARED_LIBRARY_LIBS += bar.sll',
'SHARED_LIBRARY_LIBS += foo.sll',
],
'SIMPLE_PROGRAMS': [
'SIMPLE_PROGRAMS += bar.x',
'SIMPLE_PROGRAMS += foo.x',
],
'SSRCS': [
'SSRCS += baz.S',
'SSRCS += foo.S',
Expand Down
2 changes: 2 additions & 0 deletions python/mozbuild/mozbuild/test/frontend/data/program/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
# http://creativecommons.org/publicdomain/zero/1.0/

PROGRAM = 'test_program'

SIMPLE_PROGRAMS = [ 'test_program1', 'test_program2' ]
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ SDK_LIBRARY += ['fans.sdk', 'tans.sdk']

SHARED_LIBRARY_LIBS += ['fans.sll', 'tans.sll']

SIMPLE_PROGRAMS += ['fans.x', 'tans.x']

SOURCES += ['fans.c', 'tans.c']

SOURCES += ['fans.mm', 'tans.mm']
Expand Down
19 changes: 11 additions & 8 deletions python/mozbuild/mozbuild/test/frontend/test_emitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@

from mozbuild.frontend.data import (
ConfigFileSubstitution,
DirectoryTraversal,
ReaderSummary,
VariablePassthru,
Defines,
DirectoryTraversal,
Exports,
GeneratedInclude,
Program,
IPDLFile,
LocalInclude,
Program,
ReaderSummary,
SimpleProgram,
TestManifest,
VariablePassthru,
)
from mozbuild.frontend.emitter import TreeMetadataEmitter
from mozbuild.frontend.reader import (
Expand Down Expand Up @@ -161,7 +162,6 @@ def test_variable_passthru(self):
OS_LIBS=['foo.so', '-l123', 'aaa.a'],
SDK_LIBRARY=['fans.sdk', 'tans.sdk'],
SHARED_LIBRARY_LIBS=['fans.sll', 'tans.sll'],
SIMPLE_PROGRAMS=['fans.x', 'tans.x'],
SSRCS=['bans.S', 'fans.S'],
VISIBILITY_FLAGS='',
)
Expand Down Expand Up @@ -213,12 +213,15 @@ def test_program(self):
reader = self.reader('program')
objs = self.read_topsrcdir(reader)

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

program = objs[1].program
self.assertEqual(program, 'test_program.prog')
self.assertEqual(objs[1].program, 'test_program.prog')
self.assertEqual(objs[2].program, 'test_program1.prog')
self.assertEqual(objs[3].program, 'test_program2.prog')

def test_test_manifest_missing_manifest(self):
"""A missing manifest file should result in an error."""
Expand Down
9 changes: 2 additions & 7 deletions security/manager/ssl/tests/unit/tlsserver/cmd/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,10 @@ MODULE = 'tlsserver'

FAIL_ON_WARNINGS = True

sources = [
SIMPLE_PROGRAMS = [
'OCSPStaplingServer',
]

SOURCES += [
'%s.cpp' % s for s in sources
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]
9 changes: 2 additions & 7 deletions toolkit/mozapps/plugins/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@

MODULE = 'test_plugins'

sources = [
SIMPLE_PROGRAMS = [
'BadPlugin',
'GoodPlugin',
]

SOURCES += [
'%s.cpp' % s for s in sources
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]
9 changes: 2 additions & 7 deletions toolkit/mozapps/update/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,11 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
if CONFIG['MOZ_MAINTENANCE_SERVICE']:
XPCSHELL_TESTS_MANIFESTS += ['unit_service_updater/xpcshell.ini']

sources = [
SIMPLE_PROGRAMS = [
'TestAUSHelper',
'TestAUSReadStrings',
]

SOURCES += [
'%s.cpp' % s for s in sources
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]
10 changes: 2 additions & 8 deletions toolkit/xre/test/win/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,11 @@

MODULE = 'test_xulapp'

sources = [
SIMPLE_PROGRAMS = [
'TestDllInterceptor',
'TestXREMakeCommandLineWin',
]

SOURCES += [
'%s.cpp' % s for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
]

10 changes: 2 additions & 8 deletions tools/trace-malloc/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ SOURCES += [
'tmreader.c',
]

SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in simple_c_sources
]

SIMPLE_PROGRAMS += simple_c_sources

simple_cpp_sources = [
'bloatblame',
Expand All @@ -41,7 +38,4 @@ SOURCES += [
'%s.cpp' % s for s in simple_cpp_sources
]

SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in simple_cpp_sources
]

SIMPLE_PROGRAMS += simple_cpp_sources
10 changes: 2 additions & 8 deletions uriloader/exthandler/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,10 @@ if CONFIG['OS_ARCH'] != 'Darwin':
if not CONFIG['MOZ_JSDOWNLOADS']:
XPCSHELL_TESTS_MANIFESTS += ['unit_ipc/xpcshell.ini']

sources = [
SIMPLE_PROGRAMS = [
'WriteArgument',
]

SOURCES += [
'%s.cpp' % s for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]

bin_suffix = CONFIG['BIN_SUFFIX']
SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
]

9 changes: 2 additions & 7 deletions xpcom/reflect/xptcall/tests/moz.build
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,10 @@

MODULE = 'TestXPTC'

sources = [
SIMPLE_PROGRAMS = [
'TestXPTCInvoke',
]

SOURCES += [
'%s.cpp' % s for s in sources
'%s.cpp' % s for s in SIMPLE_PROGRAMS
]

SIMPLE_PROGRAMS += [
'%s%s' % (s, bin_suffix) for s in sources
]

Loading

0 comments on commit d6aecdb

Please sign in to comment.