From c60153590b6c6a18f88c2dfb34d292c046610e0c Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Wed, 23 Jul 2014 15:14:19 +0100 Subject: [PATCH 1/2] Fix for #502. Make the build script args part of the --fsiargs switch the value of an environemnt variable named fsiargs-buildscriptargs. This is the best solution to make this restricted set of args explicitly available to the build script. --- src/app/FakeLib/FSIHelper.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/FakeLib/FSIHelper.fs b/src/app/FakeLib/FSIHelper.fs index d0f91ca4bef..7f8cfbe5836 100644 --- a/src/app/FakeLib/FSIHelper.fs +++ b/src/app/FakeLib/FSIHelper.fs @@ -96,10 +96,13 @@ let runBuildScriptWithFsiArgsAt workingDirectory printDetails (FsiArgs(fsiOption for (k,v) in args do Environment.SetEnvironmentVariable(k, v, EnvironmentVariableTarget.Process) + // Create an env var that only contains the build script args part from the --fsiargs (or ""). + Environment.SetEnvironmentVariable("fsiargs-buildscriptargs", String.Join(" ", scriptArgs)) + let fsiConfig = FsiEvaluationSession.GetDefaultConfiguration() let commonOptions = - [ "fsi.exe"; "--noninteractive" ] @ fsiOptions @ scriptArgs + [ "fsi.exe"; "--noninteractive" ] @ fsiOptions |> List.toArray let sbOut = new Text.StringBuilder() From f7d708edfc1acbe46cbf51503211a3872cf7a330 Mon Sep 17 00:00:00 2001 From: Ben Taylor Date: Wed, 23 Jul 2014 15:28:46 +0100 Subject: [PATCH 2/2] Add documentation for the new --fsiargs build script arguments approach. --- help/commandline.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/help/commandline.md b/help/commandline.md index 52718aa7307..3798e140cba 100644 --- a/help/commandline.md +++ b/help/commandline.md @@ -56,6 +56,8 @@ Important: If you use this option, you must include your build script path as o `--fsiargs --debug+ buildscript.fsx someArg1 anotherArg2` +The entire argument string *following* the build script path is set as the value of an environment variable named `fsiargs-buildscriptargs`. This means you can access this specific set of arguments from within your build script. + ### `--boot [-b] ` Boostrapp your FAKE script. A bootstrapping `build.fsx` script executes twice (in two stages), allowing you to download dependencies with NuGet and do other preparatory work in the first stage, and have these dependencies available in the second stage.