File tree Expand file tree Collapse file tree 4 files changed +45
-0
lines changed
Expand file tree Collapse file tree 4 files changed +45
-0
lines changed Original file line number Diff line number Diff line change @@ -80,6 +80,9 @@ function pbxFile(filepath, opt) {
8080
8181 this . sourceTree = opt . sourceTree || defaultSourceTree ( this ) ;
8282 this . fileEncoding = opt . fileEncoding || fileEncoding ( this ) ;
83+
84+ if ( opt . weak && opt . weak === true )
85+ this . settings = { ATTRIBUTES : [ 'Weak' ] } ;
8386}
8487
8588module . exports = pbxFile ;
Original file line number Diff line number Diff line change @@ -485,6 +485,7 @@ function pbxBuildFileObj(file) {
485485 obj . isa = 'PBXBuildFile' ;
486486 obj . fileRef = file . fileRef ;
487487 obj . fileRef_comment = file . basename ;
488+ if ( file . settings ) obj . settings = file . settings ;
488489
489490 return obj ;
490491}
Original file line number Diff line number Diff line change @@ -85,9 +85,22 @@ exports.addFramework = {
8585 test . equal ( buildFileEntry . isa , 'PBXBuildFile' ) ;
8686 test . equal ( buildFileEntry . fileRef , newFile . fileRef ) ;
8787 test . equal ( buildFileEntry . fileRef_comment , 'libsqlite3.dylib' ) ;
88+ test . equal ( buildFileEntry . settings , undefined ) ;
8889
8990 test . done ( ) ;
9091 } ,
92+ 'should add the PBXBuildFile object correctly /w weak linked frameworks' : function ( test ) {
93+ var newFile = proj . addFramework ( 'libsqlite3.dylib' , { weak : true } ) ,
94+ buildFileSection = proj . pbxBuildFileSection ( ) ,
95+ buildFileEntry = buildFileSection [ newFile . uuid ] ;
96+
97+ test . equal ( buildFileEntry . isa , 'PBXBuildFile' ) ;
98+ test . equal ( buildFileEntry . fileRef , newFile . fileRef ) ;
99+ test . equal ( buildFileEntry . fileRef_comment , 'libsqlite3.dylib' ) ;
100+ test . deepEqual ( buildFileEntry . settings , { ATTRIBUTES : [ 'Weak' ] } ) ;
101+
102+ test . done ( ) ;
103+ } ,
91104 'should add to the Frameworks PBXGroup' : function ( test ) {
92105 var newLength = proj . pbxGroupByName ( 'Frameworks' ) . children . length + 1 ,
93106 newFile = proj . addFramework ( 'libsqlite3.dylib' ) ,
Original file line number Diff line number Diff line change @@ -165,3 +165,31 @@ exports['path'] = {
165165 test . done ( ) ;
166166 }
167167}
168+
169+ exports [ 'settings' ] = {
170+ 'should not be defined by default' : function ( test ) {
171+ var sourceFile = new pbxFile ( 'social.framework' ) ;
172+
173+ test . equal ( undefined , sourceFile . settings ) ;
174+ test . done ( ) ;
175+ } ,
176+
177+ 'should be undefined if weak is false or non-boolean' : function ( test ) {
178+ var sourceFile1 = new pbxFile ( 'social.framework' ,
179+ { weak : false } ) ;
180+ var sourceFile2 = new pbxFile ( 'social.framework' ,
181+ { weak : 'bad_value' } ) ;
182+
183+ test . equal ( undefined , sourceFile1 . settings ) ;
184+ test . equal ( undefined , sourceFile2 . settings ) ;
185+ test . done ( ) ;
186+ } ,
187+
188+ 'should be {ATTRIBUTES:["Weak"]} if weak linking specified' : function ( test ) {
189+ var sourceFile = new pbxFile ( 'social.framework' ,
190+ { weak : true } ) ;
191+
192+ test . deepEqual ( { ATTRIBUTES :[ "Weak" ] } , sourceFile . settings ) ;
193+ test . done ( ) ;
194+ }
195+ }
You can’t perform that action at this time.
0 commit comments