Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -74,57 +74,61 @@ function Generate-Compile ($folder) {
Remove-Item $folder -Recurse -Force
}

./Setup.ps1
Push-Location $PSScriptRoot
try {
./Setup.ps1
Write-Host "Setup Complete"

Write-Host "Setup Complete"

if (Test-Path ./src/main) {
Remove-Item ./src/main -Recurse -Force
}
if (Test-Path ./src/samples) {
Remove-Item ./src/samples -Recurse -Force
}
if (Test-Path ./tsp-output) {
Remove-Item ./tsp-output -Recurse -Force
}
if (Test-Path ./src/main) {
Remove-Item ./src/main -Recurse -Force
}
if (Test-Path ./src/samples) {
Remove-Item ./src/samples -Recurse -Force
}
if (Test-Path ./tsp-output) {
Remove-Item ./tsp-output -Recurse -Force
}

Write-Host "Removed src/main, src/samples and tsp-output directories"
Write-Host "Removed src/main, src/samples and tsp-output directories"

# generate for http-specs/azure-http-specs test sources
Copy-Item -Path node_modules/@typespec/http-specs/specs -Destination ./ -Recurse -Force
# generate for http-specs/azure-http-specs test sources
Copy-Item -Path node_modules/@typespec/http-specs/specs -Destination ./ -Recurse -Force

Write-Host "Copied http-specs to current directory"
Write-Host "Copied http-specs to current directory"

# remove xml tests, emitter has not supported xml model
Remove-Item ./specs/payload/xml -Recurse -Force
# remove xml tests, emitter has not supported xml model
Remove-Item ./specs/payload/xml -Recurse -Force

$job = (Get-ChildItem ./specs -Include "main.tsp","old.tsp" -File -Recurse) | ForEach-Object -Parallel $generateScript -ThrottleLimit $Parallelization -AsJob
$job = (Get-ChildItem ./specs -Include "main.tsp","old.tsp" -File -Recurse) | ForEach-Object -Parallel $generateScript -ThrottleLimit $Parallelization -AsJob

$job | Wait-Job -Timeout 1200
$job | Receive-Job
$job | Wait-Job -Timeout 1200
$job | Receive-Job

Remove-Item ./specs -Recurse -Force
Remove-Item ./specs -Recurse -Force

Copy-Item -Path ./tsp-output/*/src -Destination ./ -Recurse -Force -Exclude @("module-info.java")
Copy-Item -Path ./tsp-output/*/src -Destination ./ -Recurse -Force -Exclude @("module-info.java")

Remove-Item ./tsp-output -Recurse -Force
Remove-Item ./tsp-output -Recurse -Force

if (Test-Path ./src/main/resources/META-INF/client-structure-service_metadata.json) {
# client structure is generated from multiple client.tsp files and the last one to execute overwrites
# the api view properties file. Because the tests run in parallel, the order is not guaranteed. This
# causes git diff check to fail as the checked in file is not the same as the generated one.
Remove-Item ./src/main/resources/META-INF/client-structure-service_metadata.json -Force
}
if (Test-Path ./src/main/resources/META-INF/client-structure-service_metadata.json) {
# client structure is generated from multiple client.tsp files and the last one to execute overwrites
# the api view properties file. Because the tests run in parallel, the order is not guaranteed. This
# causes git diff check to fail as the checked in file is not the same as the generated one.
Remove-Item ./src/main/resources/META-INF/client-structure-service_metadata.json -Force
}

# smoke test, generate Java project and verify compilation pass
git fetch origin pull/6981/head:smoke-test-branch
git restore --source smoke-test-branch --worktree -- ../../../smoke-http-specs
Copy-Item -Path ../../../smoke-http-specs/specs -Destination ./ -Recurse -Force
Generate-Compile todoapp
Generate-Compile petstore
Remove-Item ./specs -Recurse -Force
Remove-Item ../../../smoke-http-specs -Recurse -Force

if ($ExitCode -ne 0) {
throw "Failed to generate from tsp"
# smoke test, generate Java project and verify compilation pass
git fetch origin pull/6981/head:smoke-test-branch
git restore --source smoke-test-branch --worktree -- ../../../smoke-http-specs
Copy-Item -Path ../../../smoke-http-specs/specs -Destination ./ -Recurse -Force
Generate-Compile todoapp
Generate-Compile petstore
Remove-Item ./specs -Recurse -Force
Remove-Item ../../../smoke-http-specs -Recurse -Force

if ($ExitCode -ne 0) {
throw "Failed to generate from tsp"
}
} finally {
Pop-Location
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
# re-build http-client-java
Set-Location (Resolve-Path (Join-Path $PSScriptRoot '..' '..'))
Push-Location (Resolve-Path (Join-Path $PSScriptRoot '..' '..'))
try {
./Setup.ps1
} finally {
Pop-Location
}

./Setup.ps1

Set-Location $PSScriptRoot

npm run clean && npm install
Push-Location $PSScriptRoot
try {
npm run clean && npm install
} finally {
Pop-Location
}
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private boolean generateJava(JavaSettings settings) {
// Step 4: Print to files
// Then for each formatted file write the file. This is done synchronously as there is potential race
// conditions that can lead to deadlocking.
new Postprocessor(this).postProcess(javaPackage.getJavaFiles()
new Postprocessor(this, settings.isUseEclipseLanguageServer()).postProcess(javaPackage.getJavaFiles()
.stream()
.collect(Collectors.toMap(JavaFile::getFilePath, file -> file.getContents().toString())));

Expand Down

This file was deleted.

Loading
Loading