Skip to content
Permalink
Browse files

(build) Fixed resharper issues

  • Loading branch information...
AdmiringWorm committed May 12, 2019
1 parent 391b01c commit 30fd26b2180e260fba94812b54b9bd0297cb91f7
@@ -1,6 +1,6 @@
image:
- Ubuntu
- Visual Studio 2017
- Visual Studio 2019
version: '{build}'
pull_requests:
do_not_increment_build_number: true
@@ -40,7 +40,6 @@
"label": "watch",
"command": "dotnet",
"type": "process",
"dependsOn":["build"],
"args": [
"watch",
"--project",
@@ -1,10 +1,11 @@
using System;
using System;

namespace Cake.Warp.Demo
{
class Program
// ReSharper disable once ClassNeverInstantiated.Global
internal class Program
{
static void Main(string[] args)
internal static void Main()
{
Console.WriteLine("I should work from a single binary!");
}
@@ -14,7 +14,7 @@ public class ModuleInitializerTests
[SetUp]
public void SetAddinAssemblyDirectory()
{
string directory = typeof(Cake.Warp.ModuleInitializer).Assembly.Location;
string directory = typeof(ModuleInitializer).Assembly.Location;
var attr = File.GetAttributes(directory);
if ((attr & FileAttributes.Directory) != FileAttributes.Directory)
{
@@ -59,6 +59,7 @@ public void Should_Be_Able_To_Launch_Warp_Binary_File()
// This will throw an exception if the file can't be run
var proc = Process.Start(processInfo);

Assume.That(proc, Is.Not.Null);
proc.WaitForExit();
}
}
@@ -0,0 +1,13 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=0BB62FD9_002D8844_002D4BCA_002DBCAE_002D9C01418A2C14_002Ff_003AInclude_005FT4Include_002Ecs/@EntryIndexedValue">ExplicitlyExcluded</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/AnalysisEnabled/@EntryValue">SOLUTION</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArrangeThisQualifier/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpCodeStyle/ThisQualifier/INSTANCE_MEMBERS_QUALIFY_MEMBERS/@EntryValue">Field, Property, Event, Method</s:String>
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/PreferQualifiedReference/@EntryValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">True</s:Boolean>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=OS/@EntryIndexedValue">OS</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateInstanceFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticFields/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /&gt;</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=addin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Fody/@EntryIndexedValue">True</s:Boolean>
</wpf:ResourceDictionary>
@@ -12,6 +12,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.1" PrivateAssets="All"/>
<PackageReference Include="ModuleInit.Fody" Version="2.0.0" PrivateAssets="All" />
<PackageReference Include="Resourcer.Fody" Version="1.7.3" />
<PackageReference Include="stylecop.analyzers" Version="1.1.118">
@@ -1,6 +1,5 @@
namespace Cake.Warp.Common
{
using System;
using System.IO;
using System.Reflection;
using System.Runtime.InteropServices;
@@ -27,17 +26,7 @@ private AddinConfiguration()
/// Gets the singleton instance of the addin configuration class.
/// </summary>
public static AddinConfiguration Instance
{
get
{
if (instance == null)
{
instance = new AddinConfiguration();
}

return instance;
}
}
=> instance ?? (instance = new AddinConfiguration());

/// <summary>
/// Gets the current path to the executing assembly directory.
@@ -4,10 +4,11 @@ namespace Cake.Warp
using System.Diagnostics;
using System.IO;
using Cake.Warp.Common;
using JetBrains.Annotations;
using Resourcer;

/// <summary>
/// Module class responible for the logic needed
/// Module class responsible for the logic needed
/// to run when the library is loaded.
/// </summary>
public static class ModuleInitializer
@@ -21,13 +22,14 @@ public static class ModuleInitializer
/// called manually. It should only be called
/// using the existing IL weaving.
/// </notes>
[UsedImplicitly]
public static void Initialize()
{
var assemblyDirectory = AddinConfiguration.Instance.AssemblyDirectoryPath;
var warpFileName = "warp-packer";
if (AddinConfiguration.Instance.IsWindows)
{
// Would prefer to get the file extension preffered by
// Would prefer to get the file extension preferred by
// system instead of hard-coding this.
// Not found anything related to this.
warpFileName += ".exe";
@@ -42,16 +44,21 @@ public static void Initialize()
}

using (var resourceStream = GetWarpResource())
using (var filestream = File.Create(fullPathToFile))
using (var fileStream = File.Create(fullPathToFile))
{
// Is there perhaps a better way, than doing this
resourceStream.CopyTo(filestream);
resourceStream.CopyTo(fileStream);
}

if (!AddinConfiguration.Instance.IsWindows)
{
// This is required, otherwise we won't be able to run warp-packer
var process = Process.Start("chmod", $"755 \"{fullPathToFile}\"");
if (process == null)
{
throw new NullReferenceException("Unable to run chmod on warp packer");
}

process.WaitForExit();
}
}
@@ -64,6 +71,7 @@ private static Stream GetWarpResource()
}
else if (AddinConfiguration.Instance.IsMacOS)
{
// ReSharper disable once StringLiteralTypo
return Resource.AsStream("warp.macos-x64.warp-packer");
}
else if (AddinConfiguration.Instance.IsWindows)
@@ -14,7 +14,7 @@ public enum WarpPlatforms
/// <summary>
/// Create the application as a Mac OSX x64 executable.
/// /// </summary>
MacOSX64,
MacOsx64,

/// <summary>
/// Create the application as a Windows x64 executable.
@@ -3,6 +3,7 @@ namespace Cake.Warp
using Cake.Core.IO;
using Cake.Core.Tooling;
using Cake.Warp.Common;
using JetBrains.Annotations;

/// <summary>
/// Contains the settings used by <see cref="WarpRunner" />.
@@ -32,6 +33,7 @@ public WarpSettings()
/// <remarks>
/// This is just an alias for <see cref="Architecture" />.
/// </remarks>
[PublicAPI]
public WarpPlatforms Platform
{
get => this.Architecture;
@@ -43,7 +45,7 @@ public WarpPlatforms Platform
/// the created application is being executed by a user.
/// </summary>
/// <remarks>
/// This should only be the filaname including the file extension.
/// This should only be the filename including the file extension.
/// </remarks>
public string ExecutableName { get; set; }

0 comments on commit 30fd26b

Please sign in to comment.
You can’t perform that action at this time.