summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2014-07-29 14:02:18 +0000
committermark@chromium.org <mark@chromium.org@78cadc50-ecff-11dd-a971-7dbc132099af>2014-07-29 14:02:18 +0000
commitcb818ae005d8c48ecd202a460e5b556f7a092027 (patch)
tree0229135d7aa204980461ba45aa41e58e81b51fd2
parentb95cbeb2b4a56eb33f6568ca2e9fce5b491ce96d (diff)
downloadgyp-cb818ae005d8c48ecd202a460e5b556f7a092027.tar.gz
Enable custom suffixes for Mac bundles.
Patch by Johannes Sartisohn <jsartisohn@google.com> Review URL: https://codereview.chromium.org/401633002/ git-svn-id: http://gyp.googlecode.com/svn/trunk@1957 78cadc50-ecff-11dd-a971-7dbc132099af
-rw-r--r--pylib/gyp/xcodeproj_file.py4
-rw-r--r--test/mac/gyptest-loadable-module-bundle-product-extension.py28
-rw-r--r--test/mac/loadable-module-bundle-product-extension/src.cc7
-rw-r--r--test/mac/loadable-module-bundle-product-extension/test.gyp24
4 files changed, 61 insertions, 2 deletions
diff --git a/pylib/gyp/xcodeproj_file.py b/pylib/gyp/xcodeproj_file.py
index 2b91f5fb..7c7f1fbd 100644
--- a/pylib/gyp/xcodeproj_file.py
+++ b/pylib/gyp/xcodeproj_file.py
@@ -2316,11 +2316,11 @@ class PBXNativeTarget(XCTarget):
if force_extension is not None:
# If it's a wrapper (bundle), set WRAPPER_EXTENSION.
+ # Extension override.
+ suffix = '.' + force_extension
if filetype.startswith('wrapper.'):
self.SetBuildSetting('WRAPPER_EXTENSION', force_extension)
else:
- # Extension override.
- suffix = '.' + force_extension
self.SetBuildSetting('EXECUTABLE_EXTENSION', force_extension)
if filetype.startswith('compiled.mach-o.executable'):
diff --git a/test/mac/gyptest-loadable-module-bundle-product-extension.py b/test/mac/gyptest-loadable-module-bundle-product-extension.py
new file mode 100644
index 00000000..90c20837
--- /dev/null
+++ b/test/mac/gyptest-loadable-module-bundle-product-extension.py
@@ -0,0 +1,28 @@
+#!/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.
+
+"""
+Tests that loadable_modules don't collide when using the same name with
+different file extensions.
+"""
+
+import TestGyp
+
+import os
+import struct
+import sys
+
+if sys.platform == 'darwin':
+ test = TestGyp.TestGyp(formats=['ninja', 'make', 'xcode'])
+
+ CHDIR = 'loadable-module-bundle-product-extension'
+ test.run_gyp('test.gyp', chdir=CHDIR)
+ test.build('test.gyp', test.ALL, chdir=CHDIR)
+
+ test.must_exist(test.built_file_path('Collide.foo', chdir=CHDIR))
+ test.must_exist(test.built_file_path('Collide.bar', chdir=CHDIR))
+
+ test.pass_test()
diff --git a/test/mac/loadable-module-bundle-product-extension/src.cc b/test/mac/loadable-module-bundle-product-extension/src.cc
new file mode 100644
index 00000000..3d878e96
--- /dev/null
+++ b/test/mac/loadable-module-bundle-product-extension/src.cc
@@ -0,0 +1,7 @@
+// 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.
+
+int test() {
+ return 1337;
+}
diff --git a/test/mac/loadable-module-bundle-product-extension/test.gyp b/test/mac/loadable-module-bundle-product-extension/test.gyp
new file mode 100644
index 00000000..684a2c02
--- /dev/null
+++ b/test/mac/loadable-module-bundle-product-extension/test.gyp
@@ -0,0 +1,24 @@
+# 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.
+{
+ 'targets': [{
+ 'target_name': 'test',
+ 'type': 'none',
+ 'dependencies': ['child_one', 'child_two'],
+ }, {
+ 'target_name': 'child_one',
+ 'product_name': 'Collide',
+ 'product_extension': 'bar',
+ 'sources': ['src.cc'],
+ 'type': 'loadable_module',
+ 'mac_bundle': 1,
+ }, {
+ 'target_name': 'child_two',
+ 'product_name': 'Collide',
+ 'product_extension': 'foo',
+ 'sources': ['src.cc'],
+ 'type': 'loadable_module',
+ 'mac_bundle': 1,
+ }],
+}