Skip to content

[workoad] include missing dependencies in the workload#2281

Merged
Redth merged 3 commits intodotnet:mainfrom
jonathanpeppers:dotnet-new-nugetconfig
Sep 3, 2021
Merged

[workoad] include missing dependencies in the workload#2281
Redth merged 3 commits intodotnet:mainfrom
jonathanpeppers:dotnet-new-nugetconfig

Conversation

@jonathanpeppers
Copy link
Member

@jonathanpeppers jonathanpeppers commented Aug 27, 2021

Description of Change

I found that using .NET 6 rc.1/rc.2 builds, if you do:

  • dotnet new maui
  • dotnet build

You'll get build errors unless you add the dotnet6 feed to a
nuget.config:

<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />

We should put these packages inside the workload as library-packs,
so this is not needed. I had to start tracking various versions of
packages through Maestro for us to be able to do this.

To further help delimit what packs are for what, I created an abstract
maui-blazor workload. This is a way for us to know which packs are
only needed for Blazor. These packs are still installed by default for
all .NET MAUI workloads like maui-desktop, maui-mobile, etc., but
this gives us flexibility down the road.

To verify this won't break going forward, let's use an empty
nuget.config before building the templates.

dotnet new nugetconfig outputs:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
  </packageSources>
</configuration>

We should be able to build apps with only the packs the workload
installed or NuGet.org.

PR Checklist

  • Targets the correct branch
  • Tests are passing (or failures are unrelated)
  • Targets a single property for a single control (or intertwined few properties)
  • Adds the property to the appropriate interface
  • Avoids any changes not essential to the handler property
  • Adds the mapping to the PropertyMapper in the handler
  • Adds the mapping method to the Android, iOS, and Standard aspects of the handler
  • Implements the actual property updates (usually in extension methods in the Platform section of Core)
  • Tags ported renderer methods with [PortHandler]
  • Adds an example of the property to the sample project (MainPage)
  • Adds the property to the stub class
  • Implements basic property tests in DeviceTests

Does this PR touch anything that might affect accessibility?

No

@jonathanpeppers jonathanpeppers force-pushed the dotnet-new-nugetconfig branch 9 times, most recently from 6ca1c49 to 5233524 Compare August 31, 2021 15:49
@jonathanpeppers
Copy link
Member Author

Now dotnet new maui passes!

dotnet new maui-blazor fails with:

error NU1102: Unable to find package Microsoft.AspNetCore.Authorization with version (>= 6.0.0-rc.2.21420.26)
error NU1102: Unable to find package Microsoft.AspNetCore.Components.WebView with version (>= 6.0.0-rc.2.21420.26)
error NU1102: Unable to find package Microsoft.JSInterop with version (>= 6.0.0-rc.2.21420.26)

I may move these and BlazorWebView into a new maui-blazor workload that the other workloads extend.

@Eilon
Copy link
Contributor

Eilon commented Sep 1, 2021

Wow, lots of stuff here. I knew workloads weren't simple, but oh boy. I guess the test updates will help us catch these all sooner? I'm sure I'm guilty of most, if not all of these errors. Sorry about that.

What does a new maui-blazor workload imply? It's in some sense a pretty small thing with only a few involved packages, so it isn't clear to me the cost/benefit of more smaller workloads vs. fewer slightly chunkier workloads.

@jonathanpeppers
Copy link
Member Author

I made maui-blazor for us to just know what pieces are only needed for Blazor, and it will make it easier to estimate the real size.

In this PR, maui-blazor is abstract and shouldn't change the way anything works. You still get it if you install maui, maui-mobile, maui-desktop, maui-android, maui-ios, etc.

I'm still working on this; hopefully, it's completely working soon.

@jonathanpeppers
Copy link
Member Author

BEHOLD!

image

Need to clean this up now and write a proper commit message.

I found that using .NET 6 rc.1/rc.2 builds, if you do:

* `dotnet new maui`
* `dotnet build`

You'll get build errors unless you add the `dotnet6` feed to a
`nuget.config`:

    <add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />

We should put these packages *inside* the workload as `library-packs`,
so this is not needed. I had to start tracking various versions of
packages through Maestro for us to be able to do this.

To further help delimit what packs are for what, I created an abstract
`maui-blazor` workload. This is a way for us to know which packs are
only needed for Blazor. These packs are still installed by default for
all .NET MAUI workloads like `maui-desktop`, `maui-mobile`, etc., but
this gives us flexibility down the road.

To verify this won't break going forward, let's use an empty
`nuget.config` before building the templates.

`dotnet new nugetconfig` outputs:

    <?xml version="1.0" encoding="utf-8"?>
    <configuration>
      <packageSources>
        <!--To inherit the global NuGet package sources remove the <clear/> line below -->
        <clear />
        <add key="nuget" value="https://api.nuget.org/v3/index.json" />
      </packageSources>
    </configuration>

We should be able to build apps with only the packs the workload
installed or NuGet.org.
@jonathanpeppers jonathanpeppers changed the title [tests] empty nuget.config when building templates [workoad] include missing dependencies in the workload Sep 2, 2021
Comment on lines +3 to +9
<!-- dotnet/installer -->
<MicrosoftDotnetSdkInternalPackageVersion>6.0.100-rc.2.21423.2</MicrosoftDotnetSdkInternalPackageVersion>
<!-- dotnet/runtime -->
<MicrosoftNETCoreAppRefPackageVersion>6.0.0-rc.2.21420.29</MicrosoftNETCoreAppRefPackageVersion>
<!-- xamarin/xamarin-android -->
<MicrosoftAndroidSdkWindowsPackageVersion>31.0.100-rc.2.12</MicrosoftAndroidSdkWindowsPackageVersion>
<MicrosoftMacCatalystSdkPackageVersion>15.0.100-rc.1.521</MicrosoftMacCatalystSdkPackageVersion>
<!-- xamarin/xamarin-macios -->
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 tried to put important values at the top here with comments, and alphabetically sorted the rest.

Comment on lines +59 to +62
<Dependency Name="Microsoft.Extensions.Configuration.Binder" Version="6.0.0-rc.2.21420.29" CoherentParentDependency="Microsoft.AspNetCore.App.Runtime.win-x64">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>91406a13fb953d6ba8a6e274e8a6f6d240ac9436</Sha>
</Dependency>
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 don't know of a good VS Code command to sort XML elements, I just tried to put them in OK places. Things are "kind of" sorted.

Copy link
Contributor

Choose a reason for hiding this comment

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

"Kind of" is good enough in my book!

},
"Microsoft.Maui.Graphics.Win2D.WinUI.Desktop": {
"kind": "library",
"version": "@MicrosoftMauiGraphicsWin2DVersion@"
Copy link
Contributor

Choose a reason for hiding this comment

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

This version identifier doesn't seem to match the package name, but I'm not sure what it should be because I can't seem to find the name I would "expect" it to be: MicrosoftMauiGraphicsWin2DWinUIDesktopPackageVersion

Copy link
Member Author

Choose a reason for hiding this comment

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

These Microsoft.Maui.Graphics packages aren't on Maestro, they have custom property names:

<!-- Microsoft.Maui.Graphics.* have custom property names -->
<_VersionsToReplace Include="MicrosoftMauiGraphicsVersion" PropertyName="_MicrosoftMauiGraphics" />
<_VersionsToReplace Include="MicrosoftMauiGraphicsWin2DVersion" PropertyName="_MicrosoftMauiGraphicsWin2D" />

I should add PackageVersion on the end of the name in this file, though to be consistent.

@jonathanpeppers jonathanpeppers marked this pull request as ready for review September 2, 2021 19:01
Copy link
Contributor

@Eilon Eilon left a comment

Choose a reason for hiding this comment

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

CI seems happy, so I say it's legit!

@Redth Redth merged commit 00507dc into dotnet:main Sep 3, 2021
@jonathanpeppers jonathanpeppers deleted the dotnet-new-nugetconfig branch September 3, 2021 18:07
Csaba8472 added a commit to Csaba8472/maui that referenced this pull request Sep 6, 2021
* upstream/main: (326 commits)
  Re-enable interpreter on blazor by default
  Determine size of auto cells in GridLayout correctly when views occupy same cell (dotnet#2391)
  [main] Update dependencies from xamarin/xamarin-macios (dotnet#2326)
  [Android] Fix Horizontal Scrollbar Visibility (dotnet#2374)
  Try start vs4mac with local dotnet (dotnet#2386)
  [workoad] include missing dependencies in the workload (dotnet#2281)
  Update project templates to work with safe characters (dotnet#2368)
  [release/6.0.1xx-rc1] Update dependencies from xamarin/xamarin-android (dotnet#2369)
  Update dependencies from https://github.com/xamarin/xamarin-macios build 20210903.3 (dotnet#2384)
  Bump manifest to use api 31 (dotnet#2366)
  BoxView Handlers (dotnet#2250)
  Implement IsTextPredictionEnabled in WinUI Editor (dotnet#1478)
  Implement PlaceholderColor property in EntryHandlers (dotnet#1513)
  Automated dotnet-format update (dotnet#2355)
  Show entire search bar by default and make it not collapse (dotnet#2351)
  Remove test cloud if def for now (dotnet#2350)
  Add support for JS root components in BlazorWebView (dotnet#2293)
  Set base viewmapper to work against IViewHandler (dotnet#2339)
  NavigationView Handler for Android (dotnet#2336)
  Update OutputType to WinExe on -windows (dotnet#2340)
  ...
@Redth Redth added this to the 6.0.101-preview.9 milestone Sep 27, 2021
@Eilon Eilon added the area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions label Sep 30, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Dec 22, 2023
@samhouts samhouts added the fixed-in-6.0.101-preview.10 Look for this fix in 6.0.101-preview.10! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions fixed-in-6.0.101-preview.10 Look for this fix in 6.0.101-preview.10!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants