Skip to content

Remove unused dependencies and clean-up & Update dependencies from roslyn and arcade - #1812

Merged
sharwell merged 8 commits into
dotnet:mainfrom
ViktorHofer:FormatRefactoring
Apr 20, 2023
Merged

sharwell merged 8 commits into
dotnet:mainfrom
ViktorHofer:FormatRefactoring

Conversation

@ViktorHofer

@ViktorHofer ViktorHofer commented Apr 20, 2023 •

Copy link
Copy Markdown
Member
  1. Clean-up package dependencies that aren't needed.
  2. The "<?xml" tags aren't required anymore by msbuild
  3. Define versions in Versions.props consistently. Consider later adding
    dependabot support for external dependencies.
  4. Move common properties into Directory.Build.props (ie LangVersion).
  5. Remove unused dotnet7 feed.
  6. Use reference assemblies package used to compile the tests for
    running the tests.
  7. Update dependencies from arcade and roslyn
  8. Update integration test repo SHAs to be able to build those repos
    with the now updated repo local 8.0 P3 SDK.

This fixes the observed issues in the "Code velocity chat" and cleans up the repository.

Version changes

Commit 1 and 2 upgrade dependencies (Arcade + Roslyn)

Commit 3 updates the following versions:
MicrosoftBuildVersion -> 17.3.2
Microsoft.Extensions.FileSystemGlobbing -> 7.0.0
Microsoft.Extensions.Logging -> 7.0.0
BenchmarkDotNet -> 0.13.5
BenchmarkDotNet.Annotations -> 0.13.5

Microsoft.DiaSymReader -> 2.0.0-beta-22503-02 (transitive dependency)

Microsoft.VisualBasic -> 10.3.0 (transitive test dependency)
NETStandard.Library -> 2.0.3 (transitive test dependency)
NuGetVersion -> 6.6.0-preview.3.61 (transitive test dependency)
Microsoft.VisualStudio.Composition -> 17.4.16 (transitive test dependency)

@ghost ghost added the Community label Apr 20, 2023
@ViktorHofer

ViktorHofer commented Apr 20, 2023 •

Copy link
Copy Markdown
Member Author

Questions for @mmitche and @MichaelSimons: Should dotnet/format add a subscription to runtime and msbuild so that dependencies are kept up-to-date?

We could also add a toolset dependency for nuget which is currently brought in just for test purposes.

@ViktorHofer
ViktorHofer force-pushed the FormatRefactoring branch 4 times, most recently from f030a2d to f1f6063 Compare April 20, 2023 12:05
Comment thread eng/Versions.props
Comment on lines +30 to +31
<!-- In order tests against the same version of NuGet as the SDK. We have to set this to match. -->
<NuGetVersion>6.6.0-preview.3.61</NuGetVersion>

@ViktorHofer ViktorHofer Apr 20, 2023 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the concerning part in this repository. The tests currently require the version of NuGet assemblies referenced (transitively via Microsoft.CodeAnalysis.Analyzer.Testing but bumped up directly in the project file) and the local SDK to match. We should try to remove this dependency somehow as a follow-up. Otherwise we would put a high pressure on SBRP or not be able to regularly update to latest preview SDK pushed by Arcade. cc @mmitche

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, avoiding such an exact match would be good.

Comment thread azure-pipelines-integration.yml Resolved
Comment thread eng/format-verifier.ps1 Outdated
if ($stage -eq "format-workspace") {
Write-Output "$(Get-Date) - $solutionFile - Formatting Workspace"
$output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net7.0/dotnet-format.dll" $solution --no-restore -v diag --verify-no-changes | Out-String
$output = dotnet.exe "$currentLocation/artifacts/bin/dotnet-format/Release/net8.0/dotnet-format.dll" $solution --no-restore -v diag --verify-no-changes | Out-String

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened an issue for the hardcoded TFM values: #1814

Comment thread Directory.Build.props Resolved
Comment thread Directory.Packages.props Resolved
Comment thread eng/Versions.props Resolved
1. Clean-up package dependencies that aren't needed.
2. The "<?xml" tags aren't required anymore by msbuild
3. Define versions in Versions.props consistently. Consider later adding
   dependabot support for external dependencies.
4. Move common properties into Directory.Build.props (ie LangVersion).
5. Remove unused dotnet7 feed.
6. Use reference assemblies package used to compile the tests for
   running the tests.
@@ -30,9 +37,19 @@ private static async Task<IEnumerable<MetadataReference>> GetReferencesAsync()
MetadataReference.CreateFromFile(typeof(CodeFixProvider).Assembly.Location),
};

@sharwell sharwell Apr 20, 2023 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 All of these should be removed and resolved from NuGet packages instead of from assemblies on disk. The only time MetadataReference.CreateFromFile(typeof(T).Assembly.Location) is valid is when the test assembly is defined in the same repository as T.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you don't mind, let's do that in a follow-up as this is already existent in main. Would you mind filing an issue?

Comment thread azure-pipelines-integration.yml Resolved
Comment thread azure-pipelines-integration.yml Resolved
netCurrentReferenceAssemblies = netCurrentReferenceAssemblies.WithNuGetConfigFilePath(nugetConfigPath);

var netcoreMetadataReferences = await netCurrentReferenceAssemblies.ResolveAsync(LanguageNames.CSharp, CancellationToken.None);
references.AddRange(netcoreMetadataReferences.Where(reference => Path.GetFileName(reference.Display) != "System.Collections.Immutable.dll"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❔ Do we still need this line?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That code is still valid as System.Collections.Immutable.dll is part of the Microsoft.NETCore.App.Ref targeting pack. I have no context here but I assume the assembly is filtered out as it's coming in via an external dependency and this is a lazy attempt to replicate msbuild's conflict resolution.

This should probably be removed together with your above feedback

All of these should be removed and resolved from NuGet packages instead of from assemblies on disk. The only time MetadataReference.CreateFromFile(typeof(T).Assembly.Location) is valid is when the test assembly is defined in the same repository as T.

@sharwell
sharwell merged commit 10bb007 into dotnet:main Apr 20, 2023
@ghost ghost added this to the Next milestone Apr 20, 2023
@ViktorHofer
ViktorHofer deleted the FormatRefactoring branch April 20, 2023 17:43
MichaelSimons referenced this pull request Apr 21, 2023
[main] Update dependencies from dotnet/arcade


 - Update Versions.props

 - Update NuGet version to 6.6.0-preview.3.57

 - Merge branch 'main' into darc-main-3d6ee651-0e5b-4cab-b906-1bc0244ff60f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants