TODO create subclasses for different file types, this is currently for
compilable source files only.
nitc :: PbxFile :: add_to_project
nitc :: PbxFile :: defaultinit
nitc :: PbxFile :: add_to_project
core :: Object :: class_factory
Implementation used byget_class
to create the specific class.
nitc :: PbxFile :: defaultinit
core :: Object :: defaultinit
core :: Object :: is_same_instance
Return true ifself
and other
are the same instance (i.e. same identity).
core :: Object :: is_same_serialized
Isself
the same as other
in a serialization context?
core :: Object :: is_same_type
Return true ifself
and other
have the same dynamic type.
core :: Object :: native_class_name
The class name of the object in CString format.core :: Object :: output_class_name
Display class name on stdout (debug only).
# Reference to a file for the PBX format of a project file
#
# TODO create subclasses for different file types, this is currently for
# compilable source files only.
class PbxFile
# Path to `self`
var path: String
# Compiler flags for this source file
var cflags: String = "" is writable
# UUID for build elements
private var build_uuid: String = sys.pbx_uuid_generator.next_uuid is lazy
# File reference UUID
private var ref_uuid: String = sys.pbx_uuid_generator.next_uuid is lazy
# Documentation to add besides this file in the template
private fun doc: String do return path
# PBX file type for `self`
fun file_type: String
do
var map = sys.pbx_file_types
var ext = path.file_extension
if ext != null and map.keys.has(ext) then return map[ext]
return "unknown"
end
# PBX description of this file
private fun description: Writable
do
var extra = ""
var cflags = cflags
if not cflags.is_empty then extra = "\nsettings = \{COMPILER_FLAGS = \"{cflags}\"; \};"
return """
{{{ref_uuid}}} /* {{{doc}}} */ = {
isa = PBXFileReference;
fileEncoding = 4;
lastKnownFileType = {{{file_type}}};
path = '{{{path}}}';
sourceTree = "<group>";{{{extra}}}
};
"""
end
private fun add_to_project(project: PbxprojectTemplate)
do
project.source_files.add self
project.files.add self
end
end
src/platform/xcode_templates.nit:79,1--132,3