Skip to content

Commit

Permalink
Make all gtest targets into bundles on iOS
Browse files Browse the repository at this point in the history
The raw 'executable' type maps to the .tool Apple product-type, which doesn't exist on iOS. Make each unit test a bundle instead.

BUG=None
TEST=None


Review URL: https://chromiumcodereview.appspot.com/10704121

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@145671 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
stuartmorgan@chromium.org committed Jul 9, 2012
1 parent d35cb97 commit 17f7c43
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
43 changes: 41 additions & 2 deletions testing/gtest.gyp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2011 The Chromium Authors. All rights reserved.
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

Expand Down Expand Up @@ -51,7 +51,7 @@
'gtest_prod',
],
'conditions': [
['OS == "mac"', {
['OS == "mac" or OS == "ios"', {
'sources': [
'gtest_mac.h',
'gtest_mac.mm',
Expand All @@ -63,6 +63,34 @@
],
},
}],
['OS == "ios"', {
'direct_dependent_settings': {
'target_conditions': [
# Turn all tests into bundles on iOS because that's the only
# type of executable supported for iOS.
['_type=="executable"', {
'variables': {
# Use a variable so the path gets fixed up so it is always
# correct when INFOPLIST_FILE finally gets set.
'ios_unittest_info_plist_path':
'<(DEPTH)/testing/gtest_ios/unittest-Info.plist',
},
'mac_bundle': 1,
'xcode_settings': {
'BUNDLE_ID_TEST_NAME':
'>!(echo ">(_target_name)" | sed -e "s/_//g")',
'INFOPLIST_FILE': '>(ios_unittest_info_plist_path)',
},
'mac_bundle_resources': [
'<(ios_unittest_info_plist_path)',
],
'mac_bundle_resources!': [
'<(ios_unittest_info_plist_path)',
],
}],
],
},
}],
['os_posix == 1', {
'defines': [
# gtest isn't able to figure out when RTTI is disabled for gcc
Expand Down Expand Up @@ -111,6 +139,17 @@
'action????': ['${BUILT_PRODUCTS_DIR}/${PRODUCT_NAME}'],
},
}],
['OS=="ios"', {
'variables': {
# Use a variable so the path gets fixed up so it is always
# correct when the action finally gets used.
'ios_run_unittest_script_path':
'<(DEPTH)/testing/gtest_ios/RunUnittest.sh',
},
'run_as': {
'action????': ['>(ios_run_unittest_script_path)'],
},
}],
['OS=="win"', {
'run_as': {
'action????': ['$(TargetPath)', '--gtest_print_time'],
Expand Down
32 changes: 32 additions & 0 deletions testing/gtest_ios/unittest-Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDisplayName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.google.gtest.${BUNDLE_ID_TEST_NAME}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UISupportedInterfaceOrientation</key>
<array>
<string>UIInterfaceOrientationPortrait</string>
<string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string>
</array>
</dict>
</plist>

0 comments on commit 17f7c43

Please sign in to comment.