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

support net8.0 and fix version resolution #490

Merged
merged 1 commit into from
Nov 26, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Deploy
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ jobs:
dotnet-version: |
6.0.x
7.0.x
8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ private static Task<int> AlertOnNewVersion(CommandContext context, ExecutionDele
private static bool TryGetCurrentVersion(out SemVersion semVersion)
{
return SemVersion.TryParse(AppInfo.Instance.Version, out semVersion);

}

private static bool TryGetLatestReleaseVersion(CommandContext context, NewerReleaseConfig config, out SemVersion? semVersion)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ private static void AssertExitCodeAndErrorMessage(IScenario scenario, AppRunnerR
AssertUnexpectedOutputTexts(scenario, result, sb);
if (sb.Length > 0)
{
throw new AssertFailedException(sb.ToString());
var newLine = Environment.NewLine;
throw new AssertFailedException(
$"{sb}{newLine}Output:{newLine}{newLine}{result.Console.AllText()}");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using System;
using System.Reflection;
using System.Threading.Tasks;
using CommandDotNet.Builders;
using CommandDotNet.NewerReleasesAlerts;
Expand Down
2 changes: 0 additions & 2 deletions CommandDotNet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFolder", "SolutionFolder", "{4CA1A4AA-7105-4FEC-B88B-3A4AD3BBD6EE}"
ProjectSection(SolutionItems) = preProject
.gitignore = .gitignore
appveyor.yml = appveyor.yml
Directory.Build.props = Directory.Build.props
README.md = README.md
EndProjectSection
Expand All @@ -19,7 +18,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommandDotNet.Example", "Co
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{6296D4E9-7128-4CFA-BFB9-1DF6004B7626}"
ProjectSection(SolutionItems) = preProject
.travis.yml = .travis.yml
deploy.sh = deploy.sh
EndProjectSection
EndProject
Expand Down
7 changes: 5 additions & 2 deletions CommandDotNet/Builders/AppInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ private static AppInfo BuildAppInfo()
return new AppInfo(isExe, isSelfContainedExe, isRunViaDotNetExe, entryAssembly, filePath!, fileName);
}

private static string? GetVersion(Assembly hostAssembly) =>
private static string? GetVersion(Assembly hostAssembly)
{
// thanks Spectre console for figuring this out https://github.com/spectreconsole/spectre.console/issues/242
hostAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion ?? "?";
var version = hostAssembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
return version?.Substring(0, version.IndexOf('+'));
}

public object Clone() => new AppInfo(IsExe, IsSelfContainedExe, IsRunViaDotNetExe, EntryAssembly, FilePath, FileName, _version);

Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<LangVersion>11.0</LangVersion>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup>
Expand Down
Loading