Skip to content

Commit 6defac1

Browse files
Merge pull request #2011 from Microsoft/users/praga/m102fix
Fixing Java tasks
2 parents 17fc1b1 + 30a01a0 commit 6defac1

File tree

9 files changed

+96
-57
lines changed

9 files changed

+96
-57
lines changed

Tasks/ANT/ant.ps1

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,22 @@ if ($jdkPath)
108108
}
109109

110110
$buildRootPath = Split-Path $antBuildFile -Parent
111-
$reportDirectoryName = [guid]::NewGuid()
111+
$reportDirectoryName = "ReportDirectory75C12DBC"
112112
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
113113

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+
}
126+
114127
if($isCoverageEnabled)
115128
{
116129
if ($codeCoverageTool -eq "Cobertura")
@@ -128,10 +141,36 @@ $summaryFile = Join-Path $summaryFile $summaryFileName
128141
# ensuring unique code coverage report task name by using guid
129142
$CCReportTask = "CodeCoverage_" +[guid]::NewGuid()
130143

131-
$reportBuildFileName = [guid]::NewGuid().tostring() + ".xml"
144+
$reportBuildFileName = "ReportBuildFile9B5907FC.xml"
132145
$reportBuildFile = Join-Path $buildRootPath $reportBuildFileName
133146
$instrumentedClassesDirectory = Join-Path $buildRootPath "InstrumentedClasses"
134147

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
157+
{
158+
Write-Verbose "Failed to delete report build file"
159+
}
160+
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
170+
{
171+
Write-Verbose "Failed to delete instrumented classes directory"
172+
}
173+
135174
if($isCoverageEnabled)
136175
{
137176
try
@@ -242,23 +281,6 @@ if($isCoverageEnabled)
242281
}
243282
}
244283

245-
if(Test-Path $reportDirectory)
246-
{
247-
# delete any previous code coverage data
248-
rm -r $reportDirectory -force | Out-Null
249-
}
250-
251-
if(Test-Path $reportBuildFile)
252-
{
253-
# delete any previous code coverage report build file
254-
rm -r $reportBuildFile -force | Out-Null
255-
}
256-
257-
if(Test-Path $instrumentedClassesDirectory)
258-
{
259-
# delete any previous instrumented classes directory
260-
rm -r $instrumentedClassesDirectory -force | Out-Null
261-
}
262284
Write-Verbose "Leaving script Ant.ps1"
263285

264286

Tasks/ANT/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"version": {
1414
"Major": 1,
1515
"Minor": 0,
16-
"Patch": 45
16+
"Patch": 46
1717
},
1818
"demands": [
1919
"ant"

Tasks/ANT/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"version": {
1414
"Major": 1,
1515
"Minor": 0,
16-
"Patch": 45
16+
"Patch": 46
1717
},
1818
"demands": [
1919
"ant"

Tasks/Gradle/Gradle.ps1

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

106106
$buildRootPath = $cwd
107107
$wrapperDirectory = Split-Path $wrapperScript -Parent
108-
$reportDirectoryName = [guid]::NewGuid()
108+
$reportDirectoryName = "ReportDirectory84B7D86C"
109109
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
110110

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
120+
{
121+
Write-Verbose "Failed to delete report directory"
122+
}
123+
124+
111125
# check if project is multi module gradle build or not
112126
$subprojects = Invoke-BatchScript -Path $wrapperScript -Arguments 'properties' -WorkingFolder $buildRootPath | Select-String '^subprojects: (.*)'|ForEach-Object {$_.Matches[0].Groups[1].Value}
113127
Write-Verbose "subprojects: $subprojects"
@@ -213,11 +227,4 @@ if($isCoverageEnabled)
213227
}
214228
}
215229

216-
if(Test-Path $reportDirectory)
217-
{
218-
# delete any code coverage data
219-
rm -r $reportDirectory -force | Out-Null
220-
}
221-
222-
223230
Write-Verbose "Leaving script Gradle.ps1"

Tasks/Gradle/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"version": {
1313
"Major": 1,
1414
"Minor": 0,
15-
"Patch": 43
15+
"Patch": 44
1616
},
1717
"demands": [
1818
"java"

Tasks/Gradle/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"version": {
1313
"Major": 1,
1414
"Minor": 0,
15-
"Patch": 43
15+
"Patch": 44
1616
},
1717
"demands": [
1818
"java"

Tasks/Maven/maven.ps1

Lines changed: 34 additions & 24 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 = [guid]::NewGuid()
112+
$reportDirectoryName = "ReportDirectoryC91CDE2D"
113113
$reportDirectoryNameCobertura = "target\site\cobertura"
114-
$reportPOMFileName = [guid]::NewGuid().tostring() + ".xml"
114+
$reportPOMFileName = "ReportPOMFile4E52C1C4.xml"
115115
$reportPOMFile = Join-Path $buildRootPath $reportPOMFileName
116116
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
117117
$reportDirectoryCobertura = Join-Path $buildRootPath $reportDirectoryNameCobertura
@@ -126,6 +126,38 @@ $CCReportTask = "jacoco:report"
126126

127127
Write-Verbose "SummaryFileCobertura = $summaryFileCobertura"
128128

129+
try
130+
{
131+
if(Test-Path $reportDirectory)
132+
{
133+
# delete any previous code coverage data
134+
rm -r $reportDirectory -force | Out-Null
135+
}
136+
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
144+
{
145+
Write-Verbose "Failed to delete report directory"
146+
}
147+
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
157+
{
158+
Write-Verbose "Failed to delete report POM file"
159+
}
160+
129161
if($isCoverageEnabled)
130162
{
131163
if(Test-Path $targetDirectory)
@@ -184,26 +216,4 @@ ElseIf ($codeCoverageTool -eq "Cobertura")
184216
# Run SonarQube analysis by invoking Maven with the "sonar:sonar" goal
185217
RunSonarQubeAnalysis $sqAnalysisEnabled $sqConnectedServiceName $sqDbDetailsRequired $sqDbUrl $sqDbUsername $sqDbPassword $options $mavenPOMFile $execFileJacoco
186218

187-
if(Test-Path $reportDirectory)
188-
{
189-
# delete any previous code coverage data
190-
rm -r $reportDirectory -force | Out-Null
191-
}
192-
193-
if(Test-Path $reportDirectoryCobertura)
194-
{
195-
# delete any previous code coverage data from Cobertura
196-
rm -r $reportDirectoryCobertura -force | Out-Null
197-
}
198-
199-
if(Test-Path $reportPOMFile)
200-
{
201-
# delete any previous code coverage data
202-
rm $reportPOMFile -force | Out-Null
203-
}
204-
205219
Write-Verbose "Leaving script Maven.ps1"
206-
207-
208-
209-

Tasks/Maven/task.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 0,
19-
"Patch": 53
19+
"Patch": 54
2020
},
2121
"minimumAgentVersion": "1.89.0",
2222
"instanceNameFormat": "Maven $(mavenPOMFile)",

Tasks/Maven/task.loc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"version": {
1717
"Major": 1,
1818
"Minor": 0,
19-
"Patch": 53
19+
"Patch": 54
2020
},
2121
"minimumAgentVersion": "1.89.0",
2222
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",

0 commit comments

Comments
 (0)