Debian Codegraph @

bind/objc/seq_test.go

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