Skip to content

Commit 30a01a0

Browse files
committed
PR Comments
1 parent a34d298 commit 30a01a0

File tree

3 files changed

+72
-29
lines changed

3 files changed

+72
-29
lines changed

Tasks/ANT/ant.ps1

Lines changed: 34 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,21 @@ if ($jdkPath)
108108
}
109109

110110
$buildRootPath = Split-Path $antBuildFile -Parent
111-
$reportDirectoryName = "ReportDirectory_75C12DBC-FB59-450A-8E4F-772EA8BFCFA6"
111+
$reportDirectoryName = "ReportDirectory75C12DBC"
112112
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
113113

114-
if(Test-Path $reportDirectory)
115-
{
116-
# delete any previous code coverage data
117-
rm -r $reportDirectory -force | Out-Null
118-
}
114+
try
115+
{
116+
if(Test-Path $reportDirectory)
117+
{
118+
# delete any previous code coverage data
119+
rm -r $reportDirectory -force | Out-Null
120+
}
121+
}
122+
catch
123+
{
124+
Write-Verbose "Failed to delete report directory"
125+
}
119126

120127
if($isCoverageEnabled)
121128
{
@@ -134,20 +141,34 @@ $summaryFile = Join-Path $summaryFile $summaryFileName
134141
# ensuring unique code coverage report task name by using guid
135142
$CCReportTask = "CodeCoverage_" +[guid]::NewGuid()
136143

137-
$reportBuildFileName = "ReportBuildFile_9B5907FC-EC56-4662-B8EA-EC23FCB97C43.xml"
144+
$reportBuildFileName = "ReportBuildFile9B5907FC.xml"
138145
$reportBuildFile = Join-Path $buildRootPath $reportBuildFileName
139146
$instrumentedClassesDirectory = Join-Path $buildRootPath "InstrumentedClasses"
140147

141-
if(Test-Path $reportBuildFile)
148+
try
149+
{
150+
if(Test-Path $reportBuildFile)
151+
{
152+
# delete any previous code coverage report build file
153+
rm -r $reportBuildFile -force | Out-Null
154+
}
155+
}
156+
catch
142157
{
143-
# delete any previous code coverage report build file
144-
rm -r $reportBuildFile -force | Out-Null
158+
Write-Verbose "Failed to delete report build file"
145159
}
146160

147-
if(Test-Path $instrumentedClassesDirectory)
161+
try
162+
{
163+
if(Test-Path $instrumentedClassesDirectory)
164+
{
165+
# delete any previous instrumented classes directory
166+
rm -r $instrumentedClassesDirectory -force | Out-Null
167+
}
168+
}
169+
catch
148170
{
149-
# delete any previous instrumented classes directory
150-
rm -r $instrumentedClassesDirectory -force | Out-Null
171+
Write-Verbose "Failed to delete instrumented classes directory"
151172
}
152173

153174
if($isCoverageEnabled)

Tasks/Gradle/Gradle.ps1

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,23 @@ if ($jdkPath)
105105

106106
$buildRootPath = $cwd
107107
$wrapperDirectory = Split-Path $wrapperScript -Parent
108-
$reportDirectoryName = "ReportDirectory_84B7D86C-F08D-4B65-8D37-742D8B02D27B"
108+
$reportDirectoryName = "ReportDirectory84B7D86C"
109109
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
110110

111-
if(Test-Path $reportDirectory)
111+
try
112+
{
113+
if(Test-Path $reportDirectory)
114+
{
115+
# delete any code coverage data
116+
rm -r $reportDirectory -force | Out-Null
117+
}
118+
}
119+
catch
112120
{
113-
# delete any code coverage data
114-
rm -r $reportDirectory -force | Out-Null
121+
Write-Verbose "Failed to delete report directory"
115122
}
116123

124+
117125
# check if project is multi module gradle build or not
118126
$subprojects = Invoke-BatchScript -Path $wrapperScript -Arguments 'properties' -WorkingFolder $buildRootPath | Select-String '^subprojects: (.*)'|ForEach-Object {$_.Matches[0].Groups[1].Value}
119127
Write-Verbose "subprojects: $subprojects"

Tasks/Maven/maven.ps1

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ import-module "Microsoft.TeamFoundation.DistributedTask.Task.TestResults"
109109

110110

111111
$buildRootPath = Split-Path $mavenPOMFile -Parent
112-
$reportDirectoryName = "ReportDirectory_C91CDE2D-CC66-4541-9C27-E3EF6CB3DB16"
112+
$reportDirectoryName = "ReportDirectoryC91CDE2D"
113113
$reportDirectoryNameCobertura = "target\site\cobertura"
114-
$reportPOMFileName = "ReportPOMFile_4E52C1C4-8C32-4580-A54D-41D5E9ED1F74.xml"
114+
$reportPOMFileName = "ReportPOMFile4E52C1C4.xml"
115115
$reportPOMFile = Join-Path $buildRootPath $reportPOMFileName
116116
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
117117
$reportDirectoryCobertura = Join-Path $buildRootPath $reportDirectoryNameCobertura
@@ -126,22 +126,36 @@ $CCReportTask = "jacoco:report"
126126

127127
Write-Verbose "SummaryFileCobertura = $summaryFileCobertura"
128128

129-
if(Test-Path $reportDirectory)
129+
try
130130
{
131-
# delete any previous code coverage data
132-
rm -r $reportDirectory -force | Out-Null
133-
}
131+
if(Test-Path $reportDirectory)
132+
{
133+
# delete any previous code coverage data
134+
rm -r $reportDirectory -force | Out-Null
135+
}
134136

135-
if(Test-Path $reportDirectoryCobertura)
137+
if(Test-Path $reportDirectoryCobertura)
138+
{
139+
# delete any previous code coverage data from Cobertura
140+
rm -r $reportDirectoryCobertura -force | Out-Null
141+
}
142+
}
143+
catch
136144
{
137-
# delete any previous code coverage data from Cobertura
138-
rm -r $reportDirectoryCobertura -force | Out-Null
145+
Write-Verbose "Failed to delete report directory"
139146
}
140147

141-
if(Test-Path $reportPOMFile)
148+
try
149+
{
150+
if(Test-Path $reportPOMFile)
151+
{
152+
# delete any previous code coverage data
153+
rm $reportPOMFile -force | Out-Null
154+
}
155+
}
156+
catch
142157
{
143-
# delete any previous code coverage data
144-
rm $reportPOMFile -force | Out-Null
158+
Write-Verbose "Failed to delete report POM file"
145159
}
146160

147161
if($isCoverageEnabled)

0 commit comments

Comments
 (0)