Skip to content

Commit

Permalink
typespec renaming for unified pipeline (Azure#35123)
Browse files Browse the repository at this point in the history
* typespec renaming for unified pipeline

* update gitignore
  • Loading branch information
chunyu3 authored Mar 27, 2023
1 parent 81add1a commit 76ff148
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -174,5 +174,5 @@ BenchmarkDotNet.Artifacts
artifacts
.assets

# Temporary cadl folders for cadl generation
TempCadlFiles/
# Temporary typespec folders for typespec generation
TempTypeSpecFiles/
12 changes: 6 additions & 6 deletions eng/scripts/Invoke-GenerateAndBuildV2.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ $commitid = $inputJson.headSha
$repoHttpsUrl = $inputJson.repoHttpsUrl
$downloadUrlPrefix = $inputJson.installInstructionInput.downloadUrlPrefix
$autorestConfig = $inputJson.autorestConfig
$relatedCadlProjectFolder = $inputJson.relatedCadlProjectFolder
$relatedTypeSpecProjectFolder = $inputJson.relatedTypeSpecProjectFolder

$autorestConfigYaml = ""
if ($autorestConfig) {
Expand Down Expand Up @@ -109,10 +109,10 @@ if ($inputFileToGen) {
UpdateExistingSDKByInputFiles -inputFilePaths $inputFileToGen -sdkRootPath $sdkPath -headSha $commitid -repoHttpsUrl $repoHttpsUrl -downloadUrlPrefix "$downloadUrlPrefix" -generatedSDKPackages $generatedSDKPackages
}

# generate sdk from cadl file
if ($relatedCadlProjectFolder) {
foreach ($cadlRelativeFolder in $relatedCadlProjectFolder) {
$typespecFolder = Resolve-Path (Join-Path $swaggerDir $cadlRelativeFolder)
# generate sdk from typespec file
if ($relatedTypeSpecProjectFolder) {
foreach ($typespecRelativeFolder in $relatedTypeSpecProjectFolder) {
$typespecFolder = Resolve-Path (Join-Path $swaggerDir $typespecRelativeFolder)
$newPackageOutput = "newPackageOutput.json"

$tspConfigYaml = Get-Content -Path (Join-Path "$typespecFolder" "tspconfig.yaml") -Raw
Expand All @@ -137,7 +137,7 @@ if ($relatedCadlProjectFolder) {
-service $service `
-namespace $namespace `
-sdkPath $sdkPath `
-relatedTypeSpecProjectFolder $cadlRelativeFolder `
-relatedTypeSpecProjectFolder $typespecRelativeFolder `
-specRoot $swaggerDir `
-outputJsonFile $newpackageoutput
$newPackageOutputJson = Get-Content $newPackageOutput -Raw | ConvertFrom-Json
Expand Down
12 changes: 6 additions & 6 deletions eng/scripts/automation/Invoke-GenerateAndBuild.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $downloadUrlPrefix = $inputJson.installInstructionInput.downloadUrlPrefix
$autorestConfig = $inputJson.autorestConfig

$autorestConfig = $inputJson.autorestConfig
$relatedCadlProjectFolder = $inputJson.relatedCadlProjectFolder
$relatedTypeSpecProjectFolder = $inputJson.relatedTypeSpecProjectFolder

$autorestConfigYaml = ""
if ($autorestConfig) {
Expand Down Expand Up @@ -69,8 +69,8 @@ if ($readmeFile) {
Invoke-GenerateAndBuildSDK -readmeAbsolutePath $readme -sdkRootPath $sdkPath -autorestConfigYaml "$autorestConfigYaml" -downloadUrlPrefix "$downloadUrlPrefix" -generatedSDKPackages $generatedSDKPackages
}

if ($relatedCadlProjectFolder) {
$typespecFolder = Resolve-Path (Join-Path $swaggerDir $relatedCadlProjectFolder)
if ($relatedTypeSpecProjectFolder) {
$typespecFolder = Resolve-Path (Join-Path $swaggerDir $relatedTypeSpecProjectFolder)
$newPackageOutput = "newPackageOutput.json"

$tspConfigYaml = Get-Content -Path (Join-Path "$typespecFolder" "tspconfig.yaml") -Raw
Expand All @@ -92,16 +92,16 @@ if ($relatedCadlProjectFolder) {
}
$projectFolder = (Join-Path $sdkPath "sdk" $service $namespace)
$specRoot = $swaggerDir
if ((-Not $relatedCadlProjectFolder.Contains("specification")) -And $swaggerDir.Contains("specification"))
if ((-Not $relatedTypeSpecProjectFolder.Contains("specification")) -And $swaggerDir.Contains("specification"))
{
$relatedCadlProjectFolder = "specification/$relatedCadlProjectFolder"
$relatedTypeSpecProjectFolder = "specification/$relatedTypeSpecProjectFolder"
$specRoot = Split-Path $specRoot
}
New-TypeSpecPackageFolder `
-service $service `
-namespace $namespace `
-sdkPath $sdkPath `
-relatedTypeSpecProjectFolder $relatedCadlProjectFolder `
-relatedTypeSpecProjectFolder $relatedTypeSpecProjectFolder `
-specRoot $specRoot `
-outputJsonFile $newpackageoutput
$newPackageOutputJson = Get-Content $newPackageOutput -Raw | ConvertFrom-Json
Expand Down

0 comments on commit 76ff148

Please sign in to comment.