Skip to content

Commit 002d81b

Browse files
committed
Modernize build
1 parent 6b94129 commit 002d81b

File tree

4 files changed

+18
-29
lines changed

4 files changed

+18
-29
lines changed

build.fsx

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ let srcDir = __SOURCE_DIRECTORY__ </> "src"
6464

6565
let testDir = __SOURCE_DIRECTORY__ </> "tests" </> "IntegrationTests"
6666

67-
let dotnetcliVersion = "2.0.0"
67+
let dotnetcliVersion = DotNetCli.GetDotNetSDKVersionFromGlobalJson()
6868

6969
let mutable dotnetExePath = "dotnet"
7070

@@ -144,6 +144,12 @@ FinalTarget "CloseAndroid" (fun _ ->
144144

145145
Target "InstallDotNetCore" (fun _ ->
146146
dotnetExePath <- DotNetCli.InstallDotNetSDK dotnetcliVersion
147+
let fi = FileInfo dotnetExePath
148+
let SEPARATOR = if isWindows then ";" else ":"
149+
Environment.SetEnvironmentVariable(
150+
"PATH",
151+
fi.Directory.FullName + SEPARATOR + System.Environment.GetEnvironmentVariable "PATH",
152+
EnvironmentVariableTarget.Process)
147153
)
148154

149155
Target "Restore" (fun _ ->
@@ -244,13 +250,7 @@ Target "PrepareRelease" (fun _ ->
244250
Target "CompileForTest" (fun _ ->
245251
ActivateFinalTarget "KillProcess"
246252

247-
let result =
248-
ExecProcess (fun info ->
249-
info.FileName <- dotnetExePath
250-
info.WorkingDirectory <- srcDir
251-
info.Arguments <- " fable npm-run compile-for-test") TimeSpan.MaxValue
252-
253-
if result <> 0 then failwith "fable shut down. Please check logs above"
253+
run yarnTool "run fable-splitter -c splitter.config.js --define TEST" srcDir
254254
)
255255

256256
Target "AssembleForTest" (fun _ ->
@@ -260,12 +260,7 @@ Target "AssembleForTest" (fun _ ->
260260
Target "BuildRelease" (fun _ ->
261261
ActivateFinalTarget "KillProcess"
262262

263-
let result =
264-
ExecProcess (fun info ->
265-
info.FileName <- dotnetExePath
266-
info.WorkingDirectory <- srcDir
267-
info.Arguments <- " fable npm-run build") TimeSpan.MaxValue
268-
if result <> 0 then failwith "fable shut down. Please check logs above"
263+
run yarnTool "run fable-splitter -c splitter.config.js --define RELEASE" srcDir
269264
run gradleTool "assembleRelease --console plain" "android"
270265

271266
let outFile = "android" </> "app" </> "build" </> "outputs" </> "apk" </> "app-release.apk"
@@ -275,20 +270,9 @@ Target "BuildRelease" (fun _ ->
275270
)
276271

277272
Target "Debug" (fun _ ->
278-
let result =
279-
ExecProcess (fun info ->
280-
info.FileName <- dotnetExePath
281-
info.WorkingDirectory <- srcDir
282-
info.Arguments <- " fable npm-run cold-start") TimeSpan.MaxValue
283-
if result <> 0 then failwith "fable shut down."
273+
run yarnTool "run fable-splitter -c splitter.config.js --define DEBUG" srcDir
284274

285-
let dotnetwatch = async {
286-
let result =
287-
ExecProcess (fun info ->
288-
info.FileName <- dotnetExePath
289-
info.WorkingDirectory <- srcDir
290-
info.Arguments <- " fable npm-run start") TimeSpan.MaxValue
291-
if result <> 0 then failwith "fable shut down." }
275+
let dotnetwatch = async { run yarnTool "run fable-splitter -c splitter.config.js -w --define DEBUG" srcDir }
292276

293277
let reactNativeTool = async { run reactNativeTool "run-android" "" }
294278

global.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "2.1.402"
4+
}
5+
}

paket.dependencies

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ group Test
2323
group Build
2424
source https://nuget.org/api/v2
2525

26-
nuget FAKE
26+
nuget FAKE < 5

paket.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -480,7 +480,7 @@ NUGET
480480
GROUP Build
481481
NUGET
482482
remote: https://www.nuget.org/api/v2
483-
FAKE (4.64.4)
483+
FAKE (4.64.16)
484484

485485
GROUP Test
486486
GENERATE-LOAD-SCRIPTS: ON

0 commit comments

Comments
 (0)