Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature-intern-ResolveDependencyConflictsNew to main #10343

Merged
merged 3 commits into from
Aug 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ git.store
Dockerfile*
*.md
CODEOWNERS
**/.vs
**/NuGetUpdater/artifacts
2 changes: 1 addition & 1 deletion .github/workflows/smoke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ concurrency:

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SMOKE_TEST_BRANCH: main
SMOKE_TEST_BRANCH: feature-DependencySolver
Copy link
Contributor

Choose a reason for hiding this comment

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

q: was this change meant to be checked in?

Copy link
Contributor

Choose a reason for hiding this comment

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

We added a smoke test, this was just to make sure it was green in CI. The commit that added this will be removed prior to merging.

Copy link
Contributor

Choose a reason for hiding this comment

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

We just revert back this change because we are getting error.

Copy link
Contributor

Choose a reason for hiding this comment

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

jobs:
discover:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ coverage/
# Ignore spoom coverage report
spoom_data/
spoom_report.html
.vs/
2 changes: 2 additions & 0 deletions nuget/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
**/.vs
**/NuGetUpdater/artifacts
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,7 @@ private static async Task Run(Func<string, string[]> getArgs, (string Path, stri
try
{
await MockNuGetPackagesInDirectory(packages, path);

var args = getArgs(path);
var result = await Program.Main(args);
if (result != 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ await TestUpdateForProject("Some.Package", "9.0.1", "13.0.1",
);
}

[Fact]
public async Task UpdateVersionChildElement_InProjectFile_ForPackageReferenceInclude()
[Theory]
[InlineData("true")]
[InlineData(null)]
public async Task UpdateVersionChildElement_InProjectFile_ForPackageReferenceIncludeTheory(string variableValue)
{
// update Some.Package from 9.0.1 to 13.0.1
using var env = new TemporaryEnvironment([("UseNewNugetPackageResolver", variableValue)]);
await TestUpdateForProject("Some.Package", "9.0.1", "13.0.1",
packages:
[
Expand Down Expand Up @@ -91,6 +94,43 @@ await TestUpdateForProject("Some.Package", "9.0.1", "13.0.1",
);
}

[Fact]
public async Task CallingResolveDependencyConflictsNew()
{
// update Microsoft.CodeAnalysis.Common from 4.9.2 to 4.10.0
using var env = new TemporaryEnvironment([("UseNewNugetPackageResolver", "true")]);
await TestUpdateForProject("Microsoft.CodeAnalysis.Common", "4.9.2", "4.10.0",
// initial
projectContents: $"""
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.9.2" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.9.2" />
</ItemGroup>
</Project>
""",
// expected
expectedProjectContents: $"""
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Compilers" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.Common" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.10.0" />
<PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" Version="4.10.0" />
</ItemGroup>
</Project>
"""
);
}

[Fact]
public async Task UpdateVersions_InProjectFile_ForDuplicatePackageReferenceInclude()
{
Expand Down Expand Up @@ -489,9 +529,12 @@ await TestUpdateForProject("Some.Package", "9.0.1", "13.0.1",
);
}

[Fact]
public async Task AddPackageReference_InProjectFile_ForTransientDependency()
[Theory]
[InlineData(null)]
[InlineData("true")]
public async Task AddPackageReference_InProjectFile_ForTransientDependency(string variableValue)
{
using var env = new TemporaryEnvironment([("UseNewNugetPackageResolver", variableValue)]);
// add transient package Some.Transient.Dependency from 5.0.1 to 5.0.2
await TestUpdateForProject("Some.Transient.Dependency", "5.0.1", "5.0.2", isTransitive: true,
packages:
Expand Down Expand Up @@ -2862,9 +2905,13 @@ await TestUpdateForProject("Some.Package", "12.0.1", "13.0.1",
);
}

[Fact]
public async Task NoChange_IfThereAreIncoherentVersions()
[Theory]
[InlineData("true")]
[InlineData(null)]
public async Task NoChange_IfThereAreIncoherentVersions(string variableValue)
{
using var env = new TemporaryEnvironment([("UseNewNugetPackageResolver", variableValue)]);

// trying to update `Transitive.Dependency` to 1.1.0 would normally pull `Some.Package` from 1.0.0 to 1.1.0,
// but the TFM doesn't allow it
await TestNoChangeforProject("Transitive.Dependency", "1.0.0", "1.1.0",
Expand Down Expand Up @@ -2948,9 +2995,13 @@ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
);
}

[Fact]
public async Task UnresolvablePropertyDoesNotStopOtherUpdates()
[Theory]
[InlineData("true")]
[InlineData(null)]
public async Task UnresolvablePropertyDoesNotStopOtherUpdates(string variableValue)
{
using var env = new TemporaryEnvironment([("UseNewNugetPackageResolver", variableValue)]);

// the property `$(SomeUnresolvableProperty)` cannot be resolved
await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
packages:
Expand Down Expand Up @@ -2984,9 +3035,13 @@ await TestUpdateForProject("Some.Package", "7.0.1", "13.0.1",
);
}

[Fact]
public async Task UpdatingPackageAlsoUpdatesAnythingWithADependencyOnTheUpdatedPackage()
[Theory]
[InlineData("true")]
[InlineData(null)]
public async Task UpdatingPackageAlsoUpdatesAnythingWithADependencyOnTheUpdatedPackage(string variableValue)
{
using var env = new TemporaryEnvironment([("UseNewNugetPackageResolver", variableValue)]);

// updating Some.Package from 3.3.30 requires that Some.Package.Extensions also be updated
await TestUpdateForProject("Some.Package", "3.3.30", "3.4.3",
packages:
Expand Down
Loading
Loading