From c6efb14349efdffe801135094716621d6f66da62 Mon Sep 17 00:00:00 2001
From: kolja <38011792+kblohm@users.noreply.github.com>
Date: Sun, 5 Aug 2018 22:18:23 +0200
Subject: [PATCH] Fix the template version * only add a version constraint if
the user specified one * use * for DotNetCliToolReference if no version was
specified * do not add --version for the global tool if no version was
specified
---
build.fsx | 14 --------------
.../Content/.template.config/template.json | 4 ++--
src/template/fake-template/Content/build.proj | 4 ++++
src/template/fake-template/Content/fake.tool.cmd | 4 ++++
src/template/fake-template/Content/fake.tool.sh | 4 ++++
5 files changed, 14 insertions(+), 16 deletions(-)
diff --git a/build.fsx b/build.fsx
index 6de1a991ecf..680a34703b5 100644
--- a/build.fsx
+++ b/build.fsx
@@ -694,17 +694,6 @@ Target.create "_DotNetPackage" (fun _ ->
Environment.setEnvironVar "PackageProjectUrl" "https://github.com/fsharp/Fake"
Environment.setEnvironVar "PackageLicenseUrl" "https://github.com/fsharp/FAKE/blob/d86e9b5b8e7ebbb5a3d81c08d2e59518cf9d6da9/License.txt"
- // Update template
- let templateFromVersion, templateToVersion = """"defaultValue": "5.*",""", sprintf """"defaultValue": "%s",""" nugetVersion
- let templateConfigFile = "src/template/fake-template/Content/.template.config/template.json"
- let replaceInTemplate fromDefault toDefault =
- [ templateConfigFile ]
- |> Shell.replaceInFiles [ fromDefault, toDefault ]
- let configContents = File.ReadAllText(templateConfigFile)
- if not <| configContents.Contains templateFromVersion then
- failwithf "Make sure to revert your changes in '%s' or update the build script accordingly" templateConfigFile
- replaceInTemplate templateFromVersion templateToVersion
-
// dotnet pack
DotNet.pack (fun c ->
{ c with
@@ -716,9 +705,6 @@ Target.create "_DotNetPackage" (fun _ ->
else c.Common
} |> dtntSmpl) "Fake.sln"
- // Revert template
- replaceInTemplate templateToVersion templateFromVersion
-
// TODO: Check if we run the test in the current build!
Directory.ensure "temp"
let testZip = "temp/tests.zip"
diff --git a/src/template/fake-template/Content/.template.config/template.json b/src/template/fake-template/Content/.template.config/template.json
index 6650b3a6964..fc9b52549ba 100644
--- a/src/template/fake-template/Content/.template.config/template.json
+++ b/src/template/fake-template/Content/.template.config/template.json
@@ -59,7 +59,7 @@
"type": "parameter",
"description": "Version of FAKE to install. This parameter is only applicable when either 'tool' or 'project' is used for bootstrapping",
"dataType": "string",
- "defaultValue": "5.*",
+ "defaultValue": "latest",
"replaces": "(version)"
}
},
@@ -105,4 +105,4 @@
},
"continueOnError": false
}]
-}
+}
\ No newline at end of file
diff --git a/src/template/fake-template/Content/build.proj b/src/template/fake-template/Content/build.proj
index 0db5604e9bf..d725e65f0f8 100644
--- a/src/template/fake-template/Content/build.proj
+++ b/src/template/fake-template/Content/build.proj
@@ -3,6 +3,10 @@
netstandard2.0
+
+
+
+
\ No newline at end of file
diff --git a/src/template/fake-template/Content/fake.tool.cmd b/src/template/fake-template/Content/fake.tool.cmd
index c596b122b7a..9a4103bf6cf 100644
--- a/src/template/fake-template/Content/fake.tool.cmd
+++ b/src/template/fake-template/Content/fake.tool.cmd
@@ -1,7 +1,11 @@
SET TOOL_PATH=(ToolPath)
IF NOT EXIST "%TOOL_PATH%\fake.exe" (
+ rem #if (version == "latest")
+ dotnet tool install fake-cli --tool-path ./%TOOL_PATH%
+ rem #else
dotnet tool install fake-cli --tool-path ./%TOOL_PATH% --version (version)
+ rem #endif
)
"%TOOL_PATH%/fake.exe" %*
\ No newline at end of file
diff --git a/src/template/fake-template/Content/fake.tool.sh b/src/template/fake-template/Content/fake.tool.sh
index 342bc559a01..4cd1c0b88d2 100644
--- a/src/template/fake-template/Content/fake.tool.sh
+++ b/src/template/fake-template/Content/fake.tool.sh
@@ -22,6 +22,10 @@ FAKE="$TOOL_PATH"/fake
if ! [ -e "$FAKE" ]
then
+#if (version == "latest")
+ dotnet tool install fake-cli --tool-path "$TOOL_PATH"
+#else
dotnet tool install fake-cli --tool-path "$TOOL_PATH" --version (version)
+#endif
fi
"$FAKE" "$@"