Skip to content

Commit 66ef728

Browse files
dingmeng-xuekceiw
andauthored
Update build and sign pipeline of Az.Tools.Predictor (#17768)
Force merge code because of unrelated error in Az.Accounts * Use msbuild to build Az.Tools.Predictor.sln (#17727) * Update build and sign pipeline of Az.Tools.Predictor * Update code * update code * Update version of az.accounts * update * Update code Co-authored-by: kceiw <[email protected]>
1 parent b7bfe17 commit 66ef728

File tree

4 files changed

+25
-15
lines changed

4 files changed

+25
-15
lines changed

.azure-pipelines/sign-tool-predictor.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,29 @@ pool:
55

66
steps:
77
- task: PowerShell@2
8-
displayName: Install PS 7.2
8+
displayName: Install PowerShell
99
inputs:
1010
targetType: 'inline'
1111
script: |
12-
$url = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.3/PowerShell-7.2.0-preview.3-win-x64.zip"
13-
$output = Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3-win-x64.zip"
12+
$url = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0/PowerShell-7.2.0-win-x64.zip"
13+
$output = Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-win-x64.zip"
1414
(New-Object System.Net.WebClient).DownloadFile($url, $output)
15-
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3/"
15+
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell/"
1616
Expand-Archive -Path $output -DestinationPath $pwshPath
1717
$pwshFullPath = Convert-Path $pwshPath
1818
Write-Host $pwshFullPath
1919
2020
- task: PowerShell@2
21-
displayName: 'Install platyPS, PowerShellGet, Az 3.0.0'
21+
displayName: 'Install Dependent Modules'
2222
inputs:
2323
targetType: inline
2424
script: |
25-
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3/pwsh.exe"
25+
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell/pwsh.exe"
2626
$command = "`$PSVersionTable `
2727
Install-Module platyPS -Force -Confirm:`$false -Scope CurrentUser `
2828
Install-Module PowerShellGet -Force -Confirm:`$false -Scope CurrentUser -SkipPublisherCheck `
29-
Install-Module Az -Repository PSGallery -RequiredVersion 3.0.0 -Confirm:`$false -Scope CurrentUser -AllowClobber -Force"
29+
Install-Module PSReadLine -Force -Confirm:`$false -Scope CurrentUser `
30+
Install-Module Az.Accounts -Repository PSGallery -Confirm:`$false -Scope CurrentUser -AllowClobber -Force"
3031
Invoke-Command -ScriptBlock { param ($pwshPath, $command) & $pwshPath -Command $command } -ArgumentList $pwshPath, $command
3132
3233
- task: UseDotNet@2
@@ -41,7 +42,7 @@ steps:
4142
inputs:
4243
command: custom
4344
custom: msbuild
44-
arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Clean;Build;GenerateHelp" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell-7.2.0-preview.3\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command"'
45+
arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Clean;Build;GenerateHelp" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command"'
4546

4647
- task: UseDotNet@2
4748
displayName: 'Install DotNet 2.1 Runtime for Signing'
@@ -90,7 +91,7 @@ steps:
9091
inputs:
9192
command: custom
9293
custom: msbuild
93-
arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Package" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell-7.2.0-preview.3\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command" '
94+
arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Package" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command" '
9495

9596
- task: PublishPipelineArtifact@0
9697
displayName: 'Save artifacts'

tools/Az.Tools.Predictor/Az.Tools.Predictor.SourceGenerator/Az.Tools.Predictor.SourceGenerator.csproj

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,17 @@
3838
</PropertyGroup>
3939

4040
<Target Name="GetDependencyTargetPaths" AfterTargets="ResolvePackageDependenciesForBuild">
41-
<ItemGroup>
42-
<!-- We need to add all the (direct and indirect) dependencies. @(ResolvedCompileFileDefinitions) is a way to get that.
43-
- See more about Transient Dependencies here https://turnerj.com/blog/the-pain-points-of-csharp-source-generators
44-
-->
41+
<!-- We need to add all the (direct and indirect) dependencies. @(ResolvedCompileFileDefinitions) is a way to get that.
42+
- See more about Transient Dependencies here https://turnerj.com/blog/the-pain-points-of-csharp-source-generators
43+
- Follow up the issue here https://github.com/dotnet/sdk/issues/17775
44+
-->
45+
<ItemGroup Condition="'$(MSBuildRuntimeType)' == 'Core'">
46+
<None Include="@(ResolvedCompileFileDefinitions)" Pack="true" PackagePath="analyzers/dotnet/cs" />
47+
</ItemGroup>
48+
<ItemGroup Condition="'$(MSBuildRuntimeType)' == 'Mono'">
49+
<Error Text="Doesn't support building with Mono." />
50+
</ItemGroup>
51+
<ItemGroup Condition="'$(MSBuildRuntimeType)' != 'Core'">
4552
<TargetPathWithTargetPlatformMoniker Include="@(ResolvedCompileFileDefinitions)" IncludeRuntimeDependency="false" />
4653
</ItemGroup>
4754
</Target>

tools/Az.Tools.Predictor/Az.Tools.Predictor/Az.Tools.Predictor.psd1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ For more information on Az Predictor, please visit the following: https://aka.ms
4141
PowerShellVersion = '7.2'
4242

4343
# Modules that must be imported into the global environment prior to importing this module
44-
# "RequiredModules" requires the module in the build pipeline to build/sign this package. Instead, we will validate the dependencies at runtime by Az.Tools.Predictor.psm1
44+
RequiredModules = @(@{ModuleName = 'PSReadLine'; ModuleVersion = '2.2.2'; },
45+
@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.6.2';})
4546

47+
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
4648
CmdletsToExport = @("Enable-AzPredictor", "Disable-AzPredictor", "Open-AzPredictorSurvey", "Send-AzPredictorRating")
4749

4850
# Format files (.ps1xml) to be loaded when importing this module

tools/Az.Tools.Predictor/build.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
</Target>
3333

3434
<Target Name="GenerateHelp">
35-
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;$(RepoTools)/$(ModuleName)/GenerateHelp.ps1 -ArtifactFolder $(ArtifactFolder) -HelpFolder $(RepoTools)/$(ModuleName)/help -ModuleName $(ModuleName)" />
35+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;$(RepoTools)/$(ModuleName)/GenerateHelp.ps1 -ArtifactFolder $(ArtifactFolder) -HelpFolder $(RepoTools)/$(ModuleName)/help -ModuleName $(ModuleName) -ErrorAction Stop &quot;" />
3636
</Target>
3737

3838
<Target Name="Test" DependsOnTargets="Build">

0 commit comments

Comments
 (0)