Skip to content

Commit fd6bd10

Browse files
kMutageneKrzysztof-Cieslak
authored andcommitted
#26: Add replacement parameters for TODO items
1 parent 0fae688 commit fd6bd10

File tree

6 files changed

+94
-53
lines changed

6 files changed

+94
-53
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,6 @@ obj/
66
bin/
77
release.cmd
88
.ionide/
9-
build/
9+
build/
10+
/.vs/
11+
/Content/.vs/

.paket/Paket.Restore.targets

+48-41
Original file line numberDiff line numberDiff line change
@@ -20,75 +20,82 @@
2020
<PaketBootstrapperStyle Condition="Exists('$(PaketToolsPath)paket.bootstrapper.proj')">proj</PaketBootstrapperStyle>
2121
<PaketExeImage>assembly</PaketExeImage>
2222
<PaketExeImage Condition=" '$(PaketBootstrapperStyle)' == 'proj' ">native</PaketExeImage>
23-
<MonoPath Condition="'$(MonoPath)' == '' And Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
23+
<MonoPath Condition="'$(MonoPath)' == '' AND Exists('/Library/Frameworks/Mono.framework/Commands/mono')">/Library/Frameworks/Mono.framework/Commands/mono</MonoPath>
2424
<MonoPath Condition="'$(MonoPath)' == ''">mono</MonoPath>
2525

2626
<!-- PaketBootStrapper -->
2727
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' AND Exists('$(PaketRootPath)paket.bootstrapper.exe')">$(PaketRootPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2828
<PaketBootStrapperExePath Condition=" '$(PaketBootStrapperExePath)' == '' ">$(PaketToolsPath)paket.bootstrapper.exe</PaketBootStrapperExePath>
2929
<PaketBootStrapperExeDir Condition=" Exists('$(PaketBootStrapperExePath)') " >$([System.IO.Path]::GetDirectoryName("$(PaketBootStrapperExePath)"))\</PaketBootStrapperExeDir>
3030

31-
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT'">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
31+
<PaketBootStrapperCommand Condition=" '$(OS)' == 'Windows_NT' ">"$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
3232
<PaketBootStrapperCommand Condition=" '$(OS)' != 'Windows_NT' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketBootStrapperExePath)"</PaketBootStrapperCommand>
3333

34-
<!-- Disable automagic references for F# dotnet sdk -->
35-
<!-- This will not do anything for other project types -->
36-
<!-- see https://github.com/fsharp/fslang-design/blob/master/tooling/FST-1002-fsharp-in-dotnet-sdk.md -->
37-
<DisableImplicitFSharpCoreReference>true</DisableImplicitFSharpCoreReference>
38-
<DisableImplicitSystemValueTupleReference>true</DisableImplicitSystemValueTupleReference>
39-
4034
<!-- Disable Paket restore under NCrunch build -->
4135
<PaketRestoreDisabled Condition="'$(NCrunch)' == '1'">True</PaketRestoreDisabled>
4236

37+
<!-- Disable test for CLI tool completely - overrideable via properties in projects or via environment variables -->
38+
<PaketDisableCliTest Condition=" '$(PaketDisableCliTest)' == '' ">False</PaketDisableCliTest>
39+
4340
<PaketIntermediateOutputPath Condition=" '$(PaketIntermediateOutputPath)' == '' ">$(BaseIntermediateOutputPath.TrimEnd('\').TrimEnd('\/'))</PaketIntermediateOutputPath>
4441
</PropertyGroup>
4542

46-
<!-- Check if paket is available as local dotnet cli tool -->
43+
<!-- Resolve how paket should be called -->
44+
<!-- Current priority is: local (1: repo root, 2: .paket folder) => 3: as CLI tool => as bootstrapper (4: proj Bootstrapper style, 5: BootstrapperExeDir) => 6: global path variable -->
4745
<Target Name="SetPaketCommand" >
48-
49-
<!-- Call 'dotnet paket' and see if it returns without an error. Mute all the output. -->
50-
<Exec Command="dotnet paket --version" IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" >
51-
<Output TaskParameter="ExitCode" PropertyName="LocalPaketToolExitCode" />
52-
</Exec>
46+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 1/2 - non-windows specific -->
47+
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT' ">
48+
<!-- no windows, try native paket as default, root => tool -->
49+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
50+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
51+
</PropertyGroup>
5352

54-
<!-- If local paket tool is found, use that -->
55-
<PropertyGroup Condition=" '$(LocalPaketToolExitCode)' == '0' ">
56-
<InternalPaketCommand>dotnet paket</InternalPaketCommand>
53+
<!-- Test if paket is available in the standard locations. If so, that takes priority. Case 2/2 - same across platforms -->
54+
<PropertyGroup>
55+
<!-- root => tool -->
56+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
57+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
5758
</PropertyGroup>
5859

59-
<!-- If not, then we go through our normal steps of setting the Paket command. -->
60-
<PropertyGroup Condition=" '$(LocalPaketToolExitCode)' != '0' ">
61-
<!-- windows, root => tool => proj style => bootstrapper => global -->
62-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
63-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
64-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket.exe</PaketExePath>
65-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(_PaketBootStrapperExeDir)paket.exe</PaketExePath>
66-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' == 'Windows_NT' ">paket.exe</PaketExePath>
60+
<!-- If paket hasn't be found in standard locations, test for CLI tool usage. -->
61+
<!-- First test: Is CLI configured to be used in "dotnet-tools.json"? - can result in a false negative; only a positive outcome is reliable. -->
62+
<PropertyGroup Condition=" '$(PaketExePath)' == '' ">
63+
<_DotnetToolsJson Condition="Exists('$(PaketRootPath)/.config/dotnet-tools.json')">$([System.IO.File]::ReadAllText("$(PaketRootPath)/.config/dotnet-tools.json"))</_DotnetToolsJson>
64+
<_ConfigContainsPaket Condition=" '$(_DotnetToolsJson)' != ''">$(_DotnetToolsJson.Contains('"paket"'))</_ConfigContainsPaket>
65+
<_ConfigContainsPaket Condition=" '$(_ConfigContainsPaket)' == ''">false</_ConfigContainsPaket>
66+
</PropertyGroup>
6767

68-
<!-- no windows, try native paket as default, root => tool => proj style => mono paket => bootstrpper => global -->
69-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket') ">$(PaketRootPath)paket</PaketExePath>
70-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket') ">$(PaketToolsPath)paket</PaketExePath>
71-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
68+
<!-- Second test: Call 'dotnet paket' and see if it returns without an error. Mute all the output. Only run if previous test failed and the test has not been disabled. -->
69+
<!-- WARNING: This method can lead to processes hanging forever, and should be used as little as possible. See https://github.com/fsprojects/Paket/issues/3705 for details. -->
70+
<Exec Condition=" '$(PaketExePath)' == '' AND !$(PaketDisableCliTest) AND !$(_ConfigContainsPaket)" Command="dotnet paket --version" IgnoreExitCode="true" StandardOutputImportance="low" StandardErrorImportance="low" >
71+
<Output TaskParameter="ExitCode" PropertyName="LocalPaketToolExitCode" />
72+
</Exec>
7273

73-
<!-- no windows, try mono paket -->
74-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketRootPath)paket.exe') ">$(PaketRootPath)paket.exe</PaketExePath>
75-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketToolsPath)paket.exe') ">$(PaketToolsPath)paket.exe</PaketExePath>
74+
<!-- If paket is installed as CLI use that. Again, only if paket haven't already been found in standard locations. -->
75+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND ($(_ConfigContainsPaket) OR '$(LocalPaketToolExitCode)' == '0') ">
76+
<_PaketCommand>dotnet paket</_PaketCommand>
77+
</PropertyGroup>
7678

77-
<!-- no windows, try bootstrapper -->
78-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket.exe</PaketExePath>
79+
<!-- If neither local files nor CLI tool can be found, final attempt is searching for boostrapper config before falling back to global path variable. -->
80+
<PropertyGroup Condition=" '$(PaketExePath)' == '' AND '$(_PaketCommand)' == '' ">
81+
<!-- Test for bootstrapper setup -->
82+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(PaketBootstrapperStyle)' == 'proj' ">$(PaketToolsPath)paket</PaketExePath>
83+
<PaketExePath Condition=" '$(PaketExePath)' == '' AND Exists('$(PaketBootStrapperExeDir)') ">$(PaketBootStrapperExeDir)paket</PaketExePath>
7984

80-
<!-- no windows, try global native paket -->
81-
<PaketExePath Condition=" '$(PaketExePath)' == '' AND '$(OS)' != 'Windows_NT' ">paket</PaketExePath>
85+
<!-- If all else fails, use global path approach. -->
86+
<PaketExePath Condition=" '$(PaketExePath)' == ''">paket</PaketExePath>
87+
</PropertyGroup>
8288

89+
<!-- If not using CLI, setup correct execution command. -->
90+
<PropertyGroup Condition=" '$(_PaketCommand)' == '' ">
8391
<_PaketExeExtension>$([System.IO.Path]::GetExtension("$(PaketExePath)"))</_PaketExeExtension>
84-
<InternalPaketCommand Condition=" '$(InternalPaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</InternalPaketCommand>
85-
<InternalPaketCommand Condition=" '$(InternalPaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</InternalPaketCommand>
86-
<InternalPaketCommand Condition=" '$(InternalPaketCommand)' == '' ">"$(PaketExePath)"</InternalPaketCommand>
87-
92+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(_PaketExeExtension)' == '.dll' ">dotnet "$(PaketExePath)"</_PaketCommand>
93+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' AND '$(OS)' != 'Windows_NT' AND '$(_PaketExeExtension)' == '.exe' ">$(MonoPath) --runtime=v4.0.30319 "$(PaketExePath)"</_PaketCommand>
94+
<_PaketCommand Condition=" '$(_PaketCommand)' == '' ">"$(PaketExePath)"</_PaketCommand>
8895
</PropertyGroup>
8996

9097
<!-- The way to get a property to be available outside the target is to use this task. -->
91-
<CreateProperty Value="$(InternalPaketCommand)">
98+
<CreateProperty Value="$(_PaketCommand)">
9299
<Output TaskParameter="Value" PropertyName="PaketCommand"/>
93100
</CreateProperty>
94101

Content/.template.config/template.json

+36-4
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,42 @@
44
"classifications": [ "F#", "OSS" ],
55
"name": "Waypoint",
66
"tags": {
7-
"language": "F#",
8-
"type": "project"
7+
"language": "F#",
8+
"type": "project"
99
},
1010
"identity": "Waypoint",
1111
"shortName": "Waypoint",
12-
"sourceName": "Waypoint"
13-
}
12+
"sourceName": "Waypoint",
13+
"symbols": {
14+
"summary": {
15+
"description": "A summary for your project, will be displayed for the nuget package",
16+
"type": "parameter",
17+
"replaces": "{SUMMARY}",
18+
"defaultValue": "TODO: Add Summary"
19+
},
20+
"authors": {
21+
"description": "Authors of the library, will be displayed for the nuget package",
22+
"type": "parameter",
23+
"replaces": "{AUTHORS}",
24+
"defaultValue": "TODO: Add Authors"
25+
},
26+
"packageTags": {
27+
"description": "Tags for the generated nuget package",
28+
"type": "parameter",
29+
"replaces": "{PACKAGETAGS}",
30+
"defaultValue": "TODO: Add package tags"
31+
},
32+
"copyright": {
33+
"description": "Copyright fort the project",
34+
"type": "parameter",
35+
"replaces": "{COPYRIGHT}",
36+
"defaultValue": "TODO: Add copyright"
37+
},
38+
"gitOwner": {
39+
"description": "The name of the organization or github user that owns the github repo",
40+
"type": "parameter",
41+
"replaces": "{GITOWNER}",
42+
"defaultValue": "TODO: ADD_AUTHOR"
43+
}
44+
}
45+
}

Content/LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 TODO: ADD_AUTHOR
3+
Copyright (c) 2020 {GITOWNER}
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Content/build.fsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ open Fake.Api
1919

2020
let project = "Waypoint"
2121

22-
let summary = "TODO: Add Summary"
23-
let authors = "TODO: Add Authors"
24-
let tags = "TODO: Add package tags"
25-
let copyright = "TODO: Add copyright"
22+
let summary = "{SUMMARY}"
23+
let authors = "{AUTHORS}"
24+
let tags = "{PACKAGETAGS}"
25+
let copyright = "{COPYRIGHT}"
2626

27-
let gitOwner = "TODO: ADD_AUTHOR"
27+
let gitOwner = "{GITOWNER}"
2828
let gitName = "Waypoint"
2929
let gitHome = "https://github.com/" + gitOwner
3030
let gitUrl = gitHome + "/" + gitName

LICENSE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 TODO: ADD_AUTHOR
3+
Copyright (c) 2020 {GITOWNER}
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)