Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor build targets #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file.

## [Unreleased]

### Changed
- Build uses single set of target files for all MSBuild versions 4.0 and above.

## [1.11-alpha] - 2017-12-02
### Added
- Added change log
254 changes: 0 additions & 254 deletions Contracts/MsBuild/v12.0/Microsoft.CodeContractAnalysis.targets

This file was deleted.

646 changes: 0 additions & 646 deletions Contracts/MsBuild/v12.0/Microsoft.CodeContracts.targets

This file was deleted.

254 changes: 0 additions & 254 deletions Contracts/MsBuild/v14.0/Microsoft.CodeContractAnalysis.targets

This file was deleted.

646 changes: 0 additions & 646 deletions Contracts/MsBuild/v14.0/Microsoft.CodeContracts.targets

This file was deleted.

254 changes: 0 additions & 254 deletions Contracts/MsBuild/v15.0/Microsoft.CodeContractAnalysis.targets

This file was deleted.

646 changes: 0 additions & 646 deletions Contracts/MsBuild/v15.0/Microsoft.CodeContracts.targets

This file was deleted.

24 changes: 12 additions & 12 deletions Contracts/MsBuild/v4.0/Microsoft.CodeContractAnalysis.targets
Original file line number Diff line number Diff line change
@@ -143,7 +143,7 @@
Condition="'$(CodeContractsClassLibrary)' != ''">$(CodeContractCodeAnalysisOptions) -cclib "$(CodeContractsClassLibrary)"</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsAssemblyMode)' == '1'">$(CodeContractCodeAnalysisOptions) -assemblyMode=standard</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions>$(CodeContractCodeAnalysisOptions) -maxwarnings 400</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions>$(CodeContractCodeAnalysisOptions) -maxwarnings 1200</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsNonNullObligations)' != 'true'">$(CodeContractCodeAnalysisOptions) -nonnull:noObl</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
@@ -160,7 +160,7 @@
Condition="'$(CodeContractsRedundantAssumptions)' == 'true'">$(CodeContractCodeAnalysisOptions) -check assumptions</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsAssertsToContractsCheckBox)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest asserttocontracts</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsRedundantTests)' == 'true'">$(CodeContractCodeAnalysisOptions) -check conditionsvalidity</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsMissingPublicRequiresAsWarnings)' == 'true'">$(CodeContractCodeAnalysisOptions) -missingPublicRequiresAreErrors</CodeContractCodeAnalysisOptions>
@@ -170,29 +170,29 @@
Condition="'$(CodeContractsSuggestAssumptionsForCallees)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest calleeassumes</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSuggestAssumptions)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest assumes</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSuggestRequires)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest requires</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSuggestEnsures)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest methodensures -suggest propertyensures</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsInferEnsuresAutoProperties)' == 'true'">$(CodeContractCodeAnalysisOptions) -infer autopropertiesensures</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSuggestEnsures)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest methodensures -suggest propertyensures</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsNecessaryEnsures)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest necessaryensures</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSuggestObjectInvariants)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest objectinvariants</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSuggestReadonly)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest readonlyfields </CodeContractCodeAnalysisOptions>
Condition="'$(CodeContractsSuggestReadonly)' == 'true'">$(CodeContractCodeAnalysisOptions) -suggest readonlyfields</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsInferRequires)' == 'true'">$(CodeContractCodeAnalysisOptions) -infer requires</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsInferEnsures)' == 'true'">$(CodeContractCodeAnalysisOptions) -infer methodensures</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsInferEnsuresAutoProperties)' == 'true'">$(CodeContractCodeAnalysisOptions) -infer autopropertiesensures</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsInferObjectInvariants)' == 'true'">$(CodeContractCodeAnalysisOptions) -infer objectinvariants</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsCacheAnalysisResults)' == 'true'">$(CodeContractCodeAnalysisOptions) -cache</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsSkipAnalysisIfCannotConnectToCache)' == 'true'">$(CodeContractCodeAnalysisOptions) -forcecacheserver=true</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsFailBuildOnWarnings)' == 'true'">$(CodeContractCodeAnalysisOptions) -failOnWarnings</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsCacheDirectory)' != ''">$(CodeContractCodeAnalysisOptions) -cacheFileDirectory "$(CodeContractsCacheDirectory)"</CodeContractCodeAnalysisOptions>
@@ -206,7 +206,7 @@
Condition="'$(CodeContractsTargetType)' != ''">$(CodeContractCodeAnalysisOptions) -typeNameSelect:$(CodeContractsTargetType)</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsBeingOptimisticOnExternal)' == 'false'">$(CodeContractCodeAnalysisOptions) -lowScoreForExternal=false</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsTargetNamespace)' != ''">$(CodeContractCodeAnalysisOptions) -namespaceSelect:$(CodeContractsTargetNamespace)</CodeContractCodeAnalysisOptions>
<CodeContractCodeAnalysisOptions
Condition="'$(CodeContractsUseBaseLine)' == 'true' and '$(CodeContractsBaseLineFile)' != ''">$(CodeContractCodeAnalysisOptions) -baseline "$(CodeContractsBaseLineFile)"</CodeContractCodeAnalysisOptions>
55 changes: 27 additions & 28 deletions Contracts/MsBuild/v4.0/Microsoft.CodeContracts.targets
Original file line number Diff line number Diff line change
@@ -5,11 +5,11 @@
</PropertyGroup>

<!--=====================================================================
Begin Microsoft Code Contracts
Begin Microsoft Code Contracts
======================================================================-->

<PropertyGroup>
<CodeContractsDeclDir>$(OutDir)CodeContractsDeclarative\</CodeContractsDeclDir>
<CodeContractsDeclDir>$(IntermediateOutputPath)Decl\</CodeContractsDeclDir>
<CodeContractsContractSubDir>CodeContracts\</CodeContractsContractSubDir>
<CodeContractsCCRefgenCommand>$(CodeContractsInstallDir)Bin\ccrefgen.exe</CodeContractsCCRefgenCommand>
</PropertyGroup>
@@ -50,14 +50,14 @@
<CodeContractsReferenceAssemblyLibPath>$(CodeContractsInstallDir)Contracts\.NETFramework\v4.0</CodeContractsReferenceAssemblyLibPath>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkVersion)' == 'v4.5'">
<When Condition="$(TargetFrameworkVersion.StartsWith('v4.5'))">
<PropertyGroup>
<CodeContractsReferenceAssemblyLibPath>$(CodeContractsInstallDir)Contracts\.NETFramework\v4.5</CodeContractsReferenceAssemblyLibPath>
</PropertyGroup>
</When>
<When Condition="'$(TargetFrameworkVersion)' == 'v4.5.1'">
<When Condition="$(TargetFrameworkVersion.StartsWith('v4.'))">
<PropertyGroup>
<CodeContractsReferenceAssemblyLibPath>$(CodeContractsInstallDir)Contracts\.NETFramework\v4.5</CodeContractsReferenceAssemblyLibPath>
<CodeContractsReferenceAssemblyLibPath>$(CodeContractsInstallDir)Contracts\.NETFramework\v4.6</CodeContractsReferenceAssemblyLibPath>
</PropertyGroup>
</When>
<Otherwise>
@@ -77,7 +77,7 @@
VS property build pane picks it up and may persist it into the project
settings!
=====================================================================-->

<PropertyGroup>
<CompileDependsOn>CodeContractsSlipInDefineSymbolDynamically;$(CompileDependsOn);CodeContractReferenceAssembly</CompileDependsOn>
</PropertyGroup>
@@ -271,24 +271,26 @@

<Target
Name="CodeContractReSign"
Condition="'$(DelaySign)' != 'true'"
Condition="'$(DelaySign)' != 'true'"
>
<GetFrameworkSdkPath>
<Output
TaskParameter="Path"
PropertyName="CodeContractsSdkPath" />
</GetFrameworkSdkPath>
<PropertyGroup>
<CodeContractsSnExe>"$(CodeContractsSdkPath)Bin\NETFX 4.0 Tools\sn.exe"</CodeContractsSnExe>
<!-- SN is in the Framework SDK tools path, but TargetFrameworkSDKToolsDirectory isn't always available -->
<CodeContractsSnExe Condition=" '$(TargetFrameworkSDKToolsDirectory)' != '' ">$(TargetFrameworkSDKToolsDirectory)sn.exe</CodeContractsSnExe>
<CodeContractsSnExe Condition=" '$(TargetFrameworkSDKToolsDirectory)' == '' ">$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v8.1A\bin\NETFX 4.6 Tools\sn.exe</CodeContractsSnExe>
</PropertyGroup>
<Exec
Condition="'$(KeyOriginatorFile)' != ''"
Command='$(CodeContractsSnExe) /R "@(IntermediateAssembly)" "$(KeyOriginatorFile)"' />
Condition="'$(KeyOriginatorFile)' != ''"
Command='&quot;$(CodeContractsSnExe)&quot; /R "@(IntermediateAssembly)" "$(KeyOriginatorFile)"' />
<Exec
Condition="'$(KeyContainerName)' != ''"
Command='$(CodeContractsSnExe) /Rc "@(IntermediateAssembly)" "$(KeyContainerName)"' />
Condition="'$(KeyContainerName)' != ''"
Command='&quot;$(CodeContractsSnExe)&quot; /Rc "@(IntermediateAssembly)" "$(KeyContainerName)"' />
</Target>

<Target
Name="CodeContractInstrument"
Condition="'$(CodeContractsEnableRuntimeChecking)' == 'true' and '$(BuildingProject)'=='true'"
@@ -374,7 +376,7 @@
Name="MakeCodeContractOutputDirectory"
Condition="!Exists(@(CodeContractOutputDirectory))"
>
<Message
<Message
Text="Making directory @(CodeContractOutputDirectory)"
/>
<MakeDir
@@ -415,7 +417,7 @@
Condition="!Exists('$(CodeContractsDeclDir)')"
Directories="$(CodeContractsDeclDir)"/>
</Target>

<Target
Name="ContractDeclarativeAssemblyVB"
Condition="'$(Language)'=='VB'"
@@ -431,7 +433,7 @@
<Vbc Condition=" '%(_CoreCompileResourceInputs.WithCulture)' != 'true' "
AdditionalLibPaths="$(AdditionalLibPaths)"
AddModules="@(AddModules)"
BaseAddress="$(BaseAddress)"
BaseAddress="$(BaseAddress)"
CodePage="$(CodePage)"
DebugType="$(DebugType)"
DefineConstants="$(FinalDefineConstants),CONTRACTS_FULL=-1,CODE_ANALYSIS=-1"
@@ -458,7 +460,7 @@
OptionExplicit="$(OptionExplicit)"
OptionInfer="$(OptionInfer)"
OptionStrict="$(OptionStrict)"
OptionStrictType="$(OptionStrictType)"
OptionStrictType="$(OptionStrictType)"
OutputAssembly="@(ContractDeclarativeAssembly)"
Platform="$(PlatformTarget)"
References="@(ReferencePath)"
@@ -479,10 +481,10 @@
WarningsAsErrors=""
WarningsNotAsErrors="$(WarningsNotAsErrors)"
Win32Icon="$(ApplicationIcon)"
Win32Manifest="$(Win32Manifest)"
Win32Manifest="$(Win32Manifest)"
Win32Resource="$(Win32Resource)"
/>

<ItemGroup>
<FileWrites
Include="@(ContractDeclarativeAssemblies)"/>
@@ -528,7 +530,7 @@
NoWin32Manifest="$(NoWin32Manifest)"
Optimize="true"
OutputAssembly="@(ContractDeclarativeAssembly)"
PdbFile="@(ContractDeclarativeAssemblyPDB)"
PdbFile="@(ContractDeclarativeAssemblyPDB)"
Platform="$(PlatformTarget)"
References="@(ReferencePath)"
Resources=""
@@ -546,8 +548,8 @@
Win32Icon=""
Win32Manifest="$(Win32Manifest)"
Win32Resource="$(Win32Resource)"
/>
/>

<ItemGroup>
<FileWrites
Include="@(ContractDeclarativeAssemblies)"/>
@@ -628,17 +630,14 @@
/>

<Exec
Command='"$(CodeContractsCCdocgenCommand)" "@$(IntermediateOutputPath)$(ProjectName)ccdocgen.rsp"'
Command='"$(CodeContractsCCdocgenCommand)" "@$(IntermediateOutputPath)$(ProjectName)ccdocgen.rsp"'
/>
</Target>

<!--=====================================================================
Include Code Analysis target if present
Include Code Analysis target
======================================================================-->
<PropertyGroup>
<CodeContractAnalysisTargets>$(CodeContractsInstallDir)MsBuild\v4.0\Microsoft.CodeContractAnalysis.targets</CodeContractAnalysisTargets>
</PropertyGroup>
<Import Project="$(CodeContractAnalysisTargets)" Condition="Exists('$(CodeContractAnalysisTargets)')"/>
<Import Project="Microsoft.CodeContractAnalysis.targets" />

<!-- End Microsoft Code Contracts -->
</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<CodeContractsInstallDir Condition="'$(DontOverrideCodeContractsInstallDir)' != 'true'">$(MSBuildThisFileDirectory)..\Contracts\</CodeContractsInstallDir>
<_CodeContractsBuildToolsVersion Condition="$(MSBuildToolsVersion) &lt; 4.0">3.5</_CodeContractsBuildToolsVersion>
<_CodeContractsBuildToolsVersion Condition="$(MSBuildToolsVersion) &gt;= 4.0">4.0</_CodeContractsBuildToolsVersion>
</PropertyGroup>
<Import Condition="'$(CodeContractsImported)' != 'true' AND '$(DontImportCodeContracts)' != 'true'" Project="$(CodeContractsInstallDir)MsBuild\v$(MSBuildToolsVersion)\Microsoft.CodeContracts.targets" />
<Import Condition="'$(CodeContractsImported)' != 'true' AND '$(DontImportCodeContracts)' != 'true'" Project="$(CodeContractsInstallDir)MsBuild\v$(_CodeContractsBuildToolsVersion)\Microsoft.CodeContracts.targets" />
</Project>