From ced9fde7cb766a5941feb1cdaa31b19f61e3e3d5 Mon Sep 17 00:00:00 2001 From: Steffen Forkmann Date: Wed, 20 Feb 2019 15:29:06 +0100 Subject: [PATCH] Modernize build --- build.fsx | 36 ++++++++++-------------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/build.fsx b/build.fsx index 25278bf..79f711c 100644 --- a/build.fsx +++ b/build.fsx @@ -144,6 +144,12 @@ FinalTarget "CloseAndroid" (fun _ -> Target "InstallDotNetCore" (fun _ -> dotnetExePath <- DotNetCli.InstallDotNetSDK dotnetcliVersion + let fi = FileInfo dotnetExePath + let SEPARATOR = if isWindows then ";" else ":" + Environment.SetEnvironmentVariable( + "PATH", + fi.Directory.FullName + SEPARATOR + System.Environment.GetEnvironmentVariable "PATH", + EnvironmentVariableTarget.Process) ) Target "Restore" (fun _ -> @@ -244,13 +250,7 @@ Target "PrepareRelease" (fun _ -> Target "CompileForTest" (fun _ -> ActivateFinalTarget "KillProcess" - let result = - ExecProcess (fun info -> - info.FileName <- dotnetExePath - info.WorkingDirectory <- srcDir - info.Arguments <- " fable npm-run compile-for-test") TimeSpan.MaxValue - - if result <> 0 then failwith "fable shut down. Please check logs above" + run yarnTool "run fable-splitter -c splitter.config.js --define TEST" srcDir ) Target "AssembleForTest" (fun _ -> @@ -260,12 +260,7 @@ Target "AssembleForTest" (fun _ -> Target "BuildRelease" (fun _ -> ActivateFinalTarget "KillProcess" - let result = - ExecProcess (fun info -> - info.FileName <- dotnetExePath - info.WorkingDirectory <- srcDir - info.Arguments <- " fable npm-run build") TimeSpan.MaxValue - if result <> 0 then failwith "fable shut down. Please check logs above" + run yarnTool "run fable-splitter -c splitter.config.js --define RELEASE" srcDir run gradleTool "assembleRelease --console plain" "android" let outFile = "android" "app" "build" "outputs" "apk" "app-release.apk" @@ -275,20 +270,9 @@ Target "BuildRelease" (fun _ -> ) Target "Debug" (fun _ -> - let result = - ExecProcess (fun info -> - info.FileName <- dotnetExePath - info.WorkingDirectory <- srcDir - info.Arguments <- " fable npm-run cold-start") TimeSpan.MaxValue - if result <> 0 then failwith "fable shut down." + run yarnTool "run fable-splitter -c splitter.config.js --define DEBUG" srcDir - let dotnetwatch = async { - let result = - ExecProcess (fun info -> - info.FileName <- dotnetExePath - info.WorkingDirectory <- srcDir - info.Arguments <- " fable npm-run start") TimeSpan.MaxValue - if result <> 0 then failwith "fable shut down." } + let dotnetwatch = async { run yarnTool "run fable-splitter -c splitter.config.js -w --define DEBUG" srcDir } let reactNativeTool = async { run reactNativeTool "run-android" "" }