mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 883954 - part 1 - make GENERATED_FILES emit proper moz.build objects; r=gps
This patch is mostly useful for being able to see these changes independently of the major changes to GENERATED_FILES. We are going to need proper moz.build objects for GENERATED_FILES when we add the ability to define scripts and arguments for them, so we might as well do that first.
This commit is contained in:
parent
352a594c26
commit
b329791f5e
@ -36,6 +36,7 @@ from ..frontend.data import (
|
||||
Exports,
|
||||
ExternalLibrary,
|
||||
FinalTargetFiles,
|
||||
GeneratedFile,
|
||||
GeneratedInclude,
|
||||
GeneratedSources,
|
||||
HostLibrary,
|
||||
@ -404,6 +405,9 @@ class RecursiveMakeBackend(CommonBackend):
|
||||
elif isinstance(obj, Exports):
|
||||
self._process_exports(obj, obj.exports, backend_file)
|
||||
|
||||
elif isinstance(obj, GeneratedFile):
|
||||
backend_file.write('GENERATED_FILES += %s\n' % obj.filename)
|
||||
|
||||
elif isinstance(obj, TestHarnessFiles):
|
||||
self._process_test_harness_files(obj, backend_file)
|
||||
|
||||
|
@ -853,6 +853,18 @@ class FinalTargetFiles(ContextDerived):
|
||||
self.target = target
|
||||
|
||||
|
||||
class GeneratedFile(ContextDerived):
|
||||
"""Represents a generated file."""
|
||||
|
||||
__slots__ = (
|
||||
'filename',
|
||||
)
|
||||
|
||||
def __init__(self, context, filename):
|
||||
ContextDerived.__init__(self, context)
|
||||
self.filename = filename
|
||||
|
||||
|
||||
class ClassPathEntry(object):
|
||||
"""Represents a classpathentry in an Android Eclipse project."""
|
||||
|
||||
|
@ -32,6 +32,7 @@ from .data import (
|
||||
Exports,
|
||||
FinalTargetFiles,
|
||||
GeneratedEventWebIDLFile,
|
||||
GeneratedFile,
|
||||
GeneratedInclude,
|
||||
GeneratedSources,
|
||||
GeneratedWebIDLFile,
|
||||
@ -410,7 +411,6 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
'EXTRA_PP_COMPONENTS',
|
||||
'FAIL_ON_WARNINGS',
|
||||
'USE_STATIC_LIBS',
|
||||
'GENERATED_FILES',
|
||||
'IS_GYP_DIR',
|
||||
'MSVC_ENABLE_PGO',
|
||||
'NO_DIST_INSTALL',
|
||||
@ -518,6 +518,11 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
yield Exports(context, exports,
|
||||
dist_install=not context.get('NO_DIST_INSTALL', False))
|
||||
|
||||
generated_files = context.get('GENERATED_FILES')
|
||||
if generated_files:
|
||||
for f in generated_files:
|
||||
yield GeneratedFile(context, f)
|
||||
|
||||
test_harness_files = context.get('TEST_HARNESS_FILES')
|
||||
if test_harness_files:
|
||||
srcdir_files = defaultdict(list)
|
||||
|
@ -0,0 +1,5 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
GENERATED_FILES += [ 'bar.c', 'foo.c' ]
|
@ -369,6 +369,20 @@ class TestRecursiveMakeBackend(BackendTester):
|
||||
self.assertIn('mozilla/mozilla1.h', m)
|
||||
self.assertIn('mozilla/dom/dom2.h', m)
|
||||
|
||||
def test_generated_files(self):
|
||||
"""Ensure GENERATED_FILES is handled properly."""
|
||||
env = self._consume('generated-files', RecursiveMakeBackend)
|
||||
|
||||
backend_path = mozpath.join(env.topobjdir, 'backend.mk')
|
||||
lines = [l.strip() for l in open(backend_path, 'rt').readlines()[2:]]
|
||||
|
||||
expected = [
|
||||
'GENERATED_FILES += bar.c',
|
||||
'GENERATED_FILES += foo.c',
|
||||
]
|
||||
|
||||
self.assertEqual(lines, expected)
|
||||
|
||||
def test_resources(self):
|
||||
"""Ensure RESOURCE_FILES is handled properly."""
|
||||
env = self._consume('resources', RecursiveMakeBackend)
|
||||
|
@ -0,0 +1,5 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
GENERATED_FILES += [ 'bar.c', 'foo.c' ]
|
@ -14,6 +14,7 @@ from mozbuild.frontend.data import (
|
||||
Defines,
|
||||
DirectoryTraversal,
|
||||
Exports,
|
||||
GeneratedFile,
|
||||
GeneratedInclude,
|
||||
GeneratedSources,
|
||||
HostSources,
|
||||
@ -182,6 +183,18 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
self.assertEqual(wanted, variables)
|
||||
self.maxDiff = maxDiff
|
||||
|
||||
def test_generated_files(self):
|
||||
reader = self.reader('generated-files')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
self.assertEqual(len(objs), 2)
|
||||
for o in objs:
|
||||
self.assertIsInstance(o, GeneratedFile)
|
||||
|
||||
expected = ['bar.c', 'foo.c']
|
||||
for o, expected_filename in zip(objs, expected):
|
||||
self.assertEqual(o.filename, expected_filename)
|
||||
|
||||
def test_exports(self):
|
||||
reader = self.reader('exports')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
Loading…
Reference in New Issue
Block a user