Skip to content

Commit

Permalink
Introduces an "actions" section for custom build actions. Adds a v8 s…
Browse files Browse the repository at this point in the history
…ample

using this new feature.


git-svn-id: http://gyp.googlecode.com/svn/trunk@137 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information
[email protected] committed Feb 9, 2009
1 parent 8b2fda9 commit 5ca0052
Show file tree
Hide file tree
Showing 6 changed files with 335 additions and 3 deletions.
28 changes: 28 additions & 0 deletions pylib/gyp/generator/xcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,17 @@


generator_default_variables = {
# INTERMEDIATE_DIR is a place for targets to build up intermediate products.
# It is specific to each build environment. It is only guaranteed to exist
# and be constant within the context of a single target. Some build
# environments may allow their intermediate directory or equivalent to be
# shared between all targets in a project or even on a wider scale, but this
# is not guaranteed.
#
# Use INTERMEDIATE_DIR_SCRIPT to feed to scripts, which may accept a
# different syntax.
'INTERMEDIATE_DIR': '$(DERIVED_FILE_DIR)',
'INTERMEDIATE_DIR_SCRIPT': '${DERIVED_FILE_DIR}',
'OS': 'mac',
}

Expand Down Expand Up @@ -151,6 +162,23 @@ def GenerateOutput(target_list, target_dicts, data):
configuration_names)
xcode_targets[qualified_target] = xct

if 'actions' in spec:
for action in spec['actions']:
ssbp = gyp.xcodeproj_file.PBXShellScriptBuildPhase({
'inputPaths': action['inputs'],
'name': 'action ' + action['action_name'],
'outputPaths': action['outputs'],
'shellScript': action['action'],
'showEnvVarsInLog': 0,
})

# TODO(mark): This shouldn't insert at 0 always, we should keep the
# order of "actions" sections from the input.
# TODO(mark): this assumes too much knowledge of the internals of
# xcodeproj_file; some of these smarts should move into xcodeproj_file
# itself.
xct._properties['buildPhases'].insert(0, ssbp)

for source in spec['sources']:
# TODO(mark): Perhaps this can be made a little bit fancier.
source_extensions = ['c', 'cc', 'cpp', 'm', 'mm', 's']
Expand Down
1 change: 1 addition & 0 deletions pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ def SetUpConfigurations(target, target_dict):
# non_configuraiton_keys is a list of key names that belong in the target
# itself and should not be propagated into its configurations.
non_configuration_keys = [
'actions',
'configurations',
'dependencies',
'libraries',
Expand Down
15 changes: 12 additions & 3 deletions pylib/gyp/xcodeproj_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -803,8 +803,9 @@ def _SetDefaultsFromSchema(self):


# path_leading_variable is used by XCHierarchicalElement.__init__ to determine
# whether a pathname begins with an Xcode variable, such as "$(SDKROOT)/blah".
_path_leading_variable = re.compile('^\$\((.*?)\)/(.*)$')
# whether a pathname begins with an Xcode variable, such as "$(SDKROOT)/blah",
# or just "$(SDKROOT)".
_path_leading_variable = re.compile('^\$\((.*?)\)(/(.*))?$')


class XCHierarchicalElement(XCObject):
Expand Down Expand Up @@ -848,7 +849,15 @@ def __init__(self, properties=None, id=None, parent=None):
_path_leading_variable.match(self._properties['path'])
if source_group_match:
self._properties['sourceTree'] = source_group_match.group(1)
self._properties['path'] = source_group_match.group(2)
if source_group_match.group(3) != None:
self._properties['path'] = source_group_match.group(3)
else:
# The path was of the form "$(SDKROOT)" with no path following it.
# This object is now relative to that variable, so it has no path
# attribute of its own. It does, however, keep a name.
del self._properties['path']
if not 'name' in self._properties:
self._properties['name'] = source_group_match.group(1)

def Name(self):
if 'name' in self._properties:
Expand Down
5 changes: 5 additions & 0 deletions samples/common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@
'USE_HEADERMAP': 'NO',
'WARNING_CFLAGS': ['-Wall', '-Wendif-labels'],
},
'target_conditions': [
['_type=="shared_library"', {
'xcode_settings': {'GCC_DYNAMIC_NO_PIC': 'NO'},
}],
],
},
}],
[ 'OS=="win"', {
Expand Down
1 change: 1 addition & 0 deletions samples/samples
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ gyps = [
'third_party/libpng/libpng.gyp',
'third_party/modp_b64/modp_b64.gyp',
'third_party/zlib/zlib.gyp',
'v8/v8.gyp',
]


Expand Down
288 changes: 288 additions & 0 deletions samples/v8.gyp
Original file line number Diff line number Diff line change
@@ -0,0 +1,288 @@
{
'variables': {
'depth': '..',
},
'includes': [
'../build/common.gypi',
],
'targets': [
{
'target_name': 'v8',
'type': 'static_library',
'sources': [
# TODO(mark): choose between libraries-empty.cc and libraries.cc
# depending on snapshot.
'<(INTERMEDIATE_DIR)/libraries.cc',
'src/third_party/dtoa/dtoa.c',
'src/third_party/jscre/ASCIICType.h',
'src/third_party/jscre/config.h',
'src/third_party/jscre/pcre.h',
'src/third_party/jscre/pcre_chartables.c',
'src/third_party/jscre/pcre_compile.cpp',
'src/third_party/jscre/pcre_exec.cpp',
'src/third_party/jscre/pcre_internal.h',
'src/third_party/jscre/pcre_tables.cpp',
'src/third_party/jscre/pcre_ucp_searchfuncs.cpp',
'src/third_party/jscre/pcre_xclass.cpp',
'src/third_party/jscre/ucpinternal.h',
'src/third_party/jscre/ucptable.cpp',
'src/accessors.cc',
'src/accessors.h',
'src/allocation.cc',
'src/allocation.h',
'src/api.cc',
'src/api.h',
'src/apinatives.js',
'src/apiutils.h',
'src/arguments.h',
'src/array.js',
'src/assembler-arm-inl.h',
'src/assembler-arm.cc',
'src/assembler-arm.h',
'src/assembler-ia32-inl.h',
'src/assembler-ia32.cc',
'src/assembler-ia32.h',
'src/assembler.cc',
'src/assembler.h',
'src/ast.cc',
'src/ast.h',
'src/bootstrapper.cc',
'src/bootstrapper.h',
'src/builtins-arm.cc',
'src/builtins-ia32.cc',
'src/builtins.cc',
'src/builtins.h',
'src/bytecodes-irregexp.h',
'src/char-predicates-inl.h',
'src/char-predicates.h',
'src/checks.cc',
'src/checks.h',
'src/code-stubs.cc',
'src/code-stubs.h',
'src/code.h',
'src/codegen-arm.cc',
'src/codegen-arm.h',
'src/codegen-ia32.cc',
'src/codegen-ia32.h',
'src/codegen-inl.h',
'src/codegen.cc',
'src/codegen.h',
'src/compilation-cache.cc',
'src/compilation-cache.h',
'src/compiler.cc',
'src/compiler.h',
'src/constants-arm.h',
'src/contexts.cc',
'src/contexts.h',
'src/conversions-inl.h',
'src/conversions.cc',
'src/conversions.h',
'src/counters.cc',
'src/counters.h',
'src/cpu-arm.cc',
'src/cpu-ia32.cc',
'src/cpu.h',
'src/date-delay.js',
'src/dateparser.cc',
'src/dateparser.h',
'src/debug-arm.cc',
'src/debug-delay.js',
'src/debug-ia32.cc',
'src/debug.cc',
'src/debug.h',
'src/disasm-arm.cc',
'src/disasm-ia32.cc',
'src/disasm.h',
'src/disassembler.cc',
'src/disassembler.h',
'src/dtoa-config.c',
'src/execution.cc',
'src/execution.h',
'src/factory.cc',
'src/factory.h',
'src/flag-definitions.h',
'src/flags.cc',
'src/flags.h',
'src/frames-arm.cc',
'src/frames-arm.h',
'src/frames-ia32.cc',
'src/frames-ia32.h',
'src/frames-inl.h',
'src/frames.cc',
'src/frames.h',
'src/global-handles.cc',
'src/global-handles.h',
'src/globals.h',
'src/handles-inl.h',
'src/handles.cc',
'src/handles.h',
'src/hashmap.cc',
'src/hashmap.h',
'src/heap-inl.h',
'src/heap.cc',
'src/heap.h',
'src/ic-arm.cc',
'src/ic-ia32.cc',
'src/ic-inl.h',
'src/ic.cc',
'src/ic.h',
'src/interpreter-irregexp.cc',
'src/interpreter-irregexp.h',
'src/jsregexp-inl.h',
'src/jsregexp.cc',
'src/jsregexp.h',
'src/list-inl.h',
'src/list.h',
'src/log.cc',
'src/log.h',
'src/macro-assembler-arm.cc',
'src/macro-assembler-arm.h',
'src/macro-assembler-ia32.cc',
'src/macro-assembler-ia32.h',
'src/macro-assembler.h',
'src/macros.py',
'src/mark-compact.cc',
'src/mark-compact.h',
'src/math.js',
'src/memory.h',
'src/messages.cc',
'src/messages.h',
'src/messages.js',
'src/mirror-delay.js',
'src/natives.h',
'src/objects-debug.cc',
'src/objects-inl.h',
'src/objects.cc',
'src/objects.h',
'src/parser.cc',
'src/parser.h',
'src/platform-freebsd.cc',
'src/platform-linux.cc',
'src/platform-macos.cc',
'src/platform-nullos.cc',
'src/platform-win32.cc',
'src/platform.h',
'src/prettyprinter.cc',
'src/prettyprinter.h',
'src/property.cc',
'src/property.h',
'src/regexp-delay.js',
'src/regexp-macro-assembler-arm.cc',
'src/regexp-macro-assembler-arm.h',
'src/regexp-macro-assembler-ia32.cc',
'src/regexp-macro-assembler-ia32.h',
'src/regexp-macro-assembler-irregexp-inl.h',
'src/regexp-macro-assembler-irregexp.cc',
'src/regexp-macro-assembler-irregexp.h',
'src/regexp-macro-assembler-tracer.cc',
'src/regexp-macro-assembler-tracer.h',
'src/regexp-macro-assembler.cc',
'src/regexp-macro-assembler.h',
'src/regexp-stack.cc',
'src/regexp-stack.h',
'src/rewriter.cc',
'src/rewriter.h',
'src/runtime.cc',
'src/runtime.h',
'src/scanner.cc',
'src/scanner.h',
'src/scopeinfo.cc',
'src/scopeinfo.h',
'src/scopes.cc',
'src/scopes.h',
'src/serialize.cc',
'src/serialize.h',
'src/shell.h',
'src/smart-pointer.h',
'src/snapshot-common.cc',
# TODO(mark): choose between snapshot-empty.cc and snapshot.cc
# generated by mksnapsot.
'src/snapshot-empty.cc',
'src/snapshot.h',
'src/spaces-inl.h',
'src/spaces.cc',
'src/spaces.h',
'src/string-stream.cc',
'src/string-stream.h',
'src/string.js',
'src/stub-cache-arm.cc',
'src/stub-cache-ia32.cc',
'src/stub-cache.cc',
'src/stub-cache.h',
'src/token.cc',
'src/token.h',
'src/top.cc',
'src/top.h',
'src/unicode-inl.h',
'src/unicode.cc',
'src/unicode.h',
'src/uri.js',
'src/usage-analyzer.cc',
'src/usage-analyzer.h',
'src/utils.cc',
'src/utils.h',
'src/v8-counters.cc',
'src/v8-counters.h',
'src/v8.cc',
'src/v8.h',
'src/v8natives.js',
'src/v8threads.cc',
'src/v8threads.h',
'src/variables.cc',
'src/variables.h',
'src/zone-inl.h',
'src/zone.cc',
'src/zone.h',
],
'sources!': [
# These files are #included by others and are not meant to be compiled
# directly.
'src/third_party/dtoa/dtoa.c',
'src/third_party/jscre/pcre_chartables.c',
'src/third_party/jscre/ucptable.cpp',
],
'sources/': [
['exclude', '-arm\\.cc$'],
['exclude', '^src/platform-.*\\.cc$' ],
],
'conditions': [
# TODO(mark): These only need to be 'sources/', the extra '+' is
# for prepend, which is only temporary until the rules scanner is
# rewritten to not pull things out of the list until all includes and
# excludes are processed.
['OS=="linux"', {'sources/+': [['include', '^src/platform-linux\\.cc$']]}],
['OS=="mac"', {'sources/+': [['include', '^src/platform-macos\\.cc$']]}],
['OS=="win"', {'sources/+': [['include', '^src/platform-win32\\.cc$']]}],
],
'include_dirs': [
'src',
],
'actions': [
{
'action_name': 'js2c',
'inputs': [
'src/runtime.js',
'src/v8natives.js',
'src/array.js',
'src/string.js',
'src/uri.js',
'src/math.js',
'src/messages.js',
'src/apinatives.js',
'src/debug-delay.js',
'src/mirror-delay.js',
'src/date-delay.js',
'src/regexp-delay.js',
'src/macros.py',
'tools/js2c.py',
],
'outputs': [
'<(INTERMEDIATE_DIR)/libraries.cc',
'<(INTERMEDIATE_DIR)/libraries-empty.cc',
],
'action': 'tools/js2c.py "<(INTERMEDIATE_DIR_SCRIPT)/libraries.cc" "<(INTERMEDIATE_DIR_SCRIPT)/libraries-empty.cc" CORE src/v8natives.js src/array.js src/string.js src/uri.js src/math.js src/messages.js src/apinatives.js src/debug-delay.js src/mirror-delay.js src/date-delay.js src/regexp-delay.js src/macros.py'
},
],
},
],
}

0 comments on commit 5ca0052

Please sign in to comment.