Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
olivier-spinelli committed Dec 13, 2017
2 parents 6e59a8e + 0a4a4d6 commit 8558148
Show file tree
Hide file tree
Showing 10 changed files with 140 additions and 37 deletions.
2 changes: 1 addition & 1 deletion CK.Core/CK.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CK.Text" Version="6.0.1" />
<PackageReference Include="CK.Text" Version="6.1.0" />
</ItemGroup>

<ItemGroup>
Expand Down
4 changes: 2 additions & 2 deletions CK.Core/FileUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ static public string NormalizePathSeparator( string path, bool ensureTrailingBac
/// <summary>
/// Gets the <see cref="Path.DirectorySeparatorChar"/> as a string.
/// </summary>
public static readonly string DirectorySeparatorString = new String( Path.DirectorySeparatorChar, 1 );
public static readonly string DirectorySeparatorString = NormalizedPath.DirectorySeparatorString;

/// <summary>
/// Gets the <see cref="Path.AltDirectorySeparatorChar"/> as a string.
/// </summary>
public static readonly string AltDirectorySeparatorString = new String( Path.AltDirectorySeparatorChar, 1 );
public static readonly string AltDirectorySeparatorString = NormalizedPath.AltDirectorySeparatorString;

/// <summary>
/// A display format for <see cref="DateTime"/> that supports round-trips, is readable and can be used in path
Expand Down
97 changes: 97 additions & 0 deletions CK.Core/WeakAssemblyNameResolver.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading;

namespace CK.Core
{

/// <summary>
/// Assemby loader helper: hooks the <see cref="AppDomain.AssemblyResolve"/> event
/// in order to try to load a version-less assembly.
/// The <see cref="GetResolvedList"/> is maintained and can be used to diagnose any assembly binding issues.
/// All members are thread safe.
/// </summary>
public static class WeakAssemblyNameResolver
{
static int _installCount;
static List<KeyValuePair<AssemblyName, AssemblyName>> _list = new List<KeyValuePair<AssemblyName, AssemblyName>>();

/// <summary>
/// Gets whether this helper is active.
/// </summary>
public static bool IsInstalled => _installCount >= 0;

/// <summary>
/// Installs the hook if not already installed.
/// Instead of using Install/<see cref="Uninstall"/>, the <see cref="TemporaryInstall"/> helper should be used.
/// </summary>
public static void Install()
{
if( Interlocked.Increment( ref _installCount ) == 1 )
{
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
}
}

/// <summary>
/// Uninstall the hook if possible.
/// </summary>
public static void Uninstall()
{
if( Interlocked.Decrement( ref _installCount ) == 0 )
{
AppDomain.CurrentDomain.AssemblyResolve -= CurrentDomain_AssemblyResolve;
}
}

/// <summary>
/// Gets the pair of requested name and eventually resolved name that have been resolved so far.
/// </summary>
/// <returns>A copy of the internally maintained list of resolved assembly names.</returns>
public static KeyValuePair<AssemblyName, AssemblyName>[] GetResolvedList()
{
lock( _list )
{
return _list.ToArray();
}
}

class Auto : IDisposable
{
bool _done;

public void Dispose()
{
if( !_done )
{
_done = true;
Uninstall();
}
}
}

/// <summary>
/// Temporary installs the hook that will be uninstalled when the returned object will be disposed.
/// </summary>
/// <returns>The dispoable to dispose when done.</returns>
public static IDisposable TemporaryInstall()
{
Install();
return new Auto();
}

static Assembly CurrentDomain_AssemblyResolve( object sender, ResolveEventArgs args )
{
var failed = new AssemblyName( args.Name );
var resolved = failed.Version != null && string.IsNullOrWhiteSpace( failed.CultureName )
? Assembly.Load( new AssemblyName( failed.Name ) )
: null;
lock( _list )
{
_list.Add( new KeyValuePair<AssemblyName, AssemblyName>( failed, resolved?.GetName() ) );
}
return resolved;
}
}
}
2 changes: 1 addition & 1 deletion CodeCakeBuilder/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public Build()
|| gitInfo.PreReleaseName == "prerelease"
|| gitInfo.PreReleaseName == "rc" )
{
PushNuGetPackages( "NUGET_API_KEY", "https://www.nuget.org/api/v2/package", nugetPackages );
PushNuGetPackages( "MYGET_RELEASE_API_KEY", "https://www.myget.org/F/invenietis-preview/api/v2/package", nugetPackages );
}
else
{
Expand Down
33 changes: 16 additions & 17 deletions CodeCakeBuilder/CodeCakeBuilder.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\SimpleGitVersion.Core.0.28.0\build\SimpleGitVersion.Core.props" Condition="Exists('..\packages\SimpleGitVersion.Core.0.28.0\build\SimpleGitVersion.Core.props')" />
<Import Project="..\packages\SimpleGitVersion.Core.0.30.0\build\SimpleGitVersion.Core.props" Condition="Exists('..\packages\SimpleGitVersion.Core.0.30.0\build\SimpleGitVersion.Core.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
Expand Down Expand Up @@ -37,27 +37,26 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Cake.Common, Version=0.22.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Common.0.22.0\lib\net46\Cake.Common.dll</HintPath>
<Reference Include="Cake.Common, Version=0.23.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Common.0.23.0\lib\net46\Cake.Common.dll</HintPath>
</Reference>
<Reference Include="Cake.Core, Version=0.22.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Core.0.22.0\lib\net46\Cake.Core.dll</HintPath>
<Reference Include="Cake.Core, Version=0.23.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Cake.Core.0.23.0\lib\net46\Cake.Core.dll</HintPath>
</Reference>
<Reference Include="CK.Text, Version=6.0.1.0, Culture=neutral, PublicKeyToken=731c291b31fb8d27, processorArchitecture=MSIL">
<HintPath>..\packages\CK.Text.6.0.1\lib\net461\CK.Text.dll</HintPath>
<Reference Include="CK.Text, Version=6.1.0.0, Culture=neutral, PublicKeyToken=731c291b31fb8d27, processorArchitecture=MSIL">
<HintPath>..\packages\CK.Text.6.1.0\lib\net461\CK.Text.dll</HintPath>
</Reference>
<Reference Include="Code.Cake, Version=0.15.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Code.Cake.0.15.0\lib\net45\Code.Cake.dll</HintPath>
<Private>True</Private>
<Reference Include="Code.Cake, Version=0.18.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Code.Cake.0.18.0\lib\net45\Code.Cake.dll</HintPath>
</Reference>
<Reference Include="CSemVer, Version=1.0.0.0, Culture=neutral, PublicKeyToken=731c291b31fb8d27, processorArchitecture=MSIL">
<HintPath>..\packages\CSemVer.1.0.1\lib\net461\CSemVer.dll</HintPath>
<Reference Include="CSemVer, Version=1.1.0.0, Culture=neutral, PublicKeyToken=731c291b31fb8d27, processorArchitecture=MSIL">
<HintPath>..\packages\CSemVer.1.1.0\lib\net461\CSemVer.dll</HintPath>
</Reference>
<Reference Include="SimpleGitVersion.Cake, Version=0.28.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleGitVersion.Cake.0.28.0\lib\net45\SimpleGitVersion.Cake.dll</HintPath>
<Reference Include="SimpleGitVersion.Cake, Version=0.30.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleGitVersion.Cake.0.30.0\lib\net45\SimpleGitVersion.Cake.dll</HintPath>
</Reference>
<Reference Include="SimpleGitVersion.Core, Version=0.28.0.0, Culture=neutral, PublicKeyToken=731c291b31fb8d27, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleGitVersion.Core.0.28.0\lib\net45\SimpleGitVersion.Core.dll</HintPath>
<Reference Include="SimpleGitVersion.Core, Version=0.30.0.0, Culture=neutral, PublicKeyToken=731c291b31fb8d27, processorArchitecture=MSIL">
<HintPath>..\packages\SimpleGitVersion.Core.0.30.0\lib\net45\SimpleGitVersion.Core.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
Expand All @@ -77,7 +76,7 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\SimpleGitVersion.Core.0.28.0\build\SimpleGitVersion.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SimpleGitVersion.Core.0.28.0\build\SimpleGitVersion.Core.props'))" />
<Error Condition="!Exists('..\packages\SimpleGitVersion.Core.0.30.0\build\SimpleGitVersion.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SimpleGitVersion.Core.0.30.0\build\SimpleGitVersion.Core.props'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
14 changes: 7 additions & 7 deletions CodeCakeBuilder/packages.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Cake.Common" version="0.22.0" targetFramework="net461" developmentDependency="true" />
<package id="Cake.Core" version="0.22.0" targetFramework="net461" />
<package id="CK.Text" version="6.0.1" targetFramework="net461" />
<package id="Code.Cake" version="0.15.0" targetFramework="net451" />
<package id="CSemVer" version="1.0.1" targetFramework="net461" />
<package id="Cake.Common" version="0.23.0" targetFramework="net461" developmentDependency="true" />
<package id="Cake.Core" version="0.23.0" targetFramework="net461" />
<package id="CK.Text" version="6.1.0" targetFramework="net461" />
<package id="Code.Cake" version="0.18.0" targetFramework="net461" />
<package id="CSemVer" version="1.1.0" targetFramework="net461" />
<package id="NUnit.Runners.Net4" version="2.6.4" targetFramework="net461" />
<package id="SimpleGitVersion.Cake" version="0.28.0" targetFramework="net461" developmentDependency="true" />
<package id="SimpleGitVersion.Core" version="0.28.0" targetFramework="net461" developmentDependency="true" />
<package id="SimpleGitVersion.Cake" version="0.30.0" targetFramework="net461" developmentDependency="true" />
<package id="SimpleGitVersion.Core" version="0.30.0" targetFramework="net461" developmentDependency="true" />
</packages>
12 changes: 6 additions & 6 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="Invenietis - Preview" value="https://www.myget.org/F/invenietis-preview/api/v3/index.json" protocolVersion="3" />
<add key="Invenietis - CI" value="https://www.myget.org/F/invenietis-ci/api/v3/index.json" protocolVersion="3" />
<clear />
<add key="Invenietis - Release" value="https://www.myget.org/F/invenietis-release/api/v3/index.json" protocolVersion="3" />
<add key="Invenietis - Preview" value="https://www.myget.org/F/invenietis-preview/api/v3/index.json" protocolVersion="3" />
<add key="Invenietis - CI" value="https://www.myget.org/F/invenietis-ci/api/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
</configuration>
4 changes: 2 additions & 2 deletions Tests/CK.Core.NetCore.Tests/CK.Core.NetCore.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="4.19.4" />
<PackageReference Include="NUnitLite" Version="3.8.1" />
<PackageReference Include="NUnit" Version="3.8.1" />
<PackageReference Include="NUnitLite" Version="3.9.0" />
<PackageReference Include="NUnit" Version="3.9.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 6 additions & 1 deletion Tests/CK.Core.Tests/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"profiles": {
"net461": {
"NUnit Debug": {
"commandName": "Executable",
"executablePath": "..\\..\\packages\\NUnit.Runners.Net4.2.6.4\\tools\\nunit.exe",
"commandLineArgs": "bin\\Debug\\net461\\CK.Core.Tests.dll"
},
"NUnit Release": {
"commandName": "Executable",
"executablePath": "..\\..\\packages\\NUnit.Runners.Net4.2.6.4\\tools\\nunit.exe",
"commandLineArgs": "bin\\Release\\net461\\CK.Core.Tests.dll"
}
}
}
2 changes: 2 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ branches:
environment:
NUGET_API_KEY:
secure: Cx0q/gQZQpP3eDf6H9lzIDpYYki+sGCpruxgDcFUJRoYdpH7l5aDh7afloH3uNLD
MYGET_RELEASE_API_KEY:
secure: BmENGV1y8uv5cLhMhwpoDLwQiLJh4C66c53+FW8FuuVfu5Lf4Ac6NvSuqO/1MbPm
MYGET_PREVIEW_API_KEY:
secure: CfEqNYjhrGX9DyalZ4jcadzJ/x8q25GulMCbZQDRRs+XetfHn2AEP79OJXE1wSJ8
MYGET_CI_API_KEY:
Expand Down

0 comments on commit 8558148

Please sign in to comment.