CodeGen.proj 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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)"
  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. <_TrimmableProject Include="@(_ProjectReferenceProvider->WithMetadataValue('IsTrimmable', 'true'))" />
  24. </ItemGroup>
  25. <PropertyGroup>
  26. <ProjectListFile>$(MSBuildThisFileDirectory)ProjectReferences.props</ProjectListFile>
  27. <ProjectListContent><![CDATA[<!--
  28. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  29. This file contains a map of assembly names to the projects that build them.
  30. -->
  31. <Project>
  32. <ItemGroup>
  33. @(_ProjectReferenceProvider->'<ProjectReferenceProvider Include="%(Identity)" ProjectPath="%24(RepoRoot)%(ProjectFileRelativePath)" />', '%0A ')
  34. </ItemGroup>
  35. </Project>
  36. ]]></ProjectListContent>
  37. </PropertyGroup>
  38. <!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
  39. <WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
  40. File="$(ProjectListFile)" Lines="$([MSBuild]::Escape($(ProjectListContent)))" Overwrite="true" />
  41. <Exec Condition="'$(OS)' != 'Windows_NT'"
  42. Command="echo '$(ProjectListContent.Replace('\t','\\t'))' > $(ProjectListFile)" />
  43. <Message Importance="High" Text="Generated $(ProjectListFile)" />
  44. <PropertyGroup>
  45. <SharedFxDepList>$(MSBuildThisFileDirectory)SharedFramework.Local.props</SharedFxDepList>
  46. <SharedFxDepListContent>
  47. <![CDATA[
  48. <!--
  49. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  50. This file contains a complete list of the assemblies which are part of the shared framework.
  51. This file is generated using the <IsAspNetCoreApp/> and <IsPackable/> properties from each .csproj in this repository.
  52. -->
  53. <Project>
  54. <ItemGroup>
  55. <!-- These assemblies are available as both a NuGet package and in the shared framework -->
  56. @(_SharedFrameworkAndPackageRef->'<AspNetCoreAppReferenceAndPackage Include="%(Identity)" />', '%0A ')
  57. <!-- These assemblies are only in the shared framework -->
  58. @(_SharedFrameworkRef->'<AspNetCoreAppReference Include="%(Identity)" />', '%0A ')
  59. </ItemGroup>
  60. </Project>
  61. ]]>
  62. </SharedFxDepListContent>
  63. </PropertyGroup>
  64. <WriteLinesToFile File="$(SharedFxDepList)" Lines="$(SharedFxDepListContent)" Overwrite="true" />
  65. <Message Importance="High" Text="Generated $(SharedFxDepList)" />
  66. <PropertyGroup>
  67. <TrimmableProjectsList>$(MSBuildThisFileDirectory)TrimmableProjects.props</TrimmableProjectsList>
  68. <TrimmableProjectsListContent>
  69. <![CDATA[
  70. <!--
  71. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  72. This file contains a complete list of projects annotated for trimming.
  73. This file is generated using the <IsTrimmable> properties from each .csproj in this repository.
  74. -->
  75. <Project>
  76. <ItemGroup>
  77. @(_TrimmableProject->'<TrimmableProject Include="%(Identity)" />', '%0A ')
  78. </ItemGroup>
  79. </Project>
  80. ]]>
  81. </TrimmableProjectsListContent>
  82. </PropertyGroup>
  83. <WriteLinesToFile File="$(TrimmableProjectsList)" Lines="$(TrimmableProjectsListContent)" Overwrite="true" />
  84. <Message Importance="High" Text="Generated $(TrimmableProjectsList)" />
  85. <PropertyGroup>
  86. <DelayedBuildFile>$(MSBuildThisFileDirectory)RequiresDelayedBuildProjects.props</DelayedBuildFile>
  87. <DelayedBuildContent><![CDATA[<!--
  88. This file is automatically generated. Run `./eng/scripts/GenerateProjectList.ps1` to update.
  89. This file contains a list of projects that must be restored etc. after App.Ref and App.Runtime are fully built.
  90. This file is generated using <RequiresDelayedBuild/> properties. Content may overlap ProjectReferences.csproj
  91. but that is not required (projects that are not project reference providers are also supported).
  92. -->
  93. <Project>
  94. <ItemGroup>
  95. @(_RequiresDelayedBuild->'<RequiresDelayedBuild Include="%24(RepoRoot)%(ProjectFileRelativePath)" />', '%0A ')
  96. </ItemGroup>
  97. </Project>
  98. ]]></DelayedBuildContent>
  99. </PropertyGroup>
  100. <!-- Workaround https://github.com/Microsoft/msbuild/issues/1024 -->
  101. <WriteLinesToFile Condition="'$(OS)' == 'Windows_NT'"
  102. File="$(DelayedBuildFile)" Lines="$([MSBuild]::Escape($(DelayedBuildContent)))" Overwrite="true" />
  103. <Exec Condition="'$(OS)' != 'Windows_NT'"
  104. Command="echo '$(DelayedBuildContent.Replace('\t','\\t'))' > $(DelayedBuildFile)" />
  105. <Message Importance="High" Text="Generated $(DelayedBuildFile)" />
  106. </Target>
  107. </Project>