diff options
Diffstat (limited to 'third_party/python/gyp/test/actions-depfile')
4 files changed, 91 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/actions-depfile/depfile.gyp b/third_party/python/gyp/test/actions-depfile/depfile.gyp new file mode 100644 index 0000000000..617fe705b5 --- /dev/null +++ b/third_party/python/gyp/test/actions-depfile/depfile.gyp @@ -0,0 +1,42 @@ +# Copyright (c) 2015 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'targets': [ + { + 'target_name': 'depfile_target', + 'type': 'none', + 'actions': [ + { + 'action_name': 'depfile_action', + 'inputs': [ + 'input.txt', + ], + 'outputs': [ + 'output.txt', + ], + 'depfile': 'depfile_action.d', + 'action': [ + 'python', 'touch.py', '<(PRODUCT_DIR)/<(_depfile)', + ], + 'msvs_cygwin_shell': 0, + }, + { + 'action_name': 'depfile_action_intermediate_dir', + 'inputs': [ + 'input.txt', + ], + 'outputs': [ + 'output-intermediate.txt', + ], + 'depfile': '<(INTERMEDIATE_DIR)/depfile_action_intermediate_dir.d', + 'action': [ + 'python', 'touch.py', '<(_depfile)', + ], + 'msvs_cygwin_shell': 0, + }, + ], + }, + ], +} diff --git a/third_party/python/gyp/test/actions-depfile/gyptest-all.py b/third_party/python/gyp/test/actions-depfile/gyptest-all.py new file mode 100644 index 0000000000..68b32d611c --- /dev/null +++ b/third_party/python/gyp/test/actions-depfile/gyptest-all.py @@ -0,0 +1,30 @@ +#!/usr/bin/env python + +# Copyright (c) 2014 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +"""Verifies that depfile fields are output in ninja rules.""" + +import TestGyp +import os + +test = TestGyp.TestGyp() + +if test.format == 'ninja': + test.run_gyp('depfile.gyp') + contents = open(test.built_file_path('obj/depfile_target.ninja')).read() + + expected = [ + 'depfile = depfile_action.d', + 'depfile = ' + os.path.join( + 'obj', 'depfile_target.gen/depfile_action_intermediate_dir.d'), + ] + test.must_contain_all_lines(contents, expected) + + test.build('depfile.gyp') + test.built_file_must_exist('depfile_action.d') + test.built_file_must_exist( + 'obj/depfile_target.gen/depfile_action_intermediate_dir.d') + + test.pass_test() diff --git a/third_party/python/gyp/test/actions-depfile/input.txt b/third_party/python/gyp/test/actions-depfile/input.txt new file mode 100644 index 0000000000..3f9177e45e --- /dev/null +++ b/third_party/python/gyp/test/actions-depfile/input.txt @@ -0,0 +1 @@ +input diff --git a/third_party/python/gyp/test/actions-depfile/touch.py b/third_party/python/gyp/test/actions-depfile/touch.py new file mode 100644 index 0000000000..57f8316093 --- /dev/null +++ b/third_party/python/gyp/test/actions-depfile/touch.py @@ -0,0 +1,18 @@ +#!/usr/bin/env python +# +# Copyright (c) 2012 Google Inc. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import os +import sys + +"""Cross-platform touch.""" + +for fname in sys.argv[1:]: + if os.path.exists(fname): + os.utime(fname, None) + else: + if not os.path.exists(os.path.join('.', os.path.dirname(fname))): + os.makedirs(os.path.dirname(fname)) + open(fname, 'w').close() |