github.com/champo/mobile@v0.0.0-20190107162257-dc0771356504/bind/objc/seq_test.go (about) 1 // Copyright 2015 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package objc 6 7 import ( 8 "flag" 9 "fmt" 10 "io" 11 "io/ioutil" 12 "os" 13 "os/exec" 14 "path/filepath" 15 "strings" 16 "testing" 17 ) 18 19 // Use the Xcode XCTestCase framework to run the regular tests and the special SeqBench.m benchmarks. 20 // 21 // Regular tests run in the xcodetest project as normal unit test (logic test in Xcode lingo). 22 // Unit tests execute faster but cannot run on a real device. The benchmarks in SeqBench.m run as 23 // UI unit tests. 24 // 25 // The Xcode files embedded in this file were constructed in Xcode 9 by: 26 // 27 // - Creating a new project through Xcode. Both unit tests and UI tests were checked off. 28 // - Xcode schemes are per-user by default. The shared scheme is created by selecting 29 // Project => Schemes => Manage Schemes from the Xcode menu and selecting "Shared". 30 // - Remove files not needed for xcodebuild (determined empirically). In particular, the empty 31 // tests Xcode creates can be removed and the unused user scheme. 32 // 33 // All tests here require the Xcode command line tools. 34 35 var destination = flag.String("device", "platform=iOS Simulator,name=iPhone 6s Plus", "Specify the -destination flag to xcodebuild") 36 37 // TestObjcSeqTest runs ObjC test SeqTest.m. 38 func TestObjcSeqTest(t *testing.T) { 39 runTest(t, []string{ 40 "golang.org/x/mobile/bind/testdata/testpkg", 41 "golang.org/x/mobile/bind/testdata/testpkg/secondpkg", 42 "golang.org/x/mobile/bind/testdata/testpkg/simplepkg", 43 }, "", "SeqTest.m", "Testpkg.framework", false, false) 44 } 45 46 // TestObjcSeqBench runs ObjC test SeqBench.m. 47 func TestObjcSeqBench(t *testing.T) { 48 if testing.Short() { 49 t.Skip("skipping benchmark in short mode.") 50 } 51 runTest(t, []string{"golang.org/x/mobile/bind/testdata/benchmark"}, "", "SeqBench.m", "Benchmark.framework", true, true) 52 } 53 54 // TestObjcSeqWrappers runs ObjC test SeqWrappers.m. 55 func TestObjcSeqWrappers(t *testing.T) { 56 runTest(t, []string{"golang.org/x/mobile/bind/testdata/testpkg/objcpkg"}, "", "SeqWrappers.m", "Objcpkg.framework", false, false) 57 } 58 59 // TestObjcCustomPkg runs the ObjC test SeqCustom.m. 60 func TestObjcCustomPkg(t *testing.T) { 61 runTest(t, []string{"golang.org/x/mobile/bind/testdata/testpkg"}, "Custom", "SeqCustom.m", "Testpkg.framework", false, false) 62 } 63 64 func runTest(t *testing.T, pkgNames []string, prefix, testfile, framework string, uitest, dumpOutput bool) { 65 if _, err := run("which xcodebuild"); err != nil { 66 t.Skip("command xcodebuild not found, skipping") 67 } 68 if _, err := run("which gomobile"); err != nil { 69 t.Log("go install gomobile") 70 if _, err := run("go install golang.org/x/mobile/cmd/gomobile"); err != nil { 71 t.Fatalf("gomobile install failed: %v", err) 72 } 73 } 74 75 tmpdir, err := ioutil.TempDir("", "bind-objc-seq-test-") 76 if err != nil { 77 t.Fatalf("failed to prepare temp dir: %v", err) 78 } 79 defer os.RemoveAll(tmpdir) 80 t.Logf("tmpdir = %s", tmpdir) 81 82 if err := createProject(tmpdir, testfile, framework); err != nil { 83 t.Fatalf("failed to create project: %v", err) 84 } 85 86 if err := cp(filepath.Join(tmpdir, testfile), testfile); err != nil { 87 t.Fatalf("failed to copy %s: %v", testfile, err) 88 } 89 90 cmd := exec.Command("gomobile", "bind", "-target", "ios", "-tags", "aaa bbb") 91 if prefix != "" { 92 cmd.Args = append(cmd.Args, "-prefix", prefix) 93 } 94 cmd.Args = append(cmd.Args, pkgNames...) 95 cmd.Dir = filepath.Join(tmpdir, "xcodetest") 96 buf, err := cmd.CombinedOutput() 97 if err != nil { 98 t.Logf("%s", buf) 99 t.Fatalf("failed to run gomobile bind: %v", err) 100 } 101 102 testPattern := "xcodetestTests" 103 if uitest { 104 testPattern = "xcodetestUITests" 105 } 106 cmd = exec.Command("xcodebuild", "test", "-scheme", "xcodetest", "-destination", *destination, "-only-testing:"+testPattern) 107 cmd.Dir = tmpdir 108 buf, err = cmd.CombinedOutput() 109 if err != nil { 110 t.Logf("%s", buf) 111 t.Errorf("failed to run xcodebuild: %v", err) 112 } 113 if dumpOutput { 114 t.Logf("%s", buf) 115 } 116 } 117 118 func run(cmd string) ([]byte, error) { 119 c := strings.Split(cmd, " ") 120 return exec.Command(c[0], c[1:]...).CombinedOutput() 121 } 122 123 func cp(dst, src string) error { 124 r, err := os.Open(src) 125 if err != nil { 126 return fmt.Errorf("failed to read source: %v", err) 127 } 128 defer r.Close() 129 w, err := os.Create(dst) 130 if err != nil { 131 return fmt.Errorf("failed to open destination: %v", err) 132 } 133 _, err = io.Copy(w, r) 134 cerr := w.Close() 135 if err != nil { 136 return err 137 } 138 return cerr 139 } 140 141 // createProject generates the files required for xcodebuild test to run a 142 // Objective-C testfile with a gomobile bind framework. 143 func createProject(dir, testfile, framework string) error { 144 for _, d := range []string{"xcodetest", "xcodetest.xcodeproj/xcshareddata/xcschemes", "xcodetestTests", "xcodetestUITests"} { 145 if err := os.MkdirAll(filepath.Join(dir, d), 0700); err != nil { 146 return err 147 } 148 } 149 files := []struct { 150 path string 151 content string 152 }{ 153 {"xcodetest/Info.plist", infoPlist}, 154 {"xcodetest.xcodeproj/project.pbxproj", fmt.Sprintf(pbxproj, testfile, framework)}, 155 {"xcodetest.xcodeproj/xcshareddata/xcschemes/xcodetest.xcscheme", xcodescheme}, 156 {"xcodetestTests/Info.plist", testInfoPlist}, 157 // For UI tests. Only UI tests run on a real idevice. 158 {"xcodetestUITests/Info.plist", testInfoPlist}, 159 {"xcodetest/AppDelegate.h", appdelegateh}, 160 {"xcodetest/main.m", mainm}, 161 {"xcodetest/AppDelegate.m", appdelegatem}, 162 } 163 for _, f := range files { 164 if err := ioutil.WriteFile(filepath.Join(dir, f.path), []byte(f.content), 0700); err != nil { 165 return err 166 } 167 } 168 return nil 169 } 170 171 const infoPlist = `<?xml version="1.0" encoding="UTF-8"?> 172 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 173 <plist version="1.0"> 174 <dict> 175 <key>CFBundleDevelopmentRegion</key> 176 <string>en</string> 177 <key>CFBundleExecutable</key> 178 <string>$(EXECUTABLE_NAME)</string> 179 <key>CFBundleIdentifier</key> 180 <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 181 <key>CFBundleInfoDictionaryVersion</key> 182 <string>6.0</string> 183 <key>CFBundleName</key> 184 <string>$(PRODUCT_NAME)</string> 185 <key>CFBundlePackageType</key> 186 <string>APPL</string> 187 <key>CFBundleShortVersionString</key> 188 <string>1.0</string> 189 <key>CFBundleSignature</key> 190 <string>????</string> 191 <key>CFBundleVersion</key> 192 <string>1</string> 193 <key>LSRequiresIPhoneOS</key> 194 <true/> 195 <key>UIRequiredDeviceCapabilities</key> 196 <array> 197 <string>armv7</string> 198 </array> 199 <key>UISupportedInterfaceOrientations</key> 200 <array> 201 <string>UIInterfaceOrientationPortrait</string> 202 <string>UIInterfaceOrientationLandscapeLeft</string> 203 <string>UIInterfaceOrientationLandscapeRight</string> 204 </array> 205 <key>UISupportedInterfaceOrientations~ipad</key> 206 <array> 207 <string>UIInterfaceOrientationPortrait</string> 208 <string>UIInterfaceOrientationPortraitUpsideDown</string> 209 <string>UIInterfaceOrientationLandscapeLeft</string> 210 <string>UIInterfaceOrientationLandscapeRight</string> 211 </array> 212 </dict> 213 </plist>` 214 215 const testInfoPlist = `<?xml version="1.0" encoding="UTF-8"?> 216 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> 217 <plist version="1.0"> 218 <dict> 219 <key>CFBundleDevelopmentRegion</key> 220 <string>en</string> 221 <key>CFBundleExecutable</key> 222 <string>$(EXECUTABLE_NAME)</string> 223 <key>CFBundleIdentifier</key> 224 <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> 225 <key>CFBundleInfoDictionaryVersion</key> 226 <string>6.0</string> 227 <key>CFBundleName</key> 228 <string>$(PRODUCT_NAME)</string> 229 <key>CFBundlePackageType</key> 230 <string>BNDL</string> 231 <key>CFBundleShortVersionString</key> 232 <string>1.0</string> 233 <key>CFBundleSignature</key> 234 <string>????</string> 235 <key>CFBundleVersion</key> 236 <string>1</string> 237 </dict> 238 </plist>` 239 240 const pbxproj = `// !$*UTF8*$! 241 { 242 archiveVersion = 1; 243 classes = { 244 }; 245 objectVersion = 50; 246 objects = { 247 248 /* Begin PBXBuildFile section */ 249 642D058D2094883B00FE587C /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 642D058C2094883B00FE587C /* AppDelegate.m */; }; 250 642D05952094883C00FE587C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 642D05942094883C00FE587C /* Assets.xcassets */; }; 251 642D059B2094883C00FE587C /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 642D059A2094883C00FE587C /* main.m */; }; 252 642D05A52094883C00FE587C /* xcodetestTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 642D05A42094883C00FE587C /* xcodetestTests.m */; }; 253 642D05B02094883C00FE587C /* xcodetestUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = 642D05AF2094883C00FE587C /* xcodetestUITests.m */; }; 254 642D05BE209488E400FE587C /* Testpkg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 642D05BD209488E400FE587C /* Testpkg.framework */; }; 255 642D05BF209488E400FE587C /* Testpkg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 642D05BD209488E400FE587C /* Testpkg.framework */; }; 256 642D05C0209488E400FE587C /* Testpkg.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 642D05BD209488E400FE587C /* Testpkg.framework */; }; 257 /* End PBXBuildFile section */ 258 259 /* Begin PBXContainerItemProxy section */ 260 642D05A12094883C00FE587C /* PBXContainerItemProxy */ = { 261 isa = PBXContainerItemProxy; 262 containerPortal = 642D05802094883B00FE587C /* Project object */; 263 proxyType = 1; 264 remoteGlobalIDString = 642D05872094883B00FE587C; 265 remoteInfo = xcodetest; 266 }; 267 642D05AC2094883C00FE587C /* PBXContainerItemProxy */ = { 268 isa = PBXContainerItemProxy; 269 containerPortal = 642D05802094883B00FE587C /* Project object */; 270 proxyType = 1; 271 remoteGlobalIDString = 642D05872094883B00FE587C; 272 remoteInfo = xcodetest; 273 }; 274 /* End PBXContainerItemProxy section */ 275 276 /* Begin PBXFileReference section */ 277 642D05882094883B00FE587C /* xcodetest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = xcodetest.app; sourceTree = BUILT_PRODUCTS_DIR; }; 278 642D058B2094883B00FE587C /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; 279 642D058C2094883B00FE587C /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; 280 642D05942094883C00FE587C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; }; 281 642D05992094883C00FE587C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 282 642D059A2094883C00FE587C /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; }; 283 642D05A02094883C00FE587C /* xcodetestTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = xcodetestTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 284 642D05A42094883C00FE587C /* xcodetestTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ../%[1]s; sourceTree = "<group>"; }; 285 642D05A62094883C00FE587C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 286 642D05AB2094883C00FE587C /* xcodetestUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = xcodetestUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; 287 642D05AF2094883C00FE587C /* xcodetestUITests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ../%[1]s; sourceTree = "<group>"; }; 288 642D05B12094883C00FE587C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; 289 642D05BD209488E400FE587C /* Testpkg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Testpkg.framework; path = %[2]s; sourceTree = "<group>"; }; 290 /* End PBXFileReference section */ 291 292 /* Begin PBXFrameworksBuildPhase section */ 293 642D05852094883B00FE587C /* Frameworks */ = { 294 isa = PBXFrameworksBuildPhase; 295 buildActionMask = 2147483647; 296 files = ( 297 642D05BE209488E400FE587C /* Testpkg.framework in Frameworks */, 298 ); 299 runOnlyForDeploymentPostprocessing = 0; 300 }; 301 642D059D2094883C00FE587C /* Frameworks */ = { 302 isa = PBXFrameworksBuildPhase; 303 buildActionMask = 2147483647; 304 files = ( 305 642D05BF209488E400FE587C /* Testpkg.framework in Frameworks */, 306 ); 307 runOnlyForDeploymentPostprocessing = 0; 308 }; 309 642D05A82094883C00FE587C /* Frameworks */ = { 310 isa = PBXFrameworksBuildPhase; 311 buildActionMask = 2147483647; 312 files = ( 313 642D05C0209488E400FE587C /* Testpkg.framework in Frameworks */, 314 ); 315 runOnlyForDeploymentPostprocessing = 0; 316 }; 317 /* End PBXFrameworksBuildPhase section */ 318 319 /* Begin PBXGroup section */ 320 642D057F2094883B00FE587C = { 321 isa = PBXGroup; 322 children = ( 323 642D058A2094883B00FE587C /* xcodetest */, 324 642D05A32094883C00FE587C /* xcodetestTests */, 325 642D05AE2094883C00FE587C /* xcodetestUITests */, 326 642D05892094883B00FE587C /* Products */, 327 642D05BD209488E400FE587C /* Testpkg.framework */, 328 ); 329 sourceTree = "<group>"; 330 }; 331 642D05892094883B00FE587C /* Products */ = { 332 isa = PBXGroup; 333 children = ( 334 642D05882094883B00FE587C /* xcodetest.app */, 335 642D05A02094883C00FE587C /* xcodetestTests.xctest */, 336 642D05AB2094883C00FE587C /* xcodetestUITests.xctest */, 337 ); 338 name = Products; 339 sourceTree = "<group>"; 340 }; 341 642D058A2094883B00FE587C /* xcodetest */ = { 342 isa = PBXGroup; 343 children = ( 344 642D058B2094883B00FE587C /* AppDelegate.h */, 345 642D058C2094883B00FE587C /* AppDelegate.m */, 346 642D05942094883C00FE587C /* Assets.xcassets */, 347 642D05992094883C00FE587C /* Info.plist */, 348 642D059A2094883C00FE587C /* main.m */, 349 ); 350 path = xcodetest; 351 sourceTree = "<group>"; 352 }; 353 642D05A32094883C00FE587C /* xcodetestTests */ = { 354 isa = PBXGroup; 355 children = ( 356 642D05A42094883C00FE587C /* xcodetestTests.m */, 357 642D05A62094883C00FE587C /* Info.plist */, 358 ); 359 path = xcodetestTests; 360 sourceTree = "<group>"; 361 }; 362 642D05AE2094883C00FE587C /* xcodetestUITests */ = { 363 isa = PBXGroup; 364 children = ( 365 642D05AF2094883C00FE587C /* xcodetestUITests.m */, 366 642D05B12094883C00FE587C /* Info.plist */, 367 ); 368 path = xcodetestUITests; 369 sourceTree = "<group>"; 370 }; 371 /* End PBXGroup section */ 372 373 /* Begin PBXNativeTarget section */ 374 642D05872094883B00FE587C /* xcodetest */ = { 375 isa = PBXNativeTarget; 376 buildConfigurationList = 642D05B42094883C00FE587C /* Build configuration list for PBXNativeTarget "xcodetest" */; 377 buildPhases = ( 378 642D05842094883B00FE587C /* Sources */, 379 642D05852094883B00FE587C /* Frameworks */, 380 642D05862094883B00FE587C /* Resources */, 381 ); 382 buildRules = ( 383 ); 384 dependencies = ( 385 ); 386 name = xcodetest; 387 productName = xcodetest; 388 productReference = 642D05882094883B00FE587C /* xcodetest.app */; 389 productType = "com.apple.product-type.application"; 390 }; 391 642D059F2094883C00FE587C /* xcodetestTests */ = { 392 isa = PBXNativeTarget; 393 buildConfigurationList = 642D05B72094883C00FE587C /* Build configuration list for PBXNativeTarget "xcodetestTests" */; 394 buildPhases = ( 395 642D059C2094883C00FE587C /* Sources */, 396 642D059D2094883C00FE587C /* Frameworks */, 397 642D059E2094883C00FE587C /* Resources */, 398 ); 399 buildRules = ( 400 ); 401 dependencies = ( 402 642D05A22094883C00FE587C /* PBXTargetDependency */, 403 ); 404 name = xcodetestTests; 405 productName = xcodetestTests; 406 productReference = 642D05A02094883C00FE587C /* xcodetestTests.xctest */; 407 productType = "com.apple.product-type.bundle.unit-test"; 408 }; 409 642D05AA2094883C00FE587C /* xcodetestUITests */ = { 410 isa = PBXNativeTarget; 411 buildConfigurationList = 642D05BA2094883C00FE587C /* Build configuration list for PBXNativeTarget "xcodetestUITests" */; 412 buildPhases = ( 413 642D05A72094883C00FE587C /* Sources */, 414 642D05A82094883C00FE587C /* Frameworks */, 415 642D05A92094883C00FE587C /* Resources */, 416 ); 417 buildRules = ( 418 ); 419 dependencies = ( 420 642D05AD2094883C00FE587C /* PBXTargetDependency */, 421 ); 422 name = xcodetestUITests; 423 productName = xcodetestUITests; 424 productReference = 642D05AB2094883C00FE587C /* xcodetestUITests.xctest */; 425 productType = "com.apple.product-type.bundle.ui-testing"; 426 }; 427 /* End PBXNativeTarget section */ 428 429 /* Begin PBXProject section */ 430 642D05802094883B00FE587C /* Project object */ = { 431 isa = PBXProject; 432 attributes = { 433 LastUpgradeCheck = 0930; 434 ORGANIZATIONNAME = golang; 435 TargetAttributes = { 436 642D05872094883B00FE587C = { 437 CreatedOnToolsVersion = 9.3; 438 }; 439 642D059F2094883C00FE587C = { 440 CreatedOnToolsVersion = 9.3; 441 TestTargetID = 642D05872094883B00FE587C; 442 }; 443 642D05AA2094883C00FE587C = { 444 CreatedOnToolsVersion = 9.3; 445 TestTargetID = 642D05872094883B00FE587C; 446 }; 447 }; 448 }; 449 buildConfigurationList = 642D05832094883B00FE587C /* Build configuration list for PBXProject "xcodetest" */; 450 compatibilityVersion = "Xcode 9.3"; 451 developmentRegion = en; 452 hasScannedForEncodings = 0; 453 knownRegions = ( 454 en, 455 Base, 456 ); 457 mainGroup = 642D057F2094883B00FE587C; 458 productRefGroup = 642D05892094883B00FE587C /* Products */; 459 projectDirPath = ""; 460 projectRoot = ""; 461 targets = ( 462 642D05872094883B00FE587C /* xcodetest */, 463 642D059F2094883C00FE587C /* xcodetestTests */, 464 642D05AA2094883C00FE587C /* xcodetestUITests */, 465 ); 466 }; 467 /* End PBXProject section */ 468 469 /* Begin PBXResourcesBuildPhase section */ 470 642D05862094883B00FE587C /* Resources */ = { 471 isa = PBXResourcesBuildPhase; 472 buildActionMask = 2147483647; 473 files = ( 474 642D05952094883C00FE587C /* Assets.xcassets in Resources */, 475 ); 476 runOnlyForDeploymentPostprocessing = 0; 477 }; 478 642D059E2094883C00FE587C /* Resources */ = { 479 isa = PBXResourcesBuildPhase; 480 buildActionMask = 2147483647; 481 files = ( 482 ); 483 runOnlyForDeploymentPostprocessing = 0; 484 }; 485 642D05A92094883C00FE587C /* Resources */ = { 486 isa = PBXResourcesBuildPhase; 487 buildActionMask = 2147483647; 488 files = ( 489 ); 490 runOnlyForDeploymentPostprocessing = 0; 491 }; 492 /* End PBXResourcesBuildPhase section */ 493 494 /* Begin PBXSourcesBuildPhase section */ 495 642D05842094883B00FE587C /* Sources */ = { 496 isa = PBXSourcesBuildPhase; 497 buildActionMask = 2147483647; 498 files = ( 499 642D059B2094883C00FE587C /* main.m in Sources */, 500 642D058D2094883B00FE587C /* AppDelegate.m in Sources */, 501 ); 502 runOnlyForDeploymentPostprocessing = 0; 503 }; 504 642D059C2094883C00FE587C /* Sources */ = { 505 isa = PBXSourcesBuildPhase; 506 buildActionMask = 2147483647; 507 files = ( 508 642D05A52094883C00FE587C /* xcodetestTests.m in Sources */, 509 ); 510 runOnlyForDeploymentPostprocessing = 0; 511 }; 512 642D05A72094883C00FE587C /* Sources */ = { 513 isa = PBXSourcesBuildPhase; 514 buildActionMask = 2147483647; 515 files = ( 516 642D05B02094883C00FE587C /* xcodetestUITests.m in Sources */, 517 ); 518 runOnlyForDeploymentPostprocessing = 0; 519 }; 520 /* End PBXSourcesBuildPhase section */ 521 522 /* Begin PBXTargetDependency section */ 523 642D05A22094883C00FE587C /* PBXTargetDependency */ = { 524 isa = PBXTargetDependency; 525 target = 642D05872094883B00FE587C /* xcodetest */; 526 targetProxy = 642D05A12094883C00FE587C /* PBXContainerItemProxy */; 527 }; 528 642D05AD2094883C00FE587C /* PBXTargetDependency */ = { 529 isa = PBXTargetDependency; 530 target = 642D05872094883B00FE587C /* xcodetest */; 531 targetProxy = 642D05AC2094883C00FE587C /* PBXContainerItemProxy */; 532 }; 533 /* End PBXTargetDependency section */ 534 535 /* Begin XCBuildConfiguration section */ 536 642D05B22094883C00FE587C /* Debug */ = { 537 isa = XCBuildConfiguration; 538 buildSettings = { 539 ALWAYS_SEARCH_USER_PATHS = NO; 540 CLANG_ANALYZER_NONNULL = YES; 541 CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 542 CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 543 CLANG_CXX_LIBRARY = "libc++"; 544 CLANG_ENABLE_MODULES = YES; 545 CLANG_ENABLE_OBJC_ARC = YES; 546 CLANG_ENABLE_OBJC_WEAK = YES; 547 CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 548 CLANG_WARN_BOOL_CONVERSION = YES; 549 CLANG_WARN_COMMA = YES; 550 CLANG_WARN_CONSTANT_CONVERSION = YES; 551 CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 552 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 553 CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 554 CLANG_WARN_EMPTY_BODY = YES; 555 CLANG_WARN_ENUM_CONVERSION = YES; 556 CLANG_WARN_INFINITE_RECURSION = YES; 557 CLANG_WARN_INT_CONVERSION = YES; 558 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 559 CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 560 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 561 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 562 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 563 CLANG_WARN_STRICT_PROTOTYPES = YES; 564 CLANG_WARN_SUSPICIOUS_MOVE = YES; 565 CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 566 CLANG_WARN_UNREACHABLE_CODE = YES; 567 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 568 CODE_SIGN_IDENTITY = "iPhone Developer"; 569 COPY_PHASE_STRIP = NO; 570 DEBUG_INFORMATION_FORMAT = dwarf; 571 ENABLE_STRICT_OBJC_MSGSEND = YES; 572 ENABLE_TESTABILITY = YES; 573 GCC_C_LANGUAGE_STANDARD = gnu11; 574 GCC_DYNAMIC_NO_PIC = NO; 575 GCC_NO_COMMON_BLOCKS = YES; 576 GCC_OPTIMIZATION_LEVEL = 0; 577 GCC_PREPROCESSOR_DEFINITIONS = ( 578 "DEBUG=1", 579 "$(inherited)", 580 ); 581 GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 582 GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 583 GCC_WARN_UNDECLARED_SELECTOR = YES; 584 GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 585 GCC_WARN_UNUSED_FUNCTION = YES; 586 GCC_WARN_UNUSED_VARIABLE = YES; 587 IPHONEOS_DEPLOYMENT_TARGET = 11.3; 588 MTL_ENABLE_DEBUG_INFO = YES; 589 ONLY_ACTIVE_ARCH = YES; 590 SDKROOT = iphoneos; 591 }; 592 name = Debug; 593 }; 594 642D05B32094883C00FE587C /* Release */ = { 595 isa = XCBuildConfiguration; 596 buildSettings = { 597 ALWAYS_SEARCH_USER_PATHS = NO; 598 CLANG_ANALYZER_NONNULL = YES; 599 CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 600 CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 601 CLANG_CXX_LIBRARY = "libc++"; 602 CLANG_ENABLE_MODULES = YES; 603 CLANG_ENABLE_OBJC_ARC = YES; 604 CLANG_ENABLE_OBJC_WEAK = YES; 605 CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 606 CLANG_WARN_BOOL_CONVERSION = YES; 607 CLANG_WARN_COMMA = YES; 608 CLANG_WARN_CONSTANT_CONVERSION = YES; 609 CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 610 CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 611 CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 612 CLANG_WARN_EMPTY_BODY = YES; 613 CLANG_WARN_ENUM_CONVERSION = YES; 614 CLANG_WARN_INFINITE_RECURSION = YES; 615 CLANG_WARN_INT_CONVERSION = YES; 616 CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 617 CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 618 CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 619 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 620 CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 621 CLANG_WARN_STRICT_PROTOTYPES = YES; 622 CLANG_WARN_SUSPICIOUS_MOVE = YES; 623 CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 624 CLANG_WARN_UNREACHABLE_CODE = YES; 625 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 626 CODE_SIGN_IDENTITY = "iPhone Developer"; 627 COPY_PHASE_STRIP = NO; 628 DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 629 ENABLE_NS_ASSERTIONS = NO; 630 ENABLE_STRICT_OBJC_MSGSEND = YES; 631 GCC_C_LANGUAGE_STANDARD = gnu11; 632 GCC_NO_COMMON_BLOCKS = YES; 633 GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 634 GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 635 GCC_WARN_UNDECLARED_SELECTOR = YES; 636 GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 637 GCC_WARN_UNUSED_FUNCTION = YES; 638 GCC_WARN_UNUSED_VARIABLE = YES; 639 IPHONEOS_DEPLOYMENT_TARGET = 11.3; 640 MTL_ENABLE_DEBUG_INFO = NO; 641 SDKROOT = iphoneos; 642 VALIDATE_PRODUCT = YES; 643 }; 644 name = Release; 645 }; 646 642D05B52094883C00FE587C /* Debug */ = { 647 isa = XCBuildConfiguration; 648 buildSettings = { 649 CODE_SIGN_STYLE = Automatic; 650 FRAMEWORK_SEARCH_PATHS = ( 651 "$(inherited)", 652 "$(PROJECT_DIR)/xcodetest", 653 ); 654 INFOPLIST_FILE = xcodetest/Info.plist; 655 LD_RUNPATH_SEARCH_PATHS = ( 656 "$(inherited)", 657 "@executable_path/Frameworks", 658 ); 659 PRODUCT_BUNDLE_IDENTIFIER = org.golang.xcodetest; 660 PRODUCT_NAME = "$(TARGET_NAME)"; 661 TARGETED_DEVICE_FAMILY = "1,2"; 662 }; 663 name = Debug; 664 }; 665 642D05B62094883C00FE587C /* Release */ = { 666 isa = XCBuildConfiguration; 667 buildSettings = { 668 CODE_SIGN_STYLE = Automatic; 669 FRAMEWORK_SEARCH_PATHS = ( 670 "$(inherited)", 671 "$(PROJECT_DIR)/xcodetest", 672 ); 673 INFOPLIST_FILE = xcodetest/Info.plist; 674 LD_RUNPATH_SEARCH_PATHS = ( 675 "$(inherited)", 676 "@executable_path/Frameworks", 677 ); 678 PRODUCT_BUNDLE_IDENTIFIER = org.golang.xcodetest; 679 PRODUCT_NAME = "$(TARGET_NAME)"; 680 TARGETED_DEVICE_FAMILY = "1,2"; 681 }; 682 name = Release; 683 }; 684 642D05B82094883C00FE587C /* Debug */ = { 685 isa = XCBuildConfiguration; 686 buildSettings = { 687 BUNDLE_LOADER = "$(TEST_HOST)"; 688 CODE_SIGN_STYLE = Automatic; 689 FRAMEWORK_SEARCH_PATHS = ( 690 "$(inherited)", 691 "$(PROJECT_DIR)/xcodetest", 692 ); 693 INFOPLIST_FILE = xcodetestTests/Info.plist; 694 LD_RUNPATH_SEARCH_PATHS = ( 695 "$(inherited)", 696 "@executable_path/Frameworks", 697 "@loader_path/Frameworks", 698 ); 699 PRODUCT_BUNDLE_IDENTIFIER = org.golang.xcodetestTests; 700 PRODUCT_NAME = "$(TARGET_NAME)"; 701 TARGETED_DEVICE_FAMILY = "1,2"; 702 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xcodetest.app/xcodetest"; 703 }; 704 name = Debug; 705 }; 706 642D05B92094883C00FE587C /* Release */ = { 707 isa = XCBuildConfiguration; 708 buildSettings = { 709 BUNDLE_LOADER = "$(TEST_HOST)"; 710 CODE_SIGN_STYLE = Automatic; 711 FRAMEWORK_SEARCH_PATHS = ( 712 "$(inherited)", 713 "$(PROJECT_DIR)/xcodetest", 714 ); 715 INFOPLIST_FILE = xcodetestTests/Info.plist; 716 LD_RUNPATH_SEARCH_PATHS = ( 717 "$(inherited)", 718 "@executable_path/Frameworks", 719 "@loader_path/Frameworks", 720 ); 721 PRODUCT_BUNDLE_IDENTIFIER = org.golang.xcodetestTests; 722 PRODUCT_NAME = "$(TARGET_NAME)"; 723 TARGETED_DEVICE_FAMILY = "1,2"; 724 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/xcodetest.app/xcodetest"; 725 }; 726 name = Release; 727 }; 728 642D05BB2094883C00FE587C /* Debug */ = { 729 isa = XCBuildConfiguration; 730 buildSettings = { 731 CODE_SIGN_STYLE = Automatic; 732 FRAMEWORK_SEARCH_PATHS = ( 733 "$(inherited)", 734 "$(PROJECT_DIR)/xcodetest", 735 ); 736 INFOPLIST_FILE = xcodetestUITests/Info.plist; 737 LD_RUNPATH_SEARCH_PATHS = ( 738 "$(inherited)", 739 "@executable_path/Frameworks", 740 "@loader_path/Frameworks", 741 ); 742 PRODUCT_BUNDLE_IDENTIFIER = org.golang.xcodetestUITests; 743 PRODUCT_NAME = "$(TARGET_NAME)"; 744 TARGETED_DEVICE_FAMILY = "1,2"; 745 TEST_TARGET_NAME = xcodetest; 746 }; 747 name = Debug; 748 }; 749 642D05BC2094883C00FE587C /* Release */ = { 750 isa = XCBuildConfiguration; 751 buildSettings = { 752 CODE_SIGN_STYLE = Automatic; 753 FRAMEWORK_SEARCH_PATHS = ( 754 "$(inherited)", 755 "$(PROJECT_DIR)/xcodetest", 756 ); 757 INFOPLIST_FILE = xcodetestUITests/Info.plist; 758 LD_RUNPATH_SEARCH_PATHS = ( 759 "$(inherited)", 760 "@executable_path/Frameworks", 761 "@loader_path/Frameworks", 762 ); 763 PRODUCT_BUNDLE_IDENTIFIER = org.golang.xcodetestUITests; 764 PRODUCT_NAME = "$(TARGET_NAME)"; 765 TARGETED_DEVICE_FAMILY = "1,2"; 766 TEST_TARGET_NAME = xcodetest; 767 }; 768 name = Release; 769 }; 770 /* End XCBuildConfiguration section */ 771 772 /* Begin XCConfigurationList section */ 773 642D05832094883B00FE587C /* Build configuration list for PBXProject "xcodetest" */ = { 774 isa = XCConfigurationList; 775 buildConfigurations = ( 776 642D05B22094883C00FE587C /* Debug */, 777 642D05B32094883C00FE587C /* Release */, 778 ); 779 defaultConfigurationIsVisible = 0; 780 defaultConfigurationName = Release; 781 }; 782 642D05B42094883C00FE587C /* Build configuration list for PBXNativeTarget "xcodetest" */ = { 783 isa = XCConfigurationList; 784 buildConfigurations = ( 785 642D05B52094883C00FE587C /* Debug */, 786 642D05B62094883C00FE587C /* Release */, 787 ); 788 defaultConfigurationIsVisible = 0; 789 defaultConfigurationName = Release; 790 }; 791 642D05B72094883C00FE587C /* Build configuration list for PBXNativeTarget "xcodetestTests" */ = { 792 isa = XCConfigurationList; 793 buildConfigurations = ( 794 642D05B82094883C00FE587C /* Debug */, 795 642D05B92094883C00FE587C /* Release */, 796 ); 797 defaultConfigurationIsVisible = 0; 798 defaultConfigurationName = Release; 799 }; 800 642D05BA2094883C00FE587C /* Build configuration list for PBXNativeTarget "xcodetestUITests" */ = { 801 isa = XCConfigurationList; 802 buildConfigurations = ( 803 642D05BB2094883C00FE587C /* Debug */, 804 642D05BC2094883C00FE587C /* Release */, 805 ); 806 defaultConfigurationIsVisible = 0; 807 defaultConfigurationName = Release; 808 }; 809 /* End XCConfigurationList section */ 810 }; 811 rootObject = 642D05802094883B00FE587C /* Project object */; 812 }` 813 814 const xcodescheme = `<?xml version="1.0" encoding="UTF-8"?> 815 <Scheme 816 LastUpgradeVersion = "0930" 817 version = "1.3"> 818 <BuildAction 819 parallelizeBuildables = "YES" 820 buildImplicitDependencies = "YES"> 821 <BuildActionEntries> 822 <BuildActionEntry 823 buildForTesting = "YES" 824 buildForRunning = "YES" 825 buildForProfiling = "YES" 826 buildForArchiving = "YES" 827 buildForAnalyzing = "YES"> 828 <BuildableReference 829 BuildableIdentifier = "primary" 830 BlueprintIdentifier = "642D05872094883B00FE587C" 831 BuildableName = "xcodetest.app" 832 BlueprintName = "xcodetest" 833 ReferencedContainer = "container:xcodetest.xcodeproj"> 834 </BuildableReference> 835 </BuildActionEntry> 836 </BuildActionEntries> 837 </BuildAction> 838 <TestAction 839 buildConfiguration = "Debug" 840 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 841 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 842 shouldUseLaunchSchemeArgsEnv = "YES"> 843 <Testables> 844 <TestableReference 845 skipped = "NO"> 846 <BuildableReference 847 BuildableIdentifier = "primary" 848 BlueprintIdentifier = "642D059F2094883C00FE587C" 849 BuildableName = "xcodetestTests.xctest" 850 BlueprintName = "xcodetestTests" 851 ReferencedContainer = "container:xcodetest.xcodeproj"> 852 </BuildableReference> 853 </TestableReference> 854 <TestableReference 855 skipped = "NO"> 856 <BuildableReference 857 BuildableIdentifier = "primary" 858 BlueprintIdentifier = "642D05AA2094883C00FE587C" 859 BuildableName = "xcodetestUITests.xctest" 860 BlueprintName = "xcodetestUITests" 861 ReferencedContainer = "container:xcodetest.xcodeproj"> 862 </BuildableReference> 863 </TestableReference> 864 </Testables> 865 <MacroExpansion> 866 <BuildableReference 867 BuildableIdentifier = "primary" 868 BlueprintIdentifier = "642D05872094883B00FE587C" 869 BuildableName = "xcodetest.app" 870 BlueprintName = "xcodetest" 871 ReferencedContainer = "container:xcodetest.xcodeproj"> 872 </BuildableReference> 873 </MacroExpansion> 874 <AdditionalOptions> 875 </AdditionalOptions> 876 </TestAction> 877 <LaunchAction 878 buildConfiguration = "Debug" 879 selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" 880 selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" 881 launchStyle = "0" 882 useCustomWorkingDirectory = "NO" 883 ignoresPersistentStateOnLaunch = "NO" 884 debugDocumentVersioning = "YES" 885 debugServiceExtension = "internal" 886 allowLocationSimulation = "YES"> 887 <BuildableProductRunnable 888 runnableDebuggingMode = "0"> 889 <BuildableReference 890 BuildableIdentifier = "primary" 891 BlueprintIdentifier = "642D05872094883B00FE587C" 892 BuildableName = "xcodetest.app" 893 BlueprintName = "xcodetest" 894 ReferencedContainer = "container:xcodetest.xcodeproj"> 895 </BuildableReference> 896 </BuildableProductRunnable> 897 <AdditionalOptions> 898 </AdditionalOptions> 899 </LaunchAction> 900 <ProfileAction 901 buildConfiguration = "Release" 902 shouldUseLaunchSchemeArgsEnv = "YES" 903 savedToolIdentifier = "" 904 useCustomWorkingDirectory = "NO" 905 debugDocumentVersioning = "YES"> 906 <BuildableProductRunnable 907 runnableDebuggingMode = "0"> 908 <BuildableReference 909 BuildableIdentifier = "primary" 910 BlueprintIdentifier = "642D05872094883B00FE587C" 911 BuildableName = "xcodetest.app" 912 BlueprintName = "xcodetest" 913 ReferencedContainer = "container:xcodetest.xcodeproj"> 914 </BuildableReference> 915 </BuildableProductRunnable> 916 </ProfileAction> 917 <AnalyzeAction 918 buildConfiguration = "Debug"> 919 </AnalyzeAction> 920 <ArchiveAction 921 buildConfiguration = "Release" 922 revealArchiveInOrganizer = "YES"> 923 </ArchiveAction> 924 </Scheme>` 925 926 const appdelegateh = `#import <UIKit/UIKit.h> 927 928 @interface AppDelegate : UIResponder <UIApplicationDelegate> 929 930 @property (strong, nonatomic) UIWindow *window; 931 932 @end` 933 934 const appdelegatem = `#import "AppDelegate.h" 935 936 @interface AppDelegate () 937 938 @end 939 940 @implementation AppDelegate 941 942 943 - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 944 return YES; 945 } 946 947 - (void)applicationWillResignActive:(UIApplication *)application { 948 } 949 950 - (void)applicationDidEnterBackground:(UIApplication *)application { 951 } 952 953 - (void)applicationWillEnterForeground:(UIApplication *)application { 954 } 955 956 - (void)applicationDidBecomeActive:(UIApplication *)application { 957 } 958 959 - (void)applicationWillTerminate:(UIApplication *)application { 960 } 961 962 @end` 963 964 const mainm = `#import <UIKit/UIKit.h> 965 #import "AppDelegate.h" 966 967 int main(int argc, char * argv[]) { 968 @autoreleasepool { 969 return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 970 } 971 }`