Skip to content

Commit bb0ba6d

Browse files
authored
Sensible defaults for CommandLine (#57)
* Update nuke * Minor changes * Use latest LangVersion * Add templates * Small changes
1 parent 46c09cf commit bb0ba6d

8 files changed

Lines changed: 132 additions & 37 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: New Issue
2+
description: File a new issue
3+
labels: [state/triage, team/fire-and-motion]
4+
body:
5+
- type: markdown
6+
attributes:
7+
value: |
8+
**_Are you a customer of Octopus Deploy? Don't raise the issue here. Please contact [our support team](https://octopus.com/support) so we can triage your issue, so that we can make sure it's handled appropriately._**
9+
- type: checkboxes
10+
id: team
11+
attributes:
12+
label: Team
13+
description: Assign a `team/<team>` label to this issue so it can be dispatched to them. Use the [ownership map](https://whimsical.com/ownership-map-NzbiD4HJyvhC9jNJNfS6TG) to find the most appropriate team to assign this issue to. If you are not sure, or they are not listed, choose `team/fire-and-motion`
14+
options:
15+
- label: I've assigned a team label to this issue
16+
required: true
17+
- type: textarea
18+
id: what-happened
19+
attributes:
20+
label: What happened?
21+
description: A clear and concise description of what the issue is. Also tell us, what did you expect to happen?
22+
placeholder: Tell us what is wrong
23+
validations:
24+
required: true
25+
- type: textarea
26+
id: steps-to-reproduce
27+
attributes:
28+
label: Reproduction
29+
description: Enter either a link to an octopus instance exhibiting the error or the steps required to reproduce the error
30+
placeholder: Steps to reproduce or link to it occuring
31+
validations:
32+
required: true
33+
- type: textarea
34+
id: stacktrace
35+
attributes:
36+
label: Error and Stacktrace
37+
description: If you have an error message and/or stacktrace, add it here. No need to use backticks. Prefer text over a screenshot so it can be searched for.
38+
render: shell
39+
- type: textarea
40+
id: further-information
41+
attributes:
42+
label: More Information
43+
description: Anything else that can help us solve the problem, logs, links, screenshots, suspicions, add them here. Remember this is public so link off to internal systems if there is anything that may be confidential.
44+
placeholder: Tell us more
45+
validations:
46+
required: false
47+
- type: textarea
48+
id: workaround
49+
attributes:
50+
label: Workaround
51+
description: If you know of any workarounds, add them here

.github/pull_request_template.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
**_Are you a customer of Octopus Deploy? Please contact [our support team](https://octopus.com/support) so we can triage your PR, so that we can make sure it's handled appropriately._**
2+
3+
# Background
4+
5+
<!-- Why does this PR exist? -->
6+
7+
# Results
8+
9+
<!-- Describe the result of the change -->
10+
11+
Fixes https://github.com/OctopusDeploy/Issues/issues/... _(optional public issue)_
12+
13+
Fixes https://github.com/OctopusDeploy/ResearchAndDevelopment/issues/... _(optional private issue)_
14+
15+
See [How we use GitHub Issues](https://github.com/OctopusDeploy/Issues/blob/master/docs/CONTRIBUTING.internal.md) (including [this flowchart](https://whimsical.com/r-d-incoming-work-workflow-aug-21-NsDnGQXcwBLwU66a88Zhue)
16+
17+
## Before
18+
19+
<!-- Consider adding a log excerpt or screen capture. -->
20+
21+
![Before](https://user-images.githubusercontent.com/5088479/120727281-72762180-c51d-11eb-9776-85363dc084e2.png)
22+
23+
## After
24+
25+
<!-- Consider adding a log excerpt or screen capture. -->
26+
27+
![After](https://user-images.githubusercontent.com/5088479/120727258-67bb8c80-c51d-11eb-8d2a-e047095b2d01.png)
28+
29+
# How to review this PR
30+
31+
<!--
32+
Describe how you want people to review the pull request.
33+
Perhaps you just want an "in principal" review to prove an idea.
34+
Perhaps you want specific people to test the resulting changes.
35+
-->
36+
37+
Quality :heavy_check_mark:
38+
<!-- Describe focus areas (if any): Review tests/ Exploratory testing/ Smoke testing? -->
39+
40+
# Pre-requisites
41+
42+
- [ ] I have read [How we use GitHub Issues](https://github.com/OctopusDeploy/Issues/blob/master/docs/CONTRIBUTING.internal.md) for help deciding when and where it's appropriate to make an issue.
43+
- [ ] I have considered informing or consulting the right people, according to the [ownership map](https://whimsical.com/ownership-map-NzbiD4HJyvhC9jNJNfS6TG).
44+
- [ ] I have considered appropriate testing for my change.

.nuke/build.schema.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@
7979
"items": {
8080
"type": "string",
8181
"enum": [
82-
"CalculateVersion",
8382
"Clean",
8483
"Compile",
8584
"CopyToLocalPackages",
85+
"Default",
8686
"Merge",
8787
"Pack",
8888
"Restore",
@@ -100,10 +100,10 @@
100100
"items": {
101101
"type": "string",
102102
"enum": [
103-
"CalculateVersion",
104103
"Clean",
105104
"Compile",
106105
"CopyToLocalPackages",
106+
"Default",
107107
"Merge",
108108
"Pack",
109109
"Restore",

build/Build.cs

Lines changed: 30 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,14 @@
2121
[UnsetVisualStudioEnvironmentVariables]
2222
class Build : NukeBuild
2323
{
24-
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
24+
/// Support plugins are available for:
25+
/// - JetBrains ReSharper https://nuke.build/resharper
26+
/// - JetBrains Rider https://nuke.build/rider
27+
/// - Microsoft VisualStudio https://nuke.build/visualstudio
28+
/// - Microsoft VSCode https://nuke.build/vscode
29+
30+
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
31+
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
2532

2633
[Solution(GenerateProjects = true)] readonly Solution Solution;
2734

@@ -44,20 +51,12 @@ class Build : NukeBuild
4451
AbsolutePath OctopusCommandLineFolder => SourceDirectory / "CommandLine";
4552

4653
Target Clean => _ => _
47-
.Before(Restore)
4854
.Executes(() =>
4955
{
50-
SourceDirectory.GlobDirectories("**/bin", "**/obj", "**/TestResults").ForEach(DeleteDirectory);
56+
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(DeleteDirectory);
5157
EnsureCleanDirectory(ArtifactsDirectory);
5258
});
5359

54-
[PublicAPI]
55-
Target CalculateVersion => _ => _
56-
.Executes(() =>
57-
{
58-
//all the magic happens inside `[OctoVersion]` above. we just need a target for TeamCity to call
59-
});
60-
6160
Target Restore => _ => _
6261
.DependsOn(Clean)
6362
.Executes(() =>
@@ -67,19 +66,18 @@ class Build : NukeBuild
6766
});
6867

6968
Target Compile => _ => _
70-
.DependsOn(Clean)
7169
.DependsOn(Restore)
7270
.Executes(() =>
7371
{
74-
Log.Information("Building {0} v{1}", Solution.Name, OctoVersionInfo.FullSemVer);
75-
7672
DotNetBuild(_ => _
7773
.SetProjectFile(Solution)
7874
.SetConfiguration(Configuration)
7975
.SetVersion(OctoVersionInfo.FullSemVer)
76+
.SetInformationalVersion(OctoVersionInfo.InformationalVersion)
8077
.EnableNoRestore());
8178
});
8279

80+
[PublicAPI]
8381
Target Test => _ => _
8482
.DependsOn(Compile)
8583
.Executes(() =>
@@ -92,7 +90,7 @@ class Build : NukeBuild
9290
});
9391

9492
Target Merge => _ => _
95-
.DependsOn(Test)
93+
.DependsOn(Compile)
9694
.Executes(() =>
9795
{
9896
var targets = Solution.CommandLine.GetTargetFrameworks();
@@ -103,7 +101,7 @@ class Build : NukeBuild
103101
var outputFolder = OctopusCommandLineFolder / "bin" / Configuration / $"{target}-Merged";
104102
EnsureExistingDirectory(outputFolder);
105103

106-
// The call to ILRepack with .EnableInternalize() requires the Octopus.Server.Client.dll assembly to be first in the list.
104+
// The call to ILRepack with .EnableInternalize() requires the Octopus.CommandLine.dll assembly to be first in the list.
107105
var inputAssemblies = inputFolder.GlobFiles("NewtonSoft.Json.dll", "Octopus.*.dll")
108106
.Select(x => x.ToString())
109107
.OrderByDescending(x => x.Contains("Octopus.CommandLine.dll"))
@@ -126,8 +124,6 @@ class Build : NukeBuild
126124
});
127125

128126
Target Pack => _ => _
129-
.DependsOn(Compile)
130-
.DependsOn(Test)
131127
.DependsOn(Merge)
132128
.Executes(() =>
133129
{
@@ -148,36 +144,38 @@ class Build : NukeBuild
148144
.SetVersion(OctoVersionInfo.FullSemVer)
149145
.SetConfiguration(Configuration)
150146
.SetOutputDirectory(ArtifactsDirectory)
151-
.EnableNoBuild());
147+
.EnableNoBuild()
148+
.DisableIncludeSymbols()
149+
.SetVerbosity(DotNetVerbosity.Normal)
150+
);
152151
}
153152
finally
154153
{
155154
ReplaceTextInFiles(nuspecPath, $"<version>{OctoVersionInfo.FullSemVer}</version>", "<version>$version$</version>");
156155
ReplaceTextInFiles(nuspecPath, $"\\{Configuration.ToString()}\\", "\\$configuration$\\");
157156
}
157+
158+
static void ReplaceTextInFiles(AbsolutePath path, string oldValue, string newValue)
159+
{
160+
var fileText = File.ReadAllText(path);
161+
fileText = fileText.Replace(oldValue, newValue);
162+
File.WriteAllText(path, fileText);
163+
}
158164
});
159165

160-
[UsedImplicitly]
161166
Target CopyToLocalPackages => _ => _
162167
.OnlyWhenStatic(() => IsLocalBuild)
163168
.TriggeredBy(Pack)
164169
.Executes(() =>
165170
{
166171
EnsureExistingDirectory(LocalPackagesDirectory);
167-
CopyFileToDirectory(ArtifactsDirectory / $"{Solution.Name}.{OctoVersionInfo.FullSemVer}.nupkg", LocalPackagesDirectory, FileExistsPolicy.Overwrite);
172+
ArtifactsDirectory.GlobFiles("*.nupkg")
173+
.ForEach(package => CopyFileToDirectory(package, LocalPackagesDirectory, FileExistsPolicy.Overwrite));
168174
});
169175

170-
void ReplaceTextInFiles(AbsolutePath path, string oldValue, string newValue)
171-
{
172-
var fileText = File.ReadAllText(path);
173-
fileText = fileText.Replace(oldValue, newValue);
174-
File.WriteAllText(path, fileText);
175-
}
176+
Target Default => _ => _
177+
.DependsOn(Pack)
178+
.DependsOn(CopyToLocalPackages);
176179

177-
/// Support plugins are available for:
178-
/// - JetBrains ReSharper https://nuke.build/resharper
179-
/// - JetBrains Rider https://nuke.build/rider
180-
/// - Microsoft VisualStudio https://nuke.build/visualstudio
181-
/// - Microsoft VSCode https://nuke.build/vscode
182-
public static int Main() => Execute<Build>(x => x.Pack);
180+
public static int Main() => Execute<Build>(x => x.Default);
183181
}

global.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"sdk": {
3-
"version": "6.0.102",
3+
"version": "6.0.300",
44
"rollForward": "latestFeature"
55
}
66
}

source/CommandLine/CommandLine.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
2020
<Authors>Octopus Deploy Pty. Ltd.</Authors>
21-
<Copyright>Copyright © Octopus Deploy 2021</Copyright>
21+
<Copyright>Copyright © Octopus Deploy 2022</Copyright>
2222
<PackageProjectUrl>https://github.com/OctopusDeploy/CommandLine</PackageProjectUrl>
2323
<RepositoryUrl>https://github.com/OctopusDeploy/CommandLine</RepositoryUrl>
2424
<Description>The command line parsing library used by many of Octopus apps. Supports global and command specific help, json output, auto-complete and more.</Description>
2525
<!-- copy dependencies to the output folder (for netstandard) so we can ilmerge them together -->
2626
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
2727
<RuntimeIdentifiers>win-x64;linux-x64;osx-x64</RuntimeIdentifiers>
28+
<LangVersion>latest</LangVersion>
2829
</PropertyGroup>
2930

3031
<ItemGroup>

source/CommandLine/Octopus.CommandLine.nuspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<icon>images\icon.png</icon>
1212
<projectUrl>https://github.com/OctopusDeploy/CommandLine</projectUrl>
1313
<description>The command line parsing library used by many of Octopus apps. Supports global and command specific help, json output, auto-complete and more.</description>
14-
<copyright>Copyright © Octopus Deploy 2021</copyright>
14+
<copyright>Copyright © Octopus Deploy 2022</copyright>
1515
<repository url="https://github.com/OctopusDeploy/CommandLine" />
1616
<dependencies>
1717
<group targetFramework=".NETFramework4.6.2">

source/Tests/Tests.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<TargetFrameworks Condition="!$([MSBuild]::IsOSUnixLike())">net462;netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
55
<TargetFrameworks Condition="$([MSBuild]::IsOSUnixLike())">netstandard2.0;netcoreapp3.1;net6.0</TargetFrameworks>
6+
<LangVersion>latest</LangVersion>
67
</PropertyGroup>
78

89
<ItemGroup>

0 commit comments

Comments
 (0)