Skip to content

Commit 02d6f2b

Browse files
nodtem66Martinsos
andauthored
[Issue/3148] ./run.ps1 for building waspc on Windows (#3324)
* Add waspc/run.ps1 for building waspc projects on Windows Add a stub file for waspc/tools/install_packages_to_data_dir.ps1 * Update waspc/run.ps1 * Update waspc/tools/install_packages_to_data_dir.ps1 --------- Co-authored-by: Martin Šošić <[email protected]>
1 parent e256798 commit 02d6f2b

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

waspc/run.ps1

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# The script duplicates some part of logics from run shell script.
2+
# We plan to merge these two scripts into one platform-agnostic script in the future to avoid duplication.
3+
# Requires PowerShell 5.1 or higher.
4+
5+
param(
6+
[string]$Command = ""
7+
)
8+
9+
$PROJECT_ROOT = Split-Path -Parent $MyInvocation.MyCommand.Path
10+
$REPOSITORY_ROOT = Split-Path -Parent $PROJECT_ROOT
11+
12+
# Building
13+
$WASP_PACKAGES_COMPILE = Join-Path $PROJECT_ROOT "tools\install_packages_to_data_dir.ps1"
14+
$BUILD_HS_CMD = "cabal build all"
15+
$BUILD_ALL_CMD = "$WASP_PACKAGES_COMPILE -and $BUILD_HS_CMD"
16+
$RUN_CMD="cabal --project-dir=${PROJECT_ROOT} run wasp-cli -- $Args"
17+
18+
switch ($Command) {
19+
"build" {
20+
Invoke-Expression $BUILD_HS_CMD
21+
}
22+
"build:all" {
23+
Invoke-Expression $BUILD_ALL_CMD
24+
}
25+
"wasp-cli" {
26+
Invoke-Expression $RUN_CMD
27+
}
28+
Default {
29+
Write-Host "USAGE"
30+
Write-Host " run <command>"
31+
Write-Host ""
32+
Write-Host "COMMANDS"
33+
Write-Host " build Builds the Haskell project."
34+
Write-Host " build:all Builds the Haskell project + all sub-projects (i.e. TS packages)."
35+
Write-Host " wasp-cli <args> Runs the dev version of wasp executable while forwarding arguments."
36+
Write-Host " Builds the project (hs) first if needed. Doesn't require you to be in the waspc project to run it."
37+
}
38+
}

0 commit comments

Comments
 (0)