@@ -1390,7 +1390,7 @@ export class Targets {
1390
1390
newImports . push ( possibleSrvPgmDep ) ;
1391
1391
}
1392
1392
1393
- } else if ( currentTarget . type === `PGM` ) {
1393
+ } else if ( [ `PGM` , `MODULE` ] . includes ( currentTarget . type ) ) {
1394
1394
// Perhaps we're looking at a program object, which actually should be a multi
1395
1395
// module program, so we do a lookup for additional modules.
1396
1396
const possibleModuleDep = allModules . find ( mod => mod . exports && mod . exports . includes ( importName . toUpperCase ( ) ) )
@@ -1414,6 +1414,20 @@ export class Targets {
1414
1414
// to be a program made up of many modules, usually done with CRTPGM
1415
1415
if ( currentTarget . deps . some ( d => d . type === `MODULE` ) ) {
1416
1416
this . convertBoundProgramToMultiModuleProgram ( currentTarget ) ;
1417
+
1418
+ // Then, also include any of the modules dep modules into the currentTarget deps!!
1419
+ const depTargets = currentTarget . deps
1420
+ . filter ( d => d . type === `MODULE` )
1421
+ . map ( m => this . getTarget ( m ) ) ;
1422
+
1423
+ // Confusing names, it means: dependencies of the dependencies that are modules
1424
+ const depDeps = depTargets . map ( m => m ?. deps ) . flat ( ) . filter ( d => d . type === `MODULE` ) ;
1425
+
1426
+ for ( const newDep of depDeps ) {
1427
+ if ( newDep && ! currentTarget . deps . some ( d => d . systemName === newDep . systemName && d . type === newDep . type ) ) {
1428
+ currentTarget . deps . push ( newDep ) ;
1429
+ }
1430
+ }
1417
1431
}
1418
1432
}
1419
1433
}
@@ -1459,7 +1473,8 @@ export class Targets {
1459
1473
imports : currentTarget . imports ,
1460
1474
exports : [ ] ,
1461
1475
type : `MODULE` ,
1462
- relativePath : basePath
1476
+ relativePath : basePath ,
1477
+ extension : path . extname ( basePath ) . substring ( 1 )
1463
1478
} ;
1464
1479
1465
1480
// Replace the old resolved object with the module
0 commit comments