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

Runtime pack resolution #19596

Merged
merged 9 commits into from
Aug 12, 2021
Merged

Conversation

dsplaisted
Copy link
Member

@dsplaisted dsplaisted commented Aug 9, 2021

Fixes #14044
Fixes #18064

  • Resolves runtime packs from packs directory if present
  • Supports using DOTNETSDK_WORKLOAD_PACK_ROOTS environment variable to set additional packs folders for targeting and runtime packs
    • The packs should be under a packs subfolder of the directory specified by the environment variable
  • Supports resolving targeting or runtime pack versions from workload manifest
    • To use this, the version in the KnownFrameworkReference or KnownRuntimePack item should be set to **FromWorkload**

{
yield return TargetingPackRoot;
}
var packRootEnvironmentVariable = Environment.GetEnvironmentVariable("DOTNETSDK_WORKLOAD_PACK_ROOTS");
Copy link
Member

Choose a reason for hiding this comment

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

Do we have a central class where we can keep all these environmental variable constants? That way we don't need to worry about typo's in the code.

Copy link
Member

Choose a reason for hiding this comment

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

Thank you. I think this will save us a lot of potential pain in the future

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added one now (EnvironmentVariableNames) and added constants for the workload environment variables. There are a bunch of other CLI environment variables which I didn't refactor into this class yet.

@dsplaisted
Copy link
Member Author

@joeloff I've updated this PR to apply your feedback and also to now address #18064. So a re-review would be good :-)

@joeloff
Copy link
Member

joeloff commented Aug 12, 2021

@joeloff I've updated this PR to apply your feedback and also to now address #18064. So a re-review would be good :-)

I'll take another pass tonight


private string GetResolvedPackVersion(string packID, string packVersion)
{
if (!packVersion.Equals("**FromWorload**", StringComparison.OrdinalIgnoreCase))
Copy link
Member

Choose a reason for hiding this comment

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

Should be "FromWorkload"?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops! Thanks for catching that :-)

DefaultRuntimeFrameworkVersion='**FromWorload**'
LatestRuntimeFrameworkVersion='**FromWorload**'
TargetingPackName='Microsoft.NETCore.App.Test.Ref'
TargetingPackVersion='**FromWorload**'
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a typo - should be FromWorkload?

@joeloff
Copy link
Member

joeloff commented Aug 12, 2021

I think this looks good.

@dsplaisted dsplaisted enabled auto-merge August 12, 2021 06:19
@dsplaisted dsplaisted merged commit 865fdb6 into dotnet:main Aug 12, 2021
@@ -0,0 +1,914 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Contributor

Choose a reason for hiding this comment

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

src/Tasks/Common/Resources/xlf/Strings.ja.xlf~RF1ea49cc.TMP looks like a name for a temporary file; did you add this by accident?

There is the older Strings.es.xlf~RF13d378ed.TMP as well.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah this looks like a mistake, filed #19688 to delete them.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for catching that. I've submitted #19694 to fix.

jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 13, 2021
Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the Android workload.

You can simply do:

    ~/android-toolchain/dotnet/dotnet new android
    ~/android-toolchain/dotnet/dotnet build
var packInfo = _workloadResolver.TryGetPackInfo(new WorkloadPackId(packID));
if (packInfo == null)
{
Log.LogError("NETSDKZZZZ: Error getting pack version: Pack '{0}' was not present in workload manifests.", packID);
Copy link
Contributor

Choose a reason for hiding this comment

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

Placeholder error code?

dellis1972 pushed a commit to dotnet/android that referenced this pull request Aug 16, 2021
…6184)

Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the Android workload.

You can simply do:

    ~/android-toolchain/dotnet/dotnet new android
    ~/android-toolchain/dotnet/dotnet build
jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Aug 16, 2021
Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file for
projects when you have the `maui` workload installed.

One caveat for dotnet/maui is we have a `$(MicrosoftMauiSdkVersion)`.
We'll need to use `**FromWorkload**` in some places, and the actual
number when declaring `@(PackageReference)`.
jonathanpeppers added a commit to jonathanpeppers/xamarin-macios that referenced this pull request Aug 16, 2021
Context: dotnet/sdk#19596
Context: dotnet/android#6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />
jonathanpeppers added a commit to jonathanpeppers/maui that referenced this pull request Aug 17, 2021
Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file for
projects when you have the `maui` workload installed.

One caveat for dotnet/maui is we have a `$(MicrosoftMauiSdkVersion)`.
We'll need to use `**FromWorkload**` in some places, and the actual
number when declaring `@(PackageReference)`.
jonathanpeppers added a commit to jonathanpeppers/xamarin-macios that referenced this pull request Aug 18, 2021
Context: dotnet/sdk#19596
Context: dotnet/android#6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />
jonathanpeppers added a commit to jonathanpeppers/xamarin-macios that referenced this pull request Aug 18, 2021
Context: dotnet/sdk#19596
Context: dotnet/android#6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />
jonathanpeppers added a commit to jonathanpeppers/xamarin-macios that referenced this pull request Aug 18, 2021
Context: dotnet/sdk#19596
Context: dotnet/android#6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />
jonathanpeppers added a commit to jonathanpeppers/xamarin-macios that referenced this pull request Aug 18, 2021
Context: dotnet/sdk#19596
Context: dotnet/android#6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of the xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />

To further clean things up, I removed the need for:

* Any NuGet feed named `local-dotnet-feed`
* `$(DOTNET_FEED_DIR)`
* Generation of `dotnet/Workloads/NuGet.config`
Redth pushed a commit to dotnet/maui that referenced this pull request Aug 18, 2021
…2122)

Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file for
projects when you have the `maui` workload installed.

One caveat for dotnet/maui is we have a `$(MicrosoftMauiSdkVersion)`.
We'll need to use `**FromWorkload**` in some places, and the actual
number when declaring `@(PackageReference)`.
rolfbjarne pushed a commit to xamarin/xamarin-macios that referenced this pull request Aug 19, 2021
…2449)

Context: dotnet/sdk#19596
Context: dotnet/android#6184

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file when
building a .NET 6 app with a local build of xamarin-macios.

You will no longer need a feed such as:

    <add key="local-dotnet-feed" value="~/src/xamarin-macios/_build/nuget-feed" />

To further clean things up, I removed the need for:

* Any NuGet feed named `local-dotnet-feed`
* `$(DOTNET_FEED_DIR)`
* Generation of `dotnet/Workloads/NuGet.config`
WonyoungChoi added a commit to Samsung/Tizen.NET that referenced this pull request Aug 27, 2021
maxkatz6 pushed a commit to AvaloniaUI/Avalonia.Essentials that referenced this pull request May 15, 2023
…#2122)

Context: dotnet/sdk#19596

If we use the version number string of `**FromWorkload**`, then our
runtime packages don't need to be resolved from a NuGet feed. They can
be resolved from the `dotnet/packs` directory.

This completely eliminates the need for a `NuGet.config` file for
projects when you have the `maui` workload installed.

One caveat for dotnet/maui is we have a `$(MicrosoftMauiSdkVersion)`.
We'll need to use `**FromWorkload**` in some places, and the actual
number when declaring `@(PackageReference)`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants