-
Notifications
You must be signed in to change notification settings - Fork 85
Expand file tree
/
Copy pathBuild-TypeSpec.ps1
More file actions
43 lines (38 loc) · 1.49 KB
/
Build-TypeSpec.ps1
File metadata and controls
43 lines (38 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# WARNING: the script would "checkout" unstaged code in "./core" submodule. Please stage/commit your code there.
$ErrorActionPreference = "Stop"
Write-Host "Apply diff to core"
Push-Location ./core
try {
git checkout .
git apply ../core.patch --ignore-whitespace
} finally {
Pop-Location
}
Write-Host "Build JAR"
mvn clean install -P tsp --no-transfer-progress -DskipTests
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
Write-Host "Copy JAR and TypeSpec code to './typespec-extension' directory"
# Copy JAR
New-Item -ItemType Directory -Path ./typespec-extension/generator/http-client-generator/target/classes -Force
Copy-Item ./core/packages/http-client-java/generator/http-client-generator/target/emitter.jar ./typespec-extension/generator/http-client-generator/target/emitter.jar -Force
Copy-Item ./core/packages/http-client-java/generator/http-client-generator/target/classes/PerfAutomation.jfc ./typespec-extension/generator/http-client-generator/target/classes/PerfAutomation.jfc -Force
# Copy TypeScript code
Copy-Item -Path ./core/packages/http-client-java/emitter/src -Destination ./typespec-extension/ -Exclude "options.ts" -Recurse -Force
Copy-Item -Path ./core/packages/http-client-java/emitter/test -Destination ./typespec-extension/ -Recurse -Force
Write-Host "Build and Pack typespec-java"
Push-Location ./typespec-extension/
try {
npm ci
npm run build
# npm run lint
# npm run check-format
npm pack
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
finally {
Pop-Location
}