-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathentry.ps1
More file actions
110 lines (104 loc) · 2.99 KB
/
entry.ps1
File metadata and controls
110 lines (104 loc) · 2.99 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
param(
[string]
[ValidateSet(
"clean",
"restore",
"build",
"run",
"format",
"check",
"test",
"client:run",
"client:test",
"client:watch:test",
"client:publish",
"client:serve",
"server:run",
"server:test",
"generate:sample"
)]
$Command,
[string] $Configuration = "Release"
)
function Invoke-LocationChangeBlock {
Param(
[Parameter(Mandatory = $true)]
[scriptblock]$ScriptBlock
)
$currentDir = $PWD
try {
& $scriptBlock
}
finally {
Set-Location $currentDir
}
}
$sampleDirectory = "./Sample"
$consoleSampleDirectory = "./Sample/EventHorizon.BabylonJS.Interop.Generator.ConsoleApp"
$wasmSampleProject = "./Sample/EventHorizon.Blazor.BabylonJS/EventHorizon.Blazor.BabylonJS.csproj"
$serverSampleProject = "./Sample/EventHorizon.Blazor.Server.BabylonJS/EventHorizon.Blazor.Server.BabylonJS.csproj"
$generatedSampleDirectory = "./Sample/_generated"
$testProject = "./Tests/EventHorizon.Blazor.TypeScript.Interop.Generator.Tests/EventHorizon.Blazor.TypeScript.Interop.Generator.Tests.csproj"
$testServerProject = "./Tests/EventHorizon.Blazor.Interop.Generator.Tests/EventHorizon.Blazor.Interop.Generator.Tests.csproj"
switch ($Command) {
"setup" {
dotnet tool install --global dotnet-trace
}
"clean" {
dotnet clean
}
"restore" {
dotnet restore --no-cache
}
"build" {
dotnet csharpier .
dotnet build --no-cache
}
"run" {
dotnet run --project $serverProject
}
"format" {
dotnet csharpier .
}
"check" {
dotnet build --no-incremental -c $Configuration
dotnet csharpier --check .
}
"test" {
./entry.ps1 client:test
./entry.ps1 server:test
}
"client:run" {
dotnet run --project $wasmSampleProject
}
"client:test" {
dotnet test --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info $testProject
}
"client:watch:test" {
dotnet watch --project $testProject test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info
}
"client:publish" {
dotnet publish -c $Configuration -o ./published $wasmSampleProject
}
"client:serve" {
./entry.ps1 client:publish
dotnet serve -d="./published/wwwroot"
}
"server:test" {
dotnet test --no-restore --verbosity normal /p:CollectCoverage=true /p:CoverletOutputFormat=lcov /p:CoverletOutput=./lcov.info $testServerProject
}
"generate:sample" {
Invoke-LocationChangeBlock {
cd $consoleSampleDirectory
dotnet clean
dotnet run -c $Configuration
}
Invoke-LocationChangeBlock {
cd $sampleDirectory
dotnet build
}
}
Default {
Write-Output "Invalid Command"
}
}