@@ -697,7 +697,7 @@ describe("Source code support", () => {
697697 return pbxProj ;
698698 } ;
699699
700- it ( "adds source files as resources " , async ( ) => {
700+ it ( "adds source files in Sources build phase " , async ( ) => {
701701 const sourceFileNames = [
702702 "src/Header.h" , "src/ObjC.m" ,
703703 "src/nested/Header.hpp" , "src/nested/Source.cpp" , "src/nested/ObjCpp.mm" ,
@@ -721,14 +721,15 @@ describe("Source code support", () => {
721721
722722 sourceFileNames . map ( file => path . basename ( file ) ) . forEach ( basename => {
723723 const ext = path . extname ( basename ) ;
724- const shouldBeAdded = ext !== ".donotadd" && ! ext . startsWith ( ".h" ) ;
724+ const shouldBeAdded = ext !== ".donotadd" ;
725725 assert . notEqual ( pbxFileReferenceValues . indexOf ( basename ) , - 1 , `${ basename } not added to PBXFileRefereces` ) ;
726+
726727 const buildPhaseFile = buildPhaseFiles . find ( ( fileObject : any ) => fileObject . comment . startsWith ( basename ) ) ;
727- if ( shouldBeAdded ) {
728+ if ( shouldBeAdded && ! path . extname ( basename ) . startsWith ( ".h" ) ) {
728729 assert . isDefined ( buildPhaseFile , `${ basename } not added to PBXSourcesBuildPhase` ) ;
729730 assert . include ( buildPhaseFile . comment , "in Sources" , `${ basename } must be added to Sources group` ) ;
730731 } 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. ` ) ;
732733 }
733734 } ) ;
734735 } ) ;
@@ -749,14 +750,15 @@ describe("Source code support", () => {
749750
750751 sourceFileNames . map ( file => path . basename ( file ) ) . forEach ( basename => {
751752 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" ;
754754 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" ) ) {
756758 assert . isDefined ( buildPhaseFile , `${ basename } not added to PBXSourcesBuildPhase` ) ;
757759 assert . include ( buildPhaseFile . comment , "in Sources" , `${ basename } must be added to Sources group` ) ;
758760 } 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 ` ) ;
760762 }
761763 } ) ;
762764 } ) ;
0 commit comments