|
16 | 16 | $files = glob("src/assets/YAML/default/*/*.yaml"); |
17 | 17 | $dimensions = array(); |
18 | 18 | foreach ($files as $filename) { |
19 | | - //echo "Found $filename"; |
| 19 | + //echo "Found $filename\n"; |
20 | 20 | if (preg_match("/_meta.yaml/", $filename)) continue; |
21 | 21 | $dimension = getDimensions($filename); |
22 | 22 | if (array_key_exists("_yaml_references", $dimension)) { |
|
125 | 125 | if (array_key_exists("dependsOn", $activity)) { |
126 | 126 | foreach($activity['dependsOn'] as $index => $dependingElement) { |
127 | 127 | if(!is_string($dependingElement)) { |
128 | | - echo "$dependingElement is not a string in $activityName"; |
129 | | - var_dump($dependingElement); |
| 128 | + array_push($errorMsg, "The 'dependsOn' is not a string in $activityName: $dependingElement"); |
130 | 129 | continue; |
131 | 130 | } |
132 | | - if(str_starts_with($dependingElement, "uuid:" )) { |
133 | | - echo "$dependingElement is having a uuuid\n"; |
134 | | - $dependsOnUuid = str_replace("uuid:", "", $dependingElement); |
135 | | - $dimensionsAggregated[$dimension][$subdimension][$activityName]["dependsOn"][$index] = $dependsOnUuid; |
| 131 | + $uuidRegExp = "/(uuid:)?\s*([0-9a-f]{6,}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{6,})/"; |
| 132 | + if (preg_match($uuidRegExp, $dependingElement, $matches)) { |
| 133 | + $dependsOnUuid = $matches[2]; |
136 | 134 | $dependsOnActivityName = getActivityNameByUuid($dependsOnUuid, $dimensionsAggregated); |
| 135 | + if (is_null($dependsOnActivityName)) { |
| 136 | + array_push($errorMsg,"DependsOn non-existing activity uuid: $dependsOnUuid (in activity: $activityName)"); |
| 137 | + } else if ($matches[1] == "") { |
| 138 | + echo "WARNING: DependsOn is not prefixed by 'uuid:' for $dependsOnUuid (in activity: $activityName)\n"; |
| 139 | + } |
| 140 | + |
137 | 141 | $dimensionsAggregated[$dimension][$subdimension][$activityName]["dependsOn"][$index] = $dependsOnActivityName; |
| 142 | + // echo "exchanged $dependingElement to name $dependsOnActivityName\n"; |
| 143 | + } else { |
| 144 | + if (is_null(getUuidByActivityName($dependingElement, $dimensionsAggregated))) { |
| 145 | + array_push($errorMsg,"DependsOn non-existing activity: '$dependingElement' (in activity: $activityName)"); |
| 146 | + } |
138 | 147 | } |
139 | 148 | } |
140 | 149 | } |
|
0 commit comments