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) {
80
80
81
81
this . sourceTree = opt . sourceTree || defaultSourceTree ( this ) ;
82
82
this . fileEncoding = opt . fileEncoding || fileEncoding ( this ) ;
83
+
84
+ if ( opt . weak && opt . weak === true )
85
+ this . settings = { ATTRIBUTES : [ 'Weak' ] } ;
83
86
}
84
87
85
88
module . exports = pbxFile ;
Original file line number Diff line number Diff line change @@ -485,6 +485,7 @@ function pbxBuildFileObj(file) {
485
485
obj . isa = 'PBXBuildFile' ;
486
486
obj . fileRef = file . fileRef ;
487
487
obj . fileRef_comment = file . basename ;
488
+ if ( file . settings ) obj . settings = file . settings ;
488
489
489
490
return obj ;
490
491
}
Original file line number Diff line number Diff line change @@ -85,9 +85,22 @@ exports.addFramework = {
85
85
test . equal ( buildFileEntry . isa , 'PBXBuildFile' ) ;
86
86
test . equal ( buildFileEntry . fileRef , newFile . fileRef ) ;
87
87
test . equal ( buildFileEntry . fileRef_comment , 'libsqlite3.dylib' ) ;
88
+ test . equal ( buildFileEntry . settings , undefined ) ;
88
89
89
90
test . done ( ) ;
90
91
} ,
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
+ } ,
91
104
'should add to the Frameworks PBXGroup' : function ( test ) {
92
105
var newLength = proj . pbxGroupByName ( 'Frameworks' ) . children . length + 1 ,
93
106
newFile = proj . addFramework ( 'libsqlite3.dylib' ) ,
Original file line number Diff line number Diff line change @@ -165,3 +165,31 @@ exports['path'] = {
165
165
test . done ( ) ;
166
166
}
167
167
}
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