Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the template version #2055

Merged
merged 1 commit into from
Aug 11, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions build.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)"
}
},
Expand Down Expand Up @@ -105,4 +105,4 @@
},
"continueOnError": false
}]
}
}
4 changes: 4 additions & 0 deletions src/template/fake-template/Content/build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<!--#if (version == "latest") -->
<DotNetCliToolReference Include="dotnet-fake" Version="*" />
<!--#else-->
<DotNetCliToolReference Include="dotnet-fake" Version="(version)" />
<!--#endif-->
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/template/fake-template/Content/fake.tool.cmd
Original file line number Diff line number Diff line change
@@ -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%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we add a comment here to tell users how to "lock" the version? Anyway we can add that later

rem #else
dotnet tool install fake-cli --tool-path ./%TOOL_PATH% --version (version)
rem #endif
)

"%TOOL_PATH%/fake.exe" %*
4 changes: 4 additions & 0 deletions src/template/fake-template/Content/fake.tool.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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" "$@"