|
86 | 86 | unset($dimensionsAggregated[$dimension][$subdimension][$activityName]["evidence"]); |
87 | 87 | } |
88 | 88 | if (array_key_exists("dependsOn", $activity)) { |
89 | | - foreach($activity['dependsOn'] as $index => $dependsOn) { |
90 | | - if(!is_string($dependsOn)) { |
91 | | - array_push($errorMsg, "The 'dependsOn' is not a string '" . json_encode($dependsOn) . "' (in $activityName)"); |
| 89 | + foreach($activity['dependsOn'] as $index => $dependsOnName) { |
| 90 | + if(!is_string($dependsOnName)) { |
| 91 | + array_push($errorMsg, "The 'dependsOn' is not a string '" . json_encode($dependsOnName) . "' (in $activityName)"); |
92 | 92 | continue; |
93 | 93 | } |
94 | 94 |
|
95 | | - // Swap uuids with activity name |
| 95 | + // Load dependsOnName and dependsOnUuid, depending on actual content |
96 | 96 | $uuidRegExp = "/(uuid:)?\s*([0-9a-f]{6,}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{6,})/"; |
97 | | - if (preg_match($uuidRegExp, $dependsOn, $matches)) { |
| 97 | + if (preg_match($uuidRegExp, $dependsOnName, $matches)) { |
98 | 98 | $dependsOnUuid = $matches[2]; |
99 | | - $dependsOn = getActivityNameByUuid($dependsOnUuid, $dimensionsAggregated); |
100 | | - if (is_null($dependsOn)) { |
| 99 | + $dependsOnName = getActivityNameByUuid($dependsOnUuid, $dimensionsAggregated); |
| 100 | + if (is_null($dependsOnName)) { |
101 | 101 | array_push($errorMsg,"DependsOn non-existing activity uuid: $dependsOnUuid (in activity: '$activityName')"); |
102 | 102 | } else if ($matches[1] != "") { |
103 | 103 | echo "WARNING: DependsOn is prefixed by deprecated 'uuid:' for $dependsOnUuid (in activity: '$activityName'). Use activity name, or the uuid only\n"; |
104 | | - } |
105 | | - |
106 | | - // Trick emit_yaml() to have uuid plus a comment in a string. Removed in post-processing below. |
107 | | - $dimensionsAggregated[$dimension][$subdimension][$activityName]["dependsOn"][$index] = "{ $dependsOnUuid # $dependsOn }"; |
108 | | - |
| 104 | + } |
109 | 105 | } else { |
110 | | - if (is_null(getUuidByActivityName($dependsOn, $dimensionsAggregated))) { |
111 | | - array_push($errorMsg,"DependsOn non-existing activity: '$dependsOn' (in activity: $activityName)"); |
| 106 | + $dependsOnUuid = getUuidByActivityName($dependsOnName, $dimensionsAggregated); |
| 107 | + if (is_null(getUuidByActivityName($dependsOnName, $dimensionsAggregated))) { |
| 108 | + array_push($errorMsg,"DependsOn non-existing activity: '$dependsOnName' (in activity: $activityName)"); |
112 | 109 | } |
113 | 110 | } |
| 111 | + // Trick emit_yaml() to have uuid plus a comment in a string. Removed in post-processing below. |
| 112 | + $dimensionsAggregated[$dimension][$subdimension][$activityName]["dependsOn"][$index] = "{ $dependsOnUuid # $dependsOnName }"; |
| 113 | + |
114 | 114 |
|
115 | 115 | // Build dependency graph |
116 | 116 | if (!array_key_exists($activityName, $activityIndex)) { |
117 | 117 | $activityIndex[$activityName] = count($activityIndex); |
118 | 118 | } |
119 | | - if (!array_key_exists($dependsOn, $activityIndex)) { |
120 | | - $activityIndex[$dependsOn] = count($activityIndex); |
| 119 | + if (!array_key_exists($dependsOnName, $activityIndex)) { |
| 120 | + $activityIndex[$dependsOnName] = count($activityIndex); |
121 | 121 | } |
122 | | - array_push_item_to($dependencies, $activityIndex[$dependsOn], $activityIndex[$activityName]); |
| 122 | + array_push_item_to($dependencies, $activityIndex[$dependsOnName], $activityIndex[$activityName]); |
123 | 123 |
|
124 | 124 | } |
125 | 125 | } |
|
0 commit comments