-
Notifications
You must be signed in to change notification settings - Fork 585
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
WIP: Dotnet new template #1989
Merged
Merged
WIP: Dotnet new template #1989
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Fake Template | ||
|
||
The Fake template bootstraps FAKE and sets up a basic build-script. | ||
|
||
## Installation | ||
|
||
Run | ||
<pre><code class="lang-bash"> | ||
dotnet new -i "fake-template::*" | ||
</code></pre> | ||
to install or update the template. | ||
|
||
## Usage | ||
After you installed the template you can setup FAKE by running: | ||
<pre><code class="lang-bash"> | ||
dotnet new fake | ||
</code></pre> | ||
This will create a default `build.fsx` file, a `paket.dependencies` file used to mangage your build dependencies and two shell scripts `fake.sh` and `fake.cmd`. The shell scripts are used to bootstrap and run FAKE. All of the arguments are passed direcly to FAKE so you can run: | ||
<pre><code class="lang-bash"> | ||
.\fake.cmd build | ||
</code></pre> | ||
to run your build. Have a look [this](fake-commandline.html) for the available command-line options. [This page](fake-gettingstarted.html#Example-Compiling-and-building-your-NET-application) additional information on how to use a build script. | ||
|
||
## Options | ||
|
||
### --script-name | ||
Specifies the name of the generated build-script. Defaults to `build.fsx`. | ||
|
||
### --bootstrap | ||
Specifies your prefered way to bootstrap FAKE. | ||
|
||
- `tool` (default) - Installs the FAKE dotnet sdk global tool into the `tool--path` folder | ||
- `project` - Creates a `build.proj` and uses `DotNetCliToolReference` to bootstrap FAKE | ||
- `none` - Does not bootstrap FAKE. Use this if you want to use a global installation of FAKE | ||
|
||
### --dependencies | ||
Specifies your prefered way to define the nuget packages used in your build: | ||
|
||
- `file` (default) - Creates a `paket.dependencies` file to define build dependencies | ||
- `inline` - Defines build dependencies inside the build script | ||
- `none` - Use this if you already have a `paket.dependencies` in your folder | ||
|
||
### --tool-path | ||
Specifies the folder for the fake-cli tool. This parameter is only applicable when `tool` is used for bootstrapping. Defaults to `.fake`. | ||
|
||
### --version | ||
Specifies the version of FAKE to install. Defaults to `5.*`. This parameter is only applicable when either `tool` or `project` is used for bootstrapping. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
94 changes: 94 additions & 0 deletions
94
src/app/fake-template/Content/.template.config/template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
{ | ||
"identity": "Fake.Template", | ||
"shortName": "fake", | ||
"name": "FAKE - Template", | ||
"classifications": ["build", "FAKE"], | ||
"symbols": { | ||
"script-name": { | ||
"type": "parameter", | ||
"description": "Name of the generated build-script", | ||
"dataType": "string", | ||
"defaultValue": "build.fsx", | ||
"FileRename": "build.fsx", | ||
"replaces": "(build.fsx)" | ||
}, | ||
"bootstrap": { | ||
"type": "parameter", | ||
"dataType": "choice", | ||
"defaultValue": "tool", | ||
"choices": [{ | ||
"choice": "project", | ||
"description": "Creates a build.proj file to bootstrap FAKE" | ||
}, | ||
{ | ||
"choice": "tool", | ||
"description": "Uses the FAKE dotnet sdk global tool to bootstrap FAKE. The tool is installed into 'tool--path'" | ||
}, | ||
{ | ||
"choice": "none", | ||
"description": "Does not bootstrap FAKE. Use this if you want to use a global installation of FAKE" | ||
} | ||
] | ||
}, | ||
"dependencies": { | ||
"type": "parameter", | ||
"dataType": "choice", | ||
"defaultValue": "file", | ||
"choices": [{ | ||
"choice": "file", | ||
"description": "Use paket.dependencies file to define build dependencies" | ||
}, | ||
{ | ||
"choice": "inline", | ||
"description": "Define build dependencies inside the build script" | ||
}, | ||
{ | ||
"choice": "none", | ||
"description": "No dependencies are created. Use this if you already have a paket.dependencies file in your folder" | ||
} | ||
] | ||
}, | ||
"tool-path": { | ||
"type": "parameter", | ||
"description": "Folder for the FAKE dotnet sdk global tool. This parameter is only applicable when 'tool' is used for bootstrapping", | ||
"dataType": "string", | ||
"defaultValue": ".fake", | ||
"replaces": "(ToolPath)" | ||
}, | ||
"version": { | ||
"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.*", | ||
"replaces": "(version)" | ||
} | ||
}, | ||
"sources": [{ | ||
"exclude": "**/.template.config/**/*", | ||
"modifiers": [{ | ||
"exclude": "**/fake.tool.*", | ||
"condition": "(bootstrap != \"tool\")" | ||
}, | ||
{ | ||
"rename": { | ||
"fake.tool.sh": "fake.sh", | ||
"fake.tool.cmd": "fake.cmd" | ||
} | ||
}, | ||
{ | ||
"exclude": ["**/fake.proj.*", "**/build.proj"], | ||
"condition": "(bootstrap != \"project\")" | ||
}, | ||
{ | ||
"rename": { | ||
"fake.proj.sh": "fake.sh", | ||
"fake.proj.cmd": "fake.cmd" | ||
} | ||
}, | ||
{ | ||
"exclude": "**/paket.dependencies", | ||
"condition": "(dependencies != \"file\")" | ||
} | ||
] | ||
}] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
//#if (dependencies == "inline") | ||
#r "paket: | ||
source https://api.nuget.org/v3/index.json | ||
nuget Fake.DotNet.Cli | ||
nuget Fake.IO.FileSystem | ||
nuget Fake.Core.Target //" | ||
//#endif | ||
#load ".fake/(build.fsx)/intellisense.fsx" | ||
open Fake.Core | ||
open Fake.DotNet | ||
open Fake.IO | ||
open Fake.IO.FileSystemOperators | ||
open Fake.IO.Globbing.Operators | ||
open Fake.Core.TargetOperators | ||
|
||
Target.create "Clean" (fun _ -> | ||
!! "src/**/bin" | ||
++ "src/**/obj" | ||
|> Shell.cleanDirs | ||
) | ||
|
||
Target.create "Build" (fun _ -> | ||
!! "src/**/*.*proj" | ||
|> Seq.iter (DotNet.build id) | ||
) | ||
|
||
Target.create "All" ignore | ||
|
||
"Clean" | ||
==> "Build" | ||
==> "All" | ||
|
||
Target.runOrDefault "All" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<DotNetCliToolReference Include="dotnet-fake" Version="(version)" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
dotnet restore build.proj | ||
dotnet fake %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
dotnet restore build.proj | ||
dotnet fake "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
SET TOOL_PATH=(ToolPath) | ||
|
||
IF NOT EXIST "%TOOL_PATH%\fake.exe" ( | ||
dotnet tool install fake-cli --tool-path ./%TOOL_PATH% --version (version) | ||
) | ||
|
||
"%TOOL_PATH%/fake.exe" %* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
TOOL_PATH=(ToolPath) | ||
|
||
if ! [ -e $TOOL_PATH/fake ] | ||
then | ||
dotnet tool install fake-cli --tool-path $TOOL_PATH --version (version) | ||
fi | ||
$TOOL_PATH/fake "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// [ FAKE GROUP ] | ||
group Build | ||
source https://api.nuget.org/v3/index.json | ||
nuget Fake.DotNet.Cli | ||
nuget Fake.IO.FileSystem | ||
nuget Fake.Core.Target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<NeutralLanguage>en-US</NeutralLanguage> | ||
<PackageType>Template</PackageType> | ||
<PackProjectInputFile>$(MSBuildProjectFullPath)</PackProjectInputFile> | ||
<NoBuild>true</NoBuild> | ||
<IncludeBuildOutput>false</IncludeBuildOutput> | ||
<TargetFramework>netstandard2.0</TargetFramework> | ||
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences> | ||
</PropertyGroup> | ||
<PropertyGroup> | ||
<ExcludeFromPackage> | ||
Content/packages/**/*; | ||
Content/bin/**/*; | ||
Content/obj/**/*; | ||
Content/src/bin/**/*; | ||
Content/src/obj/**/*; | ||
</ExcludeFromPackage> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Content Include="Content/**/*" Exclude="$(ExcludeFromPackage)"> | ||
<PackagePath>Content\</PackagePath> | ||
</Content> | ||
</ItemGroup> | ||
</Project> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we just add it to
Fake.sln
?