Skip to content

Commit

Permalink
Add changes to support typespec preview pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
hallipr committed Sep 25, 2023
1 parent 783ba6b commit a173c34
Showing 1 changed file with 31 additions and 5 deletions.
36 changes: 31 additions & 5 deletions eng/scripts/Language-Settings.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ function EnsureCustomSource($package) {
-AllVersions `
-AllowPrereleaseVersions

if (!$? -or !$existingVersions) {
if (!$? -or !$existingVersions) {
Write-Host "Failed to find package $($package.Name) in custom source $customPackageSource"
return $package
}
Expand Down Expand Up @@ -495,19 +495,19 @@ function UpdateDocsMsPackages($DocConfigFile, $Mode, $DocsMetadata) {
continue
}

if ($matchingPublishedPackage.Support -eq 'deprecated') {
if ($Mode -eq 'legacy') {
if ($matchingPublishedPackage.Support -eq 'deprecated') {
if ($Mode -eq 'legacy') {

# Select the GA version, if none use the preview version
$updatedVersion = $matchingPublishedPackage.VersionGA.Trim()
if (!$updatedVersion) {
if (!$updatedVersion) {
$updatedVersion = $matchingPublishedPackage.VersionPreview.Trim()
}
$package.Versions = @($updatedVersion)

Write-Host "Add deprecated package to legacy moniker: $($package.Name)"
$outputPackages += $package
} else {
} else {
Write-Host "Removing deprecated package: $($package.Name)"
}

Expand Down Expand Up @@ -586,3 +586,29 @@ function Get-dotnet-EmitterName() {
function Get-dotnet-EmitterAdditionalOptions([string]$projectDirectory) {
return "--option @azure-tools/typespec-csharp.emitter-output-dir=$projectDirectory/src"
}

function Update-dotnet-GeneratedSdks([string]$PackageDirectoriesFile) {
$packageDirectories = Get-Content $PackageDirectoriesFile | ConvertFrom-Json
$showSummary = ($env:SYSTEM_DEBUG -eq 'true') -or ($VerbosePreference -ne 'SilentlyContinue')

foreach ($directory in $packageDirectories) {
Push-Location $RepoRoot
try {
Write-Host 'Generating projects under folder ' -ForegroundColor Green -NoNewline
Write-Host "$directory" -ForegroundColor Yellow
if ($showSummary) {
Invoke-LoggedCommand "dotnet msbuild /restore /t:GenerateCode /p:Scope=`"$directory`" /v:n /ds eng\service.proj" -GroupOutput
}
else {
Invoke-LoggedCommand "dotnet msbuild /restore /t:GenerateCode /p:Scope=`"$directory`" eng\service.proj" -GroupOutput
}
if ($LastExitCode -ne 0) {
Write-Error "Generation error in $directory"
exit 1
}
}
finally {
Pop-Location
}
}
}

0 comments on commit a173c34

Please sign in to comment.