Skip to content

Commit

Permalink
Update build and sign pipeline of Az.Tools.Predictor (#17768)
Browse files Browse the repository at this point in the history
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 <mahuang@microsoft.com>
  • Loading branch information
dingmeng-xue and kceiw authored Apr 14, 2022
1 parent b7bfe17 commit 66ef728
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
19 changes: 10 additions & 9 deletions .azure-pipelines/sign-tool-predictor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@ pool:

steps:
- task: PowerShell@2
displayName: Install PS 7.2
displayName: Install PowerShell
inputs:
targetType: 'inline'
script: |
$url = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0-preview.3/PowerShell-7.2.0-preview.3-win-x64.zip"
$output = Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3-win-x64.zip"
$url = "https://github.com/PowerShell/PowerShell/releases/download/v7.2.0/PowerShell-7.2.0-win-x64.zip"
$output = Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-win-x64.zip"
(New-Object System.Net.WebClient).DownloadFile($url, $output)
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3/"
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell/"
Expand-Archive -Path $output -DestinationPath $pwshPath
$pwshFullPath = Convert-Path $pwshPath
Write-Host $pwshFullPath
- task: PowerShell@2
displayName: 'Install platyPS, PowerShellGet, Az 3.0.0'
displayName: 'Install Dependent Modules'
inputs:
targetType: inline
script: |
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell-7.2.0-preview.3/pwsh.exe"
$pwshPath= Join-Path -Path $(Pipeline.Workspace) -ChildPath "./PowerShell/pwsh.exe"
$command = "`$PSVersionTable `
Install-Module platyPS -Force -Confirm:`$false -Scope CurrentUser `
Install-Module PowerShellGet -Force -Confirm:`$false -Scope CurrentUser -SkipPublisherCheck `
Install-Module Az -Repository PSGallery -RequiredVersion 3.0.0 -Confirm:`$false -Scope CurrentUser -AllowClobber -Force"
Install-Module PSReadLine -Force -Confirm:`$false -Scope CurrentUser `
Install-Module Az.Accounts -Repository PSGallery -Confirm:`$false -Scope CurrentUser -AllowClobber -Force"
Invoke-Command -ScriptBlock { param ($pwshPath, $command) & $pwshPath -Command $command } -ArgumentList $pwshPath, $command
- task: UseDotNet@2
Expand All @@ -41,7 +42,7 @@ steps:
inputs:
command: custom
custom: msbuild
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"'
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"'

- task: UseDotNet@2
displayName: 'Install DotNet 2.1 Runtime for Signing'
Expand Down Expand Up @@ -90,7 +91,7 @@ steps:
inputs:
command: custom
custom: msbuild
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" '
arguments: 'tools\Az.Tools.Predictor\build.proj /target:"Package" /p:Configuration=Release /p:PowerShellCoreCommandPrefix="$(Pipeline.Workspace)\\PowerShell\\pwsh.exe -NonInteractive -NoLogo -NoProfile -Command" '

- task: PublishPipelineArtifact@0
displayName: 'Save artifacts'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@
</PropertyGroup>

<Target Name="GetDependencyTargetPaths" AfterTargets="ResolvePackageDependenciesForBuild">
<ItemGroup>
<!-- We need to add all the (direct and indirect) dependencies. @(ResolvedCompileFileDefinitions) is a way to get that.
- See more about Transient Dependencies here https://turnerj.com/blog/the-pain-points-of-csharp-source-generators
-->
<!-- We need to add all the (direct and indirect) dependencies. @(ResolvedCompileFileDefinitions) is a way to get that.
- See more about Transient Dependencies here https://turnerj.com/blog/the-pain-points-of-csharp-source-generators
- Follow up the issue here https://github.com/dotnet/sdk/issues/17775
-->
<ItemGroup Condition="'$(MSBuildRuntimeType)' == 'Core'">
<None Include="@(ResolvedCompileFileDefinitions)" Pack="true" PackagePath="analyzers/dotnet/cs" />
</ItemGroup>
<ItemGroup Condition="'$(MSBuildRuntimeType)' == 'Mono'">
<Error Text="Doesn't support building with Mono." />
</ItemGroup>
<ItemGroup Condition="'$(MSBuildRuntimeType)' != 'Core'">
<TargetPathWithTargetPlatformMoniker Include="@(ResolvedCompileFileDefinitions)" IncludeRuntimeDependency="false" />
</ItemGroup>
</Target>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ For more information on Az Predictor, please visit the following: https://aka.ms
PowerShellVersion = '7.2'

# Modules that must be imported into the global environment prior to importing this module
# "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
RequiredModules = @(@{ModuleName = 'PSReadLine'; ModuleVersion = '2.2.2'; },
@{ModuleName = 'Az.Accounts'; ModuleVersion = '2.6.2';})

# 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.
CmdletsToExport = @("Enable-AzPredictor", "Disable-AzPredictor", "Open-AzPredictorSurvey", "Send-AzPredictorRating")

# Format files (.ps1xml) to be loaded when importing this module
Expand Down
2 changes: 1 addition & 1 deletion tools/Az.Tools.Predictor/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</Target>

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

<Target Name="Test" DependsOnTargets="Build">
Expand Down

0 comments on commit 66ef728

Please sign in to comment.