Skip to content

Commit

Permalink
chore: use powershell scripts for windows
Browse files Browse the repository at this point in the history
Signed-off-by: peefy <[email protected]>
  • Loading branch information
Peefy committed Dec 4, 2023
1 parent 7b90ae1 commit ab12b35
Show file tree
Hide file tree
Showing 13 changed files with 71 additions and 103 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/daily-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:

- run: echo "C:/LLVM/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- run: .\scripts\build-windows\build.bat
- run: .\scripts\build-windows\build.ps1

- run: echo ";$(pwd)\scripts\build-windows\_output\kclvm-windows\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
working-directory: .
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- run: echo "C:/LLVM/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

# Build kclvm CLI
- run: .\scripts\build-windows\build.bat
- run: .\scripts\build-windows\build.ps1

# Set kclvm CLI into PATH
- run: echo ";$(pwd)\scripts\build-windows\_output\kclvm-windows\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Expand Down
19 changes: 0 additions & 19 deletions build.bat

This file was deleted.

14 changes: 14 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Set-Location $PSScriptRoot
. '.\scripts\build-windows\build.ps1'
$bin_path = Join-Path $PSScriptRoot 'scripts\build-windows\_output\kclvm-windows\bin'
$env:Path += ";$bin_path"
# rust unit test
Set-Location .\kclvm
cargo test -p kclvm-*
Set-Location $PSScriptRoot
# rust runtime test
Set-Location .\kclvm\tests\test_units
python3 -m pytest -vv
Set-Location $PSScriptRoot
# konfig test
Invoke-Expression -Command '.\test\integration\test_konfig.bat'
2 changes: 1 addition & 1 deletion docs/dev_guide/2.quick_start.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ make build
In the top level of the `kcl-lang/kcl` repo and run:

```sh
.\build.bat
.\build.ps1
```

### Testing
Expand Down
21 changes: 0 additions & 21 deletions scripts/build-windows/build.bat

This file was deleted.

44 changes: 44 additions & 0 deletions scripts/build-windows/build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Copyright The KCL Authors. All rights reserved.

Set-Location $PSScriptRoot
# 1. Install kclvm_cli_cdylib.dll
Set-Location "..\..\kclvm"
cargo build --release
Set-Location $PSScriptRoot

New-Item -ErrorAction Ignore -Path ".\_output" -ItemType "directory"
New-Item -ErrorAction Ignore -Path ".\_output\kclvm-windows" -ItemType "directory"
New-Item -ErrorAction Ignore -Path ".\_output\kclvm-windows\bin" -ItemType "directory"
New-Item -ErrorAction Ignore -Path ".\_output\kclvm-windows\include" -ItemType "directory"

Copy-Item -Path "..\..\kclvm\target\release\kclvm_cli_cdylib.dll" -Destination ".\_output\kclvm-windows\bin\" -Force
Copy-Item -Path "..\..\kclvm\target\release\kclvm_cli_cdylib.dll.lib" -Destination ".\_output\kclvm-windows\bin\" -Force
Copy-Item -Path "..\..\kclvm\target\release\kclvm_cli_cdylib.dll.lib" -Destination "..\..\kclvm\target\release\kclvm_cli_cdylib.lib"

Set-Location $PSScriptRoot
# 2. Install kclvm CLI
Set-Location "..\..\cli"
cargo build --release
Set-Location $PSScriptRoot
Copy-Item -Path "..\..\cli\target\release\kclvm_cli.exe" -Destination ".\_output\kclvm-windows\bin\" -Force

Set-Location $PSScriptRoot
# 3. Install kcl language server
Set-Location "..\..\kclvm\tools\src\LSP"
cargo build --release
Set-Location $PSScriptRoot
Copy-Item -Path "..\..\kclvm\target\release\kcl-language-server.exe" -Destination ".\_output\kclvm-windows\bin\

Set-Location $PSScriptRoot
# 4. Copy KCLVM C API header
Copy-Item -Path "..\..\kclvm\runtime\src\_kclvm.h" -Destination ".\_output\kclvm-windows\include\" -Force

Set-Location $PSScriptRoot
# Install hello.k
Copy-Item -Path "..\..\samples\hello.k" -Destination ".\_output\kclvm-windows" -Force

# Run KCL files
.\_output\kclvm-windows\bin\kclvm_cli.exe run ..\..\samples\fib.k
.\_output\kclvm-windows\bin\kclvm_cli.exe run ..\..\samples\hello.k
.\_output\kclvm-windows\bin\kclvm_cli.exe run ..\..\samples\kubernetes.k
.\_output\kclvm-windows\bin\kclvm_cli.exe run ..\..\samples\math.k
11 changes: 0 additions & 11 deletions scripts/build-windows/build_kcl_lsp_server.bat

This file was deleted.

12 changes: 0 additions & 12 deletions scripts/build-windows/build_kclvm_cli.bat

This file was deleted.

16 changes: 0 additions & 16 deletions scripts/build-windows/build_kclvm_dll.bat

This file was deleted.

8 changes: 0 additions & 8 deletions scripts/build-windows/build_kclvm_runtime.bat

This file was deleted.

13 changes: 0 additions & 13 deletions scripts/build-windows/clean.bat

This file was deleted.

10 changes: 10 additions & 0 deletions scripts/build-windows/clean.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright The KCL Authors. All rights reserved.

Set-Location $PSScriptRoot

Remove-Item -Recurse -Force "_output"
Remove-Item -Recurse -Force "*.obj"
Remove-Item -Recurse -Force "*.exp"
Remove-Item -Recurse -Force "*.lib"
Remove-Item -Recurse -Force "*.dll"
Remove-Item -Force "*.zip"

0 comments on commit ab12b35

Please sign in to comment.