@@ -190,6 +190,20 @@ Generated: ${new Date().toISOString()}`
190
190
console . log ( ` Repository: ${ repo } ` ) ;
191
191
console . log ( ` Pull-Request description:${ JSON . stringify ( pullRequestToCreate , null , 2 ) } ` )
192
192
console . log ( 'DRYRUN set to true-skipping actual PR creation...' )
193
+ const timestamp = Date . now ( ) ;
194
+ const dummyPrId = `DRYRUN-${ timestamp } ` ;
195
+ const dummyPrLink = `https://${ orgUrl } /${ project } /_git/${ repo } /pullrequest/DRYRUN-${ timestamp } ` ;
196
+
197
+ console . log ( `##vso[task.setvariable variable=PR_ID]${ dummyPrId } ` ) ;
198
+ console . log ( `##vso[task.setvariable variable=PR_LINK]${ dummyPrLink } ` ) ;
199
+
200
+ console . log ( `DRYRUN: Generated dummy PR_ID = ${ dummyPrId } ` ) ;
201
+ console . log ( `DRYRUN: Generated dummy PR_LINK = ${ dummyPrLink } ` ) ;
202
+
203
+ return {
204
+ prId : dummyPrId ,
205
+ prLink : dummyPrLink
206
+ } ;
193
207
}
194
208
195
209
@@ -340,16 +354,13 @@ async function updateConfigsForTasks(depsArray, depsForUpdate, updatedDeps) {
340
354
while ( index < newDepsArr . length ) {
341
355
const currentDep = newDepsArr [ index ] ;
342
356
const [ name ] = await extractDependency ( currentDep ) ;
343
-
344
357
const lowerName = name && name . toLowerCase ( ) ;
345
358
if ( ! name || ! basicDepsForUpdate . has ( lowerName ) ) {
346
359
index ++ ;
347
360
continue ;
348
361
}
349
-
350
362
newDepsArr . splice ( index , 1 , depsForUpdate [ lowerName ] . depStr ) ;
351
363
index ++ ;
352
-
353
364
if ( depsForUpdate [ lowerName ] . configs ) {
354
365
depsForUpdate [ lowerName ] . configs
355
366
. sort ( ( a , b ) => a . name > b . name )
@@ -387,15 +398,28 @@ async function updateUnifiedDeps(unifiedDepsPath, newUnifiedDepsPath) {
387
398
let currentDependencies = parseUnifiedDependencies ( unifiedDepsPath ) ;
388
399
let updatedDependencies = parseUnifiedDependencies ( newUnifiedDepsPath ) ;
389
400
401
+ console . log ( '=== DETAILED Directory.Packages.props COMPARISON DEBUGGING ===' ) ;
402
+ console . log ( `Reading current dependencies from: ${ unifiedDepsPath } ` ) ;
403
+ console . log ( `Reading new dependencies from: ${ newUnifiedDepsPath } ` ) ;
404
+ console . log ( `Current dependencies count: ${ currentDependencies . length } ` ) ;
405
+ console . log ( `Updated dependencies count: ${ updatedDependencies . length } ` ) ;
406
+ console . log ( 'Updated Dependencies:' , updatedDependencies ) ;
390
407
const updatedDependenciesStructure = await getDeps ( updatedDependencies ) ;
408
+ console . log ( 'Updated Dependencies Structure:' , updatedDependenciesStructure ) ;
391
409
410
+ // Initialize the updatedDeps object to track added and removed configs for the updated Tasks
392
411
let updatedDeps = { added : [ ] , removed : [ ] } ;
393
412
394
413
[ currentDependencies , updatedDeps ] = await removeConfigsForTasks ( currentDependencies , updatedDependenciesStructure , updatedDeps ) ;
414
+ console . log ( '=== BEFORE updateConfigsForTasks ===' ) ;
415
+ console . log ( 'Dependencies for update keys:' , Object . keys ( updatedDependenciesStructure ) ) ;
416
+ console . log ( 'Current dependencies array length:' , currentDependencies . length ) ;
395
417
[ currentDependencies , updatedDeps ] = await updateConfigsForTasks ( currentDependencies , updatedDependenciesStructure , updatedDeps ) ;
396
-
397
418
fs . writeFileSync ( unifiedDepsPath , currentDependencies . join ( '\n' ) ) ;
398
419
console . log ( 'Updating Unified Dependencies file done.' ) ;
420
+ console . log ( 'Updated Dependencies:' , updatedDependencies ) ;
421
+ console . log ( 'Added Config Dependencies:' , updatedDeps . added ) ;
422
+ console . log ( 'Removed Config Dependencies:' , updatedDeps . removed ) ;
399
423
return updatedDeps ;
400
424
}
401
425
@@ -416,6 +440,12 @@ async function updateTfsServerDeps() {
416
440
const unifiedDepsPath = path . join ( repoPath , 'Directory.Packages.props' ) ;
417
441
const tfsServerPath = path . join ( repoPath , 'Tfs' , 'Service' , 'Deploy' , 'components' , 'TfsServer.hosted.xml' ) ;
418
442
const pathToTfsCore = tfsServerPath
443
+
444
+ // Capture content BEFORE any changes
445
+ const beforeUnifiedContent = fs . readFileSync ( unifiedDepsPath , 'utf8' ) ;
446
+ const beforeTfsContent = fs . readFileSync ( pathToTfsCore , 'utf8' ) ;
447
+
448
+
419
449
// Update the unified dependencies
420
450
const depsToUpdate = await updateUnifiedDeps ( unifiedDepsPath , newDeps ) ;
421
451
@@ -424,6 +454,11 @@ async function updateTfsServerDeps() {
424
454
const depsToAdd = depsToUpdate . added . filter ( dep => depsToUpdate . removed . indexOf ( dep ) === - 1 ) ;
425
455
const depsToRemove = depsToUpdate . removed . filter ( dep => depsToUpdate . added . indexOf ( dep ) === - 1 ) ;
426
456
457
+ console . log ( '=== TfsServer.hosted.xml MODIFICATION DEBUGGING ===' ) ;
458
+ console . log ( `Dependencies to add: ${ JSON . stringify ( depsToAdd , null , 2 ) } ` ) ;
459
+ console . log ( `Dependencies to remove: ${ JSON . stringify ( depsToRemove , null , 2 ) } ` ) ;
460
+ console . log ( `Total directories in TFS XML before modification: ${ tfxCoreJson . Component . Directory . length } ` ) ;
461
+
427
462
// removing dependencies
428
463
for ( let idx = 0 ; idx < tfxCoreJson . Component . Directory . length ; idx ++ ) {
429
464
const directory = tfxCoreJson . Component . Directory [ idx ] ;
@@ -440,6 +475,8 @@ async function updateTfsServerDeps() {
440
475
tfxCoreJson . Component . Directory . unshift ( directory ) ;
441
476
} ) ;
442
477
478
+ console . log ( `Total directories in TFS XML after addition: ${ tfxCoreJson . Component . Directory . length } ` ) ;
479
+
443
480
const builder = new xml2js . Builder ( {
444
481
xmldec : { version : '1.0' , encoding : 'utf-8' } ,
445
482
renderOpts : { pretty : true , indent : ' ' , newline : '\n' , allowEmpty : false , spacebeforeslash : ' ' }
@@ -448,10 +485,28 @@ async function updateTfsServerDeps() {
448
485
449
486
fs . writeFileSync ( pathToTfsCore , xml ) ;
450
487
console . log ( 'Inserting into Tfs Servicing Core file done.' ) ;
488
+
489
+ // Capture content AFTER all changes
490
+ const afterUnifiedContent = fs . readFileSync ( unifiedDepsPath , 'utf8' ) ;
491
+ const afterTfsContent = fs . readFileSync ( pathToTfsCore , 'utf8' ) ;
492
+
493
+ // Check if ANY files changed
494
+ const unifiedChanged = beforeUnifiedContent !== afterUnifiedContent ;
495
+ const tfsChanged = beforeTfsContent !== afterTfsContent ;
496
+ const anyFilesChanged = unifiedChanged || tfsChanged ;
497
+
498
+
499
+
500
+ console . log ( '=== FILE CHANGE DETECTION ===' ) ;
501
+ console . log ( `Directory.Packages.props changed: ${ unifiedChanged } ` ) ;
502
+ console . log ( `TfsServer.hosted.xml changed: ${ tfsChanged } ` ) ;
503
+ console . log ( `Any files changed: ${ anyFilesChanged } ` ) ;
504
+ console . log ( `Config additions: ${ depsToUpdate . added . length } ` ) ;
505
+ console . log ( `Config removals: ${ depsToUpdate . removed . length } ` ) ;
451
506
452
507
// Commit and push changes if there are any updates
453
- if ( depsToUpdate . added . length > 0 || depsToUpdate . removed . length > 0 ) {
454
- console . log ( `Dependencies updated : ${ depsToUpdate . added . length } added, ${ depsToUpdate . removed . length } removed ` ) ;
508
+ if ( depsToUpdate . added . length > 0 || depsToUpdate . removed . length > 0 || anyFilesChanged ) {
509
+ console . log ( `Config Dependencies added : ${ depsToUpdate . added . length } , Config Dependencies removed: ${ depsToUpdate . removed . length } , Changes in the base task version: ${ anyFilesChanged } ` ) ;
455
510
456
511
// Commit both the unified dependencies file and the TFS server file
457
512
const filesToCommit = [
0 commit comments