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

Sync eng/common directory with azure-sdk-tools for PR 5807 #29565

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 14 additions & 2 deletions eng/common/scripts/TypeSpec-Project-Sync.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ function AddSparseCheckoutPath([string]$subDirectory) {

function CopySpecToProjectIfNeeded([string]$specCloneRoot, [string]$mainSpecDir, [string]$dest, [string[]]$specAdditionalSubDirectories) {
$source = "$specCloneRoot/$mainSpecDir"
Copy-Item -Path $source -Destination $dest -Recurse -Force
Write-Host "Copying spec from $source to $dest"
# $mainSpecDir is the PR folder, we just need to copy its subfolders which include the typespec project folder
Get-ChildItem –Path "$source" -Exclude @("data-plane", "resource-manager")|
Foreach-Object {
Copy-Item -Path $_.FullName -Destination $dest -Recurse -Force
}

foreach ($additionalDir in $specAdditionalSubDirectories) {
$source = "$specCloneRoot/$additionalDir"
Expand Down Expand Up @@ -93,7 +97,15 @@ $configuration = Get-Content -Path $typespecConfigurationFile -Raw | ConvertFrom
$pieces = $typespecConfigurationFile.Path.Replace("\","/").Split("/")
$projectName = $pieces[$pieces.Count - 2]

$specSubDirectory = $configuration["directory"]
# clone the whole RP directory which is the parent of $configuration["directory"]
if ($configuration["directory"] -match "^[^/\\]+[\\/]+[^/\\]+")
{
$specSubDirectory = $Matches[0]
}
else
{
throw "The directory in $typespecConfigurationFile is not expected"
}

if ( $configuration["repo"] -and $configuration["commit"]) {
$specCloneDir = GetSpecCloneDir $projectName
Expand Down