33param (
44 [string ] $OutputDirectory ,
55 [switch ] $TargetNpmJsFeed ,
6- [string ] $emitterPackagePath
6+ [string ] $emitterPackagePath ,
7+ [string ] $GeneratorVersion
78)
89
10+ if ([string ]::IsNullOrEmpty($GeneratorVersion )) {
11+ Write-Host " GeneratorVersion is required"
12+ exit 1
13+ }
14+
915$ErrorActionPreference = ' Stop'
1016Set-StrictMode - Version 3.0
1117. " $PSScriptRoot /../../common/scripts/common.ps1"
@@ -58,6 +64,43 @@ function Build-Emitter {
5864 }
5965}
6066
67+ function Write-PackageInfo {
68+ param (
69+ [string ] $packageName ,
70+ [string ] $directoryPath ,
71+ [string ] $version
72+ )
73+
74+ $packageInfoPath = " $outputPath /PackageInfo"
75+
76+ if (! (Test-Path $packageInfoPath )) {
77+ New-Item - ItemType Directory - Force - Path $packageInfoPath | Out-Null
78+ }
79+
80+ @ {
81+ Name = $packageName
82+ Version = $version
83+ DirectoryPath = $directoryPath
84+ SdkType = " client"
85+ IsNewSdk = $true
86+ ReleaseStatus = " Unreleased"
87+ } | ConvertTo-Json | Set-Content - Path " $packageInfoPath /$packageName .json"
88+ }
89+
90+ function Pack-And-Write-Info {
91+ param (
92+ [string ] $package ,
93+ [string ] $version ,
94+ [string ] $outputPath
95+ )
96+
97+ $versionOption = " /p:Version=$version "
98+ $hasReleaseVersionOption = $version.Contains (" alpha" ) ? " /p:HasReleaseVersion=false" : " "
99+ Invoke-LoggedCommand " dotnet pack ./$package /src/$package .csproj $versionOption $hasReleaseVersionOption -c Release -o $outputPath "
100+ Write-PackageInfo - packageName $package - directoryPath " eng/packages/http-client-csharp/generator/$package /src" - version $version
101+ }
102+
103+
61104$overrides = @ {}
62105
63106$outputPath = $OutputDirectory ? $OutputDirectory : (Join-Path $RepoRoot " artifacts" " emitters" )
@@ -70,6 +113,23 @@ if ($emitterPackagePath.StartsWith("/")) {
70113$packageRoot = Join-Path $RepoRoot $emitterPackagePath
71114Build-Emitter - packageRoot $packageRoot - outputPath $outputPath - overrides $overrides
72115
116+ # Pack the generator
117+ Push-Location " $packageRoot /generator"
118+ try {
119+ Write-Host " Working in $PWD "
120+ Pack- And- Write-Info - package " Azure.Generator" - version $GeneratorVersion - outputPath $outputPath
121+ }
122+ finally
123+ {
124+ Pop-Location
125+ }
126+
127+ $packageMatrix = [ordered ]@ {
128+ " azure.generator" = $generatorVersion
129+ }
130+
131+ $packageMatrix | ConvertTo-Json | Set-Content " $outputPath /package-versions.json"
132+
73133Write-Host " Writing overrides to $outputPath /overrides.json"
74134
75135$overrides | ConvertTo-Json | Out-File - FilePath " $outputPath /overrides.json" - Encoding utf8 - Force
0 commit comments