Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
chunyu3 authored and azure-sdk committed Mar 16, 2023
1 parent 6ed831b commit 9422308
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# For details see https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/Typespec-Project-Scripts.md
# For details see https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/TypeSpec-Project-Scripts.md

[CmdletBinding()]
param (
[Parameter(Position=0)]
[ValidateNotNullOrEmpty()]
[string] $ProjectDirectory,
[Parameter(Position=1)]
[string] $TypespecAdditionalOptions ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2
[string] $typespecAdditionalOptions ## addtional typespec emitter options, separated by semicolon if more than one, e.g. option1=value1;option2=value2
)

$ErrorActionPreference = "Stop"
Expand Down Expand Up @@ -55,17 +55,17 @@ function NpmInstallForProject([string]$workingDirectory) {

$resolvedProjectDirectory = Resolve-Path $ProjectDirectory
$emitterName = &$GetEmitterNameFn
$typespecConfigurationFile = Resolve-Path "$ProjectDirectory/typespec-location.yaml"
$typespecConfigurationFile = Resolve-Path "$ProjectDirectory/tsp-location.yaml"

Write-Host "Reading configuration from $typespecConfigurationFile"
$configuration = Get-Content -Path $typespecConfigurationFile -Raw | ConvertFrom-Yaml

$specSubDirectory = $configuration["directory"]
$innerFolder = Split-Path $specSubDirectory -Leaf

$tempFolder = "$ProjectDirectory/TempTypespecFiles"
$tempFolder = "$ProjectDirectory/TempTypeSpecFiles"
$npmWorkingDir = Resolve-Path $tempFolder/$innerFolder
$mainTypespecFile = If (Test-Path "$npmWorkingDir/client.*") { Resolve-Path "$npmWorkingDir/client.*" } Else { Resolve-Path "$npmWorkingDir/main.*"}
$mainTypeSpecFile = If (Test-Path "$npmWorkingDir/client.*") { Resolve-Path "$npmWorkingDir/client.*" } Else { Resolve-Path "$npmWorkingDir/main.*"}

try {
Push-Location $npmWorkingDir
Expand All @@ -79,9 +79,9 @@ try {
$emitterAdditionalOptions = " $emitterAdditionalOptions"
}
}
$typespecCompileCommand = "npx tsp compile $mainTypespecFile --emit $emitterName$emitterAdditionalOptions"
if ($TypespecAdditionalOptions) {
$options = $TypespecAdditionalOptions.Split(";");
$typespecCompileCommand = "npx tsp compile $mainTypeSpecFile --emit $emitterName$emitterAdditionalOptions"
if ($typespecAdditionalOptions) {
$options = $typespecAdditionalOptions.Split(";");
foreach ($option in $options) {
$typespecCompileCommand += " --option $emitterName.$option"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# For details see https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/Typespec-Project-Scripts.md
# For details see https://github.com/Azure/azure-sdk-tools/blob/main/doc/common/TypeSpec-Project-Scripts.md

[CmdletBinding()]
param (
Expand Down Expand Up @@ -86,7 +86,7 @@ function GetSpecCloneDir([string]$projectName) {
return $createResult
}

$typespecConfigurationFile = Resolve-Path "$ProjectDirectory/typespec-location.yaml"
$typespecConfigurationFile = Resolve-Path "$ProjectDirectory/tsp-location.yaml"
Write-Host "Reading configuration from $typespecConfigurationFile"
$configuration = Get-Content -Path $typespecConfigurationFile -Raw | ConvertFrom-Yaml

Expand Down Expand Up @@ -118,10 +118,10 @@ if ( $configuration["repo"] -and $configuration["commit"]) {
}


$tempTypespecDir = "$ProjectDirectory/TempTypespecFiles"
New-Item $tempTypespecDir -Type Directory -Force | Out-Null
$tempTypeSpecDir = "$ProjectDirectory/TempTypeSpecFiles"
New-Item $tempTypeSpecDir -Type Directory -Force | Out-Null
CopySpecToProjectIfNeeded `
-specCloneRoot $specCloneDir `
-mainSpecDir $specSubDirectory `
-dest $tempTypespecDir `
-dest $tempTypeSpecDir `
-specAdditionalSubDirectories $configuration["additionalDirectories"]

0 comments on commit 9422308

Please sign in to comment.