-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.fsx
More file actions
134 lines (109 loc) · 4.29 KB
/
build.fsx
File metadata and controls
134 lines (109 loc) · 4.29 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#r "nuget: FAKE.Core"
#r "nuget: Fake.Core.Target"
#r "nuget: Fake.IO.FileSystem"
#r "nuget: Fake.Tools.Git"
#r "nuget: Fake.DotNet.Cli"
#r "nuget: Fake.DotNet.AssemblyInfoFile"
#r "nuget: Fake.DotNet.Paket"
#r "nuget: Paket.Core, 8.1.0-alpha004"
#r "nuget: MSBuild.StructuredLogger"
open System.IO
open System.Diagnostics
open System.Threading
open Fake.Core
open Fake.Core.TargetOperators
open Fake.DotNet
open Fake.IO
open Fake.IO.FileSystemOperators
// open Fake.JavaScript
System.Environment.GetCommandLineArgs()
|> Array.skip 2 // skip fsi.exe; build.fsx
|> Array.toList
|> Fake.Core.Context.FakeExecutionContext.Create false __SOURCE_FILE__
|> Fake.Core.Context.RuntimeContext.Fake
|> Fake.Core.Context.setExecutionContext
#load "paket-files/wsbuild/github.com/dotnet-websharper/build-script/WebSharper.Fake.fsx"
open WebSharper.Fake
let WithProjects projects args =
{ args with BuildAction = Projects projects }
let viteRun directory =
let npxPath = ProcessUtils.tryFindFileOnPath "npx"
match npxPath with
| None -> failwith "Could not find npx"
| Some npxPath ->
CreateProcess.fromRawCommandLine npxPath "vite"
|> CreateProcess.withWorkingDirectory directory
|> CreateProcess.ensureExitCode
let onStdout (line: string) =
printfn "%s" line
let onStderr (line: string) =
printfn "%s" line
let run createProcess =
createProcess
|> CreateProcess.redirectOutputIfNotRedirected
|> CreateProcess.withOutputEvents (onStdout) (onStderr)
Target.create "RunMainTestsRelease" <| fun _ ->
()
// if Environment.environVarAsBoolOrDefault "SKIP_CORE_TESTING" false || not <| System.Runtime.InteropServices.RuntimeInformation.IsOSPlatform System.Runtime.InteropServices.OSPlatform.Windows then
// Trace.log "Chutzpah testing skipped"
// else
// Trace.log "Starting Web test project"
// let mutable startedOk = false
// let started = new EventWaitHandle(false, EventResetMode.ManualReset)
// use webTestsProc = new Process()
// webTestsProc.StartInfo.FileName <- @"WebSharper.MathJS.Tests.Server\bin\Release\net6.0\WebSharper.MathJS.Tests.Server.exe"
// webTestsProc.StartInfo.WorkingDirectory <- @"WebSharper.MathJS.Tests.Server"
// webTestsProc.StartInfo.UseShellExecute <- false
// webTestsProc.StartInfo.RedirectStandardOutput <- true
// webTestsProc.OutputDataReceived.Add(fun d ->
// if not (isNull d) then
// if not startedOk then
// Trace.log d.Data
// if d.Data.Contains("Application started.") then
// startedOk <- true
// started.Set() |> ignore
// )
// webTestsProc.Exited.Add(fun _ ->
// if not startedOk then
// failwith "Starting Web test project failed."
// )
// webTestsProc.Start()
// webTestsProc.BeginOutputReadLine()
// started.WaitOne()
// Thread.Sleep(8000)
// use vite = new Process()
// vite.StartInfo.FileName <- "cmd"
// vite.StartInfo.UseShellExecute <- false
// vite.StartInfo.RedirectStandardOutput <- true
// vite.StartInfo.Arguments <- "/c npx vite"
// vite.StartInfo.WorkingDirectory <- "./WebSharper.MathJS.Tests.Client/"
// vite.Start()
// vite.BeginOutputReadLine()
// printfn "VITE started"
// Thread.Sleep(8000)
// let res =
// Shell.Exec(
// "packages/test/Chutzpah/tools/chutzpah.console.exe",
// "http://localhost:5174 /engine Chrome /parallelism 1 /silent /failOnError /showFailureReport"
// )
// webTestsProc.Kill()
// vite.Kill()
// if res <> 0 then
// failwith "Chutzpah test run failed"
let t =
LazyVersionFrom "WebSharper" |> WSTargets.Default
|> fun args ->
{ args with
Attributes = [
AssemblyInfo.Company "IntelliFactory"
AssemblyInfo.Copyright "(c) IntelliFactory 2023"
AssemblyInfo.Title "https://github.com/dotnet-websharper/mathjs"
AssemblyInfo.Product "WebSharper math.js"
]
}
|> MakeTargets
"WS-BuildRelease"
==> "RunMainTestsRelease"
"RunMainTestsRelease"
==> "CI-Release"
t |> RunTargets