3
3
$packagesPath = " $PSScriptRoot /../../sdk"
4
4
5
5
$track2MgmtDirs = Get-ChildItem - Path " $packagesPath " - Directory - Recurse - Depth 1 | Where-Object { $_.Name -match " (Azure.ResourceManager.)" -and $ (Test-Path (" $ ( $_.FullName ) /src" )) }
6
-
6
+ $newLine = [ Environment ]::NewLine
7
7
function Update-CIFile () {
8
8
param (
9
9
[string ]$mgmtCiFile = " "
@@ -13,7 +13,7 @@ function Update-CIFile() {
13
13
14
14
$content = Get-Content $mgmtCiFile - Raw
15
15
16
- if ($content -match " (?s)ServiceDirectory:\s*(?<sd>[^\r\n ]+).*-\s*name:\s*(?<p>[^\r\n ]+)" )
16
+ if ($content -match " (?s)ServiceDirectory:\s*(?<sd>[^$newLine ]+).*-\s*name:\s*(?<p>[^$newLine ]+)" )
17
17
{
18
18
$serviceDirectory = $matches [" sd" ]
19
19
$packageName = $matches [" p" ]
39
39
- $relPackageDir
40
40
"@
41
41
42
- $content = $content -replace " (?s)pr:[^\r\n ]*(\r\n ([ ]+[^\r\n ]*|))*" , " $prtriggers `r`n`r`n "
43
- $content = $content -replace " (?s)trigger:[^\r\n ]*(\r\n ([ ]+[^\r\n ]*|))*" , " trigger: none`r`n "
42
+ $content = $content -replace " (?s)pr:[^$newLine ]*($newLine ([ ]+[^$newLine ]*|))*" , " $prtriggers$newLine$newLine "
43
+ $content = $content -replace " (?s)trigger:[^$newLine ]*($newLine ([ ]+[^$newLine ]*|))*" , " trigger: none$newLine "
44
44
45
45
if ($content -notmatch " LimitForPullRequest: true" )
46
46
{
47
- $content = $content -replace " (.*)Artifacts:" , " `$ 1LimitForPullRequest: true`r`n `$ 1Artifacts:"
47
+ $content = $content -replace " (.*)Artifacts:" , " `$ 1LimitForPullRequest: true$newLine `$ 1Artifacts:"
48
48
}
49
49
50
50
Set-Content - Path $mgmtCiFile $content - NoNewline
56
56
{
57
57
$ciContent = Get-Content $ciFile - Raw
58
58
59
- $ciContent = $ciContent -replace " (?s)(paths:\r\n (\s+)include:\r\n (?:\s+-[^\r\n]*\r\n )*(?:\s+-\s+$relServiceDir /?\r\n )(?:\s+-[^\r\n]*\r\n )*)(?!\s+exclude:)" , " `$ 1`$ 2exclude:`r`n` $ 2- $relPackageDir `r`n "
59
+ $ciContent = $ciContent -replace " (?s)(paths:$newLine (\s+)include:$newLine (?:\s+-[^$newLine ]* $newLine )*(?:\s+-\s+$relServiceDir /?$newLine )(?:\s+-[^$newLine ]* $newLine )*)(?!\s+exclude:)" , " `$ 1`$ 2exclude:$newLine ` $ 2- $relPackageDir$newLine "
60
60
61
61
Set-Content - Path $ciFile $ciContent - NoNewline
62
62
}
0 commit comments