feat: upgrade to .NET6.0/7.0 and latest lib versions
This commit is contained in:
parent
55d756cb08
commit
1aa2d76ca8
30 changed files with 350 additions and 247 deletions
|
@ -9,7 +9,7 @@
|
|||
]
|
||||
},
|
||||
"nuke.globaltool": {
|
||||
"version": "5.3.0",
|
||||
"version": "6.2.1",
|
||||
"commands": [
|
||||
"nuke"
|
||||
]
|
||||
|
|
7
.gitignore
vendored
7
.gitignore
vendored
|
@ -11,3 +11,10 @@ _site
|
|||
.idea/
|
||||
*.Artifacts/
|
||||
**/artifacts/
|
||||
.nuke/temp/
|
||||
|
||||
##############
|
||||
# files #
|
||||
##############
|
||||
|
||||
*.DotSettings.user
|
1
.nuke
1
.nuke
|
@ -1 +0,0 @@
|
|||
Tand.sln
|
116
.nuke/build.schema.json
Normal file
116
.nuke/build.schema.json
Normal file
|
@ -0,0 +1,116 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Build Schema",
|
||||
"$ref": "#/definitions/build",
|
||||
"definitions": {
|
||||
"build": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Configuration": {
|
||||
"type": "string",
|
||||
"description": "Configuration to build - Default is 'Debug' (local) or 'Release' (server)",
|
||||
"enum": [
|
||||
"Debug",
|
||||
"Release"
|
||||
]
|
||||
},
|
||||
"Continue": {
|
||||
"type": "boolean",
|
||||
"description": "Indicates to continue a previously failed build attempt"
|
||||
},
|
||||
"Help": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the help text for this build assembly"
|
||||
},
|
||||
"Host": {
|
||||
"type": "string",
|
||||
"description": "Host for execution. Default is 'automatic'",
|
||||
"enum": [
|
||||
"AppVeyor",
|
||||
"AzurePipelines",
|
||||
"Bamboo",
|
||||
"Bitbucket",
|
||||
"Bitrise",
|
||||
"GitHubActions",
|
||||
"GitLab",
|
||||
"Jenkins",
|
||||
"Rider",
|
||||
"SpaceAutomation",
|
||||
"TeamCity",
|
||||
"Terminal",
|
||||
"TravisCI",
|
||||
"VisualStudio",
|
||||
"VSCode"
|
||||
]
|
||||
},
|
||||
"NoLogo": {
|
||||
"type": "boolean",
|
||||
"description": "Disables displaying the NUKE logo"
|
||||
},
|
||||
"Partition": {
|
||||
"type": "string",
|
||||
"description": "Partition to use on CI"
|
||||
},
|
||||
"Plan": {
|
||||
"type": "boolean",
|
||||
"description": "Shows the execution plan (HTML)"
|
||||
},
|
||||
"Profile": {
|
||||
"type": "array",
|
||||
"description": "Defines the profiles to load",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"Root": {
|
||||
"type": "string",
|
||||
"description": "Root directory during build execution"
|
||||
},
|
||||
"Skip": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be skipped. Empty list skips all dependencies",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Benchmark",
|
||||
"Clean",
|
||||
"Compile",
|
||||
"Pack",
|
||||
"Restore",
|
||||
"Test"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Solution": {
|
||||
"type": "string",
|
||||
"description": "Path to a solution file that is automatically loaded"
|
||||
},
|
||||
"Target": {
|
||||
"type": "array",
|
||||
"description": "List of targets to be invoked. Default is '{default_target}'",
|
||||
"items": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"Benchmark",
|
||||
"Clean",
|
||||
"Compile",
|
||||
"Pack",
|
||||
"Restore",
|
||||
"Test"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Verbosity": {
|
||||
"type": "string",
|
||||
"description": "Logging verbosity during build execution. Default is 'Normal'",
|
||||
"enum": [
|
||||
"Minimal",
|
||||
"Normal",
|
||||
"Quiet",
|
||||
"Verbose"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
4
.nuke/parameters.json
Normal file
4
.nuke/parameters.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"$schema": "./build.schema.json",
|
||||
"Solution": "Tand.sln"
|
||||
}
|
|
@ -4,13 +4,13 @@ using Nuke.Common.Execution;
|
|||
using Nuke.Common.Git;
|
||||
using Nuke.Common.IO;
|
||||
using Nuke.Common.ProjectModel;
|
||||
using Nuke.Common.Tooling;
|
||||
using Nuke.Common.Tools.DotNet;
|
||||
using Nuke.Common.Tools.GitVersion;
|
||||
using Nuke.Common.Tools.BenchmarkDotNet;
|
||||
using Nuke.Common.Utilities.Collections;
|
||||
using static Nuke.Common.IO.FileSystemTasks;
|
||||
using static Nuke.Common.Tools.BenchmarkDotNet.BenchmarkDotNetTasks;
|
||||
using static Nuke.Common.Tools.DotNet.DotNetTasks;
|
||||
using static _build.benchmarks.DotNetBenchmarkExtensions;
|
||||
|
||||
[GitHubActions(
|
||||
"dotnet",
|
||||
|
@ -19,7 +19,6 @@ using static _build.benchmarks.DotNetBenchmarkExtensions;
|
|||
On = new []{GitHubActionsTrigger.Push, GitHubActionsTrigger.PullRequest}
|
||||
)
|
||||
]
|
||||
[CheckBuildProjectConfigurations]
|
||||
[UnsetVisualStudioEnvironmentVariables]
|
||||
class Build : NukeBuild
|
||||
{
|
||||
|
@ -34,8 +33,10 @@ class Build : NukeBuild
|
|||
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
|
||||
|
||||
[Solution] readonly Solution Solution;
|
||||
[GitRepository] readonly GitRepository GitRepository;
|
||||
[GitVersion] readonly GitVersion GitVersion;
|
||||
[GitRepository]
|
||||
readonly GitRepository GitRepository;
|
||||
[GitVersion(Framework = "net6.0", NoFetch = true)]
|
||||
readonly GitVersion GitVersion;
|
||||
|
||||
AbsolutePath SourceDirectory => RootDirectory / "src";
|
||||
AbsolutePath TestsDirectory => RootDirectory / "test";
|
||||
|
@ -73,8 +74,7 @@ class Build : NukeBuild
|
|||
.SetProjectFile(Solution)
|
||||
.SetConfiguration(Configuration)
|
||||
.EnableNoRestore()
|
||||
.EnableNoBuild()
|
||||
.EnableLogOutput()));
|
||||
.EnableNoBuild()));
|
||||
|
||||
Target Pack => _ => _
|
||||
.DependsOn(Test)
|
||||
|
@ -90,17 +90,16 @@ class Build : NukeBuild
|
|||
.EnableIncludeSymbols()
|
||||
.EnableNoRestore()
|
||||
.EnableNoBuild()
|
||||
.EnableLogOutput()
|
||||
)));
|
||||
|
||||
Target Benchmark => _ => _
|
||||
.DependsOn(Compile)
|
||||
.Requires(() => Configuration.Equals(Configuration.Release))
|
||||
.Executes(() => TestsDirectory
|
||||
.GlobFiles($"**/bin/{Configuration}/**/*Benchmark*.dll")
|
||||
.ForEach(benchmarkFile => DotNetBenchmark(
|
||||
.GlobFiles($"**/bin/{Configuration.ToString()}/**/*Benchmark*.dll")
|
||||
.ForEach(benchmarkFile => BenchmarkDotNet(
|
||||
s => s
|
||||
.WithFilter("*")
|
||||
.WithDllPath(benchmarkFile)))
|
||||
.SetRuntimes("net7.0")
|
||||
.SetFilter("*")
|
||||
.SetAssemblyFile(benchmarkFile)))
|
||||
);
|
||||
}
|
14
build/Configuration.cs
Normal file
14
build/Configuration.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System.ComponentModel;
|
||||
using Nuke.Common.Tooling;
|
||||
|
||||
[TypeConverter(typeof(TypeConverter<Configuration>))]
|
||||
public class Configuration : Enumeration
|
||||
{
|
||||
public static Configuration Debug = new Configuration { Value = nameof(Debug) };
|
||||
public static Configuration Release = new Configuration { Value = nameof(Release) };
|
||||
|
||||
public static implicit operator string(Configuration configuration)
|
||||
{
|
||||
return configuration.Value;
|
||||
}
|
||||
}
|
8
build/Directory.Build.props
Normal file
8
build/Directory.Build.props
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||
<!-- Uncomment to include parent Directory.Build.props file -->
|
||||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||
|
||||
</Project>
|
8
build/Directory.Build.targets
Normal file
8
build/Directory.Build.targets
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
|
||||
<!-- This file prevents unintended imports of unrelated MSBuild files -->
|
||||
<!-- Uncomment to include parent Directory.Build.targets file -->
|
||||
<!--<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />-->
|
||||
|
||||
</Project>
|
|
@ -2,17 +2,19 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<NoWarn>CS0649;CS0169</NoWarn>
|
||||
<NukeRootDirectory>..</NukeRootDirectory>
|
||||
<NukeScriptDirectory>..\test</NukeScriptDirectory>
|
||||
<LangVersion>8</LangVersion>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<NukeTelemetryVersion>1</NukeTelemetryVersion>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nuke.Common" Version="5.3.0" />
|
||||
<PackageDownload Include="GitVersion.Tool" Version="[5.1.1]" />
|
||||
<PackageReference Include="Nuke.Common" Version="6.2.1" />
|
||||
<PackageDownload Include="benchmarkdotnet.tool" Version="[0.12.1]" />
|
||||
<PackageDownload Include="GitVersion.Tool" Version="[5.11.1]" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Nuke.Common.Tooling;
|
||||
using Nuke.Common.Tools.DotNet;
|
||||
|
||||
namespace _build.benchmarks
|
||||
{
|
||||
public class BenchmarkToolSettings : ToolSettings
|
||||
{
|
||||
readonly IDictionary<string, string> _arguments;
|
||||
|
||||
public BenchmarkToolSettings()
|
||||
{
|
||||
_arguments = new Dictionary<string, string>();
|
||||
}
|
||||
|
||||
public override string ToolPath => base.ToolPath ?? DotNetTasks.DotNetPath;
|
||||
|
||||
public string DllPath { get; private set; }
|
||||
|
||||
public BenchmarkToolSettings WithDllPath(string path)
|
||||
{
|
||||
DllPath = path;
|
||||
return this;
|
||||
}
|
||||
|
||||
public BenchmarkToolSettings WithFilter(string filter)
|
||||
{
|
||||
_arguments["filter"] = filter;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Action<OutputType, string> CustomLogger => DotNetTasks.DotNetLogger;
|
||||
|
||||
protected override Arguments ConfigureArguments(Arguments arguments)
|
||||
{
|
||||
arguments.Add("benchmark");
|
||||
arguments.Add(DllPath);
|
||||
foreach (var (k, v) in _arguments)
|
||||
{
|
||||
arguments.Add($"--{k} {{value}}", v);
|
||||
}
|
||||
|
||||
return base.ConfigureArguments(arguments);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
using System.Collections.Generic;
|
||||
using Nuke.Common.Tooling;
|
||||
|
||||
namespace _build.benchmarks
|
||||
{
|
||||
public static class DotNetBenchmarkExtensions
|
||||
{
|
||||
public static IReadOnlyCollection<Output> DotNetBenchmark(Configure<BenchmarkToolSettings> configurator)
|
||||
{
|
||||
return DotNetBenchmark(configurator(new BenchmarkToolSettings()));
|
||||
}
|
||||
|
||||
public static IReadOnlyCollection<Output> DotNetBenchmark(BenchmarkToolSettings toolSettings = null)
|
||||
{
|
||||
toolSettings ??= new BenchmarkToolSettings();
|
||||
var process = ProcessTasks.StartProcess(toolSettings);
|
||||
process.AssertZeroExitCode();
|
||||
return process.Output;
|
||||
}
|
||||
}
|
||||
}
|
5
global.json
Normal file
5
global.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"sdk": {
|
||||
"version": "7.0.100"
|
||||
}
|
||||
}
|
|
@ -1,11 +1,15 @@
|
|||
using Tand.Core.Models;
|
||||
|
||||
namespace Tand.Core.Api
|
||||
{
|
||||
public interface ITandTarget<T>
|
||||
{
|
||||
void OnEnterMethod(CallEnterContext<T> enterContext);
|
||||
namespace Tand.Core.Api;
|
||||
|
||||
public interface ITandTarget
|
||||
{
|
||||
|
||||
void OnLeaveMethod(CallLeaveContext<T> leaveContext);
|
||||
}
|
||||
}
|
||||
|
||||
public interface ITandTarget<T> : ITandTarget
|
||||
{
|
||||
void OnEnterMethod(CallEnterContext<T> enterContext);
|
||||
|
||||
void OnLeaveMethod(CallLeaveContext<T> leaveContext);
|
||||
}
|
|
@ -1,16 +1,24 @@
|
|||
using System;
|
||||
|
||||
namespace Tand.Core.Api
|
||||
namespace Tand.Core.Api;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class TandAttribute : Attribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class TandAttribute : Attribute
|
||||
public TandAttribute(Type targetType)
|
||||
{
|
||||
TargetType = targetType;
|
||||
}
|
||||
|
||||
public TandAttribute(Type targetType)
|
||||
{
|
||||
TargetType = targetType;
|
||||
}
|
||||
internal Type TargetType { get; }
|
||||
}
|
||||
|
||||
public Type TargetType { get; }
|
||||
#if NET7_0
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
|
||||
public class TandAttribute<TTandTarget> : TandAttribute where TTandTarget : ITandTarget
|
||||
{
|
||||
public TandAttribute() : base(typeof(TTandTarget))
|
||||
{
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -2,22 +2,21 @@ using System.Collections.Generic;
|
|||
using System.Linq;
|
||||
using Tand.Core.Models;
|
||||
|
||||
namespace Tand.Core.Models
|
||||
namespace Tand.Core.Models;
|
||||
|
||||
public record CallEnterContext<T>
|
||||
{
|
||||
public readonly struct CallEnterContext<T>
|
||||
private readonly IDictionary<string, object> _methodArgs;
|
||||
|
||||
public CallEnterContext(T instance, IDictionary<string, object> args)
|
||||
{
|
||||
private readonly IDictionary<string, object> _methodArgs;
|
||||
|
||||
public CallEnterContext(T instance, IDictionary<string, object> args)
|
||||
{
|
||||
Instance = instance;
|
||||
_methodArgs = args;
|
||||
}
|
||||
|
||||
public T Instance { get; }
|
||||
|
||||
public object? this[string argName] => _methodArgs.ContainsKey(argName) ? _methodArgs[argName] : null;
|
||||
|
||||
public IEnumerable<MethodArgument> Arguments => _methodArgs.Select(kv => new MethodArgument(kv.Key, kv.Value));
|
||||
Instance = instance;
|
||||
_methodArgs = args;
|
||||
}
|
||||
|
||||
public T Instance { get; }
|
||||
|
||||
public object? this[string argName] => _methodArgs.ContainsKey(argName) ? _methodArgs[argName] : null;
|
||||
|
||||
public IEnumerable<MethodArgument> Arguments => _methodArgs.Select(kv => new MethodArgument(kv.Key, kv.Value));
|
||||
}
|
|
@ -1,29 +1,28 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Tand.Core.Models
|
||||
namespace Tand.Core.Models;
|
||||
|
||||
public record CallLeaveContext<T>
|
||||
{
|
||||
public readonly struct CallLeaveContext<T>
|
||||
private readonly IDictionary<string, object> _methodArgs;
|
||||
|
||||
public CallLeaveContext(
|
||||
T instance,
|
||||
IDictionary<string, object> args,
|
||||
object callResult
|
||||
)
|
||||
{
|
||||
private readonly IDictionary<string, object> _methodArgs;
|
||||
|
||||
public CallLeaveContext(
|
||||
T instance,
|
||||
IDictionary<string, object> args,
|
||||
object callResult
|
||||
)
|
||||
{
|
||||
Instance = instance;
|
||||
_methodArgs = args;
|
||||
CallResult = callResult;
|
||||
}
|
||||
|
||||
public T Instance { get; }
|
||||
|
||||
public object CallResult { get; }
|
||||
|
||||
public object? this[string argName] => _methodArgs.ContainsKey(argName) ? _methodArgs[argName] : null;
|
||||
|
||||
public IEnumerable<MethodArgument> Arguments => _methodArgs.Select(kv => new MethodArgument(kv.Key, kv.Value));
|
||||
Instance = instance;
|
||||
_methodArgs = args;
|
||||
CallResult = callResult;
|
||||
}
|
||||
|
||||
public T Instance { get; }
|
||||
|
||||
public object CallResult { get; }
|
||||
|
||||
public object? this[string argName] => _methodArgs.ContainsKey(argName) ? _methodArgs[argName] : null;
|
||||
|
||||
public IEnumerable<MethodArgument> Arguments => _methodArgs.Select(kv => new MethodArgument(kv.Key, kv.Value));
|
||||
}
|
|
@ -1,21 +1,3 @@
|
|||
namespace Tand.Core.Models
|
||||
{
|
||||
public readonly struct MethodArgument
|
||||
{
|
||||
public MethodArgument(string name, object value)
|
||||
{
|
||||
Name = name;
|
||||
Value = value;
|
||||
}
|
||||
namespace Tand.Core.Models;
|
||||
|
||||
public string Name { get; }
|
||||
|
||||
public object Value { get; }
|
||||
|
||||
public void Deconstruct(out string name, out object value)
|
||||
{
|
||||
name = Name;
|
||||
value = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
public record MethodArgument(string Name, object Value);
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<PackageId>Tand.Core</PackageId>
|
||||
<RepositoryUrl>https://github.com/baez90/tand</RepositoryUrl>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<RepositoryUrl>https://code.icb4dc0.de/prskr/tand</RepositoryUrl>
|
||||
<Version>0.0.1</Version>
|
||||
<LangVersion>8</LangVersion>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<Optimize>true</Optimize>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
@ -2,15 +2,19 @@
|
|||
|
||||
<PropertyGroup>
|
||||
<PackageId>Tand.Extensions.DependencyInjection</PackageId>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
|
||||
<Version>0.0.1</Version>
|
||||
<RepositoryUrl>https://github.com/baez90/tand</RepositoryUrl>
|
||||
<LangVersion>8</LangVersion>
|
||||
<RepositoryUrl>https://code.icb4dc0.de/prskr/tand</RepositoryUrl>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
|
||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -6,7 +6,7 @@ namespace Tand.Core.Benchmarks
|
|||
{
|
||||
public interface IRationalsProvider
|
||||
{
|
||||
[Tand(typeof(ExecutionTimeTand<IRationalsProvider>))]
|
||||
[Tand<ExecutionTimeTand<IRationalsProvider>>]
|
||||
ICollection<Rational> Generate(IEnumerable<(int n, int d)> input);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<Optimize>true</Optimize>
|
||||
<LangVersion>8</LangVersion>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
|
||||
<PackageReference Include="BenchmarkDotNet" Version="0.13.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -1,17 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<LangVersion>8</LangVersion>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -5,7 +5,7 @@ namespace Tand.Core.Tests
|
|||
|
||||
public interface ITandSample
|
||||
{
|
||||
[Tand(typeof(LogTarget<ITandSample>))]
|
||||
[Tand<LogTarget<ITandSample>>]
|
||||
int LogMyParams(string s, int i);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,22 +1,21 @@
|
|||
using Xunit;
|
||||
|
||||
namespace Tand.Core.Tests
|
||||
namespace Tand.Core.Tests;
|
||||
|
||||
public class TandTests
|
||||
{
|
||||
public class TandTests
|
||||
|
||||
[Fact]
|
||||
public void GenerateTand()
|
||||
{
|
||||
var handleCallCounter = 0;
|
||||
var resolver = new ResolverMock(new LogTarget<ITandSample>(tandSample => handleCallCounter++));
|
||||
var tand = new Tand(resolver);
|
||||
|
||||
[Fact]
|
||||
public void GenerateTand()
|
||||
{
|
||||
var handleCallCounter = 0;
|
||||
var resolver = new ResolverMock(new LogTarget<ITandSample>(tandSample => handleCallCounter++));
|
||||
var tand = new Tand(resolver);
|
||||
|
||||
var sample = tand.DecorateWithTand<ITandSample, TandSample>(new TandSample());
|
||||
var result = sample.LogMyParams("Hello, World", 42);
|
||||
Assert.Equal(1, result);
|
||||
Assert.Equal(2, handleCallCounter);
|
||||
Assert.Equal(1, resolver.ResolvingCounter);
|
||||
}
|
||||
var sample = tand.DecorateWithTand<ITandSample, TandSample>(new TandSample());
|
||||
var result = sample.LogMyParams("Hello, World", 42);
|
||||
Assert.Equal(1, result);
|
||||
Assert.Equal(2, handleCallCounter);
|
||||
Assert.Equal(1, resolver.ResolvingCounter);
|
||||
}
|
||||
}
|
|
@ -1,17 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<LangVersion>8</LangVersion>
|
||||
<LangVersion>default</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.2.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="1.0.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.2" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="coverlet.collector" Version="3.2.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace Tand.Extensions.DependencyInjection.Tests
|
|||
|
||||
public interface ISampleService
|
||||
{
|
||||
[Tand(typeof(TestDecorator))]
|
||||
[Tand<TestDecorator>]
|
||||
string Greet();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
:; set -eo pipefail
|
||||
:; ./build.sh "$@"
|
||||
:; SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
:; ${SCRIPT_DIR}/build.sh "$@"
|
||||
:; exit $?
|
||||
|
||||
@ECHO OFF
|
||||
powershell -ExecutionPolicy ByPass -NoProfile %0\..\build.ps1 %*
|
||||
powershell -ExecutionPolicy ByPass -NoProfile -File "%~dp0build.ps1" %*
|
||||
|
|
|
@ -6,7 +6,7 @@ Param(
|
|||
|
||||
Write-Output "PowerShell $($PSVersionTable.PSEdition) version $($PSVersionTable.PSVersion)"
|
||||
|
||||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { exit 1 }
|
||||
Set-StrictMode -Version 2.0; $ErrorActionPreference = "Stop"; $ConfirmPreference = "None"; trap { Write-Error $_ -ErrorAction Continue; exit 1 }
|
||||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
###########################################################################
|
||||
|
@ -14,14 +14,15 @@ $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
|||
###########################################################################
|
||||
|
||||
$BuildProjectFile = "$PSScriptRoot\..\build\_build.csproj"
|
||||
$TempDirectory = "$PSScriptRoot\..\.tmp"
|
||||
$TempDirectory = "$PSScriptRoot\..\.nuke\temp"
|
||||
|
||||
$DotNetGlobalFile = "$PSScriptRoot\..\global.json"
|
||||
$DotNetInstallUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.ps1"
|
||||
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
|
||||
$DotNetChannel = "Current"
|
||||
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
|
||||
$env:DOTNET_MULTILEVEL_LOOKUP = 0
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
|
@ -32,37 +33,37 @@ function ExecSafe([scriptblock] $cmd) {
|
|||
if ($LASTEXITCODE) { exit $LASTEXITCODE }
|
||||
}
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if (Test-Path $DotNetGlobalFile) {
|
||||
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
|
||||
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
|
||||
$DotNetVersion = $DotNetGlobal.sdk.version
|
||||
}
|
||||
}
|
||||
|
||||
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
|
||||
# If dotnet CLI is installed globally and it matches requested version, use for execution
|
||||
if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue) -and `
|
||||
(!(Test-Path variable:DotNetVersion) -or $(& dotnet --version) -eq $DotNetVersion)) {
|
||||
$(dotnet --version) -and $LASTEXITCODE -eq 0) {
|
||||
$env:DOTNET_EXE = (Get-Command "dotnet").Path
|
||||
}
|
||||
else {
|
||||
$DotNetDirectory = "$TempDirectory\dotnet-win"
|
||||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
|
||||
|
||||
# Download install script
|
||||
$DotNetInstallFile = "$TempDirectory\dotnet-install.ps1"
|
||||
New-Item -ItemType Directory -Path $TempDirectory -Force | Out-Null
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallUrl, $DotNetInstallFile)
|
||||
|
||||
# Install by channel or version
|
||||
if (!(Test-Path variable:DotNetVersion)) {
|
||||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
|
||||
} else {
|
||||
ExecSafe { & $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
|
||||
# If global.json exists, load expected version
|
||||
if (Test-Path $DotNetGlobalFile) {
|
||||
$DotNetGlobal = $(Get-Content $DotNetGlobalFile | Out-String | ConvertFrom-Json)
|
||||
if ($DotNetGlobal.PSObject.Properties["sdk"] -and $DotNetGlobal.sdk.PSObject.Properties["version"]) {
|
||||
$DotNetVersion = $DotNetGlobal.sdk.version
|
||||
}
|
||||
}
|
||||
|
||||
# Install by channel or version
|
||||
$DotNetDirectory = "$TempDirectory\dotnet-win"
|
||||
if (!(Test-Path variable:DotNetVersion)) {
|
||||
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Channel $DotNetChannel -NoPath }
|
||||
} else {
|
||||
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
|
||||
}
|
||||
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
|
||||
}
|
||||
|
||||
Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
|
||||
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"
|
||||
|
||||
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false -nologo -clp:NoSummary --verbosity quiet }
|
||||
ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
|
||||
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
echo $(bash --version 2>&1 | head -n 1)
|
||||
bash --version 2>&1 | head -n 1
|
||||
|
||||
set -eo pipefail
|
||||
SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
||||
|
@ -10,53 +10,53 @@ SCRIPT_DIR=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
|
|||
###########################################################################
|
||||
|
||||
BUILD_PROJECT_FILE="$SCRIPT_DIR/../build/_build.csproj"
|
||||
TEMP_DIRECTORY="$SCRIPT_DIR/../.tmp"
|
||||
TEMP_DIRECTORY="$SCRIPT_DIR/../.nuke/temp"
|
||||
|
||||
DOTNET_GLOBAL_FILE="$SCRIPT_DIR/../global.json"
|
||||
DOTNET_INSTALL_URL="https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain/dotnet-install.sh"
|
||||
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
|
||||
DOTNET_CHANNEL="Current"
|
||||
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
export DOTNET_MULTILEVEL_LOOKUP=0
|
||||
|
||||
###########################################################################
|
||||
# EXECUTION
|
||||
###########################################################################
|
||||
|
||||
function FirstJsonValue {
|
||||
perl -nle 'print $1 if m{"'$1'": "([^"]+)",?}' <<< ${@:2}
|
||||
perl -nle 'print $1 if m{"'"$1"'": "([^"]+)",?}' <<< "${@:2}"
|
||||
}
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
|
||||
DOTNET_VERSION=$(FirstJsonValue "version" $(cat "$DOTNET_GLOBAL_FILE"))
|
||||
if [[ "$DOTNET_VERSION" == "" ]]; then
|
||||
unset DOTNET_VERSION
|
||||
fi
|
||||
fi
|
||||
|
||||
# If dotnet is installed locally, and expected version is not set or installation matches the expected version
|
||||
if [[ -x "$(command -v dotnet)" && (-z ${DOTNET_VERSION+x} || $(dotnet --version 2>&1) == "$DOTNET_VERSION") ]]; then
|
||||
# If dotnet CLI is installed globally and it matches requested version, use for execution
|
||||
if [ -x "$(command -v dotnet)" ] && dotnet --version &>/dev/null; then
|
||||
export DOTNET_EXE="$(command -v dotnet)"
|
||||
else
|
||||
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
|
||||
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
|
||||
|
||||
# Download install script
|
||||
DOTNET_INSTALL_FILE="$TEMP_DIRECTORY/dotnet-install.sh"
|
||||
mkdir -p "$TEMP_DIRECTORY"
|
||||
curl -Lsfo "$DOTNET_INSTALL_FILE" "$DOTNET_INSTALL_URL"
|
||||
chmod +x "$DOTNET_INSTALL_FILE"
|
||||
|
||||
# If global.json exists, load expected version
|
||||
if [[ -f "$DOTNET_GLOBAL_FILE" ]]; then
|
||||
DOTNET_VERSION=$(FirstJsonValue "version" "$(cat "$DOTNET_GLOBAL_FILE")")
|
||||
if [[ "$DOTNET_VERSION" == "" ]]; then
|
||||
unset DOTNET_VERSION
|
||||
fi
|
||||
fi
|
||||
|
||||
# Install by channel or version
|
||||
DOTNET_DIRECTORY="$TEMP_DIRECTORY/dotnet-unix"
|
||||
if [[ -z ${DOTNET_VERSION+x} ]]; then
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --channel "$DOTNET_CHANNEL" --no-path
|
||||
else
|
||||
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
|
||||
fi
|
||||
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
|
||||
fi
|
||||
|
||||
echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
|
||||
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"
|
||||
|
||||
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false -nologo -clp:NoSummary --verbosity quiet
|
||||
"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
|
||||
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
|
||||
|
|
Loading…
Reference in a new issue