diff options
Diffstat (limited to 'third_party/python/gyp/test/mac/framework')
8 files changed, 245 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings b/third_party/python/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings new file mode 100644 index 0000000000..88f65cf6ea --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/TestFramework/English.lproj/InfoPlist.strings @@ -0,0 +1,2 @@ +/* Localized versions of Info.plist keys */ + diff --git a/third_party/python/gyp/test/mac/framework/TestFramework/Info.plist b/third_party/python/gyp/test/mac/framework/TestFramework/Info.plist new file mode 100644 index 0000000000..a791b3ee48 --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/TestFramework/Info.plist @@ -0,0 +1,28 @@ +<?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>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>com.yourcompany.${PRODUCT_NAME:identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>1.0</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1</string> + <key>NSPrincipalClass</key> + <string></string> +</dict> +</plist> diff --git a/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVector.h b/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVector.h new file mode 100644 index 0000000000..c2450960cd --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVector.h @@ -0,0 +1,28 @@ +// Copyright (c) 2011 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 <Cocoa/Cocoa.h> + +#ifdef __cplusplus +struct ObjCVectorImp; +#else +typedef struct _ObjCVectorImpT ObjCVectorImp; +#endif + +@interface ObjCVector : NSObject { + @private + ObjCVectorImp* imp_; +} + +- (id)init; + +- (void)addObject:(id)obj; +- (void)addObject:(id)obj atIndex:(NSUInteger)index; + +- (void)removeObject:(id)obj; +- (void)removeObjectAtIndex:(NSUInteger)index; + +- (id)objectAtIndex:(NSUInteger)index; + +@end diff --git a/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVector.mm b/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVector.mm new file mode 100644 index 0000000000..cbf431f28d --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVector.mm @@ -0,0 +1,63 @@ +// Copyright (c) 2011 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 "ObjCVectorInternal.h" +#import "ObjCVector.h" + +#include <vector> + +@interface ObjCVector (Private) +- (std::vector<id>::iterator)makeIterator:(NSUInteger)index; +@end + +@implementation ObjCVector + +- (id)init { + if ((self = [super init])) { + imp_ = new ObjCVectorImp(); + } + return self; +} + +- (void)dealloc { + delete imp_; + [super dealloc]; +} + +- (void)addObject:(id)obj { + imp_->v.push_back([obj retain]); +} + +- (void)addObject:(id)obj atIndex:(NSUInteger)index { + imp_->v.insert([self makeIterator:index], [obj retain]); +} + +- (void)removeObject:(id)obj { + for (std::vector<id>::iterator it = imp_->v.begin(); + it != imp_->v.end(); + ++it) { + if ([*it isEqual:obj]) { + [*it autorelease]; + imp_->v.erase(it); + return; + } + } +} + +- (void)removeObjectAtIndex:(NSUInteger)index { + [imp_->v[index] autorelease]; + imp_->v.erase([self makeIterator:index]); +} + +- (id)objectAtIndex:(NSUInteger)index { + return imp_->v[index]; +} + +- (std::vector<id>::iterator)makeIterator:(NSUInteger)index { + std::vector<id>::iterator it = imp_->v.begin(); + it += index; + return it; +} + +@end diff --git a/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h b/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h new file mode 100644 index 0000000000..fb6c98258b --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/TestFramework/ObjCVectorInternal.h @@ -0,0 +1,9 @@ +// Copyright (c) 2011 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. + +#include <vector> + +struct ObjCVectorImp { + std::vector<id> v; +}; diff --git a/third_party/python/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch b/third_party/python/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch new file mode 100644 index 0000000000..394f41d957 --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/TestFramework/TestFramework_Prefix.pch @@ -0,0 +1,7 @@ +// +// Prefix header for all source files of the 'TestFramework' target in the 'TestFramework' project. +// + +#ifdef __OBJC__ + #import <Cocoa/Cocoa.h> +#endif diff --git a/third_party/python/gyp/test/mac/framework/empty.c b/third_party/python/gyp/test/mac/framework/empty.c new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/empty.c diff --git a/third_party/python/gyp/test/mac/framework/framework.gyp b/third_party/python/gyp/test/mac/framework/framework.gyp new file mode 100644 index 0000000000..52b4f37be9 --- /dev/null +++ b/third_party/python/gyp/test/mac/framework/framework.gyp @@ -0,0 +1,108 @@ +# Copyright (c) 2011 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': 'dep_framework', + 'product_name': 'Dependency Bundle', + 'type': 'shared_library', + 'mac_bundle': 1, + 'sources': [ 'empty.c', ], + }, + { + 'target_name': 'test_framework', + 'product_name': 'Test Framework', + 'type': 'shared_library', + 'mac_bundle': 1, + 'dependencies': [ 'dep_framework', ], + 'sources': [ + 'TestFramework/ObjCVector.h', + 'TestFramework/ObjCVectorInternal.h', + 'TestFramework/ObjCVector.mm', + ], + 'mac_bundle_resources': [ + 'TestFramework/English.lproj/InfoPlist.strings', + ], + 'link_settings': { + 'libraries': [ + '$(SDKROOT)/System/Library/Frameworks/Cocoa.framework', + ], + }, + 'xcode_settings': { + 'INFOPLIST_FILE': 'TestFramework/Info.plist', + 'GCC_DYNAMIC_NO_PIC': 'NO', + }, + 'copies': [ + # Test copying to a file that has envvars in its dest path. + # Needs to be in a mac_bundle target, else CONTENTS_FOLDER_PATH isn't + # set. + { + 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Libraries', + 'files': [ + 'empty.c', + ], + }, + ], + }, + { + 'target_name': 'copy_target', + 'type': 'none', + 'dependencies': [ 'test_framework', 'dep_framework', ], + 'copies': [ + # Test copying directories with spaces in src and dest paths. + { + 'destination': '<(PRODUCT_DIR)/Test Framework.framework/foo', + 'files': [ + '<(PRODUCT_DIR)/Dependency Bundle.framework', + ], + }, + ], + 'actions': [ + { + 'action_name': 'aektschn', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/touched_file'], + 'action': ['touch', '${BUILT_PRODUCTS_DIR}/action_file'], + }, + ], + }, + { + 'target_name': 'copy_embedded', + 'type': 'none', + 'dependencies': [ 'test_framework' ], + 'copies': [ + # Test copying framework to FRAMEWORK directory. + { + 'destination': '$(BUILT_FRAMEWORKS_DIR)/Embedded', + 'files': [ + '<(PRODUCT_DIR)/Test Framework.framework', + ], + }, + ], + }, + { + 'target_name': 'copy_target_code_sign', + 'type': 'none', + 'dependencies': [ 'test_framework', 'dep_framework', ], + 'copies': [ + # Test copying directories with spaces in src and dest paths. + { + 'destination': '<(PRODUCT_DIR)/Test Framework.framework/foo', + 'files': [ + '<(PRODUCT_DIR)/Dependency Bundle.framework', + ], + 'xcode_code_sign': 1, + }, + ], + 'actions': [ + { + 'action_name': 'aektschn', + 'inputs': [], + 'outputs': ['<(PRODUCT_DIR)/touched_file'], + 'action': ['touch', '${BUILT_PRODUCTS_DIR}/action_file'], + }, + ], + }, + ], +} |