From 151176f0f06e70483765cd1478f8cf12d519a884 Mon Sep 17 00:00:00 2001 From: Oren Novotny Date: Sat, 8 Sep 2018 13:32:03 -0400 Subject: [PATCH] update script to use tasks and tool --- .gitignore | 1 + .vsts-shared.yml | 75 +++++++++++++++++++-------------------- scripts/setversion.csproj | 20 ----------- scripts/version.json | 8 ----- 4 files changed, 38 insertions(+), 66 deletions(-) delete mode 100644 scripts/setversion.csproj delete mode 100644 scripts/version.json diff --git a/.gitignore b/.gitignore index d66f0dd..c60738b 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ Storage.dat *.ide/ .vs/ +.store/ *.nuget.targets *.nuget.props diff --git a/.vsts-shared.yml b/.vsts-shared.yml index ea979bd..4e7497b 100644 --- a/.vsts-shared.yml +++ b/.vsts-shared.yml @@ -2,62 +2,61 @@ parameters: signSteps: [] steps: -- task: BatchScript@1 +- task: DotNetCoreCLI@2 inputs: - filename: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Enterprise\\Common7\\Tools\\VsDevCmd.bat" - arguments: -no_logo - modifyEnvironment: true - displayName: Setup Environment Variables - -- task: NuGetToolInstaller@0 - displayName: Use NuGet 4.7.0 - inputs: - versionSpec: 4.7.0 - -- task: DotNetCoreCLI@2 - inputs: - command: build - projects: scripts/setversion.csproj - arguments: -c $(BuildConfiguration) + command: custom + custom: tool + arguments: install --tool-path . nbgv + displayName: Install NBGV tool + +- script: nbgv cloud displayName: Set Version - condition: eq(variables['system.pullrequest.isfork'], false) + condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) - powershell: | # version - nuget install NerdBank.GitVersioning -SolutionDir $(Build.SourcesDirectory) -Verbosity quiet -ExcludeVersion - - $vers = & $(Build.SourcesDirectory)\packages\nerdbank.gitversioning\tools\Get-Version.ps1 - - $simpVer = $vers.Version - $nuGetVer = $vers.NuGetPackageVersion + $ver = .\nbgv get-version -f json | ConvertFrom-Json + $doc = Get-Content ".\templates\xunit.devices.templates\source.extension.vsixmanifest" - $doc | % { $_.Replace("0.9.9", "$simpVer") } | Set-Content ".\templates\xunit.devices.templates\source.extension.vsixmanifest" + $doc | % { $_.Replace("0.9.9", "$($ver.CloudBuildVersionVars.GitBuildVersionSimple)") } | Set-Content ".\templates\xunit.devices.templates\source.extension.vsixmanifest" $doc = Get-Content ".\templates\xunit.devices.templates\source.extension.vsixmanifest" - $doc | % { $_.Replace("9.9.9", "$nuGetVer") } | Set-Content ".\templates\xunit.devices.templates\source.extension.vsixmanifest" + $doc | % { $_.Replace("9.9.9", "$($ver.NuGetPackageVersion)") } | Set-Content ".\templates\xunit.devices.templates\source.extension.vsixmanifest" # ProjectTemplates # Android $doc = Get-Content ".\templates\xunit.android.template\xunit.android.template.vstemplate" - $doc | % { $_.Replace("0.9.9", "$nuGetVer") } | Set-Content ".\templates\xunit.android.template\xunit.android.template.vstemplate" + $doc | % { $_.Replace("0.9.9", "$($ver.NuGetPackageVersion)") } | Set-Content ".\templates\xunit.android.template\xunit.android.template.vstemplate" # iOS $doc = Get-Content ".\templates\xunit.ios.template\xunit.ios.template.vstemplate" - $doc | % { $_.Replace("0.9.9", "$nuGetVer") } | Set-Content ".\templates\xunit.ios.template\xunit.ios.template.vstemplate" + $doc | % { $_.Replace("0.9.9", "$($ver.NuGetPackageVersion)") } | Set-Content ".\templates\xunit.ios.template\xunit.ios.template.vstemplate" # UWP $doc = Get-Content ".\templates\xunit.uwp.template\xunit.uwp.template.vstemplate" - $doc | % { $_.Replace("0.9.9", "$nuGetVer") } | Set-Content ".\templates\xunit.uwp.template\xunit.uwp.template.vstemplate" + $doc | % { $_.Replace("0.9.9", "$($ver.NuGetPackageVersion)") } | Set-Content ".\templates\xunit.uwp.template\xunit.uwp.template.vstemplate" displayName: Update Versions -- powershell: | - msbuild xUnit.Devices.sln /restore /m /p:Configuration=$(BuildConfiguration) /p:UseDotNetNativeToolchain=false /p:BuildAppxUploadPackageForUap=true /p:DeployExtension=false - displayName: Build +- powershell: mkdir $(Build.ArtifactStagingDirectory)\CI + displayName: Create output directory + +- task: MSBuild@1 + displayName: Build + inputs: + solution: xUnit.Devices.sln + msbuildArguments: /restore /p:UseDotNetNativeToolchain=false /p:BuildAppxUploadPackageForUap=true /p:DeployExtension=false + configuration: $(BuildConfiguration) + maximumCpuCount: true + +- task: MSBuild@1 + displayName: Pack devices + inputs: + solution: src\xunit.runner.devices\xunit.runner.devices.csproj + msbuildArguments: /t:pack /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\CI + configuration: $(BuildConfiguration) + maximumCpuCount: true + +- powershell: mv templates\xunit.devices.templates\bin\Release\*.vsix $(Build.ArtifactStagingDirectory)\CI + displayName: Move VISX to output directory -- powershell: | - mkdir $(Build.ArtifactStagingDirectory)\CI - msbuild src\xunit.runner.devices\xunit.runner.devices.csproj /t:pack /p:Configuration=$(BuildConfiguration) /p:PackageOutputPath=$(Build.ArtifactStagingDirectory)\CI - mv templates\xunit.devices.templates\bin\Release\*.vsix $(Build.ArtifactStagingDirectory)\CI - displayName: Pack - - ${{ parameters.signSteps }} - task: PublishBuildArtifacts@1 @@ -66,4 +65,4 @@ steps: pathToPublish: $(Build.ArtifactStagingDirectory)\CI artifactType: container artifactName: CI - condition: eq(variables['system.pullrequest.isfork'], false) + condition: and(succeeded(), eq(variables['system.pullrequest.isfork'], false)) diff --git a/scripts/setversion.csproj b/scripts/setversion.csproj deleted file mode 100644 index 25f6bb4..0000000 --- a/scripts/setversion.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netstandard2.0 - - - - - - - - - - $(BuildVersion) - $(BuildVersion) - $(BuildVersion) - $(BuildVersion) - - - diff --git a/scripts/version.json b/scripts/version.json deleted file mode 100644 index f1b52a7..0000000 --- a/scripts/version.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "inherit": true, - "cloudBuild": { - "buildNumber": { - "enabled": true - } - } -}