Skip to content

Commit

Permalink
Merge pull request #2011 from Microsoft/users/praga/m102fix
Browse files Browse the repository at this point in the history
Fixing Java tasks
  • Loading branch information
prawalagarwal authored Jul 5, 2016
2 parents 17fc1b1 + 30a01a0 commit 6defac1
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 57 deletions.
60 changes: 41 additions & 19 deletions Tasks/ANT/ant.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,22 @@ if ($jdkPath)
}

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

try
{
if(Test-Path $reportDirectory)
{
# delete any previous code coverage data
rm -r $reportDirectory -force | Out-Null
}
}
catch
{
Write-Verbose "Failed to delete report directory"
}

if($isCoverageEnabled)
{
if ($codeCoverageTool -eq "Cobertura")
Expand All @@ -128,10 +141,36 @@ $summaryFile = Join-Path $summaryFile $summaryFileName
# ensuring unique code coverage report task name by using guid
$CCReportTask = "CodeCoverage_" +[guid]::NewGuid()

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

try
{
if(Test-Path $reportBuildFile)
{
# delete any previous code coverage report build file
rm -r $reportBuildFile -force | Out-Null
}
}
catch
{
Write-Verbose "Failed to delete report build file"
}

try
{
if(Test-Path $instrumentedClassesDirectory)
{
# delete any previous instrumented classes directory
rm -r $instrumentedClassesDirectory -force | Out-Null
}
}
catch
{
Write-Verbose "Failed to delete instrumented classes directory"
}

if($isCoverageEnabled)
{
try
Expand Down Expand Up @@ -242,23 +281,6 @@ if($isCoverageEnabled)
}
}

if(Test-Path $reportDirectory)
{
# delete any previous code coverage data
rm -r $reportDirectory -force | Out-Null
}

if(Test-Path $reportBuildFile)
{
# delete any previous code coverage report build file
rm -r $reportBuildFile -force | Out-Null
}

if(Test-Path $instrumentedClassesDirectory)
{
# delete any previous instrumented classes directory
rm -r $instrumentedClassesDirectory -force | Out-Null
}
Write-Verbose "Leaving script Ant.ps1"


Expand Down
2 changes: 1 addition & 1 deletion Tasks/ANT/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 45
"Patch": 46
},
"demands": [
"ant"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/ANT/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 45
"Patch": 46
},
"demands": [
"ant"
Expand Down
23 changes: 15 additions & 8 deletions Tasks/Gradle/Gradle.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,23 @@ if ($jdkPath)

$buildRootPath = $cwd
$wrapperDirectory = Split-Path $wrapperScript -Parent
$reportDirectoryName = [guid]::NewGuid()
$reportDirectoryName = "ReportDirectory84B7D86C"
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName

try
{
if(Test-Path $reportDirectory)
{
# delete any code coverage data
rm -r $reportDirectory -force | Out-Null
}
}
catch
{
Write-Verbose "Failed to delete report directory"
}


# check if project is multi module gradle build or not
$subprojects = Invoke-BatchScript -Path $wrapperScript -Arguments 'properties' -WorkingFolder $buildRootPath | Select-String '^subprojects: (.*)'|ForEach-Object {$_.Matches[0].Groups[1].Value}
Write-Verbose "subprojects: $subprojects"
Expand Down Expand Up @@ -213,11 +227,4 @@ if($isCoverageEnabled)
}
}

if(Test-Path $reportDirectory)
{
# delete any code coverage data
rm -r $reportDirectory -force | Out-Null
}


Write-Verbose "Leaving script Gradle.ps1"
2 changes: 1 addition & 1 deletion Tasks/Gradle/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 43
"Patch": 44
},
"demands": [
"java"
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Gradle/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 43
"Patch": 44
},
"demands": [
"java"
Expand Down
58 changes: 34 additions & 24 deletions Tasks/Maven/maven.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ import-module "Microsoft.TeamFoundation.DistributedTask.Task.TestResults"


$buildRootPath = Split-Path $mavenPOMFile -Parent
$reportDirectoryName = [guid]::NewGuid()
$reportDirectoryName = "ReportDirectoryC91CDE2D"
$reportDirectoryNameCobertura = "target\site\cobertura"
$reportPOMFileName = [guid]::NewGuid().tostring() + ".xml"
$reportPOMFileName = "ReportPOMFile4E52C1C4.xml"
$reportPOMFile = Join-Path $buildRootPath $reportPOMFileName
$reportDirectory = Join-Path $buildRootPath $reportDirectoryName
$reportDirectoryCobertura = Join-Path $buildRootPath $reportDirectoryNameCobertura
Expand All @@ -126,6 +126,38 @@ $CCReportTask = "jacoco:report"

Write-Verbose "SummaryFileCobertura = $summaryFileCobertura"

try
{
if(Test-Path $reportDirectory)
{
# delete any previous code coverage data
rm -r $reportDirectory -force | Out-Null
}

if(Test-Path $reportDirectoryCobertura)
{
# delete any previous code coverage data from Cobertura
rm -r $reportDirectoryCobertura -force | Out-Null
}
}
catch
{
Write-Verbose "Failed to delete report directory"
}

try
{
if(Test-Path $reportPOMFile)
{
# delete any previous code coverage data
rm $reportPOMFile -force | Out-Null
}
}
catch
{
Write-Verbose "Failed to delete report POM file"
}

if($isCoverageEnabled)
{
if(Test-Path $targetDirectory)
Expand Down Expand Up @@ -184,26 +216,4 @@ ElseIf ($codeCoverageTool -eq "Cobertura")
# Run SonarQube analysis by invoking Maven with the "sonar:sonar" goal
RunSonarQubeAnalysis $sqAnalysisEnabled $sqConnectedServiceName $sqDbDetailsRequired $sqDbUrl $sqDbUsername $sqDbPassword $options $mavenPOMFile $execFileJacoco

if(Test-Path $reportDirectory)
{
# delete any previous code coverage data
rm -r $reportDirectory -force | Out-Null
}

if(Test-Path $reportDirectoryCobertura)
{
# delete any previous code coverage data from Cobertura
rm -r $reportDirectoryCobertura -force | Out-Null
}

if(Test-Path $reportPOMFile)
{
# delete any previous code coverage data
rm $reportPOMFile -force | Out-Null
}

Write-Verbose "Leaving script Maven.ps1"




2 changes: 1 addition & 1 deletion Tasks/Maven/task.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 53
"Patch": 54
},
"minimumAgentVersion": "1.89.0",
"instanceNameFormat": "Maven $(mavenPOMFile)",
Expand Down
2 changes: 1 addition & 1 deletion Tasks/Maven/task.loc.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"version": {
"Major": 1,
"Minor": 0,
"Patch": 53
"Patch": 54
},
"minimumAgentVersion": "1.89.0",
"instanceNameFormat": "ms-resource:loc.instanceNameFormat",
Expand Down

0 comments on commit 6defac1

Please sign in to comment.