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