Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support typespec to sdk preview pipeline #38576

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 46 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,44 @@ 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) {
$showSummary = ($env:SYSTEM_DEBUG -eq 'true') -or ($VerbosePreference -ne 'SilentlyContinue')
$summaryArgs = $showSummary ? "/v:n /ds" : ""

$packageDirectories = Get-Content $PackageDirectoriesFile | ConvertFrom-Json

$directoriesWithErrors = @()

Invoke-LoggedCommand "npm install -g autorest"

foreach ($directory in $packageDirectories) {
Push-Location $RepoRoot
try {
Write-Host "`n`n======================================================================"
Write-Host "Generating projects under directory '$directory'" -ForegroundColor Yellow
Write-Host "======================================================================`n"

Invoke-LoggedCommand "dotnet msbuild /restore /t:GenerateCode /p:Scope=`"$directory`" $summaryArgs eng\service.proj" -GroupOutput
}
catch {
Write-Host "##[error]Error generating project under directory $directory"
Write-Host $_.Exception.Message
$directoriesWithErrors += $directory
}
finally {
Pop-Location
}
}

if($directoriesWithErrors.Count -gt 0) {
Write-Host "##[error]Generation errors found in $($directoriesWithErrors.Count) directories:"

foreach ($directory in $directoriesWithErrors) {
Write-Host " $directory"
}

exit 1
}

}
Loading