@@ -68,42 +68,30 @@ pbxProject.prototype.generateUuid = function () {
6868}
6969
7070pbxProject . prototype . addSourceFile = function ( path , opt ) {
71- var file = new pbxFile ( path , opt ) ,
72- commentKey , pluginsGroup , sources ;
71+ var file = new pbxFile ( path , opt ) ;
7372
7473 file . uuid = this . generateUuid ( ) ;
7574 file . fileRef = this . generateUuid ( ) ;
7675
77- // PBXBuildFile
78- commentKey = f ( "%s_comment" , file . uuid ) ;
76+ this . addToPbxBuildFileSection ( file ) ; // PBXBuildFile
77+ this . addToPbxFileReferenceSection ( file ) ; // PBXFileReference
78+ this . addToPluginsPbxGroup ( file ) ; // PBXGroup
79+ this . addToPbxSourcesBuildPhase ( file ) ; // PBXSourcesBuildPhase
7980
80- this . pbxBuildFileSection ( ) [ file . uuid ] = pbxBuildFileObj ( file ) ;
81- this . pbxBuildFileSection ( ) [ commentKey ] = pbxBuildFileComment ( file ) ;
82-
83- // PBXFileReference
84- commentKey = f ( "%s_comment" , file . fileRef ) ;
81+ return file ;
82+ }
8583
86- this . pbxFileReferenceSection ( ) [ file . fileRef ] = pbxFileReferenceObj ( file ) ;
87- this . pbxFileReferenceSection ( ) [ commentKey ] = pbxFileReferenceComment ( file ) ;
84+ pbxProject . prototype . addHeaderFile = function ( path , opt ) {
85+ var file = new pbxFile ( path , opt ) ;
8886
89- // PBXGroup
90- pluginsGroup = this . pbxGroupByName ( 'Plugins' ) ;
91- pluginsGroup . children . push ( pbxGroupChild ( file ) ) ;
87+ file . fileRef = this . generateUuid ( ) ;
9288
93- // PBXSourcesBuildPhase
94- sources = this . pbxSourcesBuildPhaseObj ( ) ;
95- sources . files . push ( pbxSourceFileObj ( file ) ) ;
89+ this . addToPbxFileReferenceSection ( file ) ; // PBXFileReference
90+ this . addToPluginsPbxGroup ( file ) ; // PBXGroup
9691
9792 return file ;
9893}
9994
100- pbxProject . prototype . addHeaderFile = function ( path , opt ) {
101- /*
102- * PBXFileReference
103- * PBXGroup (Plugins)
104- */
105- }
106-
10795pbxProject . prototype . addResourceFile = function ( path , opt ) {
10896 /*
10997 * PBXBuildFile
@@ -114,6 +102,30 @@ pbxProject.prototype.addResourceFile = function (path, opt) {
114102}
115103
116104// helper access functions
105+ pbxProject . prototype . addToPbxBuildFileSection = function ( file ) {
106+ var commentKey = f ( "%s_comment" , file . uuid ) ;
107+
108+ this . pbxBuildFileSection ( ) [ file . uuid ] = pbxBuildFileObj ( file ) ;
109+ this . pbxBuildFileSection ( ) [ commentKey ] = pbxBuildFileComment ( file ) ;
110+ }
111+
112+ pbxProject . prototype . addToPbxFileReferenceSection = function ( file ) {
113+ var commentKey = f ( "%s_comment" , file . fileRef ) ;
114+
115+ this . pbxFileReferenceSection ( ) [ file . fileRef ] = pbxFileReferenceObj ( file ) ;
116+ this . pbxFileReferenceSection ( ) [ commentKey ] = pbxFileReferenceComment ( file ) ;
117+ }
118+
119+ pbxProject . prototype . addToPluginsPbxGroup = function ( file ) {
120+ var pluginsGroup = this . pbxGroupByName ( 'Plugins' ) ;
121+ pluginsGroup . children . push ( pbxGroupChild ( file ) ) ;
122+ }
123+
124+ pbxProject . prototype . addToPbxSourcesBuildPhase = function ( file ) {
125+ var sources = this . pbxSourcesBuildPhaseObj ( ) ;
126+ sources . files . push ( pbxSourceFileObj ( file ) ) ;
127+ }
128+
117129pbxProject . prototype . pbxBuildFileSection = function ( ) {
118130 return this . hash . project . objects [ 'PBXBuildFile' ] ;
119131}
0 commit comments