Skip to content

Commit

Permalink
updating the targets and package versions everywhere and fixing #116
Browse files Browse the repository at this point in the history
  • Loading branch information
dadhi committed Apr 29, 2023
1 parent a2c1151 commit 3ce2b5b
Show file tree
Hide file tree
Showing 42 changed files with 268 additions and 276 deletions.
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build_benchmark",
"program": "${workspaceFolder}/playground/Playground/bin/Debug/net6.0/Playground.exe",
"program": "${workspaceFolder}/playground/Playground/bin/Debug/net7.0/Playground.exe",
"args": [],
"cwd": "${workspaceFolder}/playground/Playground",
"stopAtEntry": false,
Expand All @@ -32,7 +32,7 @@
"request": "launch",
"preLaunchTask": "build_testrunner",
// If you have changed target frameworks, make sure to update the program path.
"program": "${workspaceFolder}/test/DryIoc.TestRunner/bin/Debug/net6.0/DryIoc.TestRunner.dll",
"program": "${workspaceFolder}/test/DryIoc.TestRunner/bin/Debug/net7.0/DryIoc.TestRunner.dll",
"args": [],
"cwd": "${workspaceFolder}/test/DryIoc.TestRunner",
// For more information about the 'console' field, see https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#console-terminal-window
Expand Down
6 changes: 1 addition & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ Make sure that there are no project build errors or failing tests.

Open `DryIoc.sln` solution and re-build it. If something is failing you may try to close VS, run `b.bat` in the root folder, open VS and try to build again.

__Note:__ DryIoc targets multiple platforms (via msbuild project multi-targeting) which makes it slower to build.
To speedup the development DryIoc has `<DevMode>true</DevMode>` (TODO: Point to change) MSBuild property set to `true` in `Directory.Build.props` file in the root folder.
This setting minimizes the number of platforms to build - that's why you need to run `b.bat` to test your work for all platforms.

__Productivity hint:__ I am using [NCrunch](http://www.ncrunch.net/) extension to build and run the tests continuously to get an immediate feedback, quickly find regressions, and generally experiment with the code.
__Productivity hint:__ I am using [NCrunch](http://www.ncrunch.net/) extension for the MS Visual Studio to build and run the tests continuously and to get the immediate feedback, quickly find regressions, and generally experiment with the code.

### Develop in Visual Studio Code

Expand Down
3 changes: 1 addition & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<Project>
<PropertyGroup>
<DevMode>true</DevMode>
<LangVersion>10</LangVersion>
<LangVersion>11</LangVersion>

<Authors>Maksim Volkau</Authors>
<Copyright>Copyright © 2013-2023 Maksim Volkau</Copyright>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project>
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="NUnit" Version="3.13.3" />
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
<PackageReference Include="NUnit3TestAdapter" Version="4.4.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'NET45'">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
Expand Down
12 changes: 6 additions & 6 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ image:
- Ubuntu
- macOS

version: 6.0.0-preview-03-{build}
version: 6.0.0-preview-04-{build}

test: off

skip_commits:
message: /noci .*/

build_script:
- dotnet test -f net6.0 -c:Release test/DryIoc.UnitTests/DryIoc.UnitTests.csproj
- dotnet test -f net6.0 -c:Release test/DryIoc.IssuesTests/DryIoc.IssuesTests.csproj
- dotnet test -f net6.0 -c:Release test/DryIoc.CommonServiceLocator.UnitTests/DryIoc.CommonServiceLocator.UnitTests.csproj
- dotnet test -f net6.0 -c:Release test/DryIoc.Microsoft.DependencyInjection.Specification.Tests/DryIoc.Microsoft.DependencyInjection.Specification.Tests.csproj
- dotnet test -f net6.0 -c:Release docs/DryIoc.Docs/DryIoc.Docs.csproj
- dotnet test -f net7.0 -c:Release test/DryIoc.UnitTests/DryIoc.UnitTests.csproj
- dotnet test -f net7.0 -c:Release test/DryIoc.IssuesTests/DryIoc.IssuesTests.csproj
- dotnet test -f net7.0 -c:Release test/DryIoc.CommonServiceLocator.UnitTests/DryIoc.CommonServiceLocator.UnitTests.csproj
- dotnet test -f net7.0 -c:Release test/DryIoc.Microsoft.DependencyInjection.Specification.Tests/DryIoc.Microsoft.DependencyInjection.Specification.Tests.csproj
- dotnet test -f net7.0 -c:Release docs/DryIoc.Docs/DryIoc.Docs.csproj

for:
- matrix:
Expand Down
2 changes: 1 addition & 1 deletion b.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setlocal EnableDelayedExpansion

dotnet clean -v:m
dotnet build -c:Release -v:m -p:DevMode=false
dotnet build -c:Release -v:m
if %ERRORLEVEL% neq 0 goto :error

echo:
Expand Down
2 changes: 1 addition & 1 deletion bt.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
setlocal EnableDelayedExpansion

echo:
echo:# Build the TestRunner (.NET 6 only)
echo:# Build the TestRunner (.NET 7 only)
echo:

dotnet build -c Release test/DryIoc.TestRunner/DryIoc.TestRunner.csproj
Expand Down
21 changes: 11 additions & 10 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
setlocal EnableDelayedExpansion

dotnet clean -v:m
dotnet build -c:Release -v:m -p:DevMode=false
dotnet build -c:Release -v:m
if %ERRORLEVEL% neq 0 goto :error

echo:
echo:## Finished: RESTORE and BUILD
echo:
@REM echo:## Starting: TestRunner... ##
@REM echo:
echo:## Starting: TestRunner...
echo:

@REM dotnet run --no-build -c Release --project test/DryIoc.TestRunner/DryIoc.TestRunner.csproj
@REM if %ERRORLEVEL% neq 0 goto :error
@REM dotnet run --no-build -c Release --project test/DryIoc.TestRunner.net472/DryIoc.TestRunner.net472.csproj
dotnet run --no-build -c Release --project test/DryIoc.TestRunner/DryIoc.TestRunner.csproj
if %ERRORLEVEL% neq 0 goto :error
dotnet run --no-build -c Release --project test/DryIoc.TestRunner.net472/DryIoc.TestRunner.net472.csproj
if %ERRORLEVEL% neq 0 goto :error

@REM if %ERRORLEVEL% neq 0 goto :error
@REM echo:## Finished: TestRunner ##
@REM echo:
echo:
echo:## Finished: TestRunner
echo:
echo:## Starting: TESTS...
echo:

dotnet test --no-build -c:Release -p:DevMode=false
dotnet test --no-build -c:Release


if %ERRORLEVEL% neq 0 goto :error
Expand Down
11 changes: 6 additions & 5 deletions build_with_packaging.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,27 @@
setlocal EnableDelayedExpansion

dotnet clean -v:m
dotnet build -c:Release -v:m -p:DevMode=false
dotnet build -c:Release -v:m
if %ERRORLEVEL% neq 0 goto :error

echo:
echo:## Finished: RESTORE and BUILD
echo:
echo:## Starting: TestRunner... ##
echo:## Starting: TestRunner...
echo:

dotnet run --no-build -c Release --project test/DryIoc.TestRunner/DryIoc.TestRunner.csproj
if %ERRORLEVEL% neq 0 goto :error
dotnet run --no-build -c Release --project test/DryIoc.TestRunner.net472/DryIoc.TestRunner.net472.csproj

if %ERRORLEVEL% neq 0 goto :error
echo:## Finished: TestRunner ##

echo:
echo:## Finished: TestRunner
echo:
echo:## Starting: TESTS...
echo:

dotnet test --no-build -c:Release -p:DevMode=false
dotnet test --no-build -c:Release

if %ERRORLEVEL% neq 0 goto :error

Expand Down
14 changes: 7 additions & 7 deletions docs/DryIoc.Docs/DryIoc.Docs.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
<TargetFrameworks>net7.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
<MSBuildWarningsAsMessages>
Expand All @@ -11,14 +11,14 @@

<ItemGroup>
<PackageReference Include="LinFu.DynamicProxy" Version="2.1.2" />
<PackageReference Include="Moq" Version="4.17.2" />
<PackageReference Include="log4net" Version="2.0.14" />
<PackageReference Include="Autofac" Version="6.3.0" />
<PackageReference Include="Castle.Core" Version="4.4.1" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="log4net" Version="2.0.15" />
<PackageReference Include="Autofac" Version="7.0.1" />
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="NSubstitute" Version="4.3.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions playground/LoadTest/LoadTest.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net461</TargetFramework>
<TargetFramework>net472</TargetFramework>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions playground/Playground/Playground.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Autofac" Version="6.5.0" />
<PackageReference Include="Autofac" Version="7.0.1" />
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="8.0.0" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.3" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.5" />
<PackageReference Include="Grace" Version="7.2.1" />
<PackageReference Include="Grace.DependencyInjection.Extensions" Version="7.1.0" />
<PackageReference Include="LightInject" Version="6.6.1" />
<PackageReference Include="LightInject" Version="6.6.3" />
<PackageReference Include="Microsoft.Experimental.Collections" Version="1.0.6-e190117-3" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
<PackageReference Include="SimpleInjector" Version="5.4.1" />
<PackageReference Include="Lamar" Version="10.0.1" />
<PackageReference Include="Lamar" Version="11.1.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net7.0</TargetFrameworks>

<Product>DryIoc.CommonServiceLocator</Product>
<VersionPrefix>5.0.0</VersionPrefix>
Expand All @@ -24,7 +24,7 @@ v5.0.0:
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CommonServiceLocator" Version="2.0.5" />
<PackageReference Include="CommonServiceLocator" Version="2.0.7" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<TargetFrameworks>netstandard2.0;net6.0;net7.0</TargetFrameworks>

<Product>DryIoc.Microsoft.DependencyInjection</Product>

<VersionPrefix>7.0.0-preview-01</VersionPrefix>
<VersionPrefix>7.0.0-preview-02</VersionPrefix>
<VersionSuffix></VersionSuffix>

<AssemblyName>$(Product)</AssemblyName>
Expand All @@ -18,6 +18,7 @@
<![CDATA[
## v7.0.0
- directly supporting .NET 6.0 and .NET 7.0
- updated to Ms.Extensions.DependencyInjection.Abstractions to v7.0.0
- breaking: Remove `DryIocServiceScopeFactory` as not used anymore and replaced by `DryIocCapabilities`
- changing: Make `DryIocServiceProviderFactory.CreateServiceProvider` virtual to allow customizations, see #539
Expand Down
6 changes: 3 additions & 3 deletions src/DryIoc.Mvc/DryIoc.Mvc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ v2.0.1
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.6" />
<PackageReference Include="Microsoft.AspNet.Razor" Version="3.2.6" />
<PackageReference Include="Microsoft.AspNet.WebPages" Version="3.2.6" />
<PackageReference Include="Microsoft.AspNet.Mvc" Version="5.2.9" />
<PackageReference Include="Microsoft.AspNet.Razor" Version="3.2.9" />
<PackageReference Include="Microsoft.AspNet.WebPages" Version="3.2.9" />
<PackageReference Include="Microsoft.Web.Infrastructure" Version="1.0.0.0" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion src/DryIoc.WebApi/DryIoc.WebApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/DryIoc/DryIoc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Product>DryIoc</Product>

<VersionPrefix>6.0.0</VersionPrefix>
<VersionSuffix>preview-03</VersionSuffix>
<VersionSuffix>preview-04</VersionSuffix>

<AssemblyName>$(Product)</AssemblyName>
<AssemblyTitle>$(AssemblyName) $(TargetFramework)</AssemblyTitle>
Expand Down
3 changes: 2 additions & 1 deletion src/DryIocAttributes/DryIocAttributes.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>

<Product>DryIocAttributes</Product>
<VersionPrefix>7.0.0</VersionPrefix>
<VersionSuffix>preview-03</VersionSuffix>
<VersionSuffix></VersionSuffix>

<AssemblyName>$(Product)</AssemblyName>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.9" />
</ItemGroup>

<ItemGroup>
Expand Down
14 changes: 6 additions & 8 deletions test/DryIoc.IssuesTests/DryIoc.IssuesTests.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net472</TargetFrameworks>
<TargetFrameworks>net7.0;net472</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Autofac" Version="6.0.0" />
<PackageReference Include="Castle.Core" Version="4.4.0" />
<PackageReference Include="JetBrains.dotMemoryUnit" Version="3.0.20171219.105559" />
<PackageReference Include="Autofac" Version="7.0.1" />
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="MediatR" Version="9.0.0" />
<PackageReference Include="NSubstitute" Version="3.1.0" />
<PackageReference Include="Moq" Version="4.15.2" />
<PackageReference Include="log4net" Version="2.0.12" />
<PackageReference Include="JetBrains.Lifetimes" Version="2022.1.4" />
<PackageReference Include="NSubstitute" Version="5.0.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="log4net" Version="2.0.15" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 12 additions & 3 deletions test/DryIoc.IssuesTests/GHIssue114_Resolve_Action_T.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace DryIoc.IssuesTests
{
[TestFixture]
public class GHIssue114_Resolve_Action_T
public class GHIssue114_Resolve_Action_T : ITest
{
public int Run()
{
Test();
return 1;
}

[Test]
public void Test()
{
var container = new Container();

container.RegisterInstance<Action<string>>(s => Console.WriteLine("1-{0}", s), IfAlreadyRegistered.AppendNotKeyed);
container.RegisterInstance<Action<string>>(s => Console.WriteLine("2-{0}", s), IfAlreadyRegistered.AppendNotKeyed);
var messages = new List<string>();
container.RegisterInstance<Action<string>>(s => messages.Add($"1-{s}"), IfAlreadyRegistered.AppendNotKeyed);
container.RegisterInstance<Action<string>>(s => messages.Add($"2-{s}"), IfAlreadyRegistered.AppendNotKeyed);

var actions = container.ResolveMany<Action<string>>().ToList();
Assert.AreEqual(2, actions.Count);

actions.ForEach(a => a.Invoke("Hello world"));
CollectionAssert.AreEquivalent(new[] { "1-Hello world", "2-Hello world" }, messages);
}
}
}
Loading

0 comments on commit 3ce2b5b

Please sign in to comment.