Skip to content

Commit

Permalink
Make MAUI into a workload based on NuGet packs
Browse files Browse the repository at this point in the history
### Description

Backport of #11206

This change moves most - if not all - the logic, assemblies, build tasks, targets and props into NuGet packages. This allows .NET MAUI to be usable without having to care about what version of the workload is installed.

There are still a few things - mostly the automagic and Windows fixes - in the workload pack, but this is probably temporary and/or non-essential for the working of the build. Things like the project capabilities are still in the workload as this is needed for the IDE and cannot be in NuGet packages.

Everything else is now inside a NuGet package that can be upgraded, pinned and otherwise used without requiring VS to have installed the workload to match. There is the benefit of the NuGet packages being installed on disk and thus reducing/removing the need to download. But that is minimal now since we have smaller and fewer packages.
# Conflicts:
#	eng/Versions.props
#	src/Controls/Foldable/src/Controls.Foldable.csproj
#	src/Controls/Maps/src/Controls.Maps.csproj
#	src/Controls/src/Core/Controls.Core.csproj
#	src/Controls/src/SourceGen/Controls.SourceGen.csproj
#	src/Controls/src/Xaml.Design/Controls.Xaml.Design.csproj
#	src/Core/maps/src/Maps.csproj
#	src/Maui.InTree.targets
#	src/Workload/Microsoft.Maui.Sdk/Sdk/BundledVersions.in.targets
  • Loading branch information
mattleibow committed Mar 31, 2023
1 parent 1d60a27 commit ab4499b
Show file tree
Hide file tree
Showing 118 changed files with 833 additions and 1,230 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore

.nuspec/**/*.dll
.nuspec/**/*.dylib
.nuspec/**/*.so
.XamarinFormsVersionFile.txt
.nuspec/
.buildtasks/
templatesTest/

# User-specific files
Expand Down
135 changes: 0 additions & 135 deletions .nuspec/AutoImport.InTree.props

This file was deleted.

49 changes: 0 additions & 49 deletions .nuspec/Microsoft.Maui.Controls.DualScreen.nuspec

This file was deleted.

29 changes: 0 additions & 29 deletions .nuspec/Microsoft.Maui.Controls.SingleProject.props

This file was deleted.

10 changes: 0 additions & 10 deletions .nuspec/Microsoft.Maui.Core.props

This file was deleted.

3 changes: 0 additions & 3 deletions .nuspec/Microsoft.Maui.Core.targets

This file was deleted.

Empty file removed .nuspec/_._
Empty file.
12 changes: 10 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,21 @@
<_MauiPreviousDotNetTfm Condition="'$(_MauiPreviousDotNetTfm)' == ''">net$(_MauiPreviousDotNetVersion)</_MauiPreviousDotNetTfm>

<_MauiTargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</_MauiTargetPlatformIdentifier>
<_MauiNoTargetPlatform>false</_MauiNoTargetPlatform>
<_MauiNoTargetPlatform Condition="'$(_MauiTargetPlatformIdentifier)' == ''">True</_MauiNoTargetPlatform>
<_MauiTargetPlatformIsAndroid>false</_MauiTargetPlatformIsAndroid>
<_MauiTargetPlatformIsAndroid Condition="'$(_MauiTargetPlatformIdentifier)' == 'android'">True</_MauiTargetPlatformIsAndroid>
<_MauiTargetPlatformIsiOS>false</_MauiTargetPlatformIsiOS>
<_MauiTargetPlatformIsiOS Condition="'$(_MauiTargetPlatformIdentifier)' == 'ios'">True</_MauiTargetPlatformIsiOS>
<_MauiTargetPlatformIsMacCatalyst>false</_MauiTargetPlatformIsMacCatalyst>
<_MauiTargetPlatformIsMacCatalyst Condition="'$(_MauiTargetPlatformIdentifier)' == 'maccatalyst'">True</_MauiTargetPlatformIsMacCatalyst>
<_MauiTargetPlatformIsmacOS>false</_MauiTargetPlatformIsmacOS>
<_MauiTargetPlatformIsmacOS Condition="'$(_MauiTargetPlatformIdentifier)' == 'macos'">True</_MauiTargetPlatformIsmacOS>
<_MauiTargetPlatformIstvOS>false</_MauiTargetPlatformIstvOS>
<_MauiTargetPlatformIstvOS Condition="'$(_MauiTargetPlatformIdentifier)' == 'tvos'">True</_MauiTargetPlatformIstvOS>
<_MauiTargetPlatformIsWindows>false</_MauiTargetPlatformIsWindows>
<_MauiTargetPlatformIsWindows Condition="$(_MauiTargetPlatformIdentifier.Contains('windows')) == 'True'">True</_MauiTargetPlatformIsWindows>
<_MauiTargetPlatformIsTizen>false</_MauiTargetPlatformIsTizen>
<_MauiTargetPlatformIsTizen Condition="'$(_MauiTargetPlatformIdentifier)' == 'tizen'">True</_MauiTargetPlatformIsTizen>
</PropertyGroup>

Expand Down Expand Up @@ -109,7 +117,6 @@
<PropertyGroup>
<MauiRootDirectory>$(MSBuildThisFileDirectory)</MauiRootDirectory>
<MauiSrcDirectory>$(MSBuildThisFileDirectory)src/</MauiSrcDirectory>
<MauiNuSpecDirectory>$(MSBuildThisFileDirectory).nuspec/</MauiNuSpecDirectory>
<DotNetOutputPath>$(MSBuildThisFileDirectory)bin/</DotNetOutputPath>
<DotNetTempDirectory>$(DotNetOutputPath)temp/</DotNetTempDirectory>
<DotNetDirectory>$(DotNetOutputPath)dotnet/</DotNetDirectory>
Expand All @@ -119,7 +126,8 @@
<DotNetSdkManifestsDirectory>$(DotNetDirectory)sdk-manifests/$(DotNetSdkManifestsFolder)/</DotNetSdkManifestsDirectory>
<DotNetTemplatePacksDirectory>$(DotNetDirectory)template-packs/</DotNetTemplatePacksDirectory>
<_MauiBuildTasksLocation>$(_MauiBuildTasksLocation)</_MauiBuildTasksLocation>
<_MauiBuildTasksLocation Condition="'$(_MauiBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory).nuspec\</_MauiBuildTasksLocation>
<_MauiBuildTasksLocation Condition="'$(_MauiBuildTasksLocation)' == ''">$(MSBuildThisFileDirectory).buildtasks\</_MauiBuildTasksLocation>
<_MauiAOTProfileLocation>$(MauiSrcDirectory)Controls\src\Build.Tasks\nuget\buildTransitive\netstandard2.0\</_MauiAOTProfileLocation>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<DebugType>portable</DebugType>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
<!--
Workaround for https://github.com/microsoft/WindowsAppSDK/issues/2684
-->
<Import Project="src\Workload\Microsoft.Maui.Sdk\Sdk\WinUI.Unpackaged.targets" Condition=" '$(WindowsPackageType)' == 'None' and '$(_MauiTargetPlatformIsWindows)' == 'True' " />
<Import Project="src\Core\src\nuget\buildTransitive\WinUI.Unpackaged.targets" Condition=" '$(WindowsPackageType)' == 'None' and '$(_MauiTargetPlatformIsWindows)' == 'True' " />

<!-- Packaging -->
<ItemGroup Condition="'$(IsPackable)' == 'true'">
Expand Down
7 changes: 1 addition & 6 deletions Microsoft.Maui-mac.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
"src\\Controls\\src\\Core\\Controls.Core.csproj",
"src\\Controls\\src\\NuGet\\Controls.NuGet.csproj",
"src\\Controls\\src\\SourceGen\\Controls.SourceGen.csproj",
"src\\Controls\\src\\Xaml.Design\\Controls.Xaml.Design.csproj",
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj",
Expand Down Expand Up @@ -57,12 +58,6 @@
"src\\TestUtils\\src\\DeviceTests.Runners\\TestUtils.DeviceTests.Runners.csproj",
"src\\TestUtils\\src\\DeviceTests\\TestUtils.DeviceTests.csproj",
"src\\TestUtils\\src\\TestUtils\\TestUtils.csproj",
"src\\Workload\\Microsoft.Maui.Controls.Ref\\Microsoft.Maui.Controls.Ref.csproj",
"src\\Workload\\Microsoft.Maui.Controls.Runtime\\Microsoft.Maui.Controls.Runtime.csproj",
"src\\Workload\\Microsoft.Maui.Core.Ref\\Microsoft.Maui.Core.Ref.csproj",
"src\\Workload\\Microsoft.Maui.Core.Runtime\\Microsoft.Maui.Core.Runtime.csproj",
"src\\Workload\\Microsoft.Maui.Essentials.Ref\\Microsoft.Maui.Essentials.Ref.csproj",
"src\\Workload\\Microsoft.Maui.Essentials.Runtime\\Microsoft.Maui.Essentials.Runtime.csproj",
"src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj",
"src\\Workload\\Microsoft.NET.Sdk.Maui\\Microsoft.NET.Sdk.Maui.csproj"
]
Expand Down
3 changes: 3 additions & 0 deletions Microsoft.Maui.BuildTasks.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
"projects": [
"src\\Graphics\\src\\Graphics\\Graphics.csproj",
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
"src\\Controls\\src\\Core\\Controls.Core.csproj",
"src\\Controls\\src\\NuGet\\Controls.NuGet.csproj",
"src\\Controls\\src\\Xaml.Design\\Controls.Xaml.Design.csproj",
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj",
"src\\Core\\src\\Core.csproj",
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj"
Expand Down
7 changes: 1 addition & 6 deletions Microsoft.Maui.Packages-mac.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"src\\Controls\\src\\Build.Tasks\\Controls.Build.Tasks.csproj",
"src\\Controls\\src\\Core.Design\\Controls.Core.Design.csproj",
"src\\Controls\\src\\Core\\Controls.Core.csproj",
"src\\Controls\\src\\NuGet\\Controls.NuGet.csproj",
"src\\Controls\\src\\SourceGen\\Controls.SourceGen.csproj",
"src\\Controls\\src\\Xaml.Design\\Controls.Xaml.Design.csproj",
"src\\Controls\\src\\Xaml\\Controls.Xaml.csproj",
Expand All @@ -20,13 +21,7 @@
"src\\Graphics\\src\\Text.Markdig\\Graphics.Text.Markdig.csproj",
"src\\SingleProject\\Resizetizer\\src\\Resizetizer.csproj",
"src\\Templates\\src\\Microsoft.Maui.Templates.csproj",
"src\\Workload\\Microsoft.Maui.Controls.Ref\\Microsoft.Maui.Controls.Ref.csproj",
"src\\Workload\\Microsoft.Maui.Controls.Runtime\\Microsoft.Maui.Controls.Runtime.csproj",
"src\\Workload\\Microsoft.Maui.Sdk\\Microsoft.Maui.Sdk.csproj",
"src\\Workload\\Microsoft.Maui.Core.Ref\\Microsoft.Maui.Core.Ref.csproj",
"src\\Workload\\Microsoft.Maui.Core.Runtime\\Microsoft.Maui.Core.Runtime.csproj",
"src\\Workload\\Microsoft.Maui.Essentials.Ref\\Microsoft.Maui.Essentials.Ref.csproj",
"src\\Workload\\Microsoft.Maui.Essentials.Runtime\\Microsoft.Maui.Essentials.Runtime.csproj",
"src\\Workload\\Microsoft.NET.Sdk.Maui\\Microsoft.NET.Sdk.Maui.csproj"
]
}
Expand Down
Loading

0 comments on commit ab4499b

Please sign in to comment.