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

Combine all test dependencies into one common project.json #1647

Merged
Merged
Show file tree
Hide file tree
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
Combine all test dependencies into one common project.json
* This was done in CoreFx with PR #12345
* Although not as impactful as for CoreFx this will shorten the time it takes to sync.
* In addition, as a simplification improvement it makes a lot of sense.
  • Loading branch information
StephenBonikowsky committed Nov 7, 2016
commit ff152a364b00831c88dff7e465c374c1e4aa338c
45 changes: 43 additions & 2 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,15 @@
</PropertyGroup>
<PropertyGroup Condition="'$(BuildTestsAgainstPackages)' == 'true'">
<TraversalBuildDependsOn>
UpdateVersionsOnTestProjectJson;
BatchGenerateTestProjectJsons;
$(TraversalBuildDependsOn);
</TraversalBuildDependsOn>
</PropertyGroup>

<ItemGroup>
<TestProjectJsons Include="$(MSBuildThisFileDirectory)src/Common/test-runtime/project.json" />
</ItemGroup>

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

Expand All @@ -82,7 +87,7 @@
<ProjectJsonFiles Condition="'$(BuildTestsAgainstPackages)' == 'true'" Include="$(GeneratedProjectJsonDir)/**/project.json" />
</ItemGroup>

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

<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring all packages..." />
Expand All @@ -91,6 +96,13 @@
<Output TaskParameter="RestoreRequired" PropertyName="RestoreRequired" />
</IsRestoreRequired>

<!-- This is to restore the test-runtime project.json up front which contains the latest packages to be tested to avoid download contention within nuget. -->
<Exec Command="$(DnuRestoreCommand) @(TestProjectJsons->'&quot;%(Identity)&quot;', ' ')"
Condition="'$(RestoreRequired)' == 'true'"
StandardOutputImportance="Low"
CustomErrorRegularExpression="(^Unable to locate .*)|(^Updating the invalid lock file with .*)"
ContinueOnError="ErrorAndContinue" />

<Exec Command="$(DnuRestoreCommand) @(DnuRestoreDir->'&quot;%(Identity)&quot;', ' ')"
Condition="'$(RestoreRequired)' == 'true'"
StandardOutputImportance="Low"
Expand All @@ -102,11 +114,40 @@

<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Restoring all packages...Done." />
</Target>

<!-- Generated project.json's may not exist when the "ProjectJsonFiles"" item group is defined (in dir.props), This target
ensures those files are added to the itemgroup. -->
<Target Name="AddGeneratedProjectJsons">
<ItemGroup>
<ProjectJsonFiles Condition="'$(BuildTestsAgainstPackages)' == 'true'" Include="$(GeneratedProjectJsonDir)/**/project.json" />
</ItemGroup>
</Target>

<UsingTask TaskName="AddDependenciesToProjectJson" AssemblyFile="$(BuildToolsTaskDir)Microsoft.DotNet.Build.Tasks.dll"/>
<Target Name="UpdateVersionsOnTestProjectJson" >

<!-- Duplicate properties to be removed in future -->
<PropertyGroup>
<PackageNameRegex Condition="'$(PackageNameRegex)' == ''">(?%3Cname%3E.*)\.(?%3Cversion%3E\d+\.\d+\.\d+)(-(?%3Cprerelease%3E.*)?)?</PackageNameRegex>
</PropertyGroup>
<ItemGroup>
<_PackagesDropsForCommonProjectJson Include="$(PackagesDrops)" />
</ItemGroup>

<AddDependenciesToProjectJson AdditionalDependencies="@(ExternalDependencies)"
PackagesDrops="@(_PackagesDropsForCommonProjectJson)"
PackageNameRegex="$(PackageNameRegex)"
VersionsFiles="@(_VersionsFiles)"
ProjectJson="$(CommonTestProjectJson)"
OutputProjectJson="$(CommonOutputTestProjectJson)"
UseNewestAvailablePackages="$(UseNewestAvailablePackages)"
/>
</Target>

<!-- Evaluate our test projects (in src\tests.builds) -->
<Target Name="BatchGenerateTestProjectJsons"
Condition="'$(BuildTestsAgainstPackages)' == 'true'"
DependsOnTargets="FilterProjects"
DependsOnTargets="FilterProjects;UpdateVersionsOnTestProjectJson"
BeforeTargets="RestorePackages">
<Message Importance="High" Text="[$([System.DateTime]::Now.ToString('HH:mm:ss.ff'))] Generating Test project.json's..." />
<MSBuild Targets="GenerateAllTestProjectJsons"
Expand Down
19 changes: 18 additions & 1 deletion dir.targets
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<Target Name="BuildAndTest" DependsOnTargets="Build;Test" />
<Target Name="RebuildAndTest" DependsOnTargets="Rebuild;Test" />
<Target Name="Test" />

<!-- Targets will be overridden if buildagainstpackages.targets is imported. -->
<Target Name="GenerateTestProjectJson" />
<Target Name="GenerateAllTestProjectJsons" />
Expand All @@ -28,6 +28,23 @@
</ProjectReference>
</ItemGroup>
</Target>

<PropertyGroup>
<CommonTestProjectJson>$(MSBuildThisFileDirectory)src/Common/test-runtime/project.json</CommonTestProjectJson>
<CommonTestProjectLockJson>$(MSBuildThisFileDirectory)src/Common/test-runtime/project.lock.json</CommonTestProjectLockJson>
<CommonOutputTestProjectJson>$(GeneratedProjectJsonDir)/project.json</CommonOutputTestProjectJson>
<CommonOutputTestProjectLockJson>$(GeneratedProjectJsonDir)/project.lock.json</CommonOutputTestProjectLockJson>
</PropertyGroup>

<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<CommonTestProjectJson Condition="'$(BuildTestsAgainstPackages)'=='true'">$(CommonOutputTestProjectJson)</CommonTestProjectJson>
<CommonTestProjectLockJson Condition="'$(BuildTestsAgainstPackages)'=='true'">$(CommonOutputTestProjectLockJson)</CommonTestProjectLockJson>
<ProjectJson Condition="'$(ProjectJson)'=='' and Exists('$(MSBuildProjectDirectory)/project.json')">$(MSBuildProjectDirectory)/project.json</ProjectJson>
<!-- If project specific project.json exists then don't skip generating test project.json files -->
<SkipGenerateTestProjectJson Condition="'$(ProjectJson)'==''" >true</SkipGenerateTestProjectJson>
<ProjectJson Condition="'$(ProjectJson)'==''">$(CommonTestProjectJson)</ProjectJson>
<ProjectLockJson Condition="'$(ProjectJson)'=='$(CommonTestProjectJson)'">$(CommonTestProjectLockJson)</ProjectLockJson>
</PropertyGroup>

<Import Project="$(ToolsDir)/Build.Common.targets" Condition="Exists('$(ToolsDir)/Build.Common.targets')" />

Expand Down
94 changes: 82 additions & 12 deletions src/Common/test-runtime/project.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,38 @@
{
"dependencies": {
"NETStandard.Library": "1.6.2-beta-24605-03",
"Microsoft.NETCore.TestHost": "1.2.0-beta-24603-03",
"Microsoft.NETCore.Runtime.CoreCLR": "1.2.0-beta-24603-03",
"System.Diagnostics.Contracts": "4.4.0-beta-24605-03",
"System.Linq.Parallel": "4.4.0-beta-24605-03",
"coveralls.io": "1.4",
"OpenCover": "4.6.519",
"ReportGenerator": "2.4.3",
"Microsoft.DotNet.xunit.performance.analysis": "1.0.0-alpha-build0040",
"Microsoft.DotNet.xunit.performance.analysis.cli": "1.0.0-alpha-build0040",
"Microsoft.DotNet.xunit.performance.runner.cli": "1.0.0-alpha-build0040",
"Microsoft.DotNet.xunit.performance.runner.Windows": "1.0.0-alpha-build0040",
"Microsoft.NETCore.TestHost": "1.2.0-beta-24603-03",
"Microsoft.NETCore.Runtime.CoreCLR": "1.2.0-beta-24603-03",
"Microsoft.DotNet.BuildTools.TestSuite": "1.0.0-prerelease-00925-01",
"xunit.console.netcore": "1.0.3-prerelease-00925-01",
"Microsoft.xunit.netcore.extensions": "1.0.0-prerelease-00925-01",
"System.Net.Security": "4.4.0-beta-24605-03",
"System.Net.WebSockets.Client": "4.4.0-beta-24605-03"
"System.Collections.Concurrent": "4.4.0-beta-24605-03",
"System.Console": "4.4.0-beta-24605-03",
"System.Diagnostics.Contracts": "4.4.0-beta-24605-03",
"System.Diagnostics.Tracing": "4.4.0-beta-24605-03",
"System.Linq": "4.4.0-beta-24605-03",
"System.Linq.Parallel": "4.4.0-beta-24605-03",
"System.Linq.Queryable": "4.4.0-beta-24605-03",
"System.Net.Http": "4.4.0-beta-24605-03",
"System.Net.WebHeaderCollection": "4.4.0-beta-24605-03",
"System.Net.WebSockets.Client": "4.4.0-beta-24605-03",
"System.Reflection.DispatchProxy": "4.4.0-beta-24605-03",
"System.Reflection.Extensions": "4.4.0-beta-24605-03",
"System.Runtime.Extensions": "4.4.0-beta-24605-03",
"System.Runtime.Serialization.Primitives": "4.4.0-beta-24605-03",
"System.Runtime.Serialization.Xml": "4.4.0-beta-24605-03",
"System.Threading.Timer": "4.4.0-beta-24605-03",
"System.Xml.XmlSerializer": "4.4.0-beta-24605-03"
},
"frameworks": {
"netstandard1.3": {},
"netstandard1.3": {
"System.Net.Security": "4.4.0-beta-24605-03"
},
"netcoreapp1.1": {
"System.Net.Security": "4.4.0-beta-24605-03"
},
"uap10.0": {
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
Expand All @@ -31,5 +44,62 @@
}
}
}
},
"supports": {
"coreFx.Test.net46": {
"net46": [
"",
"win-x86",
"win-x64"
]
},
"coreFx.Test.net461": {
"net461": [
"",
"win-x86",
"win-x64"
]
},
"coreFx.Test.net462": {
"net462": [
"",
"win-x86",
"win-x64"
]
},
"coreFx.Test.net463": {
"net463": [
"",
"win-x86",
"win-x64"
]
},
"coreFx.Test.netcore50": {
"uap10.0": [
"win10-x86",
"win10-x86-aot",
"win10-x64",
"win10-x64-aot"
]
},
"coreFx.Test.netcoreapp1.1": {
"netcoreapp1.1": [
"win7-x86",
"win7-x64",
"win10-arm64",
"osx.10.10-x64",
"centos.7-x64",
"debian.8-x64",
"rhel.7-x64",
"ubuntu.14.04-x64",
"ubuntu.16.04-x64",
"ubuntu.16.10-x64",
"fedora.23-x64",
"fedora.24-x64",
"linux-x64",
"opensuse.13.2-x64",
"opensuse.42.1-x64"
]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
<ProjectReference Include="$(WcfPrimitivesPkgProj)" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
<None Include="testproperties.props" />
<None Include="testproperties.targets" />
</ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(WcfInfrastructureCommonProj)">
<Project>{AFD69665-89A3-42AE-A32E-AB2CBBE6EE7E}</Project>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(WcfDuplexPkgProj)" />
<ProjectReference Include="$(WcfHttpPkgProj)" />
Expand Down
26 changes: 0 additions & 26 deletions src/System.Private.ServiceModel/tests/Common/Unit/project.json

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(WcfSourcePkgProj)">
<Name>System.Private.ServiceModel</Name>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@
<ItemGroup>
<Compile Include="**\*.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="$(WcfSourcePkgProj)">
<Name>System.Private.ServiceModel</Name>
Expand Down
Loading