Skip to content

Commit

Permalink
Merge pull request #1623 from Squirrel/fixups
Browse files Browse the repository at this point in the history
Fixups for Squirrel.Windows 2.0
  • Loading branch information
anaisbetts authored Aug 20, 2020
2 parents 813dd91 + 0e6228a commit 7187b19
Show file tree
Hide file tree
Showing 14 changed files with 23 additions and 45 deletions.
1 change: 1 addition & 0 deletions src/Setup/Setup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<RootNamespace>Setup</RootNamespace>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down
1 change: 0 additions & 1 deletion src/Squirrel.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<file src="Squirrel\bin\Release\NuGet.Squirrel.*" target="lib\Net45" />
<file src="Squirrel\bin\Release\ICSharpCode.*" target="lib\Net45" />
<file src="squirrel.windows.props" target="build" />
<file src="squirrel.windows.targets" target="build" />
<file src="Setup\bin\Release\Setup.exe" target="tools" />
<file src="WriteZipToSetup\bin\Release\WriteZipToSetup.exe" target="tools" />
<file src="StubExecutable\bin\Release\StubExecutable.exe" target="tools" />
Expand Down
6 changes: 3 additions & 3 deletions src/Squirrel/SimpleSplat/Logging.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public class DefaultLogManager : ILogManager

public DefaultLogManager(IDependencyResolver dependencyResolver = null)
{
dependencyResolver = dependencyResolver ?? Locator.Current;
dependencyResolver = dependencyResolver ?? SquirrelLocator.Current;

loggerCache = new MemoizingMRUCache<Type, IFullLogger>((type, _) => {
var ret = dependencyResolver.GetService<ILogger>();
Expand Down Expand Up @@ -191,7 +191,7 @@ public static IFullLogger Default {
get {
if (suppressLogging) return nullLogger;

var factory = Locator.Current.GetService<ILogManager>();
var factory = SquirrelLocator.Current.GetService<ILogManager>();
if (factory == null) {
throw new Exception("ILogManager is null. This should never happen, your dependency resolver is broken");
}
Expand All @@ -207,7 +207,7 @@ public static IFullLogger Log<T>(this T This) where T : IEnableLogger
{
if (suppressLogging) return nullLogger;

var factory = Locator.Current.GetService<ILogManager>();
var factory = SquirrelLocator.Current.GetService<ILogManager>();
if (factory == null) {
throw new Exception("ILogManager is null. This should never happen, your dependency resolver is broken");
}
Expand Down
14 changes: 7 additions & 7 deletions src/Squirrel/SimpleSplat/ServiceLocation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@

namespace Squirrel.SimpleSplat
{
public static class Locator
public static class SquirrelLocator
{
[ThreadStatic] static IDependencyResolver unitTestDependencyResolver;
static IDependencyResolver dependencyResolver;

static readonly List<Action> resolverChanged = new List<Action>();

static Locator()
static SquirrelLocator()
{
var r = new ModernDependencyResolver();
dependencyResolver = r;

RegisterResolverCallbackChanged(() => {
if (Locator.CurrentMutable == null) return;
Locator.CurrentMutable.InitializeSplat();
if (SquirrelLocator.CurrentMutable == null) return;
SquirrelLocator.CurrentMutable.InitializeSplat();
});
}

Expand Down Expand Up @@ -175,10 +175,10 @@ public static IDisposable ServiceRegistrationCallback(this IMutableDependencyRes
/// <param name="resolver">The test resolver to use.</param>
public static IDisposable WithResolver(this IDependencyResolver resolver)
{
var origResolver = Locator.Current;
Locator.Current = resolver;
var origResolver = SquirrelLocator.Current;
SquirrelLocator.Current = resolver;

return new ActionDisposable(() => Locator.Current = origResolver);
return new ActionDisposable(() => SquirrelLocator.Current = origResolver);
}

public static void RegisterConstant(this IMutableDependencyResolver This, object value, Type serviceType, string contract = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Squirrel/Utility.cs
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ public static Task<T> ErrorIfThrows<T>(this IEnableLogger This, Func<Task<T>> bl
static IFullLogger Log()
{
return logger ??
(logger = Locator.CurrentMutable.GetService<ILogManager>().GetLogger(typeof(Utility)));
(logger = SquirrelLocator.CurrentMutable.GetService<ILogManager>().GetLogger(typeof(Utility)));
}

[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
Expand Down
2 changes: 1 addition & 1 deletion src/StubExecutable/StubExecutable.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<RootNamespace>StubExecutable</RootNamespace>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
Expand Down
11 changes: 3 additions & 8 deletions src/StubExecutable/StubExecutable.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<Text Include="ReadMe.txt" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h">
Expand All @@ -36,6 +33,9 @@
<ClInclude Include="version.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="version.inl">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="stdafx.cpp">
Expand Down Expand Up @@ -64,9 +64,4 @@
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
<ItemGroup>
<None Include="version.inl">
<Filter>Header Files</Filter>
</None>
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion src/SyncReleases/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static int Main(string[] args)
async Task<int> main(string[] args)
{
using (var logger = new SetupLogLogger(false) { Level = Squirrel.SimpleSplat.LogLevel.Info }) {
Squirrel.SimpleSplat.Locator.CurrentMutable.Register(() => logger, typeof(Squirrel.SimpleSplat.ILogger));
Squirrel.SimpleSplat.SquirrelLocator.CurrentMutable.Register(() => logger, typeof(Squirrel.SimpleSplat.ILogger));

var releaseDir = default(string);
var repoUrl = default(string);
Expand Down
6 changes: 1 addition & 5 deletions src/SyncReleases/SyncReleases.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
<PackageReference Include="ILRepack" Version="1.26.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.0.50" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PostBuildEvent>
cd "$(TargetDir)"
"$(NuGetPackageRoot)ilrepack\1.26.0\tools\ILRepack.exe" /internalize /out:$(TargetFileName).tmp $(TargetFileName) SharpCompress.dll Microsoft.Web.XmlTransform.dll Splat.dll Squirrel.dll Octokit.dll NuGet.Squirrel.dll
"$(NuGetPackageRoot)ilrepack\1.26.0\tools\ILRepack.exe" /internalize /out:$(TargetFileName).tmp $(TargetFileName) SharpCompress.dll Microsoft.Web.XmlTransform.dll Squirrel.dll Octokit.dll NuGet.Squirrel.dll
del "$(TargetFileName)"
ren "$(TargetFileName).tmp" "$(TargetFileName)"
</PostBuildEvent>
Expand Down
4 changes: 2 additions & 2 deletions src/Update/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int main(string[] args)
opt = new StartupOption(args);
} catch (Exception ex) {
using (var logger = new SetupLogLogger(true, "OptionParsing") { Level = LogLevel.Info }) {
Locator.CurrentMutable.Register(() => logger, typeof(Squirrel.SimpleSplat.ILogger));
SquirrelLocator.CurrentMutable.Register(() => logger, typeof(Squirrel.SimpleSplat.ILogger));
logger.Write($"Failed to parse command line options. {ex.Message}", LogLevel.Error);
}
throw;
Expand All @@ -55,7 +55,7 @@ int main(string[] args)
bool isUninstalling = opt.updateAction == UpdateAction.Uninstall;

using (var logger = new SetupLogLogger(isUninstalling, opt.updateAction.ToString()) {Level = LogLevel.Info}) {
Locator.CurrentMutable.Register(() => logger, typeof (SimpleSplat.ILogger));
SquirrelLocator.CurrentMutable.Register(() => logger, typeof (SimpleSplat.ILogger));

try {
return executeCommandLine(args);
Expand Down
6 changes: 1 addition & 5 deletions src/Update/Update-Mono.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,11 @@
<PackageReference Include="ILRepack" Version="1.26.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.0.50" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PostBuildEvent>
cd "$(TargetDir)"
"$(NuGetPackageRoot)ilrepack\1.26.0\tools\ILRepack.exe" /internalize /out:$(TargetFileName).tmp $(TargetFileName) Microsoft.Web.XmlTransform.dll Splat.dll DeltaCompressionDotNet.dll DeltaCompressionDotNet.MsDelta.dll Squirrel.dll NuGet.Squirrel.dll Mono.Cecil.dll SharpCompress.dll
"$(NuGetPackageRoot)ilrepack\1.26.0\tools\ILRepack.exe" /internalize /out:$(TargetFileName).tmp $(TargetFileName) Microsoft.Web.XmlTransform.dll DeltaCompressionDotNet.dll DeltaCompressionDotNet.MsDelta.dll Squirrel.dll NuGet.Squirrel.dll Mono.Cecil.dll SharpCompress.dll
del "$(TargetFileName)"
ren "$(TargetFileName).tmp" "$(TargetFileName)"
</PostBuildEvent>
Expand Down
6 changes: 1 addition & 5 deletions src/Update/Update.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,11 @@
<PackageReference Include="ILRepack" Version="1.26.0" PrivateAssets="All" />
</ItemGroup>

<ItemGroup>
<PackageReference Update="Nerdbank.GitVersioning" Version="3.0.50" />
</ItemGroup>

<Import Project="Sdk.targets" Sdk="Microsoft.NET.Sdk" />
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<PostBuildEvent>
cd "$(TargetDir)"
"$(NuGetPackageRoot)ilrepack\1.26.0\tools\ILRepack.exe" /internalize /out:$(TargetFileName).tmp $(TargetFileName) WpfAnimatedGif.dll SharpCompress.dll Microsoft.Web.XmlTransform.dll Splat.dll DeltaCompressionDotNet.dll DeltaCompressionDotNet.MsDelta.dll Squirrel.dll NuGet.Squirrel.dll Mono.Cecil.dll
"$(NuGetPackageRoot)ilrepack\1.26.0\tools\ILRepack.exe" /internalize /out:$(TargetFileName).tmp $(TargetFileName) WpfAnimatedGif.dll SharpCompress.dll Microsoft.Web.XmlTransform.dll DeltaCompressionDotNet.dll DeltaCompressionDotNet.MsDelta.dll Squirrel.dll NuGet.Squirrel.dll Mono.Cecil.dll
del "$(TargetFileName)"
ren "$(TargetFileName).tmp" "$(TargetFileName)"
</PostBuildEvent>
Expand Down
2 changes: 1 addition & 1 deletion src/WriteZipToSetup/WriteZipToSetup.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<RootNamespace>WriteZipToSetup</RootNamespace>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
Expand Down
5 changes: 0 additions & 5 deletions src/squirrel.windows.targets

This file was deleted.

0 comments on commit 7187b19

Please sign in to comment.