@@ -9,6 +9,7 @@ import * as projectServiceBaseLib from "./platform-project-service-base";
9
9
import { PlistSession , Reporter } from "plist-merge-patch" ;
10
10
import { EOL } from "os" ;
11
11
import * as plist from "plist" ;
12
+ import * as fastGlob from "fast-glob" ;
12
13
import { IOSProvisionService } from "./ios-provision-service" ;
13
14
import { IOSEntitlementsService } from "./ios-entitlements-service" ;
14
15
import { IOSBuildData } from "../data/build-data" ;
@@ -817,6 +818,21 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
817
818
resourcesNativeCodePath ,
818
819
projectData
819
820
) ;
821
+
822
+ const nativeSource = this . $projectConfigService . getValue (
823
+ `${ this . _platformData . platformNameLowerCase } .NativeSource` ,
824
+ [ ]
825
+ ) ;
826
+
827
+ if ( nativeSource ?. length ) {
828
+ for ( const source of nativeSource ) {
829
+ await this . prepareNativeSourceCode (
830
+ source . name ,
831
+ source . path ,
832
+ projectData
833
+ ) ;
834
+ }
835
+ }
820
836
}
821
837
822
838
this . $iOSWatchAppService . removeWatchApp ( { pbxProjPath } ) ;
@@ -1360,7 +1376,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
1360
1376
projectData : IProjectData
1361
1377
) : Promise < void > {
1362
1378
const project = this . createPbxProj ( projectData ) ;
1363
- const group = this . getRootGroup ( groupName , sourceFolderPath ) ;
1379
+ const group = await this . getRootGroup ( groupName , sourceFolderPath ) ;
1364
1380
project . addPbxGroup ( group . files , group . name , group . path , null , {
1365
1381
isMain : true ,
1366
1382
filesRelativeToProject : true ,
@@ -1430,21 +1446,30 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
1430
1446
}
1431
1447
}
1432
1448
1433
- private getRootGroup ( name : string , rootPath : string ) {
1449
+ private async getRootGroup ( name : string , rootPath : string ) {
1434
1450
const filePathsArr : string [ ] = [ ] ;
1435
1451
const rootGroup : INativeSourceCodeGroup = {
1436
1452
name : name ,
1437
1453
files : filePathsArr ,
1438
1454
path : rootPath ,
1439
1455
} ;
1440
1456
1441
- if ( this . $fs . exists ( rootPath ) ) {
1442
- const stats = this . $fs . getFsStats ( rootPath ) ;
1443
- if ( stats . isDirectory ( ) && ! this . $fs . isEmptyDir ( rootPath ) ) {
1444
- this . $fs . readDirectory ( rootPath ) . forEach ( ( fileName ) => {
1445
- const filePath = path . join ( rootGroup . path , fileName ) ;
1446
- filePathsArr . push ( filePath ) ;
1447
- } ) ;
1457
+ if ( fastGlob . isDynamicPattern ( rootPath ) ) {
1458
+ const projectRoot = this . $projectDataService . getProjectData ( ) . projectDir ;
1459
+ const filePaths = await fastGlob ( rootPath ) ;
1460
+ for ( const filePath of filePaths ) {
1461
+ const sourceFilePath = path . normalize ( path . join ( projectRoot , filePath ) ) ;
1462
+ filePathsArr . push ( sourceFilePath ) ;
1463
+ }
1464
+ } else {
1465
+ if ( this . $fs . exists ( rootPath ) ) {
1466
+ const stats = this . $fs . getFsStats ( rootPath ) ;
1467
+ if ( stats . isDirectory ( ) && ! this . $fs . isEmptyDir ( rootPath ) ) {
1468
+ this . $fs . readDirectory ( rootPath ) . forEach ( ( fileName ) => {
1469
+ const filePath = path . join ( rootGroup . path , fileName ) ;
1470
+ filePathsArr . push ( filePath ) ;
1471
+ } ) ;
1472
+ }
1448
1473
}
1449
1474
}
1450
1475
@@ -1499,13 +1524,16 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
1499
1524
}
1500
1525
}
1501
1526
1502
- private removeNativeSourceCode (
1527
+ private async removeNativeSourceCode (
1503
1528
pluginPlatformsFolderPath : string ,
1504
1529
pluginData : IPluginData ,
1505
1530
projectData : IProjectData
1506
- ) : void {
1531
+ ) {
1507
1532
const project = this . createPbxProj ( projectData ) ;
1508
- const group = this . getRootGroup ( pluginData . name , pluginPlatformsFolderPath ) ;
1533
+ const group = await this . getRootGroup (
1534
+ pluginData . name ,
1535
+ pluginPlatformsFolderPath
1536
+ ) ;
1509
1537
project . removePbxGroup ( group . name , group . path ) ;
1510
1538
project . removeFromHeaderSearchPaths ( group . path ) ;
1511
1539
this . savePbxProj ( project , projectData ) ;
0 commit comments