@@ -494,6 +494,7 @@ private static void GetVersions(string task, string configsString, out List<(str
494
494
string gitRootPath = GetTasksRootPath ( currentDir ) ;
495
495
496
496
string taskTargetPath = Path . Combine ( gitRootPath , "Tasks" , task ) ;
497
+
497
498
if ( ! Directory . Exists ( taskTargetPath ) )
498
499
{
499
500
throw new Exception ( $ "expected { taskTargetPath } to exist!") ;
@@ -646,9 +647,6 @@ private static void MainUpdateTask(
646
647
// we need to ensure merges occur first, as the changes may cascade to other configs (e.g. Default), if there are multiple
647
648
var targetConfigsWithMergeToBaseOrderedFirst = targetConfigs . OrderBy ( x => x . mergeToBase ? 0 : 1 ) ;
648
649
649
- var defaultConfig = targetConfigs . FirstOrDefault ( x => x . isDefault )
650
- ?? throw new Exception ( $ "There is no default config for task { task } ") ;
651
-
652
650
foreach ( var config in targetConfigsWithMergeToBaseOrderedFirst )
653
651
{
654
652
if ( config . useGlobalVersion && ! includeLocalPackagesBuildConfig )
@@ -753,6 +751,12 @@ private static void MainUpdateTask(
753
751
754
752
if ( useSemverBuildConfig && ! config . mergeToBase )
755
753
{
754
+ var defaultConfig = targetConfigs . FirstOrDefault ( x => x . isDefault ) ;
755
+ if ( defaultConfig == null )
756
+ {
757
+ throw new Exception ( $ "There is no default config for task { task } ") ;
758
+ }
759
+
756
760
WriteTaskJson ( taskOutput , taskVersionState , config , "task.json" , existingLocalPackageVersion , useSemverBuildConfig : true , defaultConfig : defaultConfig ) ;
757
761
WriteTaskJson ( taskOutput , taskVersionState , config , "task.loc.json" , existingLocalPackageVersion , useSemverBuildConfig : true , defaultConfig : defaultConfig ) ;
758
762
}
@@ -1403,6 +1407,7 @@ private static void UpdateVersionsForTask(string task, TaskStateStruct taskState
1403
1407
{
1404
1408
throw new Exception ( $ "Multiple configs for task being merged. This is not supported. task={ task } mergingConfig.name={ mergingConfig . name } ") ;
1405
1409
}
1410
+
1406
1411
// versionMap contains a version that needs to be merged to base
1407
1412
allConfigsMappedAndValid = false ;
1408
1413
mergingConfig = config ;
@@ -1521,6 +1526,7 @@ private static void UpdateVersionsForTask(string task, TaskStateStruct taskState
1521
1526
else
1522
1527
{
1523
1528
TaskVersion targetVersion ;
1529
+
1524
1530
do
1525
1531
{
1526
1532
targetVersion = baseVersion . CloneWithPatch ( baseVersion . Patch + offset ) ;
@@ -1532,7 +1538,7 @@ private static void UpdateVersionsForTask(string task, TaskStateStruct taskState
1532
1538
{
1533
1539
// In the first stage of refactoring, we keep different version numbers to retain the ability to rollback.
1534
1540
// In the second stage of refactoring, we are going to use the same version, which is going to significantly reduce complexity of all this.
1535
- targetVersion . Build = config . constMappingKey ;
1541
+ targetVersion = targetVersion . CloneWithBuild ( config . constMappingKey ) ;
1536
1542
}
1537
1543
1538
1544
taskState . configTaskVersionMapping . Add ( config , targetVersion ) ;
@@ -1609,11 +1615,20 @@ private static void UpdateVersionsGlobal(string task, TaskStateStruct taskState,
1609
1615
{
1610
1616
if ( config . useGlobalVersion )
1611
1617
{
1618
+ TaskVersion versionToUse = globalVersion ;
1619
+
1620
+ if ( config . abTaskReleases )
1621
+ {
1622
+ // In the first stage of refactoring, we keep different version numbers to retain the ability to rollback.
1623
+ // In the second stage of refactoring, we are going to use the same version, which is going to significantly reduce complexity of all this.
1624
+ versionToUse = globalVersion . CloneWithBuild ( config . constMappingKey ) ;
1625
+ }
1626
+
1612
1627
if ( taskState . configTaskVersionMapping . ContainsKey ( config ) )
1613
1628
{
1614
- if ( taskState . configTaskVersionMapping [ config ] != globalVersion )
1629
+ if ( taskState . configTaskVersionMapping [ config ] != versionToUse )
1615
1630
{
1616
- taskState . configTaskVersionMapping [ config ] = globalVersion ;
1631
+ taskState . configTaskVersionMapping [ config ] = versionToUse ;
1617
1632
1618
1633
if ( ! taskState . versionsUpdated . Contains ( config ) )
1619
1634
{
@@ -1623,7 +1638,7 @@ private static void UpdateVersionsGlobal(string task, TaskStateStruct taskState,
1623
1638
}
1624
1639
else
1625
1640
{
1626
- taskState . configTaskVersionMapping . Add ( config , globalVersion ) ;
1641
+ taskState . configTaskVersionMapping . Add ( config , versionToUse ) ;
1627
1642
1628
1643
if ( ! taskState . versionsUpdated . Contains ( config ) )
1629
1644
{
0 commit comments