-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from thomaslevesque/modernize
Drop support for unsupported TFMs and modernize build script
- Loading branch information
Showing
15 changed files
with
131 additions
and
125 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<DemoTargetFrameworks>net481;net8.0-windows</DemoTargetFrameworks> | ||
</PropertyGroup> | ||
</Project> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
2 changes: 1 addition & 1 deletion
2
samples/NHotkey.WindowsForms.Demo/NHotkey.WindowsForms.Demo.csproj
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
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 |
---|---|---|
@@ -1,10 +1,10 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<TargetFrameworks>net40;net45;netcoreapp3.0</TargetFrameworks> | ||
<TargetFrameworks>$(LibraryTargetFrameworks)</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Label="Package properties"> | ||
<Description>A managed library to handle global hotkeys in Windows Forms and WPF applications. NOTE: this package doesn't contain a concrete HotkeyManager implementation; you should add either the NHotkey.Wpf or NHotkey.WindowsForms package to get one.</Description> | ||
</PropertyGroup> | ||
|
||
</Project> | ||
</Project> |
This file was deleted.
Oops, something went wrong.
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,55 @@ | ||
using static Bullseye.Targets; | ||
|
||
internal record CommandLineOptions(string Configuration, bool ShowHelp, string[] BullseyeArgs) | ||
{ | ||
public static CommandLineOptions Parse(string[] args) | ||
{ | ||
var bullseyeArgs = new List<string>(); | ||
string configuration = "Release"; | ||
bool showHelp = false; | ||
using var enumerator = ((IEnumerable<string>)args).GetEnumerator(); | ||
while (enumerator.MoveNext()) | ||
{ | ||
var arg = enumerator.Current; | ||
if (arg is "-h" or "--help") | ||
{ | ||
showHelp = true; | ||
break; | ||
} | ||
else if (arg is "-c" or "--configuration") | ||
{ | ||
configuration = ReadOptionValue(arg); | ||
} | ||
else | ||
{ | ||
bullseyeArgs.Add(arg); | ||
} | ||
} | ||
|
||
return new(configuration, showHelp, bullseyeArgs.ToArray()); | ||
|
||
string ReadOptionValue(string arg) | ||
{ | ||
if (!enumerator.MoveNext()) | ||
throw new InvalidOperationException($"Expected value for option '{arg}', but none was found."); | ||
|
||
return enumerator.Current; | ||
} | ||
} | ||
|
||
public static async Task PrintUsageAsync() | ||
{ | ||
Console.WriteLine("Usage:"); | ||
Console.WriteLine(" build [-c|--configuration <buildConfiguration>] <bullseyeArgs>"); | ||
Console.WriteLine(); | ||
Console.WriteLine("Arguments:"); | ||
Console.WriteLine(" <bullseyeArguments> Arguments to pass to Bullseye (targets and options, see below)"); | ||
Console.WriteLine(); | ||
Console.WriteLine("Options:"); | ||
Console.WriteLine(" -c, --configuration <buildConfiguration> The configuration to build [default: Release]"); | ||
Console.WriteLine(" -? -h, --help Show help and usage information"); | ||
Console.WriteLine(); | ||
Console.WriteLine("Bullseye help:"); | ||
await RunTargetsWithoutExitingAsync(["--help"]); | ||
} | ||
} |
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,52 @@ | ||
using System.Runtime.CompilerServices; | ||
using static Bullseye.Targets; | ||
using static SimpleExec.Command; | ||
|
||
var commandLineOptions = CommandLineOptions.Parse(args); | ||
|
||
Directory.SetCurrentDirectory(GetSolutionDirectory()); | ||
|
||
string artifactsDir = Path.GetFullPath("artifacts"); | ||
string logsDir = Path.Combine(artifactsDir, "logs"); | ||
string buildLogFile = Path.Combine(logsDir, "build.binlog"); | ||
string packagesDir = Path.Combine(artifactsDir, "packages"); | ||
|
||
string solutionFile = "NHotkey.sln"; | ||
|
||
Target( | ||
"artifactDirectories", | ||
() => | ||
{ | ||
Directory.CreateDirectory(artifactsDir); | ||
Directory.CreateDirectory(logsDir); | ||
Directory.CreateDirectory(packagesDir); | ||
}); | ||
|
||
Target( | ||
"build", | ||
DependsOn("artifactDirectories"), | ||
() => Run( | ||
"dotnet", | ||
$"build -c \"{commandLineOptions.Configuration}\" /bl:\"{buildLogFile}\" \"{solutionFile}\"")); | ||
|
||
Target( | ||
"pack", | ||
DependsOn("artifactDirectories", "build"), | ||
() => Run( | ||
"dotnet", | ||
$"pack -c \"{commandLineOptions.Configuration}\" --no-build -o \"{packagesDir}\"")); | ||
|
||
Target("default", DependsOn("pack")); | ||
|
||
if (commandLineOptions.ShowHelp) | ||
{ | ||
await CommandLineOptions.PrintUsageAsync(); | ||
return; | ||
} | ||
|
||
await RunTargetsAndExitAsync(commandLineOptions.BullseyeArgs); | ||
|
||
static string GetSolutionDirectory() => | ||
Path.GetFullPath(Path.Combine(GetScriptDirectory(), @"..\..")); | ||
|
||
static string GetScriptDirectory([CallerFilePath] string filename = null) => Path.GetDirectoryName(filename); |
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