Skip to content

Commit

Permalink
Revert "Enable restore for ref and src projects in libraries (dotnet#…
Browse files Browse the repository at this point in the history
…33242)" (dotnet#33437)

This reverts commit 981cc64.
  • Loading branch information
ViktorHofer authored Mar 10, 2020
1 parent 308ab65 commit 73268c7
Show file tree
Hide file tree
Showing 39 changed files with 332 additions and 284 deletions.
3 changes: 0 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@

<!-- Resource naming bug: https://github.com/microsoft/msbuild/issues/4740 -->
<EmbeddedResourceUseDependentUponConvention>false</EmbeddedResourceUseDependentUponConvention>

<!-- Enable NuGet static graph evaluation to optimize incremental restore: https://github.com/dotnet/sdk/pull/10794 -->
<!-- <RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation> -->
</PropertyGroup>

<PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions docs/coding-guidelines/project-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ once before you can iterate and work on a given library project.
- Netstandard Library - Copy to `bin\ref\netstandard2.0`
- NetFx targeting pack - Copy to `bin\ref\net472`
- Build targeting pack
- Build src\libraries\ref.proj which builds all references assembly projects. For reference assembly project information see [ref](#ref)
- Build src\ref.builds which builds all references assembly projects. For reference assembly project information see [ref](#ref)
- Build product
- Build src\libraries\src.proj which builds all the source library projects. For source library project information see [src](#src).
- Build src\src.builds which builds all the source library projects. For source library project information see [src](#src).
- Sign product
- Build src\sign.proj

Expand Down
2 changes: 0 additions & 2 deletions eng/Analyzers.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<Project>
<PropertyGroup>
<CodeAnalysisRuleset>$(MSBuildThisFileDirectory)CodeAnalysis.ruleset</CodeAnalysisRuleset>
<!-- Disable analyzers in sourcebuild -->
<EnableAnalyzers Condition="'$(DotNetBuildFromSource)' == 'true'">false</EnableAnalyzers>
</PropertyGroup>
<ItemGroup Condition="'$(EnableAnalyzers)' == 'true'">
<PackageReference Include="Microsoft.DotNet.CodeAnalysis" Version="$(MicrosoftDotNetCodeAnalysisVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />
Expand Down
9 changes: 2 additions & 7 deletions eng/Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
https://github.com/dotnet/arcade/issues/388
-->

<!-- Import to have access to properties/items used both during the Arcade phase and in the repo. -->
<Import Project="$(MSBuildThisFileDirectory)Configurations.props" />
<Import Project="$(MSBuildThisFileDirectory)Subsets.props" />

Expand Down Expand Up @@ -77,12 +76,8 @@
</ItemGroup>

<MSBuild Projects="@(RepoTaskProjects)"
Properties="Configuration=Debug;Platform=AnyCPU;__BuildPhase=Restore"
Targets="Restore" />

<MSBuild Projects="@(RepoTaskProjects)"
Properties="Configuration=Debug;Platform=AnyCPU;__BuildPhase=Build"
Targets="Build" />
Properties="Configuration=Debug;Platform=AnyCPU"
Targets="Restore;Build"/>

<WriteLinesToFile File="$(RepoTasksOutputFile)"
Lines="$(RepoTasksOutputFile)"
Expand Down
20 changes: 0 additions & 20 deletions eng/Configurations.props
Original file line number Diff line number Diff line change
@@ -1,24 +1,4 @@
<Project>
<!--
This file contains properties and items which are used in both the Arcade
steps and in the repository.
-->

<PropertyGroup>
<LibrariesProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'libraries'))</LibrariesProjectRoot>
<CoreClrProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'coreclr'))</CoreClrProjectRoot>
<MonoProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono'))</MonoProjectRoot>
<InstallerProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'installer'))</InstallerProjectRoot>
<RepoToolsLocalDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'tools-local'))</RepoToolsLocalDir>
<RepoTasksDir>$([MSBuild]::NormalizeDirectory('$(RepoToolsLocalDir)', 'tasks'))</RepoTasksDir>
<IbcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc'))</IbcOptimizationDataDir>
<XmlDocDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'docs'))</XmlDocDir>
</PropertyGroup>

<PropertyGroup>
<EnableNgenOptimization Condition="'$(EnableNgenOptimization)' == '' and '$(Configuration)' == 'Release'">true</EnableNgenOptimization>
</PropertyGroup>

<!-- Honor the generic RuntimeConfiguration property. -->
<PropertyGroup>
<RuntimeConfiguration Condition="'$(RuntimeConfiguration)' == ''">$(Configuration)</RuntimeConfiguration>
Expand Down
9 changes: 9 additions & 0 deletions eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@
artifacts to the test layout, then running the test subset.
-->

<PropertyGroup>
<LibrariesProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'libraries'))</LibrariesProjectRoot>
<CoreClrProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'coreclr'))</CoreClrProjectRoot>
<MonoProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'mono'))</MonoProjectRoot>
<InstallerProjectRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'installer'))</InstallerProjectRoot>
<RepoToolsLocalDir>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'tools-local'))</RepoToolsLocalDir>
<RepoTasksDir>$([MSBuild]::NormalizeDirectory('$(RepoToolsLocalDir)', 'tasks'))</RepoTasksDir>
</PropertyGroup>

<PropertyGroup>
<DefaultSubsetCategories>libraries-installer-coreclr-mono</DefaultSubsetCategories>
<DefaultInstallerSubsets>corehost-managed-depproj-pkgproj-bundle-installers-test</DefaultInstallerSubsets>
Expand Down
30 changes: 28 additions & 2 deletions eng/Tools.props
Original file line number Diff line number Diff line change
@@ -1,13 +1,39 @@
<Project>
<!-- Import to have access to properties/items used both during the Arcade phase and in the repo. -->
<Import Project="$(MSBuildThisFileDirectory)Configurations.props" />
<PropertyGroup>
<MSBuildTreatWarningsAsErrors>false</MSBuildTreatWarningsAsErrors>
<EnableAnalyzers>true</EnableAnalyzers>
</PropertyGroup>

<!-- We need to import this props file which contains PackageReferences to analyzers so that
analyzer build assets are imported via the Tools generated props and targets -->
<Import Project="$(RepositoryEngineeringDir)Analyzers.props" Condition="Exists('$(RepositoryEngineeringDir)Analyzers.props') and '$(DotNetBuildFromSource)' != 'true'" />

<!-- source-built packages -->
<ItemGroup>
<!-- arcade -->
<PackageReference Include="Microsoft.DotNet.GenFacades" Version="$(MicrosoftDotNetGenFacadesVersion)" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Packaging" Version="$(MicrosoftDotNetBuildTasksPackagingVersion)" />

<!-- coreclr -->
<!-- Download the package in the initial arcade restore step to work around race conditions when restoring an msbuild SDK. -->
<PackageDownload Include="Microsoft.NET.Sdk.IL" Version="[$(MicrosoftNETSdkILVersion)]" />

<!-- roslyn -->
<PackageReference Include="Microsoft.Net.Compilers.Toolset" Version="$(MicrosoftNetCompilersToolsetVersion)" PrivateAssets="all" IsImplicitlyDefined="true" />

<!-- mono -->
<PackageReference Include="illink.tasks" Version="$(ILLinkTasksVersion)" PrivateAssets="all" IsImplicitlyDefined="true" ExcludeAssets="build" GeneratePathProperty="true" />
</ItemGroup>

<!-- excluded from offline portion of source build -->
<ItemGroup Condition="'$(DotNetBuildOffline)' != 'true'">
<!-- arcade -->
<PackageReference Include="Microsoft.DotNet.GenAPI" Version="$(MicrosoftDotNetGenApiVersion)" />
</ItemGroup>

<!-- excluded from source build -->
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
<PackageReference Include="Microsoft.DotNet.ApiCompat" Version="$(MicrosoftDotNetApiCompatVersion)" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Feed" Version="$(MicrosoftDotNetBuildTasksFeedVersion)" />
<PackageReference Include="Microsoft.DotNet.VersionTools.Tasks" Version="$(MicrosoftDotNetVersionToolsTasksVersion)" />

Expand Down
6 changes: 3 additions & 3 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>421b20fb860907c45673de791177e3fd61402197</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="5.0.0-beta.20156.4">
<Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="5.0.0-beta.20153.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>421b20fb860907c45673de791177e3fd61402197</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Version="5.0.0-beta.20155.2">
<Dependency Name="Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk" Version="5.0.0-beta.20153.1">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>bc4fa8e7149769db4efd466f160417a32b11f0bf</Sha>
<Sha>421b20fb860907c45673de791177e3fd61402197</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.RemoteExecutor" Version="5.0.0-beta.20153.1">
<Uri>https://github.com/dotnet/arcade</Uri>
Expand Down
6 changes: 5 additions & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@
<UsingToolMicrosoftNetCompilers>true</UsingToolMicrosoftNetCompilers>
<UsingToolIbcOptimization>true</UsingToolIbcOptimization>
<UsingToolXliff>false</UsingToolXliff>
<!-- Paths used during restore -->
<EnableNgenOptimization Condition="'$(EnableNgenOptimization)' == '' and '$(Configuration)' == 'Release'">true</EnableNgenOptimization>
<IbcOptimizationDataDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'ibc'))</IbcOptimizationDataDir>
<XmlDocDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'docs'))</XmlDocDir>
<!-- Blob storage container that has the "Latest" channel to publish to. -->
<ContainerName>dotnet</ContainerName>
<ChecksumContainerName>$(ContainerName)</ChecksumContainerName>
Expand Down Expand Up @@ -56,7 +60,7 @@
<!-- Arcade dependencies -->
<MicrosoftDotNetApiCompatVersion>5.0.0-beta.20153.1</MicrosoftDotNetApiCompatVersion>
<MicrosoftDotNetBuildTasksFeedVersion>5.0.0-beta.20153.1</MicrosoftDotNetBuildTasksFeedVersion>
<MicrosoftDotNetCodeAnalysisVersion>5.0.0-beta.20156.4</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftDotNetCodeAnalysisVersion>5.0.0-beta.20153.1</MicrosoftDotNetCodeAnalysisVersion>
<MicrosoftDotNetGenAPIVersion>5.0.0-beta.20153.1</MicrosoftDotNetGenAPIVersion>
<MicrosoftDotNetGenFacadesVersion>5.0.0-beta.20153.1</MicrosoftDotNetGenFacadesVersion>
<MicrosoftDotNetXUnitExtensionsVersion>5.0.0-beta.20153.1</MicrosoftDotNetXUnitExtensionsVersion>
Expand Down
51 changes: 51 additions & 0 deletions eng/codeAnalysis.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<Project>
<Import Condition="Exists($(AnalyzerPropsFile)) and '$(EnableAnalyzers)' == 'true'" Project="$(AnalyzerPropsFile)" />

<!-- This target is executed when building a project and EnableAnalyzers property is set to true.
It will populate the Analyzer item that is passed to the compiler with the analyzers restored
as package references in Tools.props. Those analyzers will be saved in a props file -> artifacts\toolset\Common\Tools.Analyzers.props.
So in order to add a new analyzer just need to add a package reference in Tools.props to the package containing it.
*
This target also provides filtering for specific type of projects through to Items.
- <AnalyzersToInclude> will include only the specified analyzers and will ignore the others that where restored.
- <AnalyzersToExclude> will exclude the specified analyzers from the restored analyzers, but will preserve the others.
**The values in these Items are the name of the analyzers' dll.
**These to Items are mutually exclusive, so only 1 should be set at a time.
Example of usage:
<AnalyzersToInclude Condition="$(IsTestProject)" Include="Xunit.Analyzers" /> will only include Xunit analyzers.
<AnalyzersToExclude Condition="$(IsSourceProject)" Include="Xunit.Analyzers" /> will include all analyzers but Xunit analyzer. -->

<Target Name="CalculateAnalyzersForBuildTime">
<ItemGroup>
<Analyzer Include="@(ResolvedAnalyzer)" />
</ItemGroup>

<Warning Text="AnalyzersToExclude and AnalyzersToInclude shouldn't be set together, they are mutually exclusive." Condition="'@(AnalyzersToExclude)' != '' and '@(AnalyzersToInclude)' != ''" />

<ItemGroup Condition="'@(AnalyzersToExclude)' != '' or '@(AnalyzersToInclude)' != ''">
<_AnalyzersToFileName Include="@(Analyzer -> '%(FileName)')">
<OriginalIdentity>%(Identity)</OriginalIdentity>
</_AnalyzersToFileName>
</ItemGroup>

<ItemGroup Condition="'@(AnalyzersToExclude)' != ''">
<_AnalyzersToRemove Include="@(_AnalyzersToFileName)" Condition="'@(AnalyzersToExclude)' == '@(_AnalyzersToFileName)' and '%(Identity)' != ''" />
<Analyzer Remove="@(_AnalyzersToRemove -> '%(OriginalIdentity)')" />
</ItemGroup>

<ItemGroup Condition="'@(AnalyzersToInclude)' != ''">
<_AnalyzersToRemove Include="@(_AnalyzersToFileName)" Exclude="@(AnalyzersToInclude)" />
<_missingAnalyzersToInclude Include="@(AnalyzersToInclude)" Exclude="@(_AnalyzersToFileName)" />
<Analyzer Remove="@(_AnalyzersToRemove -> '%(OriginalIdentity)')" />
</ItemGroup>

<Error Text="Couldn't find analyzer to include with values: @(_missingAnalyzersToInclude)" Condition="'@(_missingAnalyzersToInclude)' != '' and '@(_missingAnalyzersToInclude)' != 'None'" />
</Target>

<PropertyGroup Condition="'$(EnableAnalyzers)' == 'true'">
<ResolveReferencesDependsOn>
$(ResolveReferencesDependsOn);
CalculateAnalyzersForBuildTime;
</ResolveReferencesDependsOn>
</PropertyGroup>
</Project>
3 changes: 2 additions & 1 deletion eng/docker/build-docker-sdk.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ if ($buildWindowsContainers)
# Due to size concerns, we don't currently do docker builds on windows.
# Build on the host machine, then simply copy artifacts to the target docker image.
# This should result in significantly lower build times, for now.
& "$REPO_ROOT_DIR/build.cmd" -ci -subsetcategory coreclr-libraries -runtimeconfiguration release -c $configuration
& "$REPO_ROOT_DIR/coreclr.cmd" -c Release
& "$REPO_ROOT_DIR/libraries.cmd" -ci -c $configuration -runtimeConfiguration release

# Dockerize the build artifacts
docker build --tag $imageName `
Expand Down
3 changes: 2 additions & 1 deletion eng/docker/libraries-sdk.linux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ WORKDIR /repo
COPY . .

ARG CONFIGURATION=Release
RUN ./build.sh -ci -subsetcategory coreclr-libraries -runtimeconfiguration release -c $CONFIGURATION
RUN ./src/coreclr/build.sh -release -skiptests -clang9 && \
./libraries.sh -c $CONFIGURATION -runtimeconfiguration release

FROM $SDK_BASE_IMAGE as target

Expand Down
4 changes: 2 additions & 2 deletions eng/pipelines/libraries/enterprise/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ variables:
- name: enterpriseTestsSetup
value: $(sourcesRoot)/Common/tests/System/Net/EnterpriseTests/setup
- name: containerRunTestsCommand
value: /repo/.dotnet/dotnet build /t:test
value: /repo/.dotnet/dotnet build /t:test --no-restore
- name: containerLibrariesRoot
value: /repo/src/libraries

Expand All @@ -50,7 +50,7 @@ steps:
displayName: Test linuxclient connection to web server

- bash: |
docker exec linuxclient bash -c '/repo/build.sh -subsetcategory coreclr-libraries -runtimeconfiguration release -ci'
docker exec linuxclient bash -c '/repo/src/coreclr/build.sh -release -skipnuget -clang9 && /repo/libraries.sh /p:CoreCLRConfiguration=Release'
displayName: Build product sources

- bash: |
Expand Down
2 changes: 1 addition & 1 deletion eng/restore/repoRestore.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@
<ComputeNETCoreBuildOutputFiles>false</ComputeNETCoreBuildOutputFiles>
<GenerateRuntimeConfigurationFiles>false</GenerateRuntimeConfigurationFiles>
</PropertyGroup>
</Project>
</Project>
2 changes: 2 additions & 0 deletions eng/restore/repoRestore.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
<RestoreProjectStyle Condition="'$(MSBuildProjectExtension)' != '.depproj'">Unknown</RestoreProjectStyle>
</PropertyGroup>

<Import Project="$(RepositoryEngineeringDir)codeAnalysis.targets" />

<PropertyGroup>
<!-- Nuget will normally disable all generated imports as part of a restore to avoid
non-determinism where first restore changes a subsequent restore,
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"python": "2.7.15"
},
"msbuild-sdks": {
"Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.20156.4",
"Microsoft.DotNet.Build.Tasks.TargetFramework.Sdk": "5.0.0-beta.20153.1",
"Microsoft.DotNet.Arcade.Sdk": "5.0.0-beta.20153.1",
"Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk": "5.0.0-beta.20153.1",
"Microsoft.DotNet.Helix.Sdk": "5.0.0-beta.20153.1",
Expand Down
Loading

0 comments on commit 73268c7

Please sign in to comment.