StyleCop support added

dependabot/npm_and_yarn/BuildServer/eslint-7.2.0
Inga 🏳‍🌈 9 years ago
parent b8092caa47
commit b2994504e6
  1. 6
      DotNetBuilder/Compiler.cs
  2. 6
      DotNetBuilder/ImportStyleCop.targets
  3. 6
      DotNetBuilder/MicroBuildServer.DotNetBuilder.csproj
  4. 1
      DotNetBuilder/packages.config

@ -6,6 +6,8 @@ using Microsoft.Build.Evaluation;
using Microsoft.Build.Execution; using Microsoft.Build.Execution;
using Microsoft.Build.Framework; using Microsoft.Build.Framework;
using Microsoft.Build.Utilities; using Microsoft.Build.Utilities;
using System.Reflection;
using System.IO;
namespace MicroBuildServer.DotNetBuilder namespace MicroBuildServer.DotNetBuilder
{ {
@ -65,6 +67,8 @@ namespace MicroBuildServer.DotNetBuilder
} }
} }
public static readonly string BuilderAssemblyDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
public static Response Compile(CompileRequest request) public static Response Compile(CompileRequest request)
{ {
var logger = new CompilerLogger(); var logger = new CompilerLogger();
@ -88,6 +92,8 @@ namespace MicroBuildServer.DotNetBuilder
{ {
globalProperty.Add("RunCodeAnalysis", "true"); globalProperty.Add("RunCodeAnalysis", "true");
globalProperty.Add("CodeAnalysisRuleSet", request.CodeAnalysisRuleSet); globalProperty.Add("CodeAnalysisRuleSet", request.CodeAnalysisRuleSet);
globalProperty.Add("MBSBuilderPath", BuilderAssemblyDirectory);
globalProperty.Add("CustomBeforeMicrosoftCSharpTargets", Path.Combine(BuilderAssemblyDirectory, "ImportStyleCop.targets"));
} }
var buildRequest = new BuildRequestData(request.SolutionPath, globalProperty, "14.0", new [] { request.Target }, null); var buildRequest = new BuildRequestData(request.SolutionPath, globalProperty, "14.0", new [] { request.Target }, null);

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Analyzer Include="$(MBSBuilderPath)\StyleCop.Analyzers.dll" />
</ItemGroup>
</Project>

@ -83,6 +83,9 @@
<Reference Include="nunit.util"> <Reference Include="nunit.util">
<HintPath>..\packages\NUnit.Runners.2.6.3\tools\lib\nunit.util.dll</HintPath> <HintPath>..\packages\NUnit.Runners.2.6.3\tools\lib\nunit.util.dll</HintPath>
</Reference> </Reference>
<Reference Include="StyleCop.Analyzers">
<HintPath>..\packages\StyleCop.Analyzers.1.0.0-beta008\analyzers\dotnet\cs\StyleCop.Analyzers.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" /> <Reference Include="System.Xml.Linq" />
@ -111,6 +114,9 @@
<SubType>Designer</SubType> <SubType>Designer</SubType>
</None> </None>
<None Include="packages.config" /> <None Include="packages.config" />
<Content Include="ImportStyleCop.targets">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" /> <Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />

@ -4,4 +4,5 @@
<package id="NuGet.CommandLine" version="2.8.5" targetFramework="net4" /> <package id="NuGet.CommandLine" version="2.8.5" targetFramework="net4" />
<package id="NUnit" version="2.6.3" targetFramework="net4" /> <package id="NUnit" version="2.6.3" targetFramework="net4" />
<package id="NUnit.Runners" version="2.6.3" targetFramework="net4" /> <package id="NUnit.Runners" version="2.6.3" targetFramework="net4" />
<package id="StyleCop.Analyzers" version="1.0.0-beta008" targetFramework="net46" developmentDependency="true" />
</packages> </packages>
Loading…
Cancel
Save