Skip to content

Commit 38911b0

Browse files
mickael-caro-sonarsourceduncanp-sonar
authored andcommitted
Added .NET Core 3 package for Chocolatey + fixed incorrect package name in artifacts (#809)
1 parent c105fc9 commit 38911b0

File tree

6 files changed

+70
-9
lines changed

6 files changed

+70
-9
lines changed

azure-pipelines.yml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ stages:
173173
174174
$classicScannerZipPath = Get-Item "$artifactsFolder\\sonarscanner-msbuild-net46.zip"
175175
$dotnetScannerZipPath = Get-Item "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.zip"
176+
$dotnetScannerZipPath3 = Get-Item "$artifactsFolder\\sonarscanner-msbuild-netcoreapp3.0.zip"
176177
$dotnetScannerGlobalToolPath = Get-Item "$artifactsFolder\\dotnet-sonarscanner.$leakPeriodVersion.nupkg"
177178
178179
Write-Host "Generating the chocolatey packages"
@@ -188,6 +189,12 @@ stages:
188189
-Replace '-Checksum "not-set"', "-Checksum $dotnetZipHash" `
189190
| Set-Content $netcoreps1
190191
192+
$dotnetZipHash3 = (Get-FileHash $dotnetScannerZipPath3 -Algorithm SHA256).hash
193+
$netcoreps13 = "nuspec\chocolatey\chocolateyInstall-netcoreapp3.0.ps1"
194+
(Get-Content $netcoreps13) `
195+
-Replace '-Checksum "not-set"', "-Checksum $dotnetZipHash3" `
196+
| Set-Content $netcoreps13
197+
191198
choco pack nuspec\chocolatey\sonarscanner-msbuild-net46.nuspec `
192199
--outputdirectory $artifactsFolder `
193200
--version $version
@@ -196,14 +203,19 @@ stages:
196203
--outputdirectory $artifactsFolder `
197204
--version $version
198205
206+
choco pack nuspec\chocolatey\sonarscanner-msbuild-netcoreapp3.0.nuspec `
207+
--outputdirectory $artifactsFolder `
208+
--version $version
209+
199210
Write-Host "Update artifacts locations in pom.xml"
200211
$pomFile = ".\pom.xml"
201212
(Get-Content $pomFile) `
202213
-Replace 'classicScannerZipPath', "$classicScannerZipPath" `
203214
-Replace 'dotnetScannerZipPath', "$dotnetScannerZipPath" `
204215
-Replace 'dotnetScannerGlobalToolPath', "$dotnetScannerGlobalToolPath" `
205216
-Replace 'classicScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-net46.$version.nupkg" `
206-
-Replace 'dotnetScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.$version.nupkg" `
217+
-Replace 'dotnetcore2ScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.$version.nupkg" `
218+
-Replace 'dotnetcore3ScannerChocoPath', "$artifactsFolder\\sonarscanner-msbuild-netcoreapp3.0.$version.nupkg" `
207219
| Set-Content $pomFile
208220
- task: Maven@3
209221
displayName: Promote new version in pom
@@ -236,6 +248,15 @@ stages:
236248
javaHomeOption: 'JDKVersion'
237249
jdkVersionOption: '1.11'
238250
mavenOptions: $(MAVEN_OPTS)
251+
- task: PowerShell@2
252+
displayName: "Rename artifacts for GitHub Release"
253+
inputs:
254+
targetType: 'inline'
255+
script: |
256+
$artifactsFolder = "$env:BUILD_SOURCESDIRECTORY\\DeploymentArtifacts\\BuildAgentPayload\\Release"
257+
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-net46.zip" -NewName sonarscanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-net46.zip
258+
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-netcoreapp2.0.zip" -NewName sonarscanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-netcoreapp2.0.zip
259+
Rename-Item -Path "$artifactsFolder\\sonarscanner-msbuild-netcoreapp3.0.zip" -NewName sonarscanner-msbuild-$(SONAR_PROJECT_VERSION).$(Build.BuildId)-netcoreapp3.0.zip
239260
- task: PublishPipelineArtifact@1
240261
displayName: 'Publish packages as artifacts'
241262
inputs:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Install-ChocolateyZipPackage "sonarscanner-msbuild-netcoreapp3.0" `
2+
-Url "https://github.com/SonarSource/sonar-scanner-msbuild/releases/download/$env:ChocolateyPackageVersion/sonar-scanner-msbuild-$env:ChocolateyPackageVersion-netcoreapp3.0.zip" `
3+
-UnzipLocation "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" `
4+
-ChecksumType 'sha256' `
5+
-Checksum "not-set"
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
3+
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
4+
<metadata>
5+
<id>sonarscanner-msbuild-netcoreapp3.0</id>
6+
<version>1.0.0</version>
7+
<title>SonarScanner for MSBuild .Net Core 3.0</title>
8+
<authors>SonarSource,Microsoft</authors>
9+
<owners>SonarSource</owners>
10+
<projectUrl>http://redirect.sonarsource.com/doc/msbuild-sq-runner.html</projectUrl>
11+
<projectSourceUrl>https://github.com/SonarSource/sonar-scanner-msbuild</projectSourceUrl>
12+
<packageSourceUrl>https://github.com/SonarSource/sonar-scanner-msbuild/tree/master/nuspec/chocolatey</packageSourceUrl>
13+
<iconUrl>https://cdn.rawgit.com/SonarSource/sonar-scanner-msbuild/cdd1f588/icon.png</iconUrl>
14+
<licenseUrl>https://github.com/SonarSource/sonar-scanner-msbuild/blob/master/LICENSE.txt</licenseUrl>
15+
<docsUrl>https://redirect.sonarsource.com/doc/install-configure-scanner-msbuild.html</docsUrl>
16+
<mailingListUrl>https://community.sonarsource.com/</mailingListUrl>
17+
<bugTrackerUrl>https://github.com/SonarSource/sonar-scanner-msbuild/issues</bugTrackerUrl>
18+
<requireLicenseAcceptance>false</requireLicenseAcceptance>
19+
<summary>The SonarScanner for MSBuild allows easy analysis of any .NET project with SonarCloud/SonarQube.</summary>
20+
<description>The SonarScanner for MSBuild allows easy analysis of any .NET project with SonarCloud/SonarQube.</description>
21+
<tags>sonarqube sonarcloud msbuild scanner sonarsource sonar sonar-scanner sonarscanner</tags>
22+
<copyright>SonarSource SA and Microsoft Corporation</copyright>
23+
<releaseNotes>
24+
All release notes for SonarScanner MSBuild .Net Core can be found on the GitHub site - https://github.com/SonarSource/sonar-scanner-msbuild/releases
25+
</releaseNotes>
26+
</metadata>
27+
<files>
28+
<file src="chocolateyInstall-netcoreapp3.0.ps1" target="tools\chocolateyInstall.ps1" />
29+
</files>
30+
</package>

pom.xml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0"
2+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<parent>
55
<groupId>org.sonarsource.parent</groupId>
@@ -45,7 +45,7 @@
4545
<maven.test.redirectTestOutputToFile>true</maven.test.redirectTestOutputToFile>
4646
<gitRepositoryName>sonar-scanner-msbuild</gitRepositoryName>
4747
<!-- Release: enable publication to Bintray -->
48-
<artifactsToPublish>${project.groupId}:${project.artifactId}:zip:net46,${project.groupId}:${project.artifactId}:zip:netcoreapp2.0</artifactsToPublish>
48+
<artifactsToPublish>${project.groupId}:${project.artifactId}:zip:net46,${project.groupId}:${project.artifactId}:zip:netcoreapp2.0,${project.groupId}:${project.artifactId}:zip:netcoreapp3.0</artifactsToPublish>
4949
</properties>
5050

5151
<build>
@@ -76,23 +76,28 @@
7676
<artifact>
7777
<file>dotnetScannerGlobalToolPath</file>
7878
<type>nupkg</type>
79-
<classifier>netcoreapp2.1</classifier>
79+
<classifier>netcoreapp2.1;netcoreapp3.0</classifier>
8080
</artifact>
8181
<artifact>
8282
<file>classicScannerChocoPath</file>
8383
<type>nupkg</type>
8484
<classifier>net46</classifier>
8585
</artifact>
8686
<artifact>
87-
<file>dotnetScannerChocoPath</file>
87+
<file>dotnetcore2ScannerChocoPath</file>
8888
<type>nupkg</type>
8989
<classifier>netcoreapp2.0</classifier>
9090
</artifact>
91+
<artifact>
92+
<file>dotnetcore3ScannerChocoPath</file>
93+
<type>nupkg</type>
94+
<classifier>netcoreapp3.0</classifier>
95+
</artifact>
9196
</artifacts>
9297
</configuration>
9398
</execution>
9499
</executions>
95-
</plugin>
100+
</plugin>
96101
</plugins>
97102
</build>
98103
</project>

src/DotnetVersions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<PropertyGroup>
55
<ScannerNetStandardVersion>netstandard2.0</ScannerNetStandardVersion>
6-
<ScannerNetCoreAppVersion>netcoreapp2.0</ScannerNetCoreAppVersion>
6+
<ScannerNetCoreAppVersion>netcoreapp2.0;netcoreapp3.0</ScannerNetCoreAppVersion>
77
<ScannerNetCoreGlobalToolVersion>netcoreapp2.1;netcoreapp3.0</ScannerNetCoreGlobalToolVersion>
88
<ScannerNetFxVersion>net46</ScannerNetFxVersion>
99
</PropertyGroup>

src/Packaging/Packaging.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
</Target>
272272

273273
<!-- Don't create the zip for netcoreapp2.1 -->
274-
<Target Name="ZipPayloadFiles" Condition=" '$(TargetFramework)' != '$(ScannerNetCoreGlobalToolVersion)' AND $(Configuration) == 'Release' ">
274+
<Target Name="ZipPayloadFiles" Condition=" '$(TargetFramework)' != 'netcoreapp2.1' AND '$(Configuration)' == 'Release' ">
275275
<Message Importance="high" Text="Zipping ScannerCli:" />
276276
<Message Importance="high" Text=" Source: $(WorkDestinationDir)" />
277277
<Message Importance="high" Text=" Target: $(DestinationArtifactPath)" />

0 commit comments

Comments
 (0)