Skip to content

Commit eac3882

Browse files
author
Nitin Gurram
committed
Indention correction
1 parent e06a144 commit eac3882

File tree

3 files changed

+92
-92
lines changed

3 files changed

+92
-92
lines changed

Tasks/ANT/ant.ps1

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ $reportDirectory = Join-Path $buildRootPath $reportDirectoryName
113113

114114
if($isCoverageEnabled)
115115
{
116-
if ($codeCoverageTool -eq "Cobertura")
117-
{
118-
$summaryFileName = "coverage.xml"
119-
}
120-
ElseIf ($codeCoverageTool -eq "JaCoCo")
121-
{
122-
$summaryFileName = "summary.xml"
123-
}
116+
if ($codeCoverageTool -eq "Cobertura")
117+
{
118+
$summaryFileName = "coverage.xml"
119+
}
120+
ElseIf ($codeCoverageTool -eq "JaCoCo")
121+
{
122+
$summaryFileName = "summary.xml"
123+
}
124124
}
125125

126126
$summaryFile = Join-Path $buildRootPath $reportDirectoryName
@@ -182,11 +182,11 @@ if($publishJUnitResultsFromAntBuild)
182182
else
183183
{
184184
Write-Verbose "Calling Publish-TestResults"
185-
$runTitleMemberExists = CmdletHasMember "RunTitle"
186-
if($runTitleMemberExists)
187-
{
188-
Publish-TestResults -TestRunner "JUnit" -TestResultsFiles $matchingTestResultsFiles -Context $distributedTaskContext -RunTitle $testRunTitle -MergeResults $true
189-
}
185+
$runTitleMemberExists = CmdletHasMember "RunTitle"
186+
if($runTitleMemberExists)
187+
{
188+
Publish-TestResults -TestRunner "JUnit" -TestResultsFiles $matchingTestResultsFiles -Context $distributedTaskContext -RunTitle $testRunTitle -MergeResults $true
189+
}
190190
else
191191
{
192192
if(!([string]::IsNullOrWhiteSpace($testRunTitle)))
@@ -205,7 +205,7 @@ else
205205
# check if code coverage has been enabled
206206
if($isCoverageEnabled)
207207
{
208-
208+
209209
# run report code coverage task which generates code coverage reports.
210210
$reportsGenerationFailed = $false
211211
Write-Verbose "Collecting code coverage reports" -Verbose
@@ -226,18 +226,18 @@ if($isCoverageEnabled)
226226
$reportsGenerationFailed = $true
227227
}
228228

229-
if(-not $reportsGenerationFailed -and (Test-Path $summaryFile))
230-
{
231-
Write-Verbose "Summary file = $summaryFile" -Verbose
232-
Write-Verbose "Report directory = $reportDirectory" -Verbose
233-
Write-Verbose "Calling Publish-CodeCoverage" -Verbose
234-
Publish-CodeCoverage -CodeCoverageTool $codeCoverageTool -SummaryFileLocation $summaryFile -ReportDirectory $reportDirectory -Context $distributedTaskContext
235-
}
236-
else
237-
{
229+
if(-not $reportsGenerationFailed -and (Test-Path $summaryFile))
230+
{
231+
Write-Verbose "Summary file = $summaryFile" -Verbose
232+
Write-Verbose "Report directory = $reportDirectory" -Verbose
233+
Write-Verbose "Calling Publish-CodeCoverage" -Verbose
234+
Publish-CodeCoverage -CodeCoverageTool $codeCoverageTool -SummaryFileLocation $summaryFile -ReportDirectory $reportDirectory -Context $distributedTaskContext
235+
}
236+
else
237+
{
238238
Write-Host "##vso[task.logissue type=warning;code=006003;]"
239-
Write-Warning "No code coverage results found to be published. This could occur if there were no tests executed or there was a build failure. Check the ant output for details." -Verbose
240-
}
239+
Write-Warning "No code coverage results found to be published. This could occur if there were no tests executed or there was a build failure. Check the ant output for details." -Verbose
240+
}
241241

242242
# Reset temp copy and file permissions are reset by default
243243
Copy-Item "$antBuildFile.tmp" $antBuildFile -Force -ErrorAction Continue

Tasks/Gradle/Gradle.ps1

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ if ($isCoverageEnabled)
161161
}
162162
else
163163
{
164-
$arguments = "$options $tasks"
164+
$arguments = "$options $tasks"
165165
}
166166

167167
Write-Verbose "Invoking Gradle wrapper $wrapperScript $arguments"
@@ -181,19 +181,19 @@ if($publishJUnitResultsFromAntBuild)
181181
else
182182
{
183183
Write-Verbose "Calling Publish-TestResults"
184-
$runTitleMemberExists = CmdletHasMember "RunTitle"
185-
if($runTitleMemberExists)
186-
{
187-
Publish-TestResults -TestRunner "JUnit" -TestResultsFiles $matchingTestResultsFiles -Context $distributedTaskContext -RunTitle $testRunTitle -MergeResults $true
188-
}
189-
else
190-
{
191-
if(!([string]::IsNullOrWhiteSpace($testRunTitle)))
192-
{
193-
Write-Warning "Update the build agent to be able to use the custom run title feature."
194-
}
195-
Publish-TestResults -TestRunner "JUnit" -TestResultsFiles $matchingTestResultsFiles -Context $distributedTaskContext -MergeResults $true
196-
}
184+
$runTitleMemberExists = CmdletHasMember "RunTitle"
185+
if($runTitleMemberExists)
186+
{
187+
Publish-TestResults -TestRunner "JUnit" -TestResultsFiles $matchingTestResultsFiles -Context $distributedTaskContext -RunTitle $testRunTitle -MergeResults $true
188+
}
189+
else
190+
{
191+
if(!([string]::IsNullOrWhiteSpace($testRunTitle)))
192+
{
193+
Write-Warning "Update the build agent to be able to use the custom run title feature."
194+
}
195+
Publish-TestResults -TestRunner "JUnit" -TestResultsFiles $matchingTestResultsFiles -Context $distributedTaskContext -MergeResults $true
196+
}
197197
}
198198
}
199199
else
@@ -205,18 +205,18 @@ else
205205
# check if code coverage has been enabled
206206
if ($isCoverageEnabled)
207207
{
208-
if(Test-Path $summaryFile)
209-
{
210-
Write-Verbose "Summary file = $summaryFile" -Verbose
211-
Write-Verbose "Report directory = $reportDirectory" -Verbose
212-
Write-Verbose "Calling Publish-CodeCoverage" -Verbose
213-
Publish-CodeCoverage -CodeCoverageTool $codeCoverageTool -SummaryFileLocation $summaryFile -ReportDirectory $reportDirectory -Context $distributedTaskContext
214-
}
215-
else
216-
{
208+
if(Test-Path $summaryFile)
209+
{
210+
Write-Verbose "Summary file = $summaryFile" -Verbose
211+
Write-Verbose "Report directory = $reportDirectory" -Verbose
212+
Write-Verbose "Calling Publish-CodeCoverage" -Verbose
213+
Publish-CodeCoverage -CodeCoverageTool $codeCoverageTool -SummaryFileLocation $summaryFile -ReportDirectory $reportDirectory -Context $distributedTaskContext
214+
}
215+
else
216+
{
217217
Write-Host "##vso[task.logissue type=warning;code=005003;]"
218-
Write-Warning "No code coverage results found to be published. This could occur if there were no tests executed or there was a build failure. Check the gradle output for details." -Verbose
219-
}
218+
Write-Warning "No code coverage results found to be published. This could occur if there were no tests executed or there was a build failure. Check the gradle output for details." -Verbose
219+
}
220220

221221
# Reset temp copy and file permissions are reset by default
222222
Copy-Item "$buildFile.tmp" $buildFile -Force -ErrorAction Continue

Tasks/Maven/maven.ps1

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -31,27 +31,27 @@ Function CmdletHasMember($memberName) {
3131
}
3232

3333
Function GetMavenToolPath() {
34-
if(!$mavenPath -or -not (Test-Path $mavenPath))
35-
{
36-
throw "Maven path not specified or does not exist"
37-
}
38-
# The Maven bin path should contain either mvn.cmd (Maven 3) or mvn.bat (Maven 2)
39-
$toolPath = gci -Path "$mavenPath" -Filter "mvn.cmd" -Recurse | select -First 1
40-
if(!$toolPath)
41-
{
42-
$toolPath = gci -Path "$mavenPath" -Filter "mvn.bat" -Recurse | select -First 1
43-
}
44-
if(!$toolPath)
45-
{
46-
throw "Path $mavenPath does not contain a Maven installation"
47-
}
48-
Write-Host "Using Maven executable at $($toolPath.FullName)"
49-
if($mavenSetM2Home -eq $true)
50-
{
51-
$env:M2_HOME = $mavenPath
52-
Write-Host "M2_HOME set to $mavenPath"
53-
}
54-
return $toolPath.FullName
34+
if(!$mavenPath -or -not (Test-Path $mavenPath))
35+
{
36+
throw "Maven path not specified or does not exist"
37+
}
38+
# The Maven bin path should contain either mvn.cmd (Maven 3) or mvn.bat (Maven 2)
39+
$toolPath = gci -Path "$mavenPath" -Filter "mvn.cmd" -Recurse | select -First 1
40+
if(!$toolPath)
41+
{
42+
$toolPath = gci -Path "$mavenPath" -Filter "mvn.bat" -Recurse | select -First 1
43+
}
44+
if(!$toolPath)
45+
{
46+
throw "Path $mavenPath does not contain a Maven installation"
47+
}
48+
Write-Host "Using Maven executable at $($toolPath.FullName)"
49+
if($mavenSetM2Home -eq $true)
50+
{
51+
$env:M2_HOME = $mavenPath
52+
Write-Host "M2_HOME set to $mavenPath"
53+
}
54+
return $toolPath.FullName
5555
}
5656

5757
Write-Verbose 'Entering Maven.ps1'
@@ -66,8 +66,8 @@ if($isCoverageEnabled -eq $true)
6666
{
6767
Write-Verbose "codeCoverageTool = $codeCoverageTool" -Verbose
6868
Write-Verbose "classFilter = $classFilter" -Verbose
69-
Write-Verbose "classFilesDirectories = $classFilesDirectories"
70-
Write-Verbose "srcDirectories = $srcDirectories"
69+
Write-Verbose "classFilesDirectories = $classFilesDirectories"
70+
Write-Verbose "srcDirectories = $srcDirectories"
7171
}
7272

7373
Write-Verbose "javaHomeSelection = $javaHomeSelection"
@@ -132,8 +132,8 @@ Remove-Item -Recurse -Force $targetDirectory -ErrorAction SilentlyContinue
132132

133133
if ($isCoverageEnabled)
134134
{
135-
Copy-Item $mavenPOMFile "$mavenPOMFile.tmp" -Force -ErrorAction Continue
136-
Set-ItemProperty $mavenPOMFile -Name Attributes -Value Normal
135+
Copy-Item $mavenPOMFile "$mavenPOMFile.tmp" -Force -ErrorAction Continue
136+
Set-ItemProperty $mavenPOMFile -Name Attributes -Value Normal
137137
}
138138

139139
# Enable Code Coverage
@@ -146,40 +146,40 @@ ConfigureJDK $javaHomeSelection $jdkVersion $jdkArchitecture $jdkUserInputPath
146146
Write-Host "Running Maven..."
147147
if($mavenVersionSelection -eq "Default")
148148
{
149-
Invoke-Maven -MavenPomFile $mavenPOMFile -Options $options -Goals $goals
149+
Invoke-Maven -MavenPomFile $mavenPOMFile -Options $options -Goals $goals
150150
}
151151
else
152152
{
153-
$mavenToolPath = GetMavenToolPath
154-
Invoke-Maven -MavenPomFile $mavenPOMFile -Options $options -Goals $goals -ToolPath $mavenToolPath
153+
$mavenToolPath = GetMavenToolPath
154+
Invoke-Maven -MavenPomFile $mavenPOMFile -Options $options -Goals $goals -ToolPath $mavenToolPath
155155
}
156156

157157
# Publish test results
158158
$runTitleMemberExists = CmdletHasMember "RunTitle"
159159
if($runTitleMemberExists)
160160
{
161-
PublishTestResults $publishJUnitResults $testResultsFiles $testRunTitle
161+
PublishTestResults $publishJUnitResults $testResultsFiles $testRunTitle
162162
}
163163
else
164164
{
165-
if(!([string]::IsNullOrWhiteSpace($testRunTitle)))
166-
{
167-
Write-Warning "Update the build agent to be able to use the custom run title feature."
168-
}
169-
PublishTestResults $publishJUnitResults $testResultsFiles
165+
if(!([string]::IsNullOrWhiteSpace($testRunTitle)))
166+
{
167+
Write-Warning "Update the build agent to be able to use the custom run title feature."
168+
}
169+
PublishTestResults $publishJUnitResults $testResultsFiles
170170
}
171171

172172
if ($codeCoverageTool -eq "JaCoCo")
173173
{
174-
#set sonar parameter
175-
$execFileJacoco = Join-Path $reportDirectory "jacoco.exec"
176-
# Publish code coverage for Jacoco
177-
PublishCodeCoverageJacoco $isCoverageEnabled $mavenPOMFile $CCReportTask $summaryFileJacoco $reportDirectory $codeCoverageTool $reportPOMFile
174+
#set sonar parameter
175+
$execFileJacoco = Join-Path $reportDirectory "jacoco.exec"
176+
# Publish code coverage for Jacoco
177+
PublishCodeCoverageJacoco $isCoverageEnabled $mavenPOMFile $CCReportTask $summaryFileJacoco $reportDirectory $codeCoverageTool $reportPOMFile
178178
}
179179
ElseIf ($codeCoverageTool -eq "Cobertura")
180180
{
181-
# Publish code coverage for Jacoco
182-
PublishCodeCoverageCobertura $isCoverageEnabled $mavenPOMFile $summaryFileCobertura $reportDirectoryCobertura $codeCoverageTool
181+
# Publish code coverage for Jacoco
182+
PublishCodeCoverageCobertura $isCoverageEnabled $mavenPOMFile $summaryFileCobertura $reportDirectoryCobertura $codeCoverageTool
183183
}
184184

185185
# Run SonarQube analysis by invoking Maven with the "sonar:sonar" goal
@@ -188,8 +188,8 @@ RunSonarQubeAnalysis $sqAnalysisEnabled $sqConnectedServiceName $sqDbDetailsRequ
188188
# Reset temp copy and file permissions are reset by default
189189
if ($isCoverageEnabled)
190190
{
191-
Copy-Item "$mavenPOMFile.tmp" $mavenPOMFile -Force -ErrorAction Continue
192-
Remove-Item "$mavenPOMFile.tmp" -Force -ErrorAction Continue
191+
Copy-Item "$mavenPOMFile.tmp" $mavenPOMFile -Force -ErrorAction Continue
192+
Remove-Item "$mavenPOMFile.tmp" -Force -ErrorAction Continue
193193
}
194194

195195
Write-Verbose "Leaving script Maven.ps1"

0 commit comments

Comments
 (0)