diff options
author | Viktor Hofer <viktor.hofer@microsoft.com> | 2019-06-15 22:27:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-15 22:27:13 +0300 |
commit | 5f98ba6a2bc13f1ddd7d839139383db3f30cd00d (patch) | |
tree | 84409baecbd8993558fd9f8fb690ff3d2cf25a20 /eng/restore | |
parent | b00417b88b4824233d98c71413c3bae8f38f2ad0 (diff) |
Enable project restore for test projects (dotnet/corefx#38151)
* Factor out repo restore into seperate props/targets
* Use configuration system msbuild sdk
* Remove XUnit.Runtime.depproj
* Remove TargetGroup usages in test projects
* Fix ILLink configuration
The ILLink package contains netcoreapp2.0 assets which are compatible
with netstandard2.0. Removing the old TargetFramework to restore
successfully.
* Remove usages from TargetGroup in Directory.Build.props
* Remove dead net4* configurations
* Change tests.builds to tests.proj sdk proj
* Make externals dir proj an sdk project
* Consume Microsoft.DotNet.CoreFxTesting as an msbuild sdk
* Use runtimeconfig.template.json
* Remove SupplementalTestData
* Map shared framework version to product version
* Stop binplacing tests
* Move some tool depprojs to targets during restore
* Remove dead code
* Use PackageReference instead of RefFromRuntime in test
* Disable using an apphost
* Copy compression testdata manually cause unicode bug
* Remove target batching in optimizationData
* Reference packaging tools from CoreFx.Private.TestUtilities
Commit migrated from https://github.com/dotnet/corefx/commit/c4c1985531cc1f25c805bbc4801b85c98e0dfee0
Diffstat (limited to 'eng/restore')
-rw-r--r-- | eng/restore/docs.targets | 46 | ||||
-rw-r--r-- | eng/restore/illink.targets | 20 | ||||
-rw-r--r-- | eng/restore/optimizationData.targets | 27 | ||||
-rw-r--r-- | eng/restore/repoRestore.props | 30 | ||||
-rw-r--r-- | eng/restore/repoRestore.targets | 23 | ||||
-rw-r--r-- | eng/restore/uap-tools.targets | 29 |
6 files changed, 175 insertions, 0 deletions
diff --git a/eng/restore/docs.targets b/eng/restore/docs.targets new file mode 100644 index 00000000000..54e44dca045 --- /dev/null +++ b/eng/restore/docs.targets @@ -0,0 +1,46 @@ +<Project> + + <ItemGroup> + <PackageReference Include="microsoft.private.intellisense" Version="$(MicrosoftPrivateIntellisensePackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" /> + </ItemGroup> + + <!-- the intellisense package doesn't use nuget conventions so we need to select manually --> + <Target Name="GetDocFiles" + AfterTargets="Restore"> + + <ItemGroup> + <DocFile Include="$(NuGetPackageRoot)microsoft.private.intellisense/$(MicrosoftPrivateIntellisensePackageVersion)/xmldocs/netcoreapp/**/*.xml"/> + <DocFile> + <!-- trim off slash since it differs by platform and we need to do a string compare --> + <LCID>$([System.String]::new('%(RecursiveDir)').TrimEnd('\/'))</LCID> + </DocFile> + <DocFile> + <!-- map LCID to culture name that VS expects --> + <Culture>unknown</Culture> + <Culture Condition="'%(LCID)' == '1028'">zh-hant/</Culture> + <Culture Condition="'%(LCID)' == '1031'">de/</Culture> + <!-- english is placed in the root --> + <Culture Condition="'%(LCID)' == '1033'"></Culture> + <Culture Condition="'%(LCID)' == '1036'">fr/</Culture> + <Culture Condition="'%(LCID)' == '1040'">it/</Culture> + <Culture Condition="'%(LCID)' == '1041'">ja/</Culture> + <Culture Condition="'%(LCID)' == '1042'">ko/</Culture> + <Culture Condition="'%(LCID)' == '1049'">ru/</Culture> + <Culture Condition="'%(LCID)' == '2052'">zh-hans/</Culture> + <Culture Condition="'%(LCID)' == '3082'">es/</Culture> + </DocFile> + <DocFile> + <SubFolder>%(Culture)/</SubFolder> + </DocFile> + </ItemGroup> + + <Error Condition="'%(DocFile.Culture)' == 'unknown'" Text="Unknown language folder '%(LCID)' for doc files '@(DocFile)'" /> + + <Copy SourceFiles="@(DocFile)" + DestinationFiles="$(XmlDocDir)\%(SubFolder)%(FileName)%(Extension)" + SkipUnchangedFiles="true" + UseHardlinksIfPossible="true" /> + + </Target> + +</Project>
\ No newline at end of file diff --git a/eng/restore/illink.targets b/eng/restore/illink.targets new file mode 100644 index 00000000000..b79e7696f8c --- /dev/null +++ b/eng/restore/illink.targets @@ -0,0 +1,20 @@ +<Project> + + <ItemGroup> + <PackageReference Include="illink.tasks" Version="$(ILLinkTasksPackageVersion)" PrivateAssets="all" IsImplicitlyDefined="true" /> + </ItemGroup> + + <Target Name="IncludeToolsFiles" + AfterTargets="Restore"> + + <ItemGroup> + <_illinkSrcFiles Include="$(NuGetPackageRoot)illink.tasks\$(ILLinkTasksPackageVersion)\tools\**\*" /> + </ItemGroup> + + <Copy SourceFiles="@(_illinkSrcFiles)" + DestinationFolder="$(ILLinkDir)%(_illinkSrcFiles.RecursiveDir)" + SkipUnchangedFiles="true" + UseHardlinksIfPossible="true" /> + + </Target> +</Project> diff --git a/eng/restore/optimizationData.targets b/eng/restore/optimizationData.targets new file mode 100644 index 00000000000..da5408b022d --- /dev/null +++ b/eng/restore/optimizationData.targets @@ -0,0 +1,27 @@ +<Project> + + <ItemGroup> + <IBCPackage Include="$(WindowsCoreFxOptimizationDataPackageId)" Version="$(optimizationwindows_ntx64IBCCoreFxPackageVersion)" /> + <IBCPackage Include="$(LinuxCoreFxOptimizationDataPackageId)" Version="$(optimizationwindows_ntx64IBCCoreFxPackageVersion)" /> + <PackageReference Include="@(IBCPackage)" PrivateAssets="all" IsImplicitlyDefined="true" /> + </ItemGroup> + + <!-- IBC data packages don't follow NuGet conventions. --> + <Target Name="GetIBCData" + AfterTargets="Restore"> + + <ItemGroup> + <IBCPackage> + <PackagePath>$(NuGetPackageRoot)%(IBCPackage.Identity)\%(IBCPackage.Version)</PackagePath> + </IBCPackage> + <_optimizationDataSourceFile Include="%(IBCPackage.PackagePath)\**\*.dll;%(IBCPackage.PackagePath)\**\*.ibc" Package="%(IBCPackage.Identity)" /> + </ItemGroup> + + <Copy SourceFiles="@(_optimizationDataSourceFile)" + DestinationFiles="@(_optimizationDataSourceFile->'$(IbcOptimizationDataDir)%(Package)\%(RecursiveDir)%(Filename)%(Extension)')" + SkipUnchangedFiles="true" + UseHardlinksIfPossible="true" /> + + </Target> + +</Project> diff --git a/eng/restore/repoRestore.props b/eng/restore/repoRestore.props new file mode 100644 index 00000000000..c5700ddaa9d --- /dev/null +++ b/eng/restore/repoRestore.props @@ -0,0 +1,30 @@ +<Project TreatAsLocalProperty="ExcludeRestorePackageImports"> + + <PropertyGroup> + <!-- Need to set ProjectAssetsFile to something so it doesn't get set to the Tools.proj assets file when we import the generated props --> + <ProjectAssetsFile Condition="'$(ProjectAssetsFile)' == ''">unused</ProjectAssetsFile> + <!-- Nuget will normally disable all generated imports as part of a restore to avoid + non-determinism where first restore changes a subsequent restore, + but we need these since they define properties (like TargetFramework) needed by restore. + In this case we guarantee this is ok since these specific props are not restored by this project's restore. --> + <_excludeRestorePackageImports>$(ExcludeRestorePackageImports)</_excludeRestorePackageImports> + <ExcludeRestorePackageImports>false</ExcludeRestorePackageImports> + </PropertyGroup> + <Import Project="$(ToolSetCommonDirectory)Tools.proj.nuget.g.props" Condition="Exists('$(ToolSetCommonDirectory)Tools.proj.nuget.g.props')" /> + <PropertyGroup> + <ProjectAssetsFile Condition="'$(ProjectAssetsFile)' == 'unused'" /> + <ExcludeRestorePackageImports>$(_excludeRestorePackageImports)</ExcludeRestorePackageImports> + </PropertyGroup> + + <!-- Enable the repo-restored analyzers --> + <PropertyGroup> + <EnableAnalyzers Condition="'$(EnableAnalyzers)' == '' and '$(IsSourceProject)' == 'true'">true</EnableAnalyzers> + </PropertyGroup> + + <PropertyGroup> + <!-- Disable code paths that require project.assets.json files to be present or to be computed. --> + <GenerateDependencyFile>false</GenerateDependencyFile> + <ComputeNETCoreBuildOutputFiles>false</ComputeNETCoreBuildOutputFiles> + <GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles> + </PropertyGroup> +</Project>
\ No newline at end of file diff --git a/eng/restore/repoRestore.targets b/eng/restore/repoRestore.targets new file mode 100644 index 00000000000..43ee68c8ac8 --- /dev/null +++ b/eng/restore/repoRestore.targets @@ -0,0 +1,23 @@ +<Project InitialTargets="_ClearResolvePackageAssets"> + <PropertyGroup> + <!-- Disable restoring of package references in our projects --> + <RestoreProjectStyle Condition="'$(MSBuildProjectExtension)' != '.depproj'">None</RestoreProjectStyle> + </PropertyGroup> + + <Import Project="$(RepositoryEngineeringDir)CodeAnalysis.targets" /> + + <Import Project="$(ToolSetCommonDirectory)Tools.proj.nuget.g.targets" Condition="Exists('$(ToolSetCommonDirectory)Tools.proj.nuget.g.targets')" /> + + <!-- + Hack workaround for not restoring each project. Instead, we turn off all the targets + that require a `project.assets.json`, since ours will be empty anyway. + --> + <Target Name="_ClearResolvePackageAssets" + Condition="'$(MSBuildProjectExtension)' != '.depproj'"> + + <PropertyGroup> + <ResolvePackageDependenciesForBuildDependsOn></ResolvePackageDependenciesForBuildDependsOn> + </PropertyGroup> + + </Target> +</Project>
\ No newline at end of file diff --git a/eng/restore/uap-tools.targets b/eng/restore/uap-tools.targets new file mode 100644 index 00000000000..2956bd109a8 --- /dev/null +++ b/eng/restore/uap-tools.targets @@ -0,0 +1,29 @@ +<Project> + + <!-- Retrieve the UAP Tools to the TestHost folder --> + <Target Name="CopyUAPToolsToTestHost" + Condition="'$(TargetGroup)' == 'uap' and '$(DotNetBuildFromSource)' != 'true'" + AfterTargets="Restore"> + + <PropertyGroup> + <UAPToolsFolder>$(NuGetPackageRoot)$(MicrosoftDotNetUapTestToolsPackageId)\$(MicrosoftDotNetUapTestToolsPackageVersion)\Tools\$(ArchGroup)</UAPToolsFolder> + </PropertyGroup> + + <Error Condition="!Exists('$(UAPToolsFolder)')" Text="UAP Tools package not restored or missing assets." /> + + <ItemGroup> + <RunnerFolderContents Include="$(UAPToolsFolder)\Runner\**\*" /> + <LauncherFolderContents Include="$(UAPToolsFolder)\Launcher\**\*" /> + </ItemGroup> + + <Copy SourceFiles="@(RunnerFolderContents)" + DestinationFolder="$(TestHostRootPath)Runner\%(RecursiveDir)" + SkipUnchangedFiles="true" /> + + <Copy SourceFiles="@(LauncherFolderContents)" + DestinationFolder="$(TestHostRootPath)Launcher\%(RecursiveDir)" + SkipUnchangedFiles="true" /> + + </Target> + +</Project> |