Skip to content
This repository was archived by the owner on Jun 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove all the AutoCodeFix stuff, consume it from nuget
Also, since build-time works great now, we don't need to generate
warnings for missing and outdated mocks. Those can be just Info,
and Warning only when AutoCodeFix is enabled.
  • Loading branch information
kzu committed Sep 23, 2018
commit 1a6aceae7715512a072a1479f98d5d22113a14d3
15 changes: 0 additions & 15 deletions src/Moq.sln
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.Tests", "Moq\Moq.Tests\
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{1DBDFC27-21EC-4EAC-B51B-84EDC8DBB9D5}"
ProjectSection(SolutionItems) = preProject
build\CI.props = build\CI.props
build\PackageReference.CopyLocal.targets = build\PackageReference.CopyLocal.targets
build\PackageReferences.targets = build\PackageReferences.targets
build\Packaging.props = build\Packaging.props
Expand All @@ -64,10 +63,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stunts.CodeFix", "Stunts\St
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Moq.CodeFix", "Moq\Moq.CodeFix\Moq.CodeFix.csproj", "{20370B86-1339-40F5-8A6E-ED15FE64112D}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stunts.Tasks", "Stunts\Stunts.Tasks\Stunts.Tasks.csproj", "{B53FAC7B-D649-4E44-BF9B-2E0CE486CC93}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Stunts.ProjectReader", "Stunts\Stunts.ProjectReader\Stunts.ProjectReader.csproj", "{A79A4483-490C-4C92-9366-88A79370F66C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -134,14 +129,6 @@ Global
{20370B86-1339-40F5-8A6E-ED15FE64112D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20370B86-1339-40F5-8A6E-ED15FE64112D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20370B86-1339-40F5-8A6E-ED15FE64112D}.Release|Any CPU.Build.0 = Release|Any CPU
{B53FAC7B-D649-4E44-BF9B-2E0CE486CC93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B53FAC7B-D649-4E44-BF9B-2E0CE486CC93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B53FAC7B-D649-4E44-BF9B-2E0CE486CC93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B53FAC7B-D649-4E44-BF9B-2E0CE486CC93}.Release|Any CPU.Build.0 = Release|Any CPU
{A79A4483-490C-4C92-9366-88A79370F66C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A79A4483-490C-4C92-9366-88A79370F66C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A79A4483-490C-4C92-9366-88A79370F66C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A79A4483-490C-4C92-9366-88A79370F66C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -155,8 +142,6 @@ Global
{EDBDA217-CA42-4C82-826F-7D990185EC0F} = {EEC3EC48-ACB2-4D25-B592-F360F676BE45}
{91F9A526-E62C-491B-8774-88A61BDF1E1A} = {EEC3EC48-ACB2-4D25-B592-F360F676BE45}
{A4D96CA3-75ED-43E4-B172-872EF2BCF128} = {EEC3EC48-ACB2-4D25-B592-F360F676BE45}
{B53FAC7B-D649-4E44-BF9B-2E0CE486CC93} = {EEC3EC48-ACB2-4D25-B592-F360F676BE45}
{A79A4483-490C-4C92-9366-88A79370F66C} = {EEC3EC48-ACB2-4D25-B592-F360F676BE45}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DA4CFD03-827D-482B-9304-83456D2A8115}
Expand Down
7 changes: 4 additions & 3 deletions src/Moq/Moq.CodeAnalysis/MockDiagnostics.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.CodeAnalysis;
using System;
using Microsoft.CodeAnalysis;
using Moq.Properties;

namespace Moq
Expand All @@ -10,7 +11,7 @@ public static class MockDiagnostics
new ResourceString(nameof(Resources.MissingMockAnalyzer_Title)),
new ResourceString(nameof(Resources.MissingMockAnalyzer_Message)),
"Build",
DiagnosticSeverity.Warning,
bool.TryParse(Environment.GetEnvironmentVariable("AutoCodeFix"), out var value) && value ? DiagnosticSeverity.Warning : DiagnosticSeverity.Info,
true,
new ResourceString(nameof(Resources.MissingMockAnalyzer_Description)));

Expand All @@ -19,7 +20,7 @@ public static class MockDiagnostics
new ResourceString(nameof(Resources.OutdatedMockAnalyzer_Title)),
new ResourceString(nameof(Resources.OutdatedMockAnalyzer_Message)),
"Build",
DiagnosticSeverity.Warning,
bool.TryParse(Environment.GetEnvironmentVariable("AutoCodeFix"), out var value) && value ? DiagnosticSeverity.Warning : DiagnosticSeverity.Info,
true,
new ResourceString(nameof(Resources.OutdatedMockAnalyzer_Description)));
}
Expand Down
3 changes: 2 additions & 1 deletion src/Moq/Moq.CodeAnalysis/MockGeneratorAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.CodeAnalysis;

using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Diagnostics;
using Stunts;

Expand Down
2 changes: 1 addition & 1 deletion src/Moq/Moq.CodeFix/MockGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MockGenerator : StuntGenerator
public MockGenerator(NamingConvention naming)
: base(naming, new IDocumentProcessor[]
{
new EnsureSdkReference(),
//new EnsureSdkReference(),
new DefaultImports(typeof(LazyInitializer).Namespace, typeof(IMocked).Namespace),
}
.Concat(GetDefaultProcessors())
Expand Down
1 change: 1 addition & 0 deletions src/Moq/Moq.CodeFix/Moq.CodeFix.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<FrameworkSpecific>true</FrameworkSpecific>
<Pack>true</Pack>
<TargetPath>%(Filename)%(Extension)</TargetPath>
<Visible>false</Visible>
</None>
<None Update="Moq.props">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
16 changes: 4 additions & 12 deletions src/Moq/Moq.CodeFix/Moq.props
Original file line number Diff line number Diff line change
@@ -1,21 +1,13 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemGroup>
<FixableDiagnosticId Include="MOQ001;MOQ002" />
<!-- Auto-generate mocks flagged by these two analyers. -->
<AutoFix Include="MOQ001;MOQ002" />

<!-- CodeFix analyzers should only be added to DTBs since they depend on
editor features that are not available from csc/vbc -->
<CodeFix Include="$(MSBuildThisFileDirectory)netstandard.dll" />
<CodeFix Include="$(MSBuildThisFileDirectory)Moq.CodeFix.dll" />
</ItemGroup>

<!-- Because our analyzers are intended to be design-time only,
we cannot just include them in the package `analyzer` folder.
Instead, we have to use an alternative mechanism that only
adds them for VS. The chosen hook is to check for the DesignTimeBuild
property which is passed by VS to the project when retrieving the
analyers to run as part of the design-time build only.
-->
<ItemGroup Condition="'$(DesignTimeBuild)' == 'true'">
<Analyzer Include="@(CodeFix)" />
</ItemGroup>

</Project>
22 changes: 6 additions & 16 deletions src/Moq/Moq.CodeFix/Moq.targets
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<CompileDependsOn>
_AddIntermediateMocks;
$(CompileDependsOn)
</CompileDependsOn>

<Target Name="_AddIntermediateMocks">
<ItemGroup>
<_Mocks Include="$(IntermediateOutputPath)Mocks/*$(DefaultLanguageSourceExtension)" />
<Compile Include="@(_Mocks)" Visible="false" />
<!--
<Compile Update="@(Compile -> WithMetadataValue('LinkBase', 'Stunts'))">
<Visible>false</Visible>
</Compile>
-->
</ItemGroup>
</Target>
<ItemGroup>
<Compile Include="$(IntermediateOutputPath)Mocks/*$(DefaultLanguageSourceExtension)">
<Link>Mocks/%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Compile>
</ItemGroup>

</Project>
9 changes: 3 additions & 6 deletions src/Moq/Moq.Package/Moq.Package.nuproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(NuGetAuthoringPath)\NuGet.Packaging.Authoring.props" Condition="Exists('$(NuGetAuthoringPath)\NuGet.Packaging.Authoring.props')" />
<PropertyGroup Label="Globals">
Expand All @@ -21,13 +21,11 @@
<ProjectReference Include="..\Moq.CodeFix\Moq.CodeFix.csproj" />
<ProjectReference Include="..\Moq.Sdk\Moq.Sdk.csproj" />
<ProjectReference Include="..\Moq\Moq.csproj" />
<ProjectReference Include="..\..\Stunts\Stunts.Package\Stunts.Package.nuproj" />
<ProjectReference Include="..\..\Stunts\Stunts.Package\Stunts.Package.nuproj" IncludeAssets="all" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.Common.targets" />
<Import Project="$(NuGetAuthoringPath)\NuGet.Packaging.Authoring.targets" Condition="Exists('$(NuGetAuthoringPath)\NuGet.Packaging.Authoring.targets')" />

<Target Name="FixPackageFileFramework" BeforeTargets="Pack" AfterTargets="$(GetPackageContents)"
Returns="@(_PackageContent)">
<Target Name="FixPackageFileFramework" BeforeTargets="Pack" AfterTargets="$(GetPackageContents)" Returns="@(_PackageContent)">
<ItemGroup>
<_PackageContent Condition="'%(Kind)' == 'Dependency'">
<TargetFrameworkMoniker>.NETStandard,Version=v2.0</TargetFrameworkMoniker>
Expand All @@ -36,5 +34,4 @@
</_PackageContent>
</ItemGroup>
</Target>

</Project>
43 changes: 0 additions & 43 deletions src/Moq/Moq.Sdk.Build.Tests/App.config

This file was deleted.

58 changes: 0 additions & 58 deletions src/Moq/Moq.Sdk.Build.Tests/GeneratorTests.cs

This file was deleted.

60 changes: 0 additions & 60 deletions src/Moq/Moq.Sdk.Build.Tests/Misc.cs

This file was deleted.

15 changes: 0 additions & 15 deletions src/Moq/Moq.Sdk.Build.Tests/Moq.Sdk.Build.Tests.csproj

This file was deleted.

Loading