CodeGen.proj 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <Project>
  2. <PropertyGroup>
  3. <BuildManaged>true</BuildManaged>
  4. <RepoRoot
  5. Condition=" '$(RepoRoot)' == '' OR !HasTrailingSlash('$(RepoRoot)') ">$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', '..'))</RepoRoot>
  6. <BuildMainlyReferenceProviders>true</BuildMainlyReferenceProviders>
  7. </PropertyGroup>
  8. <Import Project="Build.props" />
  9. <Target Name="GenerateProjectList">
  10. <Message Importance="High" Text="Analyzing @(ProjectToBuild->Count()) projects" />
  11. <MSBuild Projects="@(ProjectToBuild);@(ExplicitRequiresDelay)"
  12. Targets="GetReferencesProvided"
  13. BuildInParallel="true"
  14. SkipNonexistentTargets="true"
  15. SkipNonexistentProjects="true">
  16. <Output TaskParameter="TargetOutputs" ItemName="_ProvidesReferenceOrRequiresDelay" />
  17. </MSBuild>
  18. <ItemGroup>
  19. <_ProjectReferenceProvider Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('IsProjectReferenceProvider','true')->Distinct())" />
  20. <_RequiresDelayedBuild Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('RequiresDelayedBuild','true')->Distinct())" />
  21. <_SharedFrameworkAndPackageRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'true'))" />
  22. <_SharedFrameworkRef Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp','true')->WithMetadataValue('IsPackable', 'false'))" />
  23. <_ShippingAssemblyWithDupes Include="@(_ProjectReferenceProvider->WithMetadataValue('IsAspNetCoreApp', 'true'))" />
  24. <_ShippingAssemblyWithDupes Include="@(_ProjectReferenceProvider->WithMetadataValue('IsShippingPackage', 'true'))" />
  25. <_ShippingAssembly Include="@(_ShippingAssemblyWithDupes->Distinct())" />
  26. <!-- _ProjectReferenceProvider is already Distinct() and does not include metadata for each target framework. -->
  27. <!-- If a project is trimmable for even just one of multiple target frameworks, include it in TrimmableProjects.props. -->
  28. <_TrimmableProject Include="@(_ProvidesReferenceOrRequiresDelay->WithMetadataValue('IsTrimmable', 'true')->WithMetadataValue('IsProjectReferenceProvider','true')->Distinct())" />
  29. </ItemGroup>
  30. <PropertyGroup>
  31. <ProjectListFile>$(MSBuildThisFileDirectory)ProjectReferences.props</ProjectListFile>
  32. <ProjectListContent><![CDATA[<!--
  33. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  34. This file contains a map of assembly names to the projects that build them.
  35. -->
  36. <Project>
  37. <ItemGroup>
  38. @(_ProjectReferenceProvider->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" />', '$([System.Environment]::NewLine) ')
  39. </ItemGroup>
  40. </Project>
  41. ]]></ProjectListContent>
  42. </PropertyGroup>
  43. <!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
  44. <WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
  45. File="$(ProjectListFile)" Lines="$([MSBuild]::Escape($(ProjectListContent)))" Overwrite="true" />
  46. <Exec Condition="'$(OS)' != 'Windows_NT'"
  47. Command="echo '$(ProjectListContent.Replace('\t','\\t'))' > $(ProjectListFile)" />
  48. <Message Importance="High" Text="Generated $(ProjectListFile)" />
  49. <PropertyGroup>
  50. <ShippingAssembliesFile>$(MSBuildThisFileDirectory)ShippingAssemblies.props</ShippingAssembliesFile>
  51. <ShippingAssembliesContent><![CDATA[<!--
  52. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  53. This file contains a list of all assemblies shipped from this repo, either via the Shared Framework or Nuget packages (or both).
  54. -->
  55. <Project>
  56. <ItemGroup>
  57. @(_ShippingAssembly->'<AspNetCoreShippingAssembly Include="%(Identity)" />', '$([System.Environment]::NewLine) ')
  58. </ItemGroup>
  59. </Project>
  60. ]]></ShippingAssembliesContent>
  61. </PropertyGroup>
  62. <!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
  63. <WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
  64. File="$(ShippingAssembliesFile)" Lines="$([MSBuild]::Escape($(ShippingAssembliesContent)))" Overwrite="true" />
  65. <Exec Condition="'$(OS)' != 'Windows_NT'"
  66. Command="echo '$(ShippingAssembliesContent.Replace('\t','\\t'))' > $(ShippingAssembliesFile)" />
  67. <Message Importance="High" Text="Generated $(ShippingAssembliesFile)" />
  68. <PropertyGroup>
  69. <SharedFxDepList>$(MSBuildThisFileDirectory)SharedFramework.Local.props</SharedFxDepList>
  70. <SharedFxDepListContent>
  71. <![CDATA[
  72. <!--
  73. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  74. This file contains a complete list of the assemblies which are part of the shared framework.
  75. This file is generated using the <IsAspNetCoreApp/> and <IsPackable/> properties from each .csproj in this repository.
  76. -->
  77. <Project>
  78. <ItemGroup>
  79. <!-- These assemblies are available as both a NuGet package and in the shared framework -->
  80. @(_SharedFrameworkAndPackageRef->'<AspNetCoreAppReferenceAndPackage Include="%(Identity)" />', '$([System.Environment]::NewLine) ')
  81. <!-- These assemblies are only in the shared framework -->
  82. @(_SharedFrameworkRef->'<AspNetCoreAppReference Include="%(Identity)" />', '$([System.Environment]::NewLine) ')
  83. </ItemGroup>
  84. </Project>
  85. ]]>
  86. </SharedFxDepListContent>
  87. </PropertyGroup>
  88. <WriteLinesToFile File="$(SharedFxDepList)" Lines="$(SharedFxDepListContent)" Overwrite="true" />
  89. <Message Importance="High" Text="Generated $(SharedFxDepList)" />
  90. <PropertyGroup>
  91. <TrimmableProjectsList>$(MSBuildThisFileDirectory)TrimmableProjects.props</TrimmableProjectsList>
  92. <TrimmableProjectsListContent>
  93. <![CDATA[
  94. <!--
  95. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  96. This file contains a complete list of projects annotated for trimming.
  97. This file is generated using the <IsTrimmable> properties from each .csproj in this repository.
  98. -->
  99. <Project>
  100. <ItemGroup>
  101. @(_TrimmableProject->'<TrimmableProject Include="%(Identity)" />', '$([System.Environment]::NewLine) ')
  102. </ItemGroup>
  103. </Project>
  104. ]]>
  105. </TrimmableProjectsListContent>
  106. </PropertyGroup>
  107. <WriteLinesToFile File="$(TrimmableProjectsList)" Lines="$(TrimmableProjectsListContent)" Overwrite="true" />
  108. <Message Importance="High" Text="Generated $(TrimmableProjectsList)" />
  109. <PropertyGroup>
  110. <DelayedBuildFile>$(MSBuildThisFileDirectory)RequiresDelayedBuildProjects.props</DelayedBuildFile>
  111. <DelayedBuildContent><![CDATA[<!--
  112. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  113. This file contains a list of projects that must be restored etc. after App.Ref and App.Runtime are fully built.
  114. This file is generated using <RequiresDelayedBuild/> properties. Content may overlap ProjectReferences.csproj
  115. but that is not required (projects that are not project reference providers are also supported).
  116. -->
  117. <Project>
  118. <ItemGroup>
  119. @(_RequiresDelayedBuild->'<RequiresDelayedBuild Include="%24(RepoRoot)%(ProjectFileRelativePath)" />', '$([System.Environment]::NewLine) ')
  120. </ItemGroup>
  121. </Project>
  122. ]]></DelayedBuildContent>
  123. </PropertyGroup>
  124. <!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
  125. <WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
  126. File="$(DelayedBuildFile)" Lines="$([MSBuild]::Escape($(DelayedBuildContent)))" Overwrite="true" />
  127. <Exec Condition="'$(OS)' != 'Windows_NT'"
  128. Command="echo '$(DelayedBuildContent.Replace('\t','\\t'))' > $(DelayedBuildFile)" />
  129. <Message Importance="High" Text="Generated $(DelayedBuildFile)" />
  130. </Target>
  131. </Project>