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

Migrate cadl-ranch specs to http-specs and azure-http-specs #5204

Merged
merged 5 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
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
41 changes: 35 additions & 6 deletions eng/Generate.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ $testServerDirectory = Join-Path $repoRoot 'test' 'TestServerProjects'
$sharedSource = Join-Path $repoRoot 'src' 'assets'
$configurationPath = Join-Path $repoRoot 'readme.md'
$testServerSwaggerPath = Join-Path $repoRoot 'node_modules' '@microsoft.azure' 'autorest.testserver' 'swagger'
$cadlRanchFilePath = Join-Path $repoRoot 'node_modules' '@azure-tools' 'cadl-ranch-specs' 'http'
$azureSpecsDirectory = Join-Path $repoRoot 'node_modules' '@azure-tools' 'azure-http-specs' 'specs'
$specsDirectory = Join-Path $repoRoot 'node_modules' '@typespec' 'http-specs' 'specs'
$typespecEmitOptions = '--option @azure-tools/typespec-csharp.save-inputs=true --option @azure-tools/typespec-csharp.clear-output-folder=true'

function Add-Swagger ([string]$name, [string]$output, [string]$arguments, [string]$launchSettingsArgs = "") {
Expand Down Expand Up @@ -70,14 +71,42 @@ function Add-CadlRanch-TypeSpec([string]$testName, [string]$projectPrefix, [stri
$configString = "--config=$configFile "
}
$projectDirectory = Join-Path $projectDirectory "src"
$tspMain = Join-Path $cadlRanchFilePath $testName "main.tsp"
$clientTsp = Join-Path $cadlRanchFilePath $testName "client.tsp"
$mainTypeSpecFile = If (Test-Path $clientTsp) { Resolve-Path $clientTsp } Else { Resolve-Path $tspMain }
$azureMainTsp = Join-Path $azureSpecsDirectory $testName "main.tsp"
$azureClientTsp = Join-Path $azureSpecsDirectory $testName "client.tsp"
$mainTsp = Join-Path $specsDirectory $testName "main.tsp"
$clientTsp = Join-Path $specsDirectory $testName "client.tsp"

$entryFile = ""
if ($projectPrefix -eq "typespec-nonAzure-") {
$entryFile = $clientTsp
if (!(Test-Path $entryFile)) {
$entryFile = $mainTsp
}
if (!(Test-Path $entryFile)) {
$entryFile = $azureClientTsp
}
if (!(Test-Path $entryFile)) {
$entryFile = $azureMainTsp
}
pshao25 marked this conversation as resolved.
Show resolved Hide resolved
}
else {
$entryFile = $azureClientTsp
if (!(Test-Path $entryFile)) {
$entryFile = $azureMainTsp
}
if (!(Test-Path $entryFile)) {
$entryFile = $clientTsp
}
if (!(Test-Path $entryFile)) {
$entryFile = $mainTsp
}
live1206 marked this conversation as resolved.
Show resolved Hide resolved
}
$entryFile = Resolve-Path $entryFile
if ($projectPrefix -eq "typespec-nonAzure-") {
Add-TypeSpec "$projectPrefix$testName" $projectDirectory $mainTypeSpecFile "$configString--option @azure-tools/typespec-csharp.new-project=true" "-n"
Add-TypeSpec "$projectPrefix$testName" $projectDirectory $entryFile "$configString--option @azure-tools/typespec-csharp.new-project=true" "-n"
}
else {
Add-TypeSpec "$projectPrefix$testName" $projectDirectory $mainTypeSpecFile "$configString--option @azure-tools/typespec-csharp.new-project=true --option @azure-tools/typespec-csharp.flavor=azure" "-n"
Add-TypeSpec "$projectPrefix$testName" $projectDirectory $entryFile "$configString--option @azure-tools/typespec-csharp.new-project=true --option @azure-tools/typespec-csharp.flavor=azure" "-n"
}
}

Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ extends:
displayName: 'Upload Cadl Ranch Azure Coverage Report'
condition: and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))
inputs:
azureSubscription: "Cadl Ranch Storage"
azureSubscription: "TypeSpec Storage"
scriptType: "bash"
scriptLocation: "inlineScript"
inlineScript: npx cadl-ranch upload-coverage --coverageFile ./artifacts/coverage/cadl-ranch-coverage-csharp-azure.json --generatorName csharp --storageAccountName azuresdkcadlranch --generatorVersion $(node -p -e "require('./src/TypeSpec.Extension/Emitter.Csharp/package.json').version") --generatorMode azure
inlineScript: npx tsp-spector upload-coverage --coverageFile ./artifacts/coverage/tsp-spector-coverage-csharp-azure.json --generatorName csharp --storageAccountName typespec --generatorVersion $(node -p -e "require('./src/TypeSpec.Extension/Emitter.Csharp/package.json').version") --generatorMode azure --containerName coverages
workingDirectory: $(Build.SourcesDirectory)/autorest.csharp
- ${{if and(ne(variables['Build.Reason'], 'PullRequest'), eq(variables['System.TeamProject'], 'internal'))}}:
- template: new-emitter-package-files.yml
Expand Down
1 change: 0 additions & 1 deletion eng/testProjects.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"payload/content-negotiation",
"payload/media-type",
"payload/multipart",
"payload/pageable",
"serialization/encoded-name/json",
live1206 marked this conversation as resolved.
Show resolved Hide resolved
"server/endpoint/not-defined",
"server/path/multiple",
Expand Down
Loading