Classes
XCode JSON
xcode_json.JSONEntry
- ide_gen.xcode_json.JSONEntry : public ide_gen.xcode_json.JSONShared
Public Functions
- __init__(self, name, comment=None, value=None, enabled=True)
Initialize the JSONEntry.
- Parameters:
name – Name of this object
comment – Optional comment
value – Optional value
enabled – If False, don’t output this object in the generated object.
- generate(self, line_list, indent=0)
Generate the text lines for this JSON element.
- Parameters:
line_list – list object to have text lines appended to
indent – Integer number of tabs to insert (For recursion)
xcode_json.JSONArray
- ide_gen.xcode_json.JSONArray : public ide_gen.xcode_json.JSONShared
XCode JSON array.
Each JSON entry for XCode consists of the name followed by an optional comment, and an optional value.
This JSON object handles data that can be output in the form of an array. If fold_array is set to True, single entry arrays are output as a single entry without encapsulating parenthesis.
Public Functions
- __init__(self, name, comment=None, value=None, enabled=True, disable_if_empty=False, fold_array=False)
Initialize the entry.
- Parameters:
name – Name of this object
comment – Optional comment
value – List of default values
enabled – If False, don’t output this object in the generated object.
disable_if_empty – If True, don’t output if no items in the list.
fold_array – True if the array should be an entry if only one element
- add_string_entry(self, name)
Create a new JSONEntry record and add to the array.
Take the string passed in and append it to the end of the array.
The JSONEntry will have it’s name set to the input string. All other attributes are set to defaults.
- Parameters:
name – String to append to the array
- Returns:
JSONEntry created that was added
- generate(self, line_list, indent=0)
Generate the text lines for this JSON element.
Note
This can generate multiple lines of text when outputting a multi entry array.
- Parameters:
line_list – list object to have text lines appended to
indent – number of tabs to insert (For recursion)
xcode_json.JSONDict
- ide_gen.xcode_json.JSONDict : public ide_gen.xcode_json.JSONShared
XCode JSON dictionary.
Each JSON entry for XCode consists of the name followed by an optional comment, and an optional value.
The entries are encapsulated with curly brackets.
Subclassed by ide_gen.xcode.PBXBuildFile, ide_gen.xcode.PBXBuildRule, ide_gen.xcode.PBXFileReference, ide_gen.xcode.PBXFrameworksBuildPhase, ide_gen.xcode.PBXGroup, ide_gen.xcode.XCProject, ide_gen.xcode_json.JSONObjects
Public Functions
- __init__(self, name, comment=None, value=None, uuid=None, enabled=True, disable_if_empty=False, isa=None, flattened=False)
Initialize the entry.
- Parameters:
name – Name of this object
comment – Optional comment
value – List of default values
uuid – uuid hash of the object
enabled – If False, don’t output this object in the generated object.
disable_if_empty – If True, don’t output if no items in the list.
isa – “Is a” type of dictionary object
flattened – If True, flatten the child objects
- add_dict_entry(self, name, value=None, enabled=True)
Create a new JSONEntry record and add to the dictionary Take the key value pair and append it to the dictionary.
Create a JSONEntry with name as the key and value as the value.
- generate(self, line_list, indent=0)
Generate the text lines for this JSON element.
Note
This can generate multiple lines of text.
- Parameters:
line_list – list object to have text lines appended to
indent – number of tabs to insert (For recursion)
xcode_json.JSONObjects
- ide_gen.xcode_json.JSONObjects : public ide_gen.xcode_json.JSONDict
XCode JSON master object list object.
Xcode has a master object record called
objectswhich displays a special comment before emitting each sub record. This class implements this special case.Each record has a prefix and suffix comment, denoting what records are being output.
Note
This is always named
objectsPublic Functions
- __init__(self, name, uuid=None, enabled=True)
Initialize the entry.
- Parameters:
name – Name of this object
uuid – uuid hash of the object
enabled – If False, don’t output this object in the generated object.
- get_entries(self, isa)
Return a list of items that match the isa name.
- Parameters:
isa – isa name string.
- Returns:
List of entires found, can be an empty list.
- generate(self, line_list, indent=0)
Generate the text lines for this JSON element.
The objects are generated in OBJECT_ORDER order.
Note
This can generate multiple lines of text.
- Parameters:
line_list – list object to have text lines appended to
indent – number of tabs to insert (For recursion)
XCode Sections
xcode.XCProject
- ide_gen.xcode.XCProject : public ide_gen.xcode_json.JSONDict
Root object for an XCode IDE project file.
Created with the name of the project and the version code
Public Functions
- __init__(self, name, file_version, uuid=None)
Init the project generator.
- Parameters:
name – Project solution to generate from.
file_version – XCode project file version
uuid – uuid override for the project
- generate(self, line_list, indent=0)
Generate an entire XCode project file.
- Parameters:
line_list – Line list to append new lines.
indent – number of tabs to insert (For recursion)
- Returns:
Non-zero on error.
xcode.PBXFileReference
- ide_gen.xcode.PBXFileReference : public ide_gen.xcode_json.JSONDict
A PBXFileReference entry.
For each and every file managed by an XCode project, a PBXFileReference object will exist to reference it. Other sections of XCode will use the UUID of this object to act upon the file referenced by this object.
The UUID is used for both PBXGroup for file hierachical display and PBXBuildFile if the file needs to be built with a compiler.
Public Functions
- __init__(self, file_name, uuid=None, file_type=None)
Initialize the PBXFileReference object.
- Parameters:
source_file – core.SourceFile record
ide – IDETypes of the ide being built for.
Public Members
- file_name = file_name
Filename.
- file_type = file_type
Xcode filetype.
- file_encoding = self.add_dict_entry("fileEncoding", "4")
fileEncoding record
- explicit_file_type = self.add_dict_entry("explicitFileType",file_type, False)
explicitFileType record
- last_known_file_type = self.add_dict_entry("lastKnownFileType",file_type)
lastKnownFileType record
- include_in_index = self.add_dict_entry("includeInIndex", "0", False)
includeInIndex record
- name_entry = self.add_dict_entry("name", basename)
name record
- path = self.add_dict_entry("path", file_name)
path record
- source_tree = self.add_dict_entry("sourceTree", "SOURCE_ROOT")
sourceTree record
xcode.PBXBuildFile
- ide_gen.xcode.PBXBuildFile : public ide_gen.xcode_json.JSONDict
Create a PBXBuildFile entry.
Every file that is built needs a record to associate a source file to an output file. This record connects the two objects to alert XCode to build the input file for the output file.
Effectively, these are makefile entries to invoke compilation recipes.
Note
The outputfile is only needed for ensuring UUIDs are unique for XCode projects where multiple output files are created. There has to be unique PBXBuildFile uuid for every build target, even if the source file is the same
Public Functions
- __init__(self, input_reference, output_reference, uuid=None)
Init the PBXBuildFile record.
- Parameters:
input_reference – PBXFileReference of source file to compile
output_reference – PBXFileReference of lib/exe being built.
uuid – uuid override for this object
Public Members
- file_reference = input_reference
PBXFileReference of the file being compiled.
- settings = JSONDict("settings", disable_if_empty=True)
Additional compiler settings applied only to this file.
xcode.PBXGroup
- ide_gen.xcode.PBXGroup : public ide_gen.xcode_json.JSONDict
Public Functions
- __init__(self, group_name, path, uuid=None)
Init the PBXGroup.
- Parameters:
group_name – Name of this group
path – Pathname for the group to represent
uuid – uuid override for this object
- is_empty(self)
Return True if there are no entries in this group.
- Returns:
True if this PBXGroup has no entries.
- add_file(self, file_reference)
Append a file uuid and name to the end of the list.
- Parameters:
file_reference – PBXFileReference item to attach to this group.
- add_group(self, group)
Append a group to the end of the list.
- Parameters:
group – PBXGroup item to attach to this group.
- generate(self, line_list, indent=0)
Write this record to output.
- Parameters:
line_list – Line list to append new lines.
indent – number of tabs to insert (For recursion)
Public Members
- group_list = []
List of child groups.
- file_list = []
List of child files.
- children = JSONArray("children")
Children list.
- name_entry = self.add_dict_entry("name", group_name)
name record
- path = self.add_dict_entry("path", path)
path record
- source_tree = self.add_dict_entry("sourceTree", value)
sourceTree record
xcode.PBXBuildRule
- ide_gen.xcode.PBXBuildRule : public ide_gen.xcode_json.JSONDict
Create a PBXBuildRule entry.
Create a generic build rule so that files with a certain extension will have a custom script run, so that it will build non-standard source code.
Public Functions
- __init__(self, file_pattern=None, file_type=None, output_files=None, script=None, uuid=None)
Initialize the PBXBuildRule.
- Parameters:
file_pattern – File pattern to match
file_type – Xcode internal tool name if known
output_files – List of output files this will generate
script – Bash script to execute
uuid – uuid override
- generate(self, line_list, indent=0)
Write this record to output.
- Parameters:
line_list – Line list to append new lines.
indent – number of tabs to insert (For recursion)
Public Members
- compiler_spec = self.add_dict_entry("compilerSpec","com.apple.compilers.proxy.script")
compilerSpec record
- file_patterns = self.add_dict_entry("filePatterns", file_pattern)
filePatterns record
- file_type = self.add_dict_entry("fileType", file_type)
fileType record
- input_files = JSONArray("inputFiles")
inputFiles record
- is_editable = self.add_dict_entry("isEditable", "1")
isEditable record
- output_files = JSONArray("outputFiles")
outputFiles record
- run_once_per_architecture = self.add_dict_entry("runOncePerArchitecture", "0")
runOncePerArchitecture record
- script = self.add_dict_entry("script", script)
script record
xcode.PBXFrameworksBuildPhase
- ide_gen.xcode.PBXFrameworksBuildPhase : public ide_gen.xcode_json.JSONDict
Each PBXFrameworksBuildPhase entry.
Public Functions
- __init__(self, file_reference)
Initialize PBXFrameworksBuildPhase.
- Parameters:
file_reference – PBXFileReference record
- add_build_file(self, build_file)
Add a framework to the files record.
- Parameters:
build_file – PBXBuildFile record
Public Members
- build_action_mask = self.add_dict_entry("buildActionMask", "2147483647")
Integer mask for enabling operations.
- files = JSONArray(name="files")
JSONArray of PBXBuildFile records.
- run_only_for_deployment = self.add_dict_entry("runOnlyForDeploymentPostprocessing", "0")
runOnlyForDeploymentPostprocessing record