From 7bd612a404dafb6aab0e0e88a79c3c7e57676f58 Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Fri, 18 Aug 2023 13:31:47 +0800 Subject: [PATCH] make.fsx: implement the 'reinstall' target in Win For easier development experience. TODO: implement same for unix, but maybe when we get rid of legacy framework support, so that we can just adopt make.fsx (instead of having install.sh for mac/linux like it's happening now). --- Makefile | 4 ++++ scripts/make.fsx | 34 ++++++++++++++++++++-------------- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 94e173ac..863b5057 100644 --- a/Makefile +++ b/Makefile @@ -7,5 +7,9 @@ release: install: release ./scripts/install.sh +reinstall: + echo "'reinstall' target not supported yet in Unix, uninstall manually and use 'install' for now" >> /dev/stderr + exit 1 + check: ./scripts/runTests.fsx diff --git a/scripts/make.fsx b/scripts/make.fsx index 8d56f0c9..4bd5e270 100644 --- a/scripts/make.fsx +++ b/scripts/make.fsx @@ -212,24 +212,17 @@ let finalReleaseFolderPath = Path.Combine(releaseFolderPath, "net6.0") let finalReleaseFolderPath = releaseFolderPath #endif -match maybeTarget with - -| None -| Some "all" -> MakeAll() |> ignore - -| Some "release" -> - let buildConfig = BinaryConfig.Release - JustBuild buildConfig - -| Some "install" -> +let Install(isReinstall: bool) = let buildConfig = BinaryConfig.Release JustBuild buildConfig if fsxInstallationDir.Exists then - // TODO - failwithf - "Existing installation found in '%s'. This script can't overwrite an existing installation yet" - fsxInstallationDir.FullName + if not isReinstall then + failwithf + "Existing installation found in '%s'. Consider using the target 'reinstall' instead of 'install'." + fsxInstallationDir.FullName + else + fsxInstallationDir.Delete true Console.WriteLine "Installing..." Console.WriteLine() @@ -322,6 +315,19 @@ match maybeTarget with sprintf "Successfully installed in %s" fsxInstallationDir.FullName ) +match maybeTarget with + +| None +| Some "all" -> MakeAll() |> ignore + +| Some "release" -> + let buildConfig = BinaryConfig.Release + JustBuild buildConfig + +| Some "reinstall" -> Install true + +| Some "install" -> Install false + | Some "check" -> // FIXME: contributor should be able to run 'make check' before 'make install'