mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 00:32:11 +00:00
Bug 1253431 part 1 - Add SDK_FILES to moz.build; r=gps
This adds support for an SDK_FILES variable in moz.build, which creates a FinalTargetFiles object to install files into dist/sdk/ MozReview-Commit-ID: 97a5NdbZmmD --HG-- extra : rebase_source : ad8d521ec56fe4610437c8d2d503c545894b40c2
This commit is contained in:
parent
007c074be0
commit
7ea5981744
@ -36,14 +36,12 @@ from ..frontend.data import (
|
||||
AndroidExtraResDirs,
|
||||
AndroidExtraPackages,
|
||||
AndroidEclipseProjectData,
|
||||
BrandingFiles,
|
||||
ChromeManifestEntry,
|
||||
ConfigFileSubstitution,
|
||||
ContextDerived,
|
||||
ContextWrapped,
|
||||
Defines,
|
||||
DirectoryTraversal,
|
||||
Exports,
|
||||
ExternalLibrary,
|
||||
FinalTargetFiles,
|
||||
FinalTargetPreprocessedFiles,
|
||||
@ -1244,6 +1242,7 @@ INSTALL_TARGETS += %(prefix)s
|
||||
'_tests',
|
||||
'dist/include',
|
||||
'dist/branding',
|
||||
'dist/sdk',
|
||||
))
|
||||
if not path:
|
||||
raise Exception("Cannot install to " + target)
|
||||
|
@ -1278,6 +1278,20 @@ VARIABLES = {
|
||||
BRANDING_FILES.images.subdir += ['bar.png']
|
||||
"""),
|
||||
|
||||
'SDK_FILES': (ContextDerivedTypedHierarchicalStringList(Path), list,
|
||||
"""List of files to be installed into the sdk directory.
|
||||
|
||||
``SDK_FILES`` will copy (or symlink, if the platform supports it)
|
||||
the contents of its files to the ``dist/sdk`` directory. Files that
|
||||
are destined for a subdirectory can be specified by accessing a field.
|
||||
For example, to export ``foo.py`` to the top-level directory and
|
||||
``bar.py`` to the directory ``subdir``, append to
|
||||
``SDK_FILES`` like so::
|
||||
|
||||
SDK_FILES += ['foo.py']
|
||||
SDK_FILES.subdir += ['bar.py']
|
||||
"""),
|
||||
|
||||
'SDK_LIBRARY': (bool, bool,
|
||||
"""Whether the library built in the directory is part of the SDK.
|
||||
|
||||
|
@ -846,6 +846,19 @@ class BrandingFiles(FinalTargetFiles):
|
||||
return 'dist/branding'
|
||||
|
||||
|
||||
class SdkFiles(FinalTargetFiles):
|
||||
"""Sandbox container object for SDK_FILES, which is a
|
||||
HierarchicalStringList.
|
||||
|
||||
We need an object derived from ContextDerived for use in the backend, so
|
||||
this object fills that role. It just has a reference to the underlying
|
||||
HierarchicalStringList, which is created when parsing SDK_FILES.
|
||||
"""
|
||||
@property
|
||||
def install_target(self):
|
||||
return 'dist/sdk'
|
||||
|
||||
|
||||
class GeneratedFile(ContextDerived):
|
||||
"""Represents a generated file."""
|
||||
|
||||
|
@ -57,6 +57,7 @@ from .data import (
|
||||
PreprocessedTestWebIDLFile,
|
||||
PreprocessedWebIDLFile,
|
||||
Program,
|
||||
SdkFiles,
|
||||
SharedLibrary,
|
||||
SimpleProgram,
|
||||
Sources,
|
||||
@ -828,6 +829,7 @@ class TreeMetadataEmitter(LoggingMixin):
|
||||
('EXPORTS', Exports),
|
||||
('FINAL_TARGET_FILES', FinalTargetFiles),
|
||||
('FINAL_TARGET_PP_FILES', FinalTargetPreprocessedFiles),
|
||||
('SDK_FILES', SdkFiles),
|
||||
('TESTING_FILES', TestingFiles),
|
||||
):
|
||||
all_files = context.get(var)
|
||||
|
@ -0,0 +1,11 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
SDK_FILES += [
|
||||
'bar.ico',
|
||||
'sub/quux.png',
|
||||
]
|
||||
|
||||
SDK_FILES.icons += [
|
||||
'foo.ico',
|
||||
]
|
@ -494,6 +494,18 @@ class TestRecursiveMakeBackend(BackendTester):
|
||||
self.assertIn('quux.png', m)
|
||||
self.assertIn('icons/foo.ico', m)
|
||||
|
||||
def test_sdk_files(self):
|
||||
"""Ensure SDK_FILES is handled properly."""
|
||||
env = self._consume('sdk-files', RecursiveMakeBackend)
|
||||
|
||||
#SDK_FILES should appear in the dist_sdk install manifest.
|
||||
m = InstallManifest(path=os.path.join(env.topobjdir,
|
||||
'_build_manifests', 'install', 'dist_sdk'))
|
||||
self.assertEqual(len(m), 3)
|
||||
self.assertIn('bar.ico', m)
|
||||
self.assertIn('quux.png', m)
|
||||
self.assertIn('icons/foo.ico', m)
|
||||
|
||||
def test_test_manifests_files_written(self):
|
||||
"""Ensure test manifests get turned into files."""
|
||||
env = self._consume('test-manifests-written', RecursiveMakeBackend)
|
||||
|
@ -0,0 +1,12 @@
|
||||
# Any copyright is dedicated to the Public Domain.
|
||||
# http://creativecommons.org/publicdomain/zero/1.0/
|
||||
|
||||
SDK_FILES += [
|
||||
'bar.ico',
|
||||
'baz.png',
|
||||
'foo.xpm',
|
||||
]
|
||||
|
||||
SDK_FILES.icons += [
|
||||
'quux.icns',
|
||||
]
|
@ -30,6 +30,7 @@ from mozbuild.frontend.data import (
|
||||
JARManifest,
|
||||
LocalInclude,
|
||||
Program,
|
||||
SdkFiles,
|
||||
SharedLibrary,
|
||||
SimpleProgram,
|
||||
Sources,
|
||||
@ -347,6 +348,22 @@ class TestEmitterBasic(unittest.TestCase):
|
||||
|
||||
self.assertEqual(icons._strings, ['quux.icns'])
|
||||
|
||||
def test_sdk_files(self):
|
||||
reader = self.reader('sdk-files')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
||||
self.assertEqual(len(objs), 1)
|
||||
self.assertIsInstance(objs[0], SdkFiles)
|
||||
|
||||
files = objs[0].files
|
||||
|
||||
self.assertEqual(files._strings, ['bar.ico', 'baz.png', 'foo.xpm'])
|
||||
|
||||
self.assertIn('icons', files._children)
|
||||
icons = files._children['icons']
|
||||
|
||||
self.assertEqual(icons._strings, ['quux.icns'])
|
||||
|
||||
def test_program(self):
|
||||
reader = self.reader('program')
|
||||
objs = self.read_topsrcdir(reader)
|
||||
|
Loading…
Reference in New Issue
Block a user