@@ -697,7 +697,7 @@ describe("Source code support", () => {
697
697
return pbxProj ;
698
698
} ;
699
699
700
- it ( "adds source files as resources " , async ( ) => {
700
+ it ( "adds source files in Sources build phase " , async ( ) => {
701
701
const sourceFileNames = [
702
702
"src/Header.h" , "src/ObjC.m" ,
703
703
"src/nested/Header.hpp" , "src/nested/Source.cpp" , "src/nested/ObjCpp.mm" ,
@@ -721,14 +721,15 @@ describe("Source code support", () => {
721
721
722
722
sourceFileNames . map ( file => path . basename ( file ) ) . forEach ( basename => {
723
723
const ext = path . extname ( basename ) ;
724
- const shouldBeAdded = ext !== ".donotadd" && ! ext . startsWith ( ".h" ) ;
724
+ const shouldBeAdded = ext !== ".donotadd" ;
725
725
assert . notEqual ( pbxFileReferenceValues . indexOf ( basename ) , - 1 , `${ basename } not added to PBXFileRefereces` ) ;
726
+
726
727
const buildPhaseFile = buildPhaseFiles . find ( ( fileObject : any ) => fileObject . comment . startsWith ( basename ) ) ;
727
- if ( shouldBeAdded ) {
728
+ if ( shouldBeAdded && ! path . extname ( basename ) . startsWith ( ".h" ) ) {
728
729
assert . isDefined ( buildPhaseFile , `${ basename } not added to PBXSourcesBuildPhase` ) ;
729
730
assert . include ( buildPhaseFile . comment , "in Sources" , `${ basename } must be added to Sources group` ) ;
730
731
} else {
731
- assert . isUndefined ( buildPhaseFile , `${ basename } must not be added to Sources group ` ) ;
732
+ assert . isUndefined ( buildPhaseFile , `${ basename } is added to PBXSourcesBuildPhase, but it shouldn't have been. ` ) ;
732
733
}
733
734
} ) ;
734
735
} ) ;
@@ -749,14 +750,15 @@ describe("Source code support", () => {
749
750
750
751
sourceFileNames . map ( file => path . basename ( file ) ) . forEach ( basename => {
751
752
const ext = path . extname ( basename ) ;
752
- const shouldBeAdded = ext !== ".donotadd" && ! ext . startsWith ( ".h" ) ;
753
- const buildPhaseFile = buildPhaseFiles . find ( ( fileObject : any ) => fileObject . comment . startsWith ( basename ) ) ;
753
+ const shouldBeAdded = ext !== ".donotadd" ;
754
754
assert . notEqual ( pbxFileReferenceValues . indexOf ( basename ) , - 1 , `${ basename } not added to PBXFileRefereces` ) ;
755
- if ( shouldBeAdded ) {
755
+
756
+ const buildPhaseFile = buildPhaseFiles . find ( ( fileObject : any ) => fileObject . comment . startsWith ( basename ) ) ;
757
+ if ( shouldBeAdded && ! path . extname ( basename ) . startsWith ( ".h" ) ) {
756
758
assert . isDefined ( buildPhaseFile , `${ basename } not added to PBXSourcesBuildPhase` ) ;
757
759
assert . include ( buildPhaseFile . comment , "in Sources" , `${ basename } must be added to Sources group` ) ;
758
760
} else {
759
- assert . isUndefined ( buildPhaseFile , `${ basename } must not be added to Sources group ` ) ;
761
+ assert . isUndefined ( buildPhaseFile , `${ basename } was added to PBXSourcesBuildPhase, but it shouldn't have been ` ) ;
760
762
}
761
763
} ) ;
762
764
} ) ;
0 commit comments