Skip to content

Commit

Permalink
Add full-version package dependency verification.
Browse files Browse the repository at this point in the history
  • Loading branch information
dagood committed Aug 23, 2016
1 parent 3427c56 commit 903d045
Show file tree
Hide file tree
Showing 4 changed files with 111 additions and 106 deletions.
2 changes: 1 addition & 1 deletion BuildToolsVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.26-prerelease-00711-02
1.0.26-prerelease-00723-02
20 changes: 1 addition & 19 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@

<PropertyGroup Condition="'$(RestoreDuringBuild)'=='true'">
<TraversalBuildDependsOn>
ValidateAllProjectDependencies;
BatchRestorePackages;
ValidateExactRestore;
CreateOrUpdateCurrentVersionFile;
Expand All @@ -76,7 +75,7 @@

<UsingTask TaskName="GatherDirectoriesToRestore" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

<Target Name="BatchRestorePackages">
<Target Name="BatchRestorePackages" DependsOnTargets="VerifyDependencies">
<MakeDir Directories="$(PackagesDir)" Condition="!Exists('$(PackagesDir)')" />

<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring all packages..." />
Expand All @@ -103,23 +102,6 @@
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Generating Test project.json's...done" />
</Target>

<!-- Task from buildtools that validates dependencies contained in project.json files. -->
<UsingTask TaskName="ValidateProjectDependencyVersions" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

<Target Name="ValidateAllProjectDependencies"
Condition="'$(ValidatePackageVersions)'=='true' and '@(ProjectJsonFiles)'!=''">
<ValidateProjectDependencyVersions ProjectJsons="@(ProjectJsonFiles)"
ProhibitFloatingDependencies="$(ProhibitFloatingDependencies)"
ValidationPatterns="@(ValidationPattern)" />
</Target>

<Target Name="UpdateInvalidPackageVersions">
<ValidateProjectDependencyVersions ProjectJsons="@(ProjectJsonFiles)"
ProhibitFloatingDependencies="$(ProhibitFloatingDependencies)"
ValidationPatterns="@(ValidationPattern)"
UpdateInvalidDependencies="true" />
</Target>

<!-- Task from buildtools that uses lockfiles to validate that packages restored are exactly what were specified. -->
<UsingTask TaskName="ValidateExactRestore" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll" />

Expand Down
106 changes: 106 additions & 0 deletions dependencies.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Source of truth for dependency tooling: the commit hash of the dotnet/versions master branch as of the last auto-upgrade. -->
<PropertyGroup>
<CoreFxCurrentRef>ba7aee2987f40d2b192087873177ec923c368752</CoreFxCurrentRef>
<CoreClrCurrentRef>c46101d17dfca07c64d81de3d7fe3fba3c5b1005</CoreClrCurrentRef>
<ExternalCurrentRef>061f2d7f7e65b233e806ba588f69a086a196f142</ExternalCurrentRef>
</PropertyGroup>

<!-- Auto-upgraded properties for each build info dependency. -->
<PropertyGroup>
<CoreFxExpectedPrerelease>beta-devapi-24422-01</CoreFxExpectedPrerelease>
<CoreClrExpectedPrerelease>beta-24419-04</CoreClrExpectedPrerelease>
<ExternalExpectedPrerelease>beta-24418-00</ExternalExpectedPrerelease>
</PropertyGroup>

<!-- Full package version strings that are used in other parts of the build. -->
<PropertyGroup>
<AppXRunnerVersion>1.0.3-prerelease-00614-01</AppXRunnerVersion>
</PropertyGroup>

<!-- Package dependency verification/auto-upgrade configuration. -->
<PropertyGroup>
<BaseDotNetBuildInfo>build-info/dotnet/</BaseDotNetBuildInfo>
<DependencyBranch>master</DependencyBranch>
<CurrentRefXmlPath>$(MSBuildThisFileFullPath)</CurrentRefXmlPath>
</PropertyGroup>

<ItemGroup>
<!--
Disabling validation of NetNative targeting pack. The TP used by netcore50 target frameworks
is different than the one that's used by uap10.1 target frameworks. VerifyDependencies
currently doesn't support multi-value Version. We need to figure out how we compose the
new TP, such that it's consumable by both frameworks.
-->
<DisabledBuildInfoPackages Include="Microsoft.TargetingPack.Private.NETNative" />

<RemoteDependencyBuildInfo Include="CoreFx">
<BuildInfoPath>$(BaseDotNetBuildInfo)corefx/dev/api</BuildInfoPath>
<CurrentRef>$(CoreFxCurrentRef)</CurrentRef>
</RemoteDependencyBuildInfo>
<RemoteDependencyBuildInfo Include="CoreClr">
<BuildInfoPath>$(BaseDotNetBuildInfo)coreclr/$(DependencyBranch)</BuildInfoPath>
<CurrentRef>$(CoreClrCurrentRef)</CurrentRef>
</RemoteDependencyBuildInfo>
<RemoteDependencyBuildInfo Include="External">
<BuildInfoPath>$(BaseDotNetBuildInfo)projectk-tfs/$(DependencyBranch)</BuildInfoPath>
<CurrentRef>$(ExternalCurrentRef)</CurrentRef>
</RemoteDependencyBuildInfo>

<DependencyBuildInfo Include="@(RemoteDependencyBuildInfo)">
<RawVersionsBaseUrl>https://raw.githubusercontent.com/dotnet/versions</RawVersionsBaseUrl>
<DisabledPackages>@(DisabledBuildInfoPackages)</DisabledPackages>
</DependencyBuildInfo>

<XmlUpdateStep Include="CoreFx">
<Path>$(MSBuildThisFileFullPath)</Path>
<ElementName>CoreFxExpectedPrerelease</ElementName>
<BuildInfoName>CoreFx</BuildInfoName>
</XmlUpdateStep>
<XmlUpdateStep Include="CoreClr">
<Path>$(MSBuildThisFileFullPath)</Path>
<ElementName>CoreClrExpectedPrerelease</ElementName>
<BuildInfoName>CoreClr</BuildInfoName>
</XmlUpdateStep>
<XmlUpdateStep Include="External">
<Path>$(MSBuildThisFileFullPath)</Path>
<ElementName>ExternalExpectedPrerelease</ElementName>
<BuildInfoName>External</BuildInfoName>
</XmlUpdateStep>
</ItemGroup>

<!-- Set up dependencies on packages that aren't found in a BuildInfo. -->
<ItemGroup>
<TargetingPackDependency Include="Microsoft.TargetingPack.NETFramework.v4.5" />
<TargetingPackDependency Include="Microsoft.TargetingPack.NETFramework.v4.5.1" />
<TargetingPackDependency Include="Microsoft.TargetingPack.NETFramework.v4.5.2" />
<TargetingPackDependency Include="Microsoft.TargetingPack.NETFramework.v4.6" />
<TargetingPackDependency Include="Microsoft.TargetingPack.NETFramework.v4.6.1" />
<TargetingPackDependency Include="Microsoft.TargetingPack.NETFramework.v4.6.2" />
<TargetingPackDependency Include="Microsoft.TargetingPack.Private.WinRT" />
<StaticDependency Include="@(TargetingPackDependency)">
<Version>1.0.1</Version>
</StaticDependency>

<XUnitDependency Include="xunit"/>
<XUnitDependency Include="xunit.runner.utility"/>
<XUnitDependency Include="xunit.runner.console"/>
<StaticDependency Include="@(XUnitDependency)">
<Version>2.1.0</Version>
</StaticDependency>

<StaticDependency Include="Microsoft.xunit.netcore.extensions;Microsoft.DotNet.BuildTools.TestSuite">
<Version>1.0.0-prerelease-00704-03</Version>
</StaticDependency>

<DependencyBuildInfo Include="@(StaticDependency)">
<PackageId>%(Identity)</PackageId>
<UpdateStableVersions>true</UpdateStableVersions>
</DependencyBuildInfo>

<DependencyBuildInfo Include="uwpRunnerVersion">
<PackageId>microsoft.xunit.runner.uwp</PackageId>
<Version>$(AppXRunnerVersion)</Version>
</DependencyBuildInfo>
</ItemGroup>
</Project>
89 changes: 3 additions & 86 deletions dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@
<EnableDotnetAnalyzers Condition="'$(EnableDotnetAnalyzers)'==''">true</EnableDotnetAnalyzers>
</PropertyGroup>

<!-- Provides package dependency version properties and verification/auto-upgrade configuration -->
<Import Project="$(MSBuildThisFileDirectory)dependencies.props" />

<!-- Explicitly setting
- SupportsUWP to true when TargetGroup is uap101*. This will enable the correct pinvoke checker to be picked
- BlockReflectionAttribute to true. This will enable injecting BlockReflectionAttribute.cs into the compile target.
Expand All @@ -95,94 +98,8 @@
<BlockReflectionAttribute>true</BlockReflectionAttribute>
</PropertyGroup>

<!-- Package dependency validation -->
<PropertyGroup>
<ValidatePackageVersions>true</ValidatePackageVersions>
<ProhibitFloatingDependencies>true</ProhibitFloatingDependencies>

<CoreFxExpectedPrerelease>beta-devapi-24422-01</CoreFxExpectedPrerelease>
<CoreClrExpectedPrerelease>beta-24419-04</CoreClrExpectedPrerelease>
<ExternalExpectedPrerelease>beta-24418-00</ExternalExpectedPrerelease>

<CoreFxVersionsIdentityRegex>^(?i)(((System\..*)(?&lt;!System\.ServiceModel\..*))|(NETStandard\.Library)|(Microsoft\.CSharp)|(Microsoft\.NETCore\.Targets)|(Microsoft\.NETCore\.Platforms)|(Microsoft\.Win32\..*)|(Microsoft\.VisualBasic))(?&lt;!TestData)$</CoreFxVersionsIdentityRegex>
<BaseDotNetBuildInfoUrl>https://raw.githubusercontent.com/dotnet/versions/master/build-info/dotnet/</BaseDotNetBuildInfoUrl>
<DependencyBranch>master</DependencyBranch>
</PropertyGroup>

<Import Project="$(MSBuildThisFileDirectory)pkg/ExternalPackages/versions.props" Condition="Exists('$(MSBuildThisFileDirectory)pkg/ExternalPackages/versions.props')" />

<!-- Dependency auto-upgrade configuration -->
<ItemGroup>
<DependencyBuildInfo Include="CoreFx">
<RawUrl>$(BaseDotNetBuildInfoUrl)corefx/dev/api</RawUrl>
</DependencyBuildInfo>
<DependencyBuildInfo Include="CoreClr">
<RawUrl>$(BaseDotNetBuildInfoUrl)coreclr/$(DependencyBranch)</RawUrl>
</DependencyBuildInfo>
<DependencyBuildInfo Include="External">
<RawUrl>$(BaseDotNetBuildInfoUrl)projectk-tfs/$(DependencyBranch)</RawUrl>
</DependencyBuildInfo>

<XmlUpdateStep Include="CoreFx">
<Path>$(MSBuildThisFileFullPath)</Path>
<ElementName>CoreFxExpectedPrerelease</ElementName>
<BuildInfoName>CoreFx</BuildInfoName>
</XmlUpdateStep>
<XmlUpdateStep Include="CoreClr">
<Path>$(MSBuildThisFileFullPath)</Path>
<ElementName>CoreClrExpectedPrerelease</ElementName>
<BuildInfoName>CoreClr</BuildInfoName>
</XmlUpdateStep>
<XmlUpdateStep Include="External">
<Path>$(MSBuildThisFileFullPath)</Path>
<ElementName>ExternalExpectedPrerelease</ElementName>
<BuildInfoName>External</BuildInfoName>
</XmlUpdateStep>
</ItemGroup>

<ItemGroup>
<ValidationPattern Include="CoreFxVersions">
<IdentityRegex>$(CoreFxVersionsIdentityRegex)</IdentityRegex>
<ExpectedPrerelease>$(CoreFxExpectedPrerelease)</ExpectedPrerelease>
</ValidationPattern>
<ValidationPattern Include="CoreClrVersions">
<IdentityRegex>^(?i)(Microsoft\.NETCore\.Runtime.*)|(Microsoft\.TargetingPack\.Private\.CoreCLR)$</IdentityRegex>
<ExpectedPrerelease>$(CoreClrExpectedPrerelease)</ExpectedPrerelease>
</ValidationPattern>
<!-- Disabling validation of NetNative targeting pack. The TP used by netcore50 target frameworks is different than the
one that's used by uap10.1 target frameworks. ValidatePackageVersions currently doesn't support multi-value ExpectedVersion.
We need to figure out how we compose the new TP, such that it's consumable by both frameworks.
<ValidationPattern Include="CoreLibTargetingPackVersions">
<IdentityRegex>^(?i)Microsoft\.TargetingPack\.Private\.NETNative$</IdentityRegex>
<ExpectedPrerelease>$(ExternalExpectedPrerelease)</ExpectedPrerelease>
</ValidationPattern>
-->
<ValidationPattern Include="TargetingPackVersions">
<IdentityRegex>^(?i)Microsoft\.TargetingPack\.(NetFramework.*|Private\.WinRT)$</IdentityRegex>
<ExpectedVersion>1.0.1</ExpectedVersion>
</ValidationPattern>
<ValidationPattern Include="xUnitStableVersions">
<IdentityRegex>^(?i)xunit$</IdentityRegex>
<ExpectedVersion>2.1.0</ExpectedVersion>
</ValidationPattern>
<ValidationPattern Include="xUnitExtensionsVersions">
<IdentityRegex>^(?i)Microsoft\.xunit\.netcore\.extensions$</IdentityRegex>
<ExpectedVersion>1.0.0-prerelease-00704-03</ExpectedVersion>
</ValidationPattern>
<ValidationPattern Include="buildToolsTestSuiteVersions">
<IdentityRegex>^(?i)Microsoft\.DotNet\.BuildTools\.TestSuite$</IdentityRegex>
<ExpectedVersion>1.0.0-prerelease-00704-03</ExpectedVersion>
</ValidationPattern>
<ValidationPattern Include="uwpRunnerVersion">
<IdentityRegex>^(?i)microsoft\.xunit\.runner\.uwp$</IdentityRegex>
<ExpectedVersion>$(AppXRunnerVersion)</ExpectedVersion>
</ValidationPattern>
</ItemGroup>

<!-- Runner versions -->
<PropertyGroup>
<AppXRunnerVersion>1.0.3-prerelease-00614-01</AppXRunnerVersion>
</PropertyGroup>
<!-- Import packaging props -->
<Import Project="$(MSBuildThisFileDirectory)Packaging.props"/>

Expand Down

0 comments on commit 903d045

Please sign in to comment.