Template for a PBX project file, usually a project.pbcproj

This file list all information required to build an XCode project. It would usually be written and read by XCode. From the command line, xcodebuild can read this file but not write it.

Information in the file (simplified list):

  • Compilable source files
  • Asset files
  • Build configurations (Release and debug modes, cflags, etc.)
  • List of files composing the project

Introduced properties

private var _asset_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: _asset_files

All asset files added to the app package
private var _cflags: String

nitc :: PbxprojectTemplate :: _cflags

OTHER_CFLAGS
private var _files: Array[PbxFile]

nitc :: PbxprojectTemplate :: _files

All files used by this project
private var _name: String

nitc :: PbxprojectTemplate :: _name

Name of the project
private var _source_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: _source_files

All body/implementation source files to be compiled
fun add_file(file: PbxFile)

nitc :: PbxprojectTemplate :: add_file

Add file to this project
private fun asset_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: asset_files

All asset files added to the app package
private fun asset_files=(asset_files: Array[PbxFile])

nitc :: PbxprojectTemplate :: asset_files=

All asset files added to the app package
fun cflags: String

nitc :: PbxprojectTemplate :: cflags

OTHER_CFLAGS
fun cflags=(cflags: String)

nitc :: PbxprojectTemplate :: cflags=

OTHER_CFLAGS
private fun files: Array[PbxFile]

nitc :: PbxprojectTemplate :: files

All files used by this project
private fun files=(files: Array[PbxFile])

nitc :: PbxprojectTemplate :: files=

All files used by this project
fun name: String

nitc :: PbxprojectTemplate :: name

Name of the project
protected fun name=(name: String)

nitc :: PbxprojectTemplate :: name=

Name of the project
private fun source_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: source_files

All body/implementation source files to be compiled
private fun source_files=(source_files: Array[PbxFile])

nitc :: PbxprojectTemplate :: source_files=

All body/implementation source files to be compiled

Redefined properties

redef type SELF: PbxprojectTemplate

nitc $ PbxprojectTemplate :: SELF

Type of this instance, automatically specialized in every class
redef fun rendering

nitc $ PbxprojectTemplate :: rendering

Service used to render the content of the template.

All properties

fun !=(other: nullable Object): Bool

core :: Object :: !=

Have self and other different values?
fun ==(other: nullable Object): Bool

core :: Object :: ==

Have self and other the same value?
type CLASS: Class[SELF]

core :: Object :: CLASS

The type of the class of self.
type SELF: Object

core :: Object :: SELF

Type of this instance, automatically specialized in every class
private var _asset_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: _asset_files

All asset files added to the app package
private var _cflags: String

nitc :: PbxprojectTemplate :: _cflags

OTHER_CFLAGS
private var _content: Array[Writable]

template :: Template :: _content

Each sub-elements
private var _files: Array[PbxFile]

nitc :: PbxprojectTemplate :: _files

All files used by this project
private var _is_frozen: Bool

template :: Template :: _is_frozen

Is the template allowing more modification (add)
private var _is_writing: Bool

template :: Template :: _is_writing

Flag to avoid infinite recursivity if a template contains itself
private var _name: String

nitc :: PbxprojectTemplate :: _name

Name of the project
private var _render_done: Bool

template :: Template :: _render_done

Flag to avoid multiple rendering
private var _source_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: _source_files

All body/implementation source files to be compiled
fun add(element: Writable)

template :: Template :: add

Append an element (String, other Template, etc.) at the end of the template.
fun add_all(elements: Collection[Writable])

template :: Template :: add_all

Append a bunch of elements at the end of the template.
fun add_file(file: PbxFile)

nitc :: PbxprojectTemplate :: add_file

Add file to this project
fun add_list(elements: Collection[Writable], sep: Writable, last_sep: Writable)

template :: Template :: add_list

Append a bunch of elements at the end of the template with separations.
fun addn(element: Writable)

template :: Template :: addn

Append element and the end of the template then append a "\n".
private fun asset_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: asset_files

All asset files added to the app package
private fun asset_files=(asset_files: Array[PbxFile])

nitc :: PbxprojectTemplate :: asset_files=

All asset files added to the app package
fun cflags: String

nitc :: PbxprojectTemplate :: cflags

OTHER_CFLAGS
fun cflags=(cflags: String)

nitc :: PbxprojectTemplate :: cflags=

OTHER_CFLAGS
protected fun class_factory(name: String): CLASS

core :: Object :: class_factory

Implementation used by get_class to create the specific class.
fun class_name: String

core :: Object :: class_name

The class name of the object.
private fun content: Array[Writable]

template :: Template :: content

Each sub-elements
private fun content=(content: Array[Writable])

template :: Template :: content=

Each sub-elements
private fun files: Array[PbxFile]

nitc :: PbxprojectTemplate :: files

All files used by this project
private fun files=(files: Array[PbxFile])

nitc :: PbxprojectTemplate :: files=

All files used by this project
fun force_render

template :: Template :: force_render

Call rendering, if not already done
fun freeze

template :: Template :: freeze

Disable further modification: no more add is allowed
fun get_class: CLASS

core :: Object :: get_class

The meta-object representing the dynamic type of self.
fun hash: Int

core :: Object :: hash

The hash code of the object.
init init

core :: Object :: init

fun inspect: String

core :: Object :: inspect

Developer readable representation of self.
protected fun inspect_head: String

core :: Object :: inspect_head

Return "CLASSNAME:#OBJECTID".
fun is_frozen: Bool

template :: Template :: is_frozen

Is the template allowing more modification (add)
protected fun is_frozen=(is_frozen: Bool)

template :: Template :: is_frozen=

Is the template allowing more modification (add)
intern fun is_same_instance(other: nullable Object): Bool

core :: Object :: is_same_instance

Return true if self and other are the same instance (i.e. same identity).
fun is_same_serialized(other: nullable Object): Bool

core :: Object :: is_same_serialized

Is self the same as other in a serialization context?
intern fun is_same_type(other: Object): Bool

core :: Object :: is_same_type

Return true if self and other have the same dynamic type.
private fun is_writing: Bool

template :: Template :: is_writing

Flag to avoid infinite recursivity if a template contains itself
private fun is_writing=(is_writing: Bool)

template :: Template :: is_writing=

Flag to avoid infinite recursivity if a template contains itself
fun name: String

nitc :: PbxprojectTemplate :: name

Name of the project
protected fun name=(name: String)

nitc :: PbxprojectTemplate :: name=

Name of the project
private intern fun native_class_name: CString

core :: Object :: native_class_name

The class name of the object in CString format.
fun new_sub: Template

template :: Template :: new_sub

Return a new basic template that is automatically added in self (using add)
intern fun object_id: Int

core :: Object :: object_id

An internal hash code for the object based on its identity.
fun output

core :: Object :: output

Display self on stdout (debug only).
intern fun output_class_name

core :: Object :: output_class_name

Display class name on stdout (debug only).
private fun render_done: Bool

template :: Template :: render_done

Flag to avoid multiple rendering
private fun render_done=(render_done: Bool)

template :: Template :: render_done=

Flag to avoid multiple rendering
protected fun rendering

template :: Template :: rendering

Service used to render the content of the template.
fun serialization_hash: Int

core :: Object :: serialization_hash

Hash value use for serialization
private fun source_files: Array[PbxFile]

nitc :: PbxprojectTemplate :: source_files

All body/implementation source files to be compiled
private fun source_files=(source_files: Array[PbxFile])

nitc :: PbxprojectTemplate :: source_files=

All body/implementation source files to be compiled
intern fun sys: Sys

core :: Object :: sys

Return the global sys object, the only instance of the Sys class.
abstract fun to_jvalue(env: JniEnv): JValue

core :: Object :: to_jvalue

fun to_s: String

core :: Object :: to_s

User readable representation of self.
abstract fun write_to(stream: Writer)

core :: Writable :: write_to

Write itself to a stream
fun write_to_bytes: Bytes

core :: Writable :: write_to_bytes

Like write_to but return a new Bytes (may be quite large)
fun write_to_file(filepath: String)

core :: Writable :: write_to_file

Like write_to but take care of creating the file
fun write_to_string: String

core :: Writable :: write_to_string

Like write_to but return a new String (may be quite large).
package_diagram nitc::PbxprojectTemplate PbxprojectTemplate template::Template Template nitc::PbxprojectTemplate->template::Template core::Writable Writable template::Template->core::Writable ...core::Writable ... ...core::Writable->core::Writable

Ancestors

interface Object

core :: Object

The root of the class hierarchy.
interface Writable

core :: Writable

Things that can be efficienlty written to a Writer

Parents

class Template

template :: Template

Templates are simple hierarchical pieces of text used for efficient stream writing.

Class definitions

nitc $ PbxprojectTemplate
# Template for a PBX project file, usually a `project.pbcproj`
#
# This file list all information required to build an XCode project.
# It would usually be written and read by XCode.
# From the command line, xcodebuild can read this file but not write it.
#
# Information in the file (simplified list):
#
# * Compilable source files
# * Asset files
# * Build configurations (Release and debug modes, cflags, etc.)
# * List of files composing the project
class PbxprojectTemplate
	super Template

	# Name of the project
	var name: String

	# OTHER_CFLAGS
	var cflags = "" is writable

	# All body/implementation source files to be compiled
	private var source_files = new Array[PbxFile]

	# All asset files added to the app package
	private var asset_files = new Array[PbxFile]

	# All files used by this project
	private var files = new Array[PbxFile]

	# Add `file` to this project
	fun add_file(file: PbxFile) do file.add_to_project(self)

	redef fun rendering
	do
		add """
// !$*UTF8*$!
{
	archiveVersion = 1;
	classes = {
	};
	objectVersion = 46;
	objects = {

/* Begin PBXBuildFile section */
"""

		# List build files (compilable sources and assets) with their reference UUID
		for array in [source_files, asset_files] do for file in array do add """
		{{{file.build_uuid}}} /* {{{file.doc}}} */ = {
			isa = PBXBuildFile;
			fileRef = {{{file.ref_uuid}}} /* {{{file.doc}}} */;
			};
"""

		add """
		0F4688411FDF8748004F34D4 /* assets in Resources */ = {isa = PBXBuildFile; fileRef = 0F4688401FDF8748004F34D4 /* assets */; };
		0FDD07A21C6F8E0E006FF70E /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 0FDD07A11C6F8E0E006FF70E /* LaunchScreen.storyboard */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
	/* Static generated files */
		AF9F83CC1A5F0D21004B62C0 /* {{{name}}}.app */ = {
			isa = PBXFileReference;
			explicitFileType = wrapper.application;
			includeInIndex = 0;
			path = {{{name}}}.app;
			sourceTree = BUILT_PRODUCTS_DIR;
			};
		AF9F83D01A5F0D21004B62C0 /* Info.plist */ = {
			isa = PBXFileReference;
			lastKnownFileType = text.plist.xml;
			path = Info.plist;
			sourceTree = "<group>";
			};
		AF9F83DE1A5F0D21004B62C0 /* Base */ = {
			isa = PBXFileReference;
			lastKnownFileType = file.storyboard;
			name = Base;
			path = Base.lproj/Main.storyboard;
			sourceTree = "<group>";
			};
		AF9F83E01A5F0D21004B62C0 /* Images.xcassets */ = {
			isa = PBXFileReference;
			lastKnownFileType = folder.assetcatalog;
			path = Images.xcassets;
			sourceTree = "<group>";
			};
		AF9F83E31A5F0D21004B62C0 /* Base */ = {
			isa = PBXFileReference;
			lastKnownFileType = file.xib;
			name = Base;
			path = Base.lproj/LaunchScreen.xib;
			sourceTree = "<group>";
			};

	/* Changing generated files */
"""
		# Describe all known files
		for file in files do add file.description

		add """
		0F4688401FDF8748004F34D4 /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = assets; path = {{{name}}}/assets; sourceTree = SOURCE_ROOT; };
		0FDD07A11C6F8E0E006FF70E /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
		AF9F83C91A5F0D21004B62C0 /* Frameworks */ = {
			isa = PBXFrameworksBuildPhase;
			buildActionMask = 2147483647;
			files = (
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
		AF9F83C31A5F0D21004B62C0 = {
			isa = PBXGroup;
			children = (
				AF9F83CE1A5F0D21004B62C0 /* {{{name}}} */,
				AF9F83CD1A5F0D21004B62C0 /* Products */,
				0FDD07A11C6F8E0E006FF70E /* LaunchScreen.storyboard */,
			);
			sourceTree = "<group>";
		};
		AF9F83CD1A5F0D21004B62C0 /* Products */ = {
			isa = PBXGroup;
			children = (
				AF9F83CC1A5F0D21004B62C0 /* {{{name}}}.app */,
			);
			name = Products;
			sourceTree = "<group>";
		};
		AF9F83CE1A5F0D21004B62C0 /* {{{name}}} */ = {
			isa = PBXGroup;
			children = (
				0F4688401FDF8748004F34D4 /* assets */,
"""
			# Reference all known files
			for file in files do add """
				{{{file.ref_uuid}}} /* {{{file.doc}}} */,
"""

		add """
			);
			path = {{{name}}};
			sourceTree = "<group>";
		};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
		AF9F83CB1A5F0D21004B62C0 /* {{{name}}} */ = {
			isa = PBXNativeTarget;
			buildConfigurationList = AF9F83F31A5F0D21004B62C0 /* Build configuration list for PBXNativeTarget "{{{name}}}" */;
			buildPhases = (
				AF9F83C81A5F0D21004B62C0 /* Sources */,
				AF9F83C91A5F0D21004B62C0 /* Frameworks */,
				AF9F83CA1A5F0D21004B62C0 /* Resources */,
			);
			buildRules = (
			);
			dependencies = (
			);
			name = {{{name}}};
			productName = {{{name}}};
			productReference = AF9F83CC1A5F0D21004B62C0 /* {{{name}}}.app */;
			productType = "com.apple.product-type.application";
		};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
		AF9F83C41A5F0D21004B62C0 /* Project object */ = {
			isa = PBXProject;
			attributes = {
				LastUpgradeCheck = 0610;
				TargetAttributes = {
					AF9F83CB1A5F0D21004B62C0 = {
						CreatedOnToolsVersion = 6.1.1;
					};
				};
			};
			buildConfigurationList = AF9F83C71A5F0D21004B62C0 /* Build configuration list for PBXProject "{{{name}}}" */;
			compatibilityVersion = "Xcode 3.2";
			developmentRegion = English;
			hasScannedForEncodings = 0;
			knownRegions = (
				en,
				Base,
			);
			mainGroup = AF9F83C31A5F0D21004B62C0;
			productRefGroup = AF9F83CD1A5F0D21004B62C0 /* Products */;
			projectDirPath = "";
			projectRoot = "";
			targets = (
				AF9F83CB1A5F0D21004B62C0 /* {{{name}}} */,
			);
		};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
		AF9F83CA1A5F0D21004B62C0 /* Resources */ = {
			isa = PBXResourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
"""
		# Reference all asset files by their build UUID
		for file in asset_files do add """
				{{{file.build_uuid}}} /* {{{file.doc}}} */,
"""

		add """
				0FDD07A21C6F8E0E006FF70E /* LaunchScreen.storyboard in Resources */,
				0F4688411FDF8748004F34D4 /* assets in Resources */,
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
		AF9F83C81A5F0D21004B62C0 /* Sources */ = {
			isa = PBXSourcesBuildPhase;
			buildActionMask = 2147483647;
			files = (
"""
		# Reference all compilable source files by their build UUID
		for file in source_files do add """
				{{{file.build_uuid}}} /* {{{file.doc}}} */,
"""
		add """
			);
			runOnlyForDeploymentPostprocessing = 0;
		};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
		AF9F83F11A5F0D21004B62C0 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
				COPY_PHASE_STRIP = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_DYNAMIC_NO_PIC = NO;
				GCC_OPTIMIZATION_LEVEL = 0;
				GCC_PREPROCESSOR_DEFINITIONS = (
					"DEBUG=1",
					"$(inherited)",
				);
				GCC_SYMBOLS_PRIVATE_EXTERN = NO;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
				MTL_ENABLE_DEBUG_INFO = YES;
				ONLY_ACTIVE_ARCH = YES;
				SDKROOT = iphoneos;
				TARGETED_DEVICE_FAMILY = "1,2";
			};
			name = Debug;
		};
		AF9F83F21A5F0D21004B62C0 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ALWAYS_SEARCH_USER_PATHS = NO;
				CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
				CLANG_CXX_LIBRARY = "libc++";
				CLANG_ENABLE_MODULES = YES;
				CLANG_ENABLE_OBJC_ARC = YES;
				CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
				CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
				COPY_PHASE_STRIP = YES;
				ENABLE_NS_ASSERTIONS = NO;
				ENABLE_STRICT_OBJC_MSGSEND = YES;
				GCC_C_LANGUAGE_STANDARD = gnu99;
				GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
				GCC_WARN_UNDECLARED_SELECTOR = YES;
				GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
				IPHONEOS_DEPLOYMENT_TARGET = 8.1;
				MTL_ENABLE_DEBUG_INFO = NO;
				SDKROOT = iphoneos;
				TARGETED_DEVICE_FAMILY = "1,2";
				VALIDATE_PRODUCT = YES;
			};
			name = Release;
		};
		AF9F83F41A5F0D21004B62C0 /* Debug */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				INFOPLIST_FILE = {{{name}}}/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
				OTHER_CFLAGS = "{{{cflags.escape_to_c}}}";
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Debug;
		};
		AF9F83F51A5F0D21004B62C0 /* Release */ = {
			isa = XCBuildConfiguration;
			buildSettings = {
				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
				INFOPLIST_FILE = {{{name}}}/Info.plist;
				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
				OTHER_CFLAGS = "{{{cflags.escape_to_c}}}";
				PRODUCT_NAME = "$(TARGET_NAME)";
			};
			name = Release;
		};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
		AF9F83C71A5F0D21004B62C0 /* Build configuration list for PBXProject "{{{name}}}" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				AF9F83F11A5F0D21004B62C0 /* Debug */,
				AF9F83F21A5F0D21004B62C0 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
			defaultConfigurationName = Release;
		};
		AF9F83F31A5F0D21004B62C0 /* Build configuration list for PBXNativeTarget "{{{name}}}" */ = {
			isa = XCConfigurationList;
			buildConfigurations = (
				AF9F83F41A5F0D21004B62C0 /* Debug */,
				AF9F83F51A5F0D21004B62C0 /* Release */,
			);
			defaultConfigurationIsVisible = 0;
		};
/* End XCConfigurationList section */
	};
	rootObject = AF9F83C41A5F0D21004B62C0 /* Project object */;
}
"""
	end
end
src/platform/xcode_templates.nit:134,1--476,3