nitc: the iOS platform use app.nit annotations
[nit.git] / src / platform / xcode_templates.nit
1 # This file is part of NIT ( http://www.nitlanguage.org ).
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Templates and other services to create XCode projects
16 module xcode_templates
17
18 import template
19
20 import platform
21 import compiler::abstract_compiler
22
23 redef class Sys
24 # Map to identify the PBX file type for a given file extension
25 private var pbx_file_types: Map[String, String] is lazy do
26 var map = new HashMap[String, String]
27
28 # Source code
29 map["m"] = "sourcecode.c.objc"
30 map["c"] = "sourcecode.c.c"
31 map["h"] = "sourcecode.c.h"
32 map["cpp"] = "sourcecode.cpp.cpp"
33 map["hpp"] = "sourcecode.cpp.h"
34 map["vsh"] = "sourcecode.glsl"
35 map["fsh"] = "sourcecode.glsl"
36
37 # Images
38 map["png"] = "image.png"
39 map["gif"] = "image.gif"
40 map["jpg"] = "image.jpeg"
41 map["jpeg"] = "image.jpeg"
42 map["pdf"] = "image.pdf"
43 map["ico"] = "image.ico"
44
45 # Others
46 map["app"] = "wrapper.application"
47 map["plist"] = "text.plist.xml"
48 map["storyboard"] = "file.storyboard"
49 map["xib"] = "file.xib"
50 map["xcassets"] = "folder.assetcatalog"
51 map["xctest"] = "wrapper.cfbundle"
52
53 return map
54 end
55
56 # Generator of PBX UUIDs quique to an execution of the compiler
57 private var pbx_uuid_generator = new PbxUUIDGenerator is lazy
58 end
59
60 # Generator of PBX UUIDs
61 #
62 # PBX UUID are composed of 24 hex characters.
63 # They only need to be unique within the same project.
64 #
65 # This implementation simply counts upward from 0.
66 class PbxUUIDGenerator
67 private var seed = 0
68
69 # Generate a new UUID
70 fun next_uuid: String
71 do
72 seed += 1
73
74 var hex_val = seed.to_hex.to_upper
75 return "0"*(24-hex_val.length) + hex_val
76 end
77 end
78
79 # Reference to a file for the PBX format of a project file
80 #
81 # TODO create subclasses for different file types, this is currently for
82 # compilable source files only.
83 class PbxFile
84
85 # Path to `self`
86 var path: String
87
88 # UUID for build elements
89 private var build_uuid: String = sys.pbx_uuid_generator.next_uuid is lazy
90
91 # File reference UUID
92 private var ref_uuid: String = sys.pbx_uuid_generator.next_uuid is lazy
93
94 # Documentation to add besides this file in the template
95 private fun doc: String do return path
96
97 # PBX file type for `self`
98 fun file_type: String
99 do
100 var map = sys.pbx_file_types
101 var ext = path.file_extension
102 if ext != null and map.keys.has(ext) then return map[ext]
103 return "unknown"
104 end
105
106 # PBX description of this file
107 private fun description: Writable do return """
108 {{{ref_uuid}}} /* {{{doc}}} */ = {
109 isa = PBXFileReference;
110 fileEncoding = 4;
111 lastKnownFileType = {{{file_type}}};
112 path = {{{path}}};
113 sourceTree = "<group>";
114 };
115 """
116
117 private fun add_to_project(project: PbxprojectTemplate)
118 do
119 project.source_files.add self
120 project.files.add self
121 end
122 end
123
124 # Template for a PBX project file, usually a `project.pbcproj`
125 #
126 # This file list all information required to build an XCode project.
127 # It would usually be written and read by XCode.
128 # From the command line, xcodebuild can read this file but not write it.
129 #
130 # Information in the file (simplified list):
131 #
132 # * Compilable source files
133 # * Asset files
134 # * Build configurations (Release and debug modes, cflags, etc.)
135 # * List of files composing the project
136 class PbxprojectTemplate
137 super Template
138
139 # Name of the project
140 var name: String
141
142 # All body/implementation source files to be compiled
143 private var source_files = new Array[PbxFile]
144
145 # All asset files added to the app package
146 private var asset_files = new Array[PbxFile]
147
148 # All files used by this project
149 private var files = new Array[PbxFile]
150
151 # Add `file` to this project
152 fun add_file(file: PbxFile) do file.add_to_project(self)
153
154 redef fun rendering
155 do
156 add """
157 // !$*UTF8*$!
158 {
159 archiveVersion = 1;
160 classes = {
161 };
162 objectVersion = 46;
163 objects = {
164
165 /* Begin PBXBuildFile section */
166 """
167
168 # List build files (compilable sources and assets) with their reference UUID
169 for array in [source_files, asset_files] do for file in array do add """
170 {{{file.build_uuid}}} /* {{{file.doc}}} */ = {
171 isa = PBXBuildFile;
172 fileRef = {{{file.ref_uuid}}} /* {{{file.doc}}} */;
173 };
174 """
175
176 add """
177 /* End PBXBuildFile section */
178
179 /* Begin PBXContainerItemProxy section */
180 AF9F83EA1A5F0D21004B62C0 /* PBXContainerItemProxy */ = {
181 isa = PBXContainerItemProxy;
182 containerPortal = AF9F83C41A5F0D21004B62C0 /* Project object */;
183 proxyType = 1;
184 remoteGlobalIDString = AF9F83CB1A5F0D21004B62C0;
185 remoteInfo = {{{name}}};
186 };
187 /* End PBXContainerItemProxy section */
188
189 /* Begin PBXFileReference section */
190 /* Static generated files */
191 AF9F83CC1A5F0D21004B62C0 /* {{{name}}}.app */ = {
192 isa = PBXFileReference;
193 explicitFileType = wrapper.application;
194 includeInIndex = 0;
195 path = {{{name}}}.app;
196 sourceTree = BUILT_PRODUCTS_DIR;
197 };
198 AF9F83D01A5F0D21004B62C0 /* Info.plist */ = {
199 isa = PBXFileReference;
200 lastKnownFileType = text.plist.xml;
201 path = Info.plist;
202 sourceTree = "<group>";
203 };
204 AF9F83DE1A5F0D21004B62C0 /* Base */ = {
205 isa = PBXFileReference;
206 lastKnownFileType = file.storyboard;
207 name = Base;
208 path = Base.lproj/Main.storyboard;
209 sourceTree = "<group>";
210 };
211 AF9F83E01A5F0D21004B62C0 /* Images.xcassets */ = {
212 isa = PBXFileReference;
213 lastKnownFileType = folder.assetcatalog;
214 path = Images.xcassets;
215 sourceTree = "<group>";
216 };
217 AF9F83E31A5F0D21004B62C0 /* Base */ = {
218 isa = PBXFileReference;
219 lastKnownFileType = file.xib;
220 name = Base;
221 path = Base.lproj/LaunchScreen.xib;
222 sourceTree = "<group>";
223 };
224 AF9F83E91A5F0D21004B62C0 /* {{{name}}}Tests.xctest */ = {
225 isa = PBXFileReference;
226 explicitFileType = wrapper.cfbundle;
227 includeInIndex = 0;
228 path = {{{name}}}Tests.xctest;
229 sourceTree = BUILT_PRODUCTS_DIR;
230 };
231 AF9F83EE1A5F0D21004B62C0 /* Info.plist */ = {
232 isa = PBXFileReference;
233 lastKnownFileType = text.plist.xml;
234 path = Info.plist;
235 sourceTree = "<group>";
236 };
237 AF9F83EF1A5F0D21004B62C0 /* {{{name}}}Tests.m */ = {
238 isa = PBXFileReference;
239 lastKnownFileType = sourcecode.c.objc;
240 path = {{{name}}}Tests.m;
241 sourceTree = "<group>";
242 };
243
244 /* Changing generated files */
245 """
246 # Describe all known files
247 for file in files do add file.description
248
249 add """
250 /* End PBXFileReference section */
251
252 /* Begin PBXFrameworksBuildPhase section */
253 AF9F83C91A5F0D21004B62C0 /* Frameworks */ = {
254 isa = PBXFrameworksBuildPhase;
255 buildActionMask = 2147483647;
256 files = (
257 );
258 runOnlyForDeploymentPostprocessing = 0;
259 };
260 AF9F83E61A5F0D21004B62C0 /* Frameworks */ = {
261 isa = PBXFrameworksBuildPhase;
262 buildActionMask = 2147483647;
263 files = (
264 );
265 runOnlyForDeploymentPostprocessing = 0;
266 };
267 /* End PBXFrameworksBuildPhase section */
268
269 /* Begin PBXGroup section */
270 AF9F83C31A5F0D21004B62C0 = {
271 isa = PBXGroup;
272 children = (
273 AF9F83CE1A5F0D21004B62C0 /* {{{name}}} */,
274 AF9F83EC1A5F0D21004B62C0 /* {{{name}}}Tests */,
275 AF9F83CD1A5F0D21004B62C0 /* Products */,
276 );
277 sourceTree = "<group>";
278 };
279 AF9F83CD1A5F0D21004B62C0 /* Products */ = {
280 isa = PBXGroup;
281 children = (
282 AF9F83CC1A5F0D21004B62C0 /* {{{name}}}.app */,
283 AF9F83E91A5F0D21004B62C0 /* {{{name}}}Tests.xctest */,
284 );
285 name = Products;
286 sourceTree = "<group>";
287 };
288 AF9F83CE1A5F0D21004B62C0 /* {{{name}}} */ = {
289 isa = PBXGroup;
290 children = (
291 """
292 # Reference all known files
293 for file in files do add """
294 {{{file.ref_uuid}}} /* {{{file.doc}}} */,
295 """
296
297 add """
298 );
299 path = {{{name}}};
300 sourceTree = "<group>";
301 };
302 AF9F83CF1A5F0D21004B62C0 /* Supporting Files */ = {
303 isa = PBXGroup;
304 children = (
305 AF9F83D01A5F0D21004B62C0 /* Info.plist */,
306 AF9F83D11A5F0D21004B62C0 /* main.m */,
307 );
308 name = "Supporting Files";
309 sourceTree = "<group>";
310 };
311 AF9F83EC1A5F0D21004B62C0 /* {{{name}}}Tests */ = {
312 isa = PBXGroup;
313 children = (
314 AF9F83EF1A5F0D21004B62C0 /* {{{name}}}Tests.m */,
315 AF9F83ED1A5F0D21004B62C0 /* Supporting Files */,
316 );
317 path = {{{name}}}Tests;
318 sourceTree = "<group>";
319 };
320 AF9F83ED1A5F0D21004B62C0 /* Supporting Files */ = {
321 isa = PBXGroup;
322 children = (
323 AF9F83EE1A5F0D21004B62C0 /* Info.plist */,
324 );
325 name = "Supporting Files";
326 sourceTree = "<group>";
327 };
328 /* End PBXGroup section */
329
330 /* Begin PBXNativeTarget section */
331 AF9F83CB1A5F0D21004B62C0 /* {{{name}}} */ = {
332 isa = PBXNativeTarget;
333 buildConfigurationList = AF9F83F31A5F0D21004B62C0 /* Build configuration list for PBXNativeTarget "{{{name}}}" */;
334 buildPhases = (
335 AF9F83C81A5F0D21004B62C0 /* Sources */,
336 AF9F83C91A5F0D21004B62C0 /* Frameworks */,
337 AF9F83CA1A5F0D21004B62C0 /* Resources */,
338 );
339 buildRules = (
340 );
341 dependencies = (
342 );
343 name = {{{name}}};
344 productName = {{{name}}};
345 productReference = AF9F83CC1A5F0D21004B62C0 /* {{{name}}}.app */;
346 productType = "com.apple.product-type.application";
347 };
348 AF9F83E81A5F0D21004B62C0 /* {{{name}}}Tests */ = {
349 isa = PBXNativeTarget;
350 buildConfigurationList = AF9F83F61A5F0D21004B62C0 /* Build configuration list for PBXNativeTarget "{{{name}}}Tests" */;
351 buildPhases = (
352 AF9F83E51A5F0D21004B62C0 /* Sources */,
353 AF9F83E61A5F0D21004B62C0 /* Frameworks */,
354 AF9F83E71A5F0D21004B62C0 /* Resources */,
355 );
356 buildRules = (
357 );
358 dependencies = (
359 AF9F83EB1A5F0D21004B62C0 /* PBXTargetDependency */,
360 );
361 name = {{{name}}}Tests;
362 productName = {{{name}}}Tests;
363 productReference = AF9F83E91A5F0D21004B62C0 /* {{{name}}}Tests.xctest */;
364 productType = "com.apple.product-type.bundle.unit-test";
365 };
366 /* End PBXNativeTarget section */
367
368 /* Begin PBXProject section */
369 AF9F83C41A5F0D21004B62C0 /* Project object */ = {
370 isa = PBXProject;
371 attributes = {
372 LastUpgradeCheck = 0610;
373 TargetAttributes = {
374 AF9F83CB1A5F0D21004B62C0 = {
375 CreatedOnToolsVersion = 6.1.1;
376 };
377 AF9F83E81A5F0D21004B62C0 = {
378 CreatedOnToolsVersion = 6.1.1;
379 TestTargetID = AF9F83CB1A5F0D21004B62C0;
380 };
381 };
382 };
383 buildConfigurationList = AF9F83C71A5F0D21004B62C0 /* Build configuration list for PBXProject "{{{name}}}" */;
384 compatibilityVersion = "Xcode 3.2";
385 developmentRegion = English;
386 hasScannedForEncodings = 0;
387 knownRegions = (
388 en,
389 Base,
390 );
391 mainGroup = AF9F83C31A5F0D21004B62C0;
392 productRefGroup = AF9F83CD1A5F0D21004B62C0 /* Products */;
393 projectDirPath = "";
394 projectRoot = "";
395 targets = (
396 AF9F83CB1A5F0D21004B62C0 /* {{{name}}} */,
397 AF9F83E81A5F0D21004B62C0 /* {{{name}}}Tests */,
398 );
399 };
400 /* End PBXProject section */
401
402 /* Begin PBXResourcesBuildPhase section */
403 AF9F83CA1A5F0D21004B62C0 /* Resources */ = {
404 isa = PBXResourcesBuildPhase;
405 buildActionMask = 2147483647;
406 files = (
407 """
408 # Reference all asset files by their build UUID
409 for file in asset_files do add """
410 {{{file.build_uuid}}} /* {{{file.doc}}} */,
411 """
412
413 add """
414 );
415 runOnlyForDeploymentPostprocessing = 0;
416 };
417 AF9F83E71A5F0D21004B62C0 /* Resources */ = {
418 isa = PBXResourcesBuildPhase;
419 buildActionMask = 2147483647;
420 files = (
421 );
422 runOnlyForDeploymentPostprocessing = 0;
423 };
424 /* End PBXResourcesBuildPhase section */
425
426 /* Begin PBXSourcesBuildPhase section */
427 AF9F83C81A5F0D21004B62C0 /* Sources */ = {
428 isa = PBXSourcesBuildPhase;
429 buildActionMask = 2147483647;
430 files = (
431 """
432 # Reference all compilable source files by their build UUID
433 for file in source_files do add """
434 {{{file.build_uuid}}} /* {{{file.doc}}} */,
435 """
436 add """
437 );
438 runOnlyForDeploymentPostprocessing = 0;
439 };
440 AF9F83E51A5F0D21004B62C0 /* Sources */ = {
441 isa = PBXSourcesBuildPhase;
442 buildActionMask = 2147483647;
443 files = (
444 AF9F83F01A5F0D21004B62C0 /* {{{name}}}Tests.m in Sources */,
445 );
446 runOnlyForDeploymentPostprocessing = 0;
447 };
448 /* End PBXSourcesBuildPhase section */
449
450 /* Begin PBXTargetDependency section */
451 AF9F83EB1A5F0D21004B62C0 /* PBXTargetDependency */ = {
452 isa = PBXTargetDependency;
453 target = AF9F83CB1A5F0D21004B62C0 /* {{{name}}} */;
454 targetProxy = AF9F83EA1A5F0D21004B62C0 /* PBXContainerItemProxy */;
455 };
456 /* End PBXTargetDependency section */
457
458 /* Begin PBXVariantGroup section */
459 AF9F83DD1A5F0D21004B62C0 /* Main.storyboard */ = {
460 isa = PBXVariantGroup;
461 children = (
462 AF9F83DE1A5F0D21004B62C0 /* Base */,
463 );
464 name = Main.storyboard;
465 sourceTree = "<group>";
466 };
467 AF9F83E21A5F0D21004B62C0 /* LaunchScreen.xib */ = {
468 isa = PBXVariantGroup;
469 children = (
470 AF9F83E31A5F0D21004B62C0 /* Base */,
471 );
472 name = LaunchScreen.xib;
473 sourceTree = "<group>";
474 };
475 /* End PBXVariantGroup section */
476
477 /* Begin XCBuildConfiguration section */
478 AF9F83F11A5F0D21004B62C0 /* Debug */ = {
479 isa = XCBuildConfiguration;
480 buildSettings = {
481 ALWAYS_SEARCH_USER_PATHS = NO;
482 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
483 CLANG_CXX_LIBRARY = "libc++";
484 CLANG_ENABLE_MODULES = YES;
485 CLANG_ENABLE_OBJC_ARC = YES;
486 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
487 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
488 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
489 COPY_PHASE_STRIP = NO;
490 ENABLE_STRICT_OBJC_MSGSEND = YES;
491 GCC_C_LANGUAGE_STANDARD = gnu99;
492 GCC_DYNAMIC_NO_PIC = NO;
493 GCC_OPTIMIZATION_LEVEL = 0;
494 GCC_PREPROCESSOR_DEFINITIONS = (
495 "DEBUG=1",
496 "$(inherited)",
497 );
498 GCC_SYMBOLS_PRIVATE_EXTERN = NO;
499 GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
500 GCC_WARN_UNDECLARED_SELECTOR = YES;
501 GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
502 IPHONEOS_DEPLOYMENT_TARGET = 8.1;
503 MTL_ENABLE_DEBUG_INFO = YES;
504 ONLY_ACTIVE_ARCH = YES;
505 SDKROOT = iphoneos;
506 TARGETED_DEVICE_FAMILY = "1,2";
507 };
508 name = Debug;
509 };
510 AF9F83F21A5F0D21004B62C0 /* Release */ = {
511 isa = XCBuildConfiguration;
512 buildSettings = {
513 ALWAYS_SEARCH_USER_PATHS = NO;
514 CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
515 CLANG_CXX_LIBRARY = "libc++";
516 CLANG_ENABLE_MODULES = YES;
517 CLANG_ENABLE_OBJC_ARC = YES;
518 CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
519 CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
520 "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
521 COPY_PHASE_STRIP = YES;
522 ENABLE_NS_ASSERTIONS = NO;
523 ENABLE_STRICT_OBJC_MSGSEND = YES;
524 GCC_C_LANGUAGE_STANDARD = gnu99;
525 GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
526 GCC_WARN_UNDECLARED_SELECTOR = YES;
527 GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
528 IPHONEOS_DEPLOYMENT_TARGET = 8.1;
529 MTL_ENABLE_DEBUG_INFO = NO;
530 SDKROOT = iphoneos;
531 TARGETED_DEVICE_FAMILY = "1,2";
532 VALIDATE_PRODUCT = YES;
533 };
534 name = Release;
535 };
536 AF9F83F41A5F0D21004B62C0 /* Debug */ = {
537 isa = XCBuildConfiguration;
538 buildSettings = {
539 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
540 INFOPLIST_FILE = {{{name}}}/Info.plist;
541 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
542 PRODUCT_NAME = "$(TARGET_NAME)";
543 };
544 name = Debug;
545 };
546 AF9F83F51A5F0D21004B62C0 /* Release */ = {
547 isa = XCBuildConfiguration;
548 buildSettings = {
549 ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
550 INFOPLIST_FILE = {{{name}}}/Info.plist;
551 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
552 PRODUCT_NAME = "$(TARGET_NAME)";
553 };
554 name = Release;
555 };
556 AF9F83F71A5F0D21004B62C0 /* Debug */ = {
557 isa = XCBuildConfiguration;
558 buildSettings = {
559 BUNDLE_LOADER = "$(TEST_HOST)";
560 FRAMEWORK_SEARCH_PATHS = (
561 "$(SDKROOT)/Developer/Library/Frameworks",
562 "$(inherited)",
563 );
564 GCC_PREPROCESSOR_DEFINITIONS = (
565 "DEBUG=1",
566 "$(inherited)",
567 );
568 INFOPLIST_FILE = {{{name}}}Tests/Info.plist;
569 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
570 PRODUCT_NAME = "$(TARGET_NAME)";
571 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/{{{name}}}.app/{{{name}}}";
572 };
573 name = Debug;
574 };
575 AF9F83F81A5F0D21004B62C0 /* Release */ = {
576 isa = XCBuildConfiguration;
577 buildSettings = {
578 BUNDLE_LOADER = "$(TEST_HOST)";
579 FRAMEWORK_SEARCH_PATHS = (
580 "$(SDKROOT)/Developer/Library/Frameworks",
581 "$(inherited)",
582 );
583 INFOPLIST_FILE = {{{name}}}Tests/Info.plist;
584 LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
585 PRODUCT_NAME = "$(TARGET_NAME)";
586 TEST_HOST = "$(BUILT_PRODUCTS_DIR)/{{{name}}}.app/{{{name}}}";
587 };
588 name = Release;
589 };
590 /* End XCBuildConfiguration section */
591
592 /* Begin XCConfigurationList section */
593 AF9F83C71A5F0D21004B62C0 /* Build configuration list for PBXProject "{{{name}}}" */ = {
594 isa = XCConfigurationList;
595 buildConfigurations = (
596 AF9F83F11A5F0D21004B62C0 /* Debug */,
597 AF9F83F21A5F0D21004B62C0 /* Release */,
598 );
599 defaultConfigurationIsVisible = 0;
600 defaultConfigurationName = Release;
601 };
602 AF9F83F31A5F0D21004B62C0 /* Build configuration list for PBXNativeTarget "{{{name}}}" */ = {
603 isa = XCConfigurationList;
604 buildConfigurations = (
605 AF9F83F41A5F0D21004B62C0 /* Debug */,
606 AF9F83F51A5F0D21004B62C0 /* Release */,
607 );
608 defaultConfigurationIsVisible = 0;
609 };
610 AF9F83F61A5F0D21004B62C0 /* Build configuration list for PBXNativeTarget "{{{name}}}Tests" */ = {
611 isa = XCConfigurationList;
612 buildConfigurations = (
613 AF9F83F71A5F0D21004B62C0 /* Debug */,
614 AF9F83F81A5F0D21004B62C0 /* Release */,
615 );
616 defaultConfigurationIsVisible = 0;
617 };
618 /* End XCConfigurationList section */
619 };
620 rootObject = AF9F83C41A5F0D21004B62C0 /* Project object */;
621 }
622 """
623 end
624 end
625
626 # Template for a property list used by XCode for iOS projects
627 class PlistTemplate
628 super Template
629
630 # Value of CFBundleName, pretty name of the application
631 var product_name: String
632
633 # Value of CFBundleIdentifier, namespace of the app
634 var bundle_identifier: String
635
636 # Value of CFBundleShortVersionString, human readable version
637 var short_version: String
638
639 # Value of CFBundleVersion, often a revision number
640 var bundle_version: String
641
642 redef fun rendering
643 do
644 add """
645 <?xml version="1.0" encoding="UTF-8"?>
646 <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
647 <plist version="1.0">
648 <dict>
649 <key>CFBundleDevelopmentRegion</key>
650 <string>en</string>
651 <key>CFBundleExecutable</key>
652 <string>$(EXECUTABLE_NAME)</string>
653 <key>CFBundleIdentifier</key>
654 <string>{{{bundle_identifier}}}</string>
655 <key>CFBundleInfoDictionaryVersion</key>
656 <string>6.0</string>
657 <key>CFBundleName</key>
658 <string>{{{product_name}}}</string>
659 <key>CFBundlePackageType</key>
660 <string>APPL</string>
661 <key>CFBundleShortVersionString</key>
662 <string>{{{short_version}}}</string>
663 <key>CFBundleSignature</key>
664 <string>\\?\\?\\?\\?</string>
665 <key>CFBundleVersion</key>
666 <string>{{{bundle_version}}}</string>
667 <key>LSRequiresIPhoneOS</key>
668 <true/>
669 <key>UIRequiredDeviceCapabilities</key>
670 <array>
671 <string>armv7</string>
672 </array>
673 <key>UISupportedInterfaceOrientations</key>
674 <array>
675 <string>UIInterfaceOrientationPortrait</string>
676 <string>UIInterfaceOrientationLandscapeLeft</string>
677 <string>UIInterfaceOrientationLandscapeRight</string>
678 </array>
679 <key>UISupportedInterfaceOrientations~ipad</key>
680 <array>
681 <string>UIInterfaceOrientationPortrait</string>
682 <string>UIInterfaceOrientationPortraitUpsideDown</string>
683 <string>UIInterfaceOrientationLandscapeLeft</string>
684 <string>UIInterfaceOrientationLandscapeRight</string>
685 </array>
686 </dict>
687 </plist>
688 """
689 end
690 end