diff --git a/bind/benchmark/benchmark.go b/bind/benchmark/benchmark.go index 2e56861..d15f4c3 100644 --- a/bind/benchmark/benchmark.go +++ b/bind/benchmark/benchmark.go @@ -90,7 +90,7 @@ func RunBenchmarks(b Benchmarks) { "Onearg", "Oneret", "Manyargs", - "Refjava", + "Refforeign", "Refgo", "StringShort", "StringLong", @@ -102,10 +102,10 @@ func RunBenchmarks(b Benchmarks) { "SliceLong", } for _, name := range names { - runBenchmark("Java"+name, func(n int) { + runBenchmark("Foreign"+name, func(n int) { b.Run(name, n) }) - runBenchmark("Java"+name+"Direct", func(n int) { + runBenchmark("Foreign"+name+"Direct", func(n int) { b.RunDirect(name, n) }) } @@ -113,8 +113,8 @@ func RunBenchmarks(b Benchmarks) { runGoBenchmark("Noarg", func() { b.Noargs() }) runGoBenchmark("Onearg", func() { b.Onearg(0) }) runGoBenchmark("Oneret", func() { b.Oneret() }) - javaRef := b.NewI() - runGoBenchmark("Refjava", func() { b.Ref(javaRef) }) + foreignRef := b.NewI() + runGoBenchmark("Refforeign", func() { b.Ref(foreignRef) }) goRef := NewI() runGoBenchmark("Refgo", func() { b.Ref(goRef) }) runGoBenchmark("Manyargs", func() { b.Manyargs(0, 0, 0, 0, 0, 0, 0, 0, 0, 0) }) diff --git a/bind/java/SeqBench.java b/bind/java/SeqBench.java index 90e75a3..95dfc28 100644 --- a/bind/java/SeqBench.java +++ b/bind/java/SeqBench.java @@ -53,7 +53,7 @@ public class SeqBench extends InstrumentationTestCase { } }); final Benchmark.I javaRef = new AnI(); - benchmarks.put("Refjava", new Runnable() { + benchmarks.put("Refforeign", new Runnable() { @Override public void run() { Benchmark.Ref(javaRef); } diff --git a/bind/objc/SeqBench.m b/bind/objc/SeqBench.m new file mode 100644 index 0000000..fd7294d --- /dev/null +++ b/bind/objc/SeqBench.m @@ -0,0 +1,196 @@ +// Copyright 2015 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build ignore + +#import +#import +#import "benchmark/Benchmark.h" + +@interface AnI : NSObject { +} +@end + +@implementation AnI +- (void)f { +} +@end + +@interface Benchmarks : NSObject { +} +@end + +@implementation Benchmarks +- (void)manyargs:(int)p0 p1:(int)p1 p2:(int)p2 p3:(int)p3 p4:(int)p4 p5:(int)p5 p6:(int)p6 p7:(int)p7 p8:(int)p8 p9:(int)p9 { +} + +- (id)newI { + return [[AnI alloc] init]; +} + +- (void)noargs { +} + +- (void)onearg:(int)p0 { +} + +- (int)oneret { + return 0; +} + +- (void)ref:(id)p0 { +} + +- (void)slice:(NSData*)p0 { +} + +- (void)string:(NSString*)p0 { +} + +- (NSString*)stringRetLong { + return GoBenchmarkLongString; +} + +- (NSString*)stringRetShort { + return GoBenchmarkShortString; +} + +- (void (^)(void))lookupBenchmark:(NSString *)name { + if ([name isEqualToString:@"Empty"]) { + return ^() { + }; + } else if ([name isEqualToString:@"Noargs"]) { + return ^() { + GoBenchmarkNoargs(); + }; + } else if ([name isEqualToString:@"Onearg"]) { + return ^() { + GoBenchmarkOnearg(0); + }; + } else if ([name isEqualToString:@"Manyargs"]) { + return ^() { + GoBenchmarkManyargs(0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + }; + } else if ([name isEqualToString:@"Oneret"]) { + return ^() { + GoBenchmarkOneret(); + }; + } else if ([name isEqualToString:@"Refforeign"]) { + id objcRef = [[AnI alloc] init]; + return ^() { + GoBenchmarkRef(objcRef); + }; + } else if ([name isEqualToString:@"Refgo"]) { + id goRef = GoBenchmarkNewI(); + return ^() { + GoBenchmarkRef(goRef); + }; + } else if ([name isEqualToString:@"StringShort"]) { + return ^() { + GoBenchmarkString(GoBenchmarkShortString); + }; + } else if ([name isEqualToString:@"StringLong"]) { + return ^() { + GoBenchmarkString(GoBenchmarkLongString); + }; + } else if ([name isEqualToString:@"StringShortUnicode"]) { + return ^() { + GoBenchmarkString(GoBenchmarkShortStringUnicode); + }; + } else if ([name isEqualToString:@"StringLongUnicode"]) { + return ^() { + GoBenchmarkString(GoBenchmarkLongStringUnicode); + }; + } else if ([name isEqualToString:@"StringRetShort"]) { + return ^() { + GoBenchmarkStringRetShort(); + }; + } else if ([name isEqualToString:@"StringRetLong"]) { + return ^() { + GoBenchmarkStringRetLong(); + }; + } else if ([name isEqualToString:@"SliceShort"]) { + NSData *s = [GoBenchmark shortSlice]; + return ^() { + GoBenchmarkSlice(s); + }; + } else if ([name isEqualToString:@"SliceLong"]) { + NSData *s = [GoBenchmark longSlice]; + return ^() { + GoBenchmarkSlice(s); + }; + } else { + return nil; + } +} + +- (void)run:(NSString*)name n:(int)n { + void (^bench)(void) = [self lookupBenchmark:name]; + if (bench == nil) { + NSLog(@"Error: no such benchmark: %@", name); + return; + } + for (int i = 0; i < n; i++) { + bench(); + } +} + +- (void)runDirect:(NSString*)name n:(int)n { + void (^bench)(void) = [self lookupBenchmark:name]; + if (bench == nil) { + NSLog(@"Error: no such benchmark: %@", name); + return; + } + dispatch_sync(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + for (int i = 0; i < n; i++) { + bench(); + } + }); +} + +@end + +@interface benchmarks : XCTestCase + +@end + +@implementation benchmarks + +- (void)setUp { + [super setUp]; + + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + self.continueAfterFailure = NO; + // UI tests must launch the application that they test. Doing this in setup will make sure it happens for each test method. + [[[XCUIApplication alloc] init] launch]; + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testBenchmark { + // Long running unit tests seem to hang. Use an XCTestExpectation and run the Go + // benchmark suite on a GCD thread. + XCTestExpectation *expectation = + [self expectationWithDescription:@"Benchmark"]; + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + Benchmarks *b = [[Benchmarks alloc] init]; + GoBenchmarkRunBenchmarks(b); + [expectation fulfill]; + }); + + [self waitForExpectationsWithTimeout:5*60.0 handler:^(NSError *error) { + if (error) { + NSLog(@"Timeout Error: %@", error); + } + }]; +} +@end diff --git a/bind/objc/seq_test.go b/bind/objc/seq_test.go index b7e13b4..be7f68f 100644 --- a/bind/objc/seq_test.go +++ b/bind/objc/seq_test.go @@ -16,15 +16,37 @@ import ( "testing" ) +// Use the Xcode XCTestCase framework to run the SeqTest.m tests and the SeqBench.m benchmarks. +// +// SeqTest.m runs in the xcodetest project as normal unit test (logic test in Xcode lingo). +// Unit tests execute faster but cannot run on a real device. That is why SeqBench.m runs as +// a UI unit test through the xcodebench project. +// +// Both xcodetest and xcodebench were constructed in Xcode 7 by: +// +// - Creating a new project through Xcode. Choose to include either unit tests or UI tests as +// needed. +// - Add SeqTest.m or SeqBench.m to the right unit test target. +// - Xcode schemes are per-user by default. The shared scheme is created by selecting +// Project => Schemes => Manage Schemes from the Xcode menu and selecting "Shared". +// - Remove files not needed for xcodebuild (determined empirically). In particular, the empty +// tests Xcode creates can be removed and the unused user scheme. + var destination = flag.String("device", "platform=iOS Simulator,name=iPhone 6s Plus", "Specify the -destination flag to xcodebuild") // TestObjcSeqTest runs ObjC test SeqTest.m. // This requires the xcode command lines tools. func TestObjcSeqTest(t *testing.T) { - runTest(t, "golang.org/x/mobile/bind/objc/testpkg", "xcodetest", "SeqTest.m") + runTest(t, "golang.org/x/mobile/bind/objc/testpkg", "xcodetest", "SeqTest.m", false) } -func runTest(t *testing.T, pkgName, project, testfile string) { +// TestObjcSeqBench runs ObjC test SeqBench.m. +// This requires the xcode command lines tools. +func TestObjcSeqBench(t *testing.T) { + runTest(t, "golang.org/x/mobile/bind/benchmark", "xcodebench", "SeqBench.m", true) +} + +func runTest(t *testing.T, pkgName, project, testfile string, dumpOutput bool) { if _, err := run("which xcodebuild"); err != nil { t.Skip("command xcodebuild not found, skipping") } @@ -68,11 +90,15 @@ func runTest(t *testing.T, pkgName, project, testfile string) { t.Fatalf("failed to run gomobile bind: %v", err) } - cmd := exec.Command("xcodebuild", "test", "-scheme", "xcodetest", "-destination", *destination) - if buf, err := cmd.CombinedOutput(); err != nil { + cmd := exec.Command("xcodebuild", "test", "-scheme", project, "-destination", *destination) + buf, err = cmd.CombinedOutput() + if err != nil { t.Logf("%s", buf) t.Errorf("failed to run xcodebuild: %v", err) } + if dumpOutput { + t.Logf("%s", buf) + } } func run(cmd string) ([]byte, error) { diff --git a/bind/objc/xcodebench/xcodebench.xcodeproj/project.pbxproj b/bind/objc/xcodebench/xcodebench.xcodeproj/project.pbxproj new file mode 100644 index 0000000..1186c11 --- /dev/null +++ b/bind/objc/xcodebench/xcodebench.xcodeproj/project.pbxproj @@ -0,0 +1,394 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 64658E371C8C903800FBDE8A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 64658E361C8C903800FBDE8A /* main.m */; }; + 64658E3A1C8C903800FBDE8A /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 64658E391C8C903800FBDE8A /* AppDelegate.m */; }; + 64658E5B1C8C904600FBDE8A /* SeqBench.m in Sources */ = {isa = PBXBuildFile; fileRef = 64658E5A1C8C904600FBDE8A /* SeqBench.m */; }; + 64658E5D1C8C906B00FBDE8A /* Benchmark.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 64658E5C1C8C906B00FBDE8A /* Benchmark.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 64658E4C1C8C903800FBDE8A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 64658E2A1C8C903800FBDE8A /* Project object */; + proxyType = 1; + remoteGlobalIDString = 64658E311C8C903800FBDE8A; + remoteInfo = xcodebench; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 64658E321C8C903800FBDE8A /* xcodebench.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = xcodebench.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 64658E361C8C903800FBDE8A /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 64658E381C8C903800FBDE8A /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 64658E391C8C903800FBDE8A /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 64658E461C8C903800FBDE8A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 64658E4B1C8C903800FBDE8A /* xcodebenchUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = xcodebenchUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 64658E511C8C903800FBDE8A /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 64658E5A1C8C904600FBDE8A /* SeqBench.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SeqBench.m; path = ../../SeqBench.m; sourceTree = ""; }; + 64658E5C1C8C906B00FBDE8A /* Benchmark.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Benchmark.framework; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 64658E2F1C8C903800FBDE8A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 64658E481C8C903800FBDE8A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 64658E5D1C8C906B00FBDE8A /* Benchmark.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 64658E291C8C903800FBDE8A = { + isa = PBXGroup; + children = ( + 64658E341C8C903800FBDE8A /* xcodebench */, + 64658E4E1C8C903800FBDE8A /* xcodebenchUITests */, + 64658E331C8C903800FBDE8A /* Products */, + ); + sourceTree = ""; + }; + 64658E331C8C903800FBDE8A /* Products */ = { + isa = PBXGroup; + children = ( + 64658E321C8C903800FBDE8A /* xcodebench.app */, + 64658E4B1C8C903800FBDE8A /* xcodebenchUITests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 64658E341C8C903800FBDE8A /* xcodebench */ = { + isa = PBXGroup; + children = ( + 64658E381C8C903800FBDE8A /* AppDelegate.h */, + 64658E391C8C903800FBDE8A /* AppDelegate.m */, + 64658E461C8C903800FBDE8A /* Info.plist */, + 64658E351C8C903800FBDE8A /* Supporting Files */, + ); + path = xcodebench; + sourceTree = ""; + }; + 64658E351C8C903800FBDE8A /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 64658E361C8C903800FBDE8A /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + 64658E4E1C8C903800FBDE8A /* xcodebenchUITests */ = { + isa = PBXGroup; + children = ( + 64658E5C1C8C906B00FBDE8A /* Benchmark.framework */, + 64658E5A1C8C904600FBDE8A /* SeqBench.m */, + 64658E511C8C903800FBDE8A /* Info.plist */, + ); + path = xcodebenchUITests; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 64658E311C8C903800FBDE8A /* xcodebench */ = { + isa = PBXNativeTarget; + buildConfigurationList = 64658E541C8C903800FBDE8A /* Build configuration list for PBXNativeTarget "xcodebench" */; + buildPhases = ( + 64658E2E1C8C903800FBDE8A /* Sources */, + 64658E2F1C8C903800FBDE8A /* Frameworks */, + 64658E301C8C903800FBDE8A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = xcodebench; + productName = xcodebench; + productReference = 64658E321C8C903800FBDE8A /* xcodebench.app */; + productType = "com.apple.product-type.application"; + }; + 64658E4A1C8C903800FBDE8A /* xcodebenchUITests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 64658E571C8C903800FBDE8A /* Build configuration list for PBXNativeTarget "xcodebenchUITests" */; + buildPhases = ( + 64658E471C8C903800FBDE8A /* Sources */, + 64658E481C8C903800FBDE8A /* Frameworks */, + 64658E491C8C903800FBDE8A /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 64658E4D1C8C903800FBDE8A /* PBXTargetDependency */, + ); + name = xcodebenchUITests; + productName = xcodebenchUITests; + productReference = 64658E4B1C8C903800FBDE8A /* xcodebenchUITests.xctest */; + productType = "com.apple.product-type.bundle.ui-testing"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 64658E2A1C8C903800FBDE8A /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0720; + ORGANIZATIONNAME = golang.org; + TargetAttributes = { + 64658E311C8C903800FBDE8A = { + CreatedOnToolsVersion = 7.2.1; + }; + 64658E4A1C8C903800FBDE8A = { + CreatedOnToolsVersion = 7.2.1; + TestTargetID = 64658E311C8C903800FBDE8A; + }; + }; + }; + buildConfigurationList = 64658E2D1C8C903800FBDE8A /* Build configuration list for PBXProject "xcodebench" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = 64658E291C8C903800FBDE8A; + productRefGroup = 64658E331C8C903800FBDE8A /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 64658E311C8C903800FBDE8A /* xcodebench */, + 64658E4A1C8C903800FBDE8A /* xcodebenchUITests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 64658E301C8C903800FBDE8A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 64658E491C8C903800FBDE8A /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 64658E2E1C8C903800FBDE8A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 64658E3A1C8C903800FBDE8A /* AppDelegate.m in Sources */, + 64658E371C8C903800FBDE8A /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 64658E471C8C903800FBDE8A /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 64658E5B1C8C904600FBDE8A /* SeqBench.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 64658E4D1C8C903800FBDE8A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 64658E311C8C903800FBDE8A /* xcodebench */; + targetProxy = 64658E4C1C8C903800FBDE8A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 64658E521C8C903800FBDE8A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 64658E531C8C903800FBDE8A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 9.2; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 64658E551C8C903800FBDE8A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = xcodebench/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = golang.xcodebench; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 64658E561C8C903800FBDE8A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = xcodebench/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = golang.xcodebench; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 64658E581C8C903800FBDE8A /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = xcodebenchUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = golang.xcodebenchUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = xcodebench; + USES_XCTRUNNER = YES; + }; + name = Debug; + }; + 64658E591C8C903800FBDE8A /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)", + ); + INFOPLIST_FILE = xcodebenchUITests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = golang.xcodebenchUITests; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_TARGET_NAME = xcodebench; + USES_XCTRUNNER = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 64658E2D1C8C903800FBDE8A /* Build configuration list for PBXProject "xcodebench" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 64658E521C8C903800FBDE8A /* Debug */, + 64658E531C8C903800FBDE8A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 64658E541C8C903800FBDE8A /* Build configuration list for PBXNativeTarget "xcodebench" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 64658E551C8C903800FBDE8A /* Debug */, + 64658E561C8C903800FBDE8A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 64658E571C8C903800FBDE8A /* Build configuration list for PBXNativeTarget "xcodebenchUITests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 64658E581C8C903800FBDE8A /* Debug */, + 64658E591C8C903800FBDE8A /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 64658E2A1C8C903800FBDE8A /* Project object */; +} diff --git a/bind/objc/xcodebench/xcodebench.xcodeproj/xcshareddata/xcschemes/xcodebench.xcscheme b/bind/objc/xcodebench/xcodebench.xcodeproj/xcshareddata/xcschemes/xcodebench.xcscheme new file mode 100644 index 0000000..b741f40 --- /dev/null +++ b/bind/objc/xcodebench/xcodebench.xcodeproj/xcshareddata/xcschemes/xcodebench.xcscheme @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bind/objc/xcodebench/xcodebench/AppDelegate.h b/bind/objc/xcodebench/xcodebench/AppDelegate.h new file mode 100644 index 0000000..57b2033 --- /dev/null +++ b/bind/objc/xcodebench/xcodebench/AppDelegate.h @@ -0,0 +1,13 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + + +@end + diff --git a/bind/objc/xcodebench/xcodebench/AppDelegate.m b/bind/objc/xcodebench/xcodebench/AppDelegate.m new file mode 100644 index 0000000..afedff8 --- /dev/null +++ b/bind/objc/xcodebench/xcodebench/AppDelegate.m @@ -0,0 +1,41 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. +} + +@end diff --git a/bind/objc/xcodebench/xcodebench/Info.plist b/bind/objc/xcodebench/xcodebench/Info.plist new file mode 100644 index 0000000..7c961f8 --- /dev/null +++ b/bind/objc/xcodebench/xcodebench/Info.plist @@ -0,0 +1,43 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/bind/objc/xcodebench/xcodebench/main.m b/bind/objc/xcodebench/xcodebench/main.m new file mode 100644 index 0000000..2815086 --- /dev/null +++ b/bind/objc/xcodebench/xcodebench/main.m @@ -0,0 +1,12 @@ +// Copyright 2016 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/bind/objc/xcodebench/xcodebenchUITests/Info.plist b/bind/objc/xcodebench/xcodebenchUITests/Info.plist new file mode 100644 index 0000000..ba72822 --- /dev/null +++ b/bind/objc/xcodebench/xcodebenchUITests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + +