-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Include assembly and file versions in deps file for non self-contained publish #2118
Include assembly and file versions in deps file for non self-contained publish #2118
Conversation
@steveharter @eerhardt Here's my PR for adding the assembly and file versions to the deps.json as requested in #1847. My end-to-end test (
Can you help me figure out why the test is failing? |
// deps.json to support rolling forward to a newer shared framework. See https://github.com/dotnet/core-setup/pull/3704 | ||
// Reading these versions could impact build perf, so we avoid doing it if we aren't publishing or if we are | ||
// publishing a self-contained app. | ||
bool includeRuntimeFileVersions = IsPublish && !IsSelfContained; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be better to use projectContext.IsFrameworkDependent
here instead of !IsSelfContained
. The comment even says "publishing a framework-dependent app".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about moving this logic out of the C# task all together and making a property for "IncludeRuntimeFileVersions" that is defaulted in the MSBuild XML? That way someone could turn this on even if they weren't publishing, or in a self-contained app in case they wanted this info for some reason.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to be able to have the info on non-publish optionally.
What Steve and I had considered was:
Default experience:
- Build (F5) -> runtimeconfig.dev.json disables roll forward
- Publish -> writes the info
But there could be an opt-in to have build write the info (taking a perf hit) and not disable roll forward.
Can you try repro'ing it outside of the test, and then set Also, ensure you are using a recent host build. How old of a version are you using? |
@eerhardt Here's the COREHOST_TRACE output: I think the version of the host I'm using is 2.1.0-preview2-26314-02 (that's the version of the runtime that's being used). |
Here's the log for the two deps entries:
So it looks like the framework's deps file doesn't have the metadata added yet... So it will never "win" in a conflict. |
9c87cf6
to
b4c7edf
Compare
@eerhardt @steveharter @weshaggard I think this is ready for review. Per discussion with @eerhardt, the runtime's deps.json is generated using the SDK, so in order to include the file and assembly versions in it, we will need to get this change into the SDK and then update the runtime deps generation process to use the updated SDK. I've filed #2124 to enable the failing end-to-end test from this PR once that happens. |
<!-- | ||
If publishing a framework-dependent app, then include the assembly and file versions of files in the | ||
deps.json to support rolling forward to a newer shared framework. See https://github.com/dotnet/core-setup/pull/3704 | ||
Reading these versions could impact build perf, so we avoid doing it by default if we aren't publishing or if we are |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you measured the overhead?
} | ||
} | ||
|
||
[Fact(Skip = "Host deps.json doesn't have runtime file version info yet: https://github.com/dotnet/sdk/issues/2124")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you try mocking the metadata (to see if it will pass when the metadata is available)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending test success
Do you have an issue or reminder to enable the test once the framework metadata is available?
50ff015
to
e18c743
Compare
I think this is going to cause issues with source-build. Source-build is currently using /cc @dseefeld @weshaggard |
@@ -538,7 +569,7 @@ private IEnumerable<RuntimeLibrary> GetDirectReferenceRuntimeLibraries() | |||
name: GetReferenceLibraryName(r), | |||
version: r.Version, | |||
hash: string.Empty, | |||
runtimeAssemblyGroups: new[] { new RuntimeAssetGroup(string.Empty, r.FileName) }, | |||
runtimeAssemblyGroups: new[] { new RuntimeAssetGroup(string.Empty, new[] { CreateRuntimeFile(r.FileName, r.FullPath) }) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note - when @tannergooding's change #2090 goes in, we will need to merge this with that, so the new references get CreateRuntimeFile
called on them as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#2090 was merged, was this handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tannergooding @eerhardt It looks like this is handled correctly, as the new code from #2090 ends up calling through GetReferenceRuntimeLibraries
for the indirect references, the same as how the direct references are handled.
@@ -156,5 +159,52 @@ private void ExtractNupkg(string nugetCache, string nupkg) | |||
} | |||
} | |||
} | |||
|
|||
private class MockPackageDownloader : IPackageDownloader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated to the feature. I retargeted this to master, and tests targeting .NET Core 2.1 were failing. So I'm trying to update the stage 0 CLI, which brought in an update to NuGet, which had API changes which required this addition... 🤷♂️
e18c743
to
e346737
Compare
@@ -156,5 +159,52 @@ private void ExtractNupkg(string nugetCache, string nupkg) | |||
} | |||
} | |||
} | |||
|
|||
private class MockPackageDownloader : IPackageDownloader |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nkolev92 @rohit21agrawal Can you provide guidance on how to implement an IPackageDownloader
for a test like this? I tried naively just implementing one method, and it looks like it's failing when it calls the SignedPackageReader
getter. What actually needs to be implemented here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we have a test implementation here: https://github.com/NuGet/NuGet.Client/blob/dev/test/NuGet.Core.Tests/NuGet.Packaging.Test/NugetPackageUtilTests.cs#L805
Hope that helps!
e346737
to
dcc217c
Compare
@dotnet-bot test this |
@dotnet-bot test this please |
@dotnet-bot test this |
@dotnet-bot test this please |
820d4a0
to
afa2714
Compare
var testAsset = _testAssetsManager.CreateTestProject(testProject) | ||
.Restore(Log, testProject.Name); | ||
var testAsset = _testAssetsManager.CreateTestProject(testProject); | ||
NuGetConfigWriter.Write(testAsset.TestRoot, NuGetConfigWriter.DotnetCoreMyGetFeed); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnbeisner Without adding this feed I get an error on CI: Unable to find package Microsoft.NETCore.App with version (>= 2.1.0-preview3-26411-06
Should this package not be in the dotnet-core blob storage feed?
@steveharter, @dsplaisted, when will this change get merged? It is blocking release due to the following issue: https://github.com/dotnet/corefx/issues/29032 |
cc @joshfree, @weshaggard, @ericstj |
source-build is using 2.1.101 SDK to build 2.1 Preview 2 (producing a source-built 2.1.300 SDK). We will then move to using 2.1.300 SDK to build RC. We need to do this because msbuild also needs 2.1.300 SDK to build. I think source-build is good here. |
@dleeapho So source-build 2.1 RC will be released after the RTM of the 2.1.300 SDK? |
@dsplaisted no, RC is before RTM for source-build. The point is that we are bootstrapping the use of 2.1.300 SDK as a source-build toolset for RC, RTW via Preview 2. |
Fixes dotnet#1942 (in most cases)
…e or .NET Standard
3bc399f
to
d29e8a5
Compare
@dotnet-bot test OSX10.12 Release |
} | ||
|
||
public static string NormalizeRelativePath(string relativePath) | ||
=> relativePath.Replace('/', Path.DirectorySeparatorChar); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: indentation looks non-standard here.
@ahsonkhan It just got merged |
@dsplaisted, what version of the cli/sdk do we need to test that this change fixed https://github.com/dotnet/corefx/issues/29032? |
@mmitche can you tell us when there's a prodcon build with this change? |
It appears this was in last night's build, according to https://github.com/dotnet/versions/tree/657165b2995d4383d61f02cff0e89f27721daa34/build-info/dotnet/product/cli/release/2.1#built-repositories |
Make note again that a follow-up change is needed to get versions in to runtime's deps.json as well. |
This means that core-setup will only be able to use the Preview 2 SDK for building RC which means that core-setup will not have this update deps file for RC (at least not in source-build). |
I am assuming we have to wait for https://github.com/dotnet/core-setup/issues/4082.
I tried that build, and still see a failure when building the repro provided in dotnet/corefx#29032 (with a different error though) |
Different error is normal, its failing earlier now: on load of the wrong assembly, rather than later on when it tries to find API that isn't there. |
Fixes #1847
Also fixes #1942 (in most cases)