From d53009c562a5dce471e1a1635287ac7cbf7726f9 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 30 Jun 2022 15:08:15 +0200 Subject: [PATCH 01/13] Bump MonoTouch.Dialog and Touch.Unit. We can now use these projects with a .NET 6 TFM. New commits in migueldeicaza/MonoTouch.Dialog: * migueldeicaza/MonoTouch.Dialog@558958b Revert "[MonoTouch.Dialog] Use 'BundledNETCoreAppTargetFrameworkVersion' to specify the .NET version in the project files. (migueldeicaza/MonoTouch.Dialogspouliot/Touch.Unit#261)" * migueldeicaza/MonoTouch.Dialog@8e859cc [MonoTouch.Dialog] Use 'BundledNETCoreAppTargetFrameworkVersion' to specify the .NET version in the project files. Removed commits from migueldeicaza/MonoTouch.Dialog: * migueldeicaza/MonoTouch.Dialog@eaa2202 [MonoTouch.Dialog] Use 'BundledNETCoreAppTargetFrameworkVersion' to specify the .NET version in the project files. Diff: https://github.com/migueldeicaza/MonoTouch.Dialog/compare/eaa22021dda3969a73117959a8f638f78a565690..558958b0a2de19036cf6fdd21401573a65239017 New commits in spouliot/Touch.Unit: * spouliot/Touch.Unit@564433f Revert "[Touch.Client] Use 'BundledNETCoreAppTargetFrameworkVersion' to specify the .NET version in the project files. (spouliot/Touch.Unit#113)" * spouliot/Touch.Unit@6963a2a [TouchRunner] Flush the console before exiting. Diff: https://github.com/spouliot/Touch.Unit/compare/be3a8d0855b8291848d02c9c9d99748cb41c56c2..564433f35c8ab6b7bb0709f83e1b81a89c406956 --- external/MonoTouch.Dialog | 2 +- external/Touch.Unit | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/external/MonoTouch.Dialog b/external/MonoTouch.Dialog index eaa22021dd..558958b0a2 160000 --- a/external/MonoTouch.Dialog +++ b/external/MonoTouch.Dialog @@ -1 +1 @@ -Subproject commit eaa22021dda3969a73117959a8f638f78a565690 +Subproject commit 558958b0a2de19036cf6fdd21401573a65239017 diff --git a/external/Touch.Unit b/external/Touch.Unit index be3a8d0855..564433f35c 160000 --- a/external/Touch.Unit +++ b/external/Touch.Unit @@ -1 +1 @@ -Subproject commit be3a8d0855b8291848d02c9c9d99748cb41c56c2 +Subproject commit 564433f35c8ab6b7bb0709f83e1b81a89c406956 From ba64775ba7277397f1ca0a1a96e6aa1e4b6c0227 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 30 Jun 2022 13:04:04 +0200 Subject: [PATCH 02/13] [dotnet] Rework KnownFrameworkReference so that 'net6.0-*' TargetFrameworks work when building with .NET 7. Fixes #15375. The KnownFrameworkReference now references the exact versions of the ref and runtime packs we're shipping with the sdk pack, instead of telling the build to use whatever version is defined in the workload. Then in the workload we specify the latest released version of the .NET 6 for the ref and runtime packs. Finally we add an aliased sdk pack, which points to the .NET 6 sdk pack, and when we're building a .NET 6 TargetFramework we load this aliased sdk pack instead of the one we're shipping with this workload. Putting this together means that: * When we're building a .NET 7 TargetFramework, we load the sdk pack shipped with the workload, which adds a KnownFrameworkReference which references the ref and runtime packs with the same version as the sdk pack. * When we're building a .NET 6 TargetFramework, we load the (aliased) sdk pack which points to the latest stable .NET 6 sdk pack. That sdk pack will add a KnownFrameworkReference that tells the build to use the ref and runtime pack versions specified in the workload - which are now pointing to the .NET 6 ref and runtime pack versions. Thus we use the .NET 6 sdk, ref and runtime packs when building a .NET 6 TargetFramework, and we use the .NET 7 sdk, ref and runtime packs when building a .NET 7 TargetFramework. According to the workload design spec [1], this is supposed to be implemented by using aliased ref and runtime packs, but that doesn't work due to https://github.com/dotnet/sdk/issues/26384. Fixes https://github.com/xamarin/xamarin-macios/issues/15375. [1]: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-manifest.md?rgh-link-date=2022-06-30T08%3A25%3A10Z#side-by-side-workload-pattern --- Make.versions | 7 ++++++ dotnet/Makefile | 8 +++++-- .../WorkloadManifest.targets | 5 +++- .../WorkloadManifest.targets | 8 +++++-- .../WorkloadManifest.targets | 5 +++- .../WorkloadManifest.targets | 5 +++- .../Microsoft.Sdk.Versions.template.props | 16 +++++++++++++ .../Xamarin.Shared.Sdk.DefaultItems.targets | 24 ------------------- 8 files changed, 47 insertions(+), 31 deletions(-) diff --git a/Make.versions b/Make.versions index 8d01e37253..ba2b1eded2 100644 --- a/Make.versions +++ b/Make.versions @@ -85,3 +85,10 @@ DEFAULT_TARGET_PLATFORM_VERSION_TVOS=15.4 DEFAULT_TARGET_PLATFORM_VERSION_WATCHOS=8.5 DEFAULT_TARGET_PLATFORM_VERSION_MACOS=12.3 DEFAULT_TARGET_PLATFORM_VERSION_MACCATALYST=15.4 + +# These variables must be updated whenever we release a new stable version into .NET 6 +NET6_IOS_NUGET_VERSION_NO_METADATA=15.4.447 +NET6_TVOS_NUGET_VERSION_NO_METADATA=15.4.447 +NET6_WATCHOS_NUGET_VERSION_NO_METADATA=8.5.447 +NET6_MACOS_NUGET_VERSION_NO_METADATA=12.3.447 +NET6_MACCATALYST_NUGET_VERSION_NO_METADATA=15.4.447 diff --git a/dotnet/Makefile b/dotnet/Makefile index 55b45f42b0..7f7e57cec6 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -12,6 +12,7 @@ DOTNET_PLATFORMS_UPPERCASE:=$(shell echo $(DOTNET_PLATFORMS) | tr a-z A-Z) # Create variables prefixed with the correctly cased platform name from the upper-cased platform name. This makes some of the next sections somewhat simpler. $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(platform)_NUGET_VERSION_NO_METADATA:=$($(shell echo $(platform) | tr a-z A-Z)_NUGET_VERSION_NO_METADATA))) +$(foreach platform,$(DOTNET_PLATFORMS),$(eval NET6_$(platform)_NUGET_VERSION_NO_METADATA:=$(NET6_$(shell echo $(platform) | tr a-z A-Z)_NUGET_VERSION_NO_METADATA))) DOTNET_iOS_GLOBAL_USINGS=CoreGraphics Foundation UIKit DOTNET_tvOS_GLOBAL_USINGS=CoreGraphics Foundation UIKit @@ -104,13 +105,15 @@ targets/Microsoft.$(1).Sdk.Versions.props: targets/Microsoft.Sdk.Versions.templa -e "s/@CURRENT_BRANCH@/$$(CURRENT_BRANCH_SED_ESCAPED)/g" \ -e "s/@CURRENT_HASH_LONG@/$$(CURRENT_HASH_LONG)/g" \ -e 's*@VALID_RUNTIME_IDENTIFIERS@*$(foreach rid,$(3),\n\t\t<_XamarinValidRuntimeIdentifier Include="$(rid)" Platform="$(1)" />)*' \ + -e 's/@DOTNET_TFM@/$(DOTNET_TFM)/g' \ + -e 's/@RUNTIME_PACK_RUNTIME_IDENTIFIERS@/$(4)/g' \ $$< > $$@.tmp $$(Q) mv $$@.tmp $$@ Microsoft.$1.Sdk/targets/Microsoft.$1.Sdk.Versions.props: targets/Microsoft.$1.Sdk.Versions.props $$(Q) $$(CP) $$< $$@ endef -$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionsTemplate,$(platform),$(shell echo $(platform) | tr a-z A-Z),$(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS)))) +$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call VersionsTemplate,$(platform),$(shell echo $(platform) | tr a-z A-Z),$(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS),$(shell echo $(DOTNET_$(shell echo $(platform) | tr a-z A-Z)_RUNTIME_IDENTIFIERS) | tr ' ' ';')))) define AutoImports Microsoft.$(1).Sdk/Sdk/AutoImport.props: targets/AutoImport.template.props Makefile @@ -154,6 +157,7 @@ Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json: targets/WorkloadManifest $$(Q) rm -f $$@.tmp $$(Q_GEN) sed \ -e "s/@VERSION@/$3/g" \ + -e "s/@NET6_VERSION@/$(4)/g" \ -e "s/@BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION@/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/g" \ -e "s/@PLATFORM_LOWERCASE@/$2/g" \ -e "s/@PLATFORM@/$1/g" \ @@ -169,7 +173,7 @@ WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/LICENSE LOCAL_WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json LOCAL_WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/LICENSE endef -$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform),$(shell echo $(platform) | tr A-Z a-z),$($(platform)_NUGET_VERSION_NO_METADATA)))) +$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform),$(shell echo $(platform) | tr A-Z a-z),$($(platform)_NUGET_VERSION_NO_METADATA),$(NET6_$(platform)_NUGET_VERSION_NO_METADATA)))) $(DOTNET_NUPKG_DIR)/vs-workload.props: Workloads/vs-workload.template.props $(Q) rm -f $@.tmp diff --git a/dotnet/Workloads/Microsoft.NET.Sdk.MacCatalyst/WorkloadManifest.targets b/dotnet/Workloads/Microsoft.NET.Sdk.MacCatalyst/WorkloadManifest.targets index 84fee5edb0..ffdd636cb3 100644 --- a/dotnet/Workloads/Microsoft.NET.Sdk.MacCatalyst/WorkloadManifest.targets +++ b/dotnet/Workloads/Microsoft.NET.Sdk.MacCatalyst/WorkloadManifest.targets @@ -1,5 +1,8 @@ - + + + + diff --git a/dotnet/Workloads/Microsoft.NET.Sdk.iOS/WorkloadManifest.targets b/dotnet/Workloads/Microsoft.NET.Sdk.iOS/WorkloadManifest.targets index 00be7cf391..957987c7c5 100644 --- a/dotnet/Workloads/Microsoft.NET.Sdk.iOS/WorkloadManifest.targets +++ b/dotnet/Workloads/Microsoft.NET.Sdk.iOS/WorkloadManifest.targets @@ -1,6 +1,10 @@ - - + + + + + + diff --git a/dotnet/Workloads/Microsoft.NET.Sdk.macOS/WorkloadManifest.targets b/dotnet/Workloads/Microsoft.NET.Sdk.macOS/WorkloadManifest.targets index 8824a24402..207c68bcdb 100644 --- a/dotnet/Workloads/Microsoft.NET.Sdk.macOS/WorkloadManifest.targets +++ b/dotnet/Workloads/Microsoft.NET.Sdk.macOS/WorkloadManifest.targets @@ -1,5 +1,8 @@ - + + + + diff --git a/dotnet/Workloads/Microsoft.NET.Sdk.tvOS/WorkloadManifest.targets b/dotnet/Workloads/Microsoft.NET.Sdk.tvOS/WorkloadManifest.targets index e46ed82e56..9352012875 100644 --- a/dotnet/Workloads/Microsoft.NET.Sdk.tvOS/WorkloadManifest.targets +++ b/dotnet/Workloads/Microsoft.NET.Sdk.tvOS/WorkloadManifest.targets @@ -1,5 +1,8 @@ - + + + + diff --git a/dotnet/targets/Microsoft.Sdk.Versions.template.props b/dotnet/targets/Microsoft.Sdk.Versions.template.props index 48f0ef2da0..40aa4d8e01 100644 --- a/dotnet/targets/Microsoft.Sdk.Versions.template.props +++ b/dotnet/targets/Microsoft.Sdk.Versions.template.props @@ -11,4 +11,20 @@ @VALID_RUNTIME_IDENTIFIERS@ + + + + + diff --git a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets index 1170a570c9..33f3567f2b 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.DefaultItems.targets @@ -76,35 +76,11 @@ iPhone - - - - <_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'iOS' ">iossimulator-x64;ios-arm64;ios-arm;iossimulator-x86;iossimulator-arm64 - <_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'tvOS' ">tvossimulator-x64;tvos-arm64;tvossimulator-arm64 - <_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'watchOS' ">watchos-x86;watchos-x64;watchos-arm - <_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'macOS' ">osx-x64;osx-arm64 - <_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'MacCatalyst' ">maccatalyst-x64;maccatalyst-arm64 - - <_RuntimeFrameworkVersion>$(BundledNETCorePlatformsPackageVersion) <_RuntimeFrameworkVersion Condition="'$(CUSTOM_DOTNET_VERSION)' != ''">$(CUSTOM_DOTNET_VERSION) - - - - From 61823e41829856155df6b2a66a9dfce62a6712b0 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 14 Jul 2022 21:11:37 +0200 Subject: [PATCH 03/13] [dotnet] Generate the WorkloadManifest.json files and add .net6/.net7 variants in there. This way a workload restore will get the .NET 7 runtime packs. --- dotnet/Makefile | 12 +- dotnet/generate-workloadmanifest-json.csharp | 137 ++++++++++++++++++ ...WorkloadManifest.MacCatalyst.template.json | 40 ----- .../WorkloadManifest.iOS.template.json | 65 --------- .../WorkloadManifest.macOS.template.json | 40 ----- .../WorkloadManifest.tvOS.template.json | 45 ------ 6 files changed, 140 insertions(+), 199 deletions(-) create mode 100755 dotnet/generate-workloadmanifest-json.csharp delete mode 100644 dotnet/targets/WorkloadManifest.MacCatalyst.template.json delete mode 100644 dotnet/targets/WorkloadManifest.iOS.template.json delete mode 100644 dotnet/targets/WorkloadManifest.macOS.template.json delete mode 100644 dotnet/targets/WorkloadManifest.tvOS.template.json diff --git a/dotnet/Makefile b/dotnet/Makefile index 7f7e57cec6..50f461ff8e 100644 --- a/dotnet/Makefile +++ b/dotnet/Makefile @@ -153,15 +153,9 @@ endef $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call SupportedTargetPlatforms,$(platform)))) define WorkloadTargets -Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json: targets/WorkloadManifest.$(1).template.json Makefile $(TOP)/Make.config.inc $(TOP)/.git/HEAD $(TOP)/.git/index Makefile +Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json: Makefile $(TOP)/Make.config.inc $(TOP)/.git/HEAD $(TOP)/.git/index Makefile generate-workloadmanifest-json.csharp $$(Q) rm -f $$@.tmp - $$(Q_GEN) sed \ - -e "s/@VERSION@/$3/g" \ - -e "s/@NET6_VERSION@/$(4)/g" \ - -e "s/@BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION@/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/g" \ - -e "s/@PLATFORM_LOWERCASE@/$2/g" \ - -e "s/@PLATFORM@/$1/g" \ - $$< > $$@.tmp + $$(Q_GEN) ./generate-workloadmanifest-json.csharp "$(1)" "$(3)" "$(4)" "$$(DOTNET_$(5)_RUNTIME_IDENTIFIERS)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" $$(Q) mv $$@.tmp $$@ Workloads/Microsoft.NET.Sdk.$(1)/LICENSE: $(TOP)/LICENSE @@ -173,7 +167,7 @@ WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/LICENSE LOCAL_WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json LOCAL_WORKLOAD_TARGETS += Workloads/Microsoft.NET.Sdk.$(1)/LICENSE endef -$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform),$(shell echo $(platform) | tr A-Z a-z),$($(platform)_NUGET_VERSION_NO_METADATA),$(NET6_$(platform)_NUGET_VERSION_NO_METADATA)))) +$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call WorkloadTargets,$(platform),$(shell echo $(platform) | tr A-Z a-z),$($(platform)_NUGET_VERSION_NO_METADATA),$(NET6_$(platform)_NUGET_VERSION_NO_METADATA),$(shell echo $(platform) | tr a-z A-Z)))) $(DOTNET_NUPKG_DIR)/vs-workload.props: Workloads/vs-workload.template.props $(Q) rm -f $@.tmp diff --git a/dotnet/generate-workloadmanifest-json.csharp b/dotnet/generate-workloadmanifest-json.csharp new file mode 100755 index 0000000000..fa88de4e01 --- /dev/null +++ b/dotnet/generate-workloadmanifest-json.csharp @@ -0,0 +1,137 @@ +#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp + +// arguments are: + +using System.IO; +using System.Xml; + +var args = Environment.GetCommandLineArgs (); +var expectedArgumentCount = 6; +if (args.Length != expectedArgumentCount + 2 /* 2 default arguments (executable + script) + 'expectedArgumentCount' arguments we're interested in */) { + // first arg is "/Library/Frameworks/Mono.framework/Versions/4.8.0/lib/mono/4.5/csharp.exe" + // second arg the script itself + // then comes the ones we care about + Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length - 2}"); + Environment.Exit (1); + return; +} + +var argumentIndex = 2; +var platform = args [argumentIndex++]; +var version = args [argumentIndex++]; +var net6Version = args [argumentIndex++]; +var runtimeIdentifiers = args [argumentIndex++].Split (' '); +var outputPath = args [argumentIndex++]; +var windowsPlatforms = args [argumentIndex++].Split (' '); +var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0; + +var platformLowerCase = platform.ToLowerInvariant (); + +using (TextWriter writer = new StreamWriter (outputPath)) { + writer.WriteLine ($"{{"); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"workloads\": {{"); + writer.WriteLine ($" \"{platformLowerCase}\": {{"); + writer.WriteLine ($" \"description\": \".NET SDK Workload for building {platform} applications.\","); + writer.WriteLine ($" \"packs\": ["); + writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net7\","); + writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net6\","); + if (hasWindows) { + writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net7\","); + writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net6\","); + } + writer.WriteLine ($" \"Microsoft.{platform}.Ref.net7\","); + writer.WriteLine ($" \"Microsoft.{platform}.Ref\","); + foreach (var rid in runtimeIdentifiers) { + writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.net7\","); + writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}\","); + } + writer.WriteLine ($" \"Microsoft.{platform}.Templates.net7\""); + writer.WriteLine ($" ],"); + writer.WriteLine ($" \"extends\": ["); + if (platform == "macOS") { + writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling\","); + writer.WriteLine ($" \"microsoft-net-runtime-mono-tooling-net6\","); + } else { + writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}\","); + writer.WriteLine ($" \"microsoft-net-runtime-{platformLowerCase}-net6\","); + } + writer.WriteLine ($" ]"); + writer.WriteLine ($" }},"); + writer.WriteLine ($" }},"); + writer.WriteLine ($" \"packs\": {{"); + writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net7\": {{"); + writer.WriteLine ($" \"kind\": \"sdk\","); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Sdk\""); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net6\": {{"); + writer.WriteLine ($" \"kind\": \"sdk\","); + writer.WriteLine ($" \"version\": \"{net6Version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Sdk\""); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + if (hasWindows) { + writer.WriteLine ($" \"Microsoft.@PLATFORM@.Windows.Sdk.Aliased.net7\": {{"); + writer.WriteLine ($" \"kind\": \"sdk\","); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net6\": {{"); + writer.WriteLine ($" \"kind\": \"sdk\","); + writer.WriteLine ($" \"version\": \"{net6Version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"win-x64\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" \"win-x86\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" \"win-arm64\": \"Microsoft.{platform}.Windows.Sdk\","); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + } + writer.WriteLine ($" // The ref and runtime packs use the .net6 version, because when we load the .net6 SDK pack, it says to use the ref and runtime pack versions from the workload (**FromWorkload**)."); + writer.WriteLine ($" // This could be solvable with aliases as well, except that aliases doesn't work in this scenario (https://github.com/dotnet/sdk/issues/26384)."); + writer.WriteLine ($" // For the .net7 packs, we're stating the exact version to use in the KnownFrameworkReference item, so whatever we specify here is ignored."); + writer.WriteLine ($" \"Microsoft.{platform}.Ref\": {{"); + writer.WriteLine ($" \"kind\": \"framework\","); + writer.WriteLine ($" \"version\": \"{net6Version}\""); + writer.WriteLine ($" }},"); + writer.WriteLine ($" \"Microsoft.{platform}.Ref.net7\": {{"); + writer.WriteLine ($" \"kind\": \"framework\","); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Ref\","); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + foreach (var rid in runtimeIdentifiers) { + writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}\": {{"); + writer.WriteLine ($" \"kind\": \"framework\","); + writer.WriteLine ($" \"version\": \"{net6Version}\""); + writer.WriteLine ($" }},"); + } + foreach (var rid in runtimeIdentifiers) { + writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.net7\": {{"); + writer.WriteLine ($" \"kind\": \"framework\","); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Runtime.{rid}\","); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }},"); + } + writer.WriteLine ($" \"Microsoft.{platform}.Templates.net7\": {{"); + writer.WriteLine ($" \"kind\": \"template\","); + writer.WriteLine ($" \"version\": \"{version}\","); + writer.WriteLine ($" \"alias-to\": {{"); + writer.WriteLine ($" \"any\": \"Microsoft.{platform}.Templates\","); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }}"); + writer.WriteLine ($" }}"); + writer.WriteLine ($"}}"); +} + +Environment.Exit (0); diff --git a/dotnet/targets/WorkloadManifest.MacCatalyst.template.json b/dotnet/targets/WorkloadManifest.MacCatalyst.template.json deleted file mode 100644 index 7f9fdd41a0..0000000000 --- a/dotnet/targets/WorkloadManifest.MacCatalyst.template.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": "@VERSION@", - "workloads": { - "@PLATFORM_LOWERCASE@": { - "description": ".NET SDK Workload for building macOS applications with @PLATFORM@.", - "packs": [ - "Microsoft.@PLATFORM@.Sdk", - "Microsoft.@PLATFORM@.Ref", - "Microsoft.@PLATFORM@.Runtime.maccatalyst-arm64", - "Microsoft.@PLATFORM@.Runtime.maccatalyst-x64", - "Microsoft.@PLATFORM@.Templates" - ], - "extends": [ - "microsoft-net-runtime-maccatalyst" - ] - } - }, - "packs": { - "Microsoft.@PLATFORM@.Sdk": { - "kind": "sdk", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Ref": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.maccatalyst-arm64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.maccatalyst-x64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Templates": { - "kind": "template", - "version": "@VERSION@" - } - } -} diff --git a/dotnet/targets/WorkloadManifest.iOS.template.json b/dotnet/targets/WorkloadManifest.iOS.template.json deleted file mode 100644 index a628df8283..0000000000 --- a/dotnet/targets/WorkloadManifest.iOS.template.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "version": "@VERSION@", - "workloads": { - "@PLATFORM_LOWERCASE@": { - "description": ".NET SDK Workload for building @PLATFORM@ applications.", - "packs": [ - "Microsoft.@PLATFORM@.Sdk", - "Microsoft.@PLATFORM@.Windows.Sdk.Aliased", - "Microsoft.@PLATFORM@.Ref", - "Microsoft.@PLATFORM@.Runtime.ios-arm", - "Microsoft.@PLATFORM@.Runtime.ios-arm64", - "Microsoft.@PLATFORM@.Runtime.iossimulator-x86", - "Microsoft.@PLATFORM@.Runtime.iossimulator-x64", - "Microsoft.@PLATFORM@.Runtime.iossimulator-arm64", - "Microsoft.@PLATFORM@.Templates" - ], - "extends": [ - "microsoft-net-runtime-ios" - ] - } - }, - "packs": { - "Microsoft.@PLATFORM@.Sdk": { - "kind": "sdk", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Windows.Sdk.Aliased": { - "kind": "sdk", - "version": "@VERSION@", - "alias-to": { - "win-x64": "Microsoft.@PLATFORM@.Windows.Sdk", - "win-x86": "Microsoft.@PLATFORM@.Windows.Sdk", - "win-arm64": "Microsoft.@PLATFORM@.Windows.Sdk", - } - }, - "Microsoft.@PLATFORM@.Ref": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.ios-arm": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.ios-arm64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.iossimulator-x86": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.iossimulator-x64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.iossimulator-arm64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Templates": { - "kind": "template", - "version": "@VERSION@" - } - } -} diff --git a/dotnet/targets/WorkloadManifest.macOS.template.json b/dotnet/targets/WorkloadManifest.macOS.template.json deleted file mode 100644 index 7404d828b2..0000000000 --- a/dotnet/targets/WorkloadManifest.macOS.template.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "version": "@VERSION@", - "workloads": { - "@PLATFORM_LOWERCASE@": { - "description": ".NET SDK Workload for building @PLATFORM@ applications.", - "packs": [ - "Microsoft.@PLATFORM@.Sdk", - "Microsoft.@PLATFORM@.Ref", - "Microsoft.@PLATFORM@.Runtime.osx-arm64", - "Microsoft.@PLATFORM@.Runtime.osx-x64", - "Microsoft.@PLATFORM@.Templates" - ], - "extends": [ - "microsoft-net-runtime-mono-tooling" - ] - } - }, - "packs": { - "Microsoft.@PLATFORM@.Sdk": { - "kind": "sdk", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Ref": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.osx-arm64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.osx-x64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Templates": { - "kind": "template", - "version": "@VERSION@" - } - } -} diff --git a/dotnet/targets/WorkloadManifest.tvOS.template.json b/dotnet/targets/WorkloadManifest.tvOS.template.json deleted file mode 100644 index d60dfa2323..0000000000 --- a/dotnet/targets/WorkloadManifest.tvOS.template.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "version": "@VERSION@", - "workloads": { - "@PLATFORM_LOWERCASE@": { - "description": ".NET SDK Workload for building @PLATFORM@ applications.", - "packs": [ - "Microsoft.@PLATFORM@.Sdk", - "Microsoft.@PLATFORM@.Ref", - "Microsoft.@PLATFORM@.Runtime.tvos-arm64", - "Microsoft.@PLATFORM@.Runtime.tvossimulator-x64", - "Microsoft.@PLATFORM@.Runtime.tvossimulator-arm64", - "Microsoft.@PLATFORM@.Templates" - ], - "extends": [ - "microsoft-net-runtime-tvos" - ] - } - }, - "packs": { - "Microsoft.@PLATFORM@.Sdk": { - "kind": "sdk", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Ref": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.tvos-arm64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.tvossimulator-x64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Runtime.tvossimulator-arm64": { - "kind": "framework", - "version": "@VERSION@" - }, - "Microsoft.@PLATFORM@.Templates": { - "kind": "template", - "version": "@VERSION@" - } - } -} From 731e15a9b83c4d5ffc21819df1f48aa2136c6510 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 30 Jun 2022 13:20:04 +0200 Subject: [PATCH 04/13] [tests] Add test case for building a net6.0 project. --- tests/common/shared-dotnet.mk | 8 +++-- tests/dotnet/Net6_0SimpleApp/AppDelegate.cs | 19 ++++++++++++ .../Net6_0SimpleApp/MacCatalyst/Makefile | 1 + .../MacCatalyst/Net6_0SimpleApp.csproj | 7 +++++ tests/dotnet/Net6_0SimpleApp/Makefile | 2 ++ tests/dotnet/Net6_0SimpleApp/iOS/Makefile | 1 + .../iOS/Net6_0SimpleApp.csproj | 7 +++++ tests/dotnet/Net6_0SimpleApp/macOS/Makefile | 1 + .../macOS/Net6_0SimpleApp.csproj | 7 +++++ tests/dotnet/Net6_0SimpleApp/shared.csproj | 16 ++++++++++ tests/dotnet/Net6_0SimpleApp/shared.mk | 4 +++ tests/dotnet/Net6_0SimpleApp/tvOS/Makefile | 1 + .../tvOS/Net6_0SimpleApp.csproj | 7 +++++ tests/dotnet/UnitTests/ProjectTest.cs | 29 +++++++++++++++++++ tests/dotnet/UnitTests/TestBaseClass.cs | 8 ++--- tools/common/ApplePlatform.cs | 8 +++-- 16 files changed, 118 insertions(+), 8 deletions(-) create mode 100644 tests/dotnet/Net6_0SimpleApp/AppDelegate.cs create mode 100644 tests/dotnet/Net6_0SimpleApp/MacCatalyst/Makefile create mode 100644 tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj create mode 100644 tests/dotnet/Net6_0SimpleApp/Makefile create mode 100644 tests/dotnet/Net6_0SimpleApp/iOS/Makefile create mode 100644 tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj create mode 100644 tests/dotnet/Net6_0SimpleApp/macOS/Makefile create mode 100644 tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj create mode 100644 tests/dotnet/Net6_0SimpleApp/shared.csproj create mode 100644 tests/dotnet/Net6_0SimpleApp/shared.mk create mode 100644 tests/dotnet/Net6_0SimpleApp/tvOS/Makefile create mode 100644 tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj diff --git a/tests/common/shared-dotnet.mk b/tests/common/shared-dotnet.mk index ed393da27c..073cb1ba15 100644 --- a/tests/common/shared-dotnet.mk +++ b/tests/common/shared-dotnet.mk @@ -10,6 +10,10 @@ ifeq ($(TESTNAME),) TESTNAME:=$(notdir $(shell dirname "$(shell dirname "$(CURDIR)")")) endif +ifeq ($(TEST_TFM),) +TEST_TFM=$(DOTNET_TFM) +endif + prepare: @# nothing to do here right now @@ -34,12 +38,12 @@ run: prepare $(Q) $(DOTNET) build "/bl:$(abspath $@-$(BINLOG_TIMESTAMP).binlog)" *.?sproj $(MSBUILD_VERBOSITY) $(BUILD_ARGUMENTS) -t:Run run-bare: - $(Q) "$(abspath .)"/bin/Debug/$(DOTNET_TFM)-*/*/"$(TESTNAME)".app/Contents/MacOS/"$(TESTNAME)" --autostart --autoexit + $(Q) "$(abspath .)"/bin/Debug/$(TEST_TFM)-*/*/"$(TESTNAME)".app/Contents/MacOS/"$(TESTNAME)" --autostart --autoexit run-remote: $(Q) test -n "$(REMOTE_HOST)" || ( echo "Must specify the remote machine by setting the REMOTE_HOST environment variable"; exit 1 ) @echo "Copying the '$(TESTNAME)' test app to $(REMOTE_HOST)..." - rsync -avz ./bin/Debug/$(DOTNET_TFM)-*/*/"$(TESTNAME)".app $(USER)@$(REMOTE_HOST):/tmp/test-run-remote-execution/ + rsync -avz ./bin/Debug/$(TEST_TFM)-*/*/"$(TESTNAME)".app $(USER)@$(REMOTE_HOST):/tmp/test-run-remote-execution/ @echo "Killing any existing test executables ('$(TESTNAME)')" ssh $(USER)@$(REMOTE_HOST) -- pkill -9 "$(TESTNAME)" || true @echo "Executing '$(TESTNAME)' on $(REMOTE_HOST)..." diff --git a/tests/dotnet/Net6_0SimpleApp/AppDelegate.cs b/tests/dotnet/Net6_0SimpleApp/AppDelegate.cs new file mode 100644 index 0000000000..24a52b91ba --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/AppDelegate.cs @@ -0,0 +1,19 @@ +using System; +using System.Runtime.InteropServices; + +using Foundation; + +namespace MySimpleApp +{ + public class Program + { + static int Main (string[] args) + { + GC.KeepAlive (typeof (NSObject)); // prevent linking away the platform assembly + + Console.WriteLine (Environment.GetEnvironmentVariable ("MAGIC_WORD")); + + return args.Length; + } + } +} diff --git a/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Makefile b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Makefile new file mode 100644 index 0000000000..110d078f45 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj new file mode 100644 index 0000000000..ccebf1f778 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/MacCatalyst/Net6_0SimpleApp.csproj @@ -0,0 +1,7 @@ + + + + net6.0-maccatalyst + + + diff --git a/tests/dotnet/Net6_0SimpleApp/Makefile b/tests/dotnet/Net6_0SimpleApp/Makefile new file mode 100644 index 0000000000..6affa45ff1 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/Makefile @@ -0,0 +1,2 @@ +TOP=../../.. +include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/dotnet/Net6_0SimpleApp/iOS/Makefile b/tests/dotnet/Net6_0SimpleApp/iOS/Makefile new file mode 100644 index 0000000000..110d078f45 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/iOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj new file mode 100644 index 0000000000..bbb942faa1 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/iOS/Net6_0SimpleApp.csproj @@ -0,0 +1,7 @@ + + + + net6.0-ios + + + diff --git a/tests/dotnet/Net6_0SimpleApp/macOS/Makefile b/tests/dotnet/Net6_0SimpleApp/macOS/Makefile new file mode 100644 index 0000000000..110d078f45 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/macOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj new file mode 100644 index 0000000000..56f7fe0d8c --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/macOS/Net6_0SimpleApp.csproj @@ -0,0 +1,7 @@ + + + + net6.0-macos + + + diff --git a/tests/dotnet/Net6_0SimpleApp/shared.csproj b/tests/dotnet/Net6_0SimpleApp/shared.csproj new file mode 100644 index 0000000000..35c065fc06 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/shared.csproj @@ -0,0 +1,16 @@ + + + + Exe + + MySimpleApp + com.xamarin.mysimpleapp + 6.0 + + + + + + + + diff --git a/tests/dotnet/Net6_0SimpleApp/shared.mk b/tests/dotnet/Net6_0SimpleApp/shared.mk new file mode 100644 index 0000000000..8ead838a1f --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/shared.mk @@ -0,0 +1,4 @@ +TOP=../../../.. +TESTNAME=Net6_0SimpleApp +TEST_TFM=net6.0 +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/Net6_0SimpleApp/tvOS/Makefile b/tests/dotnet/Net6_0SimpleApp/tvOS/Makefile new file mode 100644 index 0000000000..110d078f45 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/tvOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj b/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj new file mode 100644 index 0000000000..07832eb3e0 --- /dev/null +++ b/tests/dotnet/Net6_0SimpleApp/tvOS/Net6_0SimpleApp.csproj @@ -0,0 +1,7 @@ + + + + net6.0-tvos + + + diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index 063a9ef524..b4ed8f1f7e 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -948,6 +948,35 @@ namespace Xamarin.Tests { Assert.AreEqual ($"The UIDeviceFamily value '6' requires macOS 11.0. Please set the 'SupportedOSPlatformVersion' in the project file to at least 14.0 (the Mac Catalyst version equivalent of macOS 11.0). The current value is {minOS} (equivalent to macOS 10.15.2).", errors [0].Message, "Error message"); } + [Test] + [TestCase (ApplePlatform.iOS, "iossimulator-x64")] + [TestCase (ApplePlatform.iOS, "ios-arm64")] + [TestCase (ApplePlatform.TVOS, "tvossimulator-arm64")] + [TestCase (ApplePlatform.MacOSX, "osx-arm64")] + [TestCase (ApplePlatform.MacCatalyst, "maccatalyst-x64")] + public void BuildNet6_0App (ApplePlatform platform, string runtimeIdentifiers) + { + var project = "Net6_0SimpleApp"; + Configuration.IgnoreIfIgnoredPlatform (platform); + + var project_path = GetProjectPath (project, runtimeIdentifiers: runtimeIdentifiers, platform: platform, out var appPath, netVersion: "net6.0"); + Clean (project_path); + var properties = GetDefaultProperties (runtimeIdentifiers); + + var result = DotNet.AssertBuild (project_path, properties); + AssertThatLinkerExecuted (result); + var infoPlistPath = GetInfoPListPath (platform, appPath); + Assert.That (infoPlistPath, Does.Exist, "Info.plist"); + var infoPlist = PDictionary.FromFile (infoPlistPath); + Assert.AreEqual ("com.xamarin.mysimpleapp", infoPlist.GetString ("CFBundleIdentifier").Value, "CFBundleIdentifier"); + Assert.AreEqual ("MySimpleApp", infoPlist.GetString ("CFBundleDisplayName").Value, "CFBundleDisplayName"); + Assert.AreEqual ("6.0", infoPlist.GetString ("CFBundleVersion").Value, "CFBundleVersion"); + Assert.AreEqual ("6.0", infoPlist.GetString ("CFBundleShortVersionString").Value, "CFBundleShortVersionString"); + + var appExecutable = GetNativeExecutable (platform, appPath); + ExecuteWithMagicWordAndAssert (platform, runtimeIdentifiers, appExecutable); + } + [Test] [TestCase (ApplePlatform.iOS, "iossimulator-x64")] // [TestCase (ApplePlatform.TVOS, "tvos-arm64")] // Currently doesn't work because we overwrite the required MtouchExtraArgs in tests/nunit.frameworks.target in this test. diff --git a/tests/dotnet/UnitTests/TestBaseClass.cs b/tests/dotnet/UnitTests/TestBaseClass.cs index 83a2a72c7b..e452340e89 100644 --- a/tests/dotnet/UnitTests/TestBaseClass.cs +++ b/tests/dotnet/UnitTests/TestBaseClass.cs @@ -36,18 +36,18 @@ namespace Xamarin.Tests { properties [multiRid] = runtimeIdentifiers; } - protected string GetProjectPath (string project, string runtimeIdentifiers, ApplePlatform platform, out string appPath, string? subdir = null, string configuration = "Debug") + protected string GetProjectPath (string project, string runtimeIdentifiers, ApplePlatform platform, out string appPath, string? subdir = null, string configuration = "Debug", string? netVersion = null) { - return GetProjectPath (project, null, runtimeIdentifiers, platform, out appPath, configuration); + return GetProjectPath (project, null, runtimeIdentifiers, platform, out appPath, configuration, netVersion); } - protected string GetProjectPath (string project, string? subdir, string runtimeIdentifiers, ApplePlatform platform, out string appPath, string configuration = "Debug") + protected string GetProjectPath (string project, string? subdir, string runtimeIdentifiers, ApplePlatform platform, out string appPath, string configuration = "Debug", string? netVersion = null) { var rv = GetProjectPath (project, subdir, platform); if (string.IsNullOrEmpty (runtimeIdentifiers)) runtimeIdentifiers = GetDefaultRuntimeIdentifier (platform); var appPathRuntimeIdentifier = runtimeIdentifiers.IndexOf (';') >= 0 ? "" : runtimeIdentifiers; - appPath = Path.Combine (Path.GetDirectoryName (rv)!, "bin", configuration, platform.ToFramework (), appPathRuntimeIdentifier, project + ".app"); + appPath = Path.Combine (Path.GetDirectoryName (rv)!, "bin", configuration, platform.ToFramework (netVersion), appPathRuntimeIdentifier, project + ".app"); return rv; } diff --git a/tools/common/ApplePlatform.cs b/tools/common/ApplePlatform.cs index e6e525588f..2239f46f67 100644 --- a/tools/common/ApplePlatform.cs +++ b/tools/common/ApplePlatform.cs @@ -3,6 +3,8 @@ // // Copyright 2020 Microsoft Corp. All Rights Reserved. +#nullable enable + namespace Xamarin.Utils { public enum ApplePlatform { @@ -35,9 +37,11 @@ namespace Xamarin.Utils } } - public static string ToFramework (this ApplePlatform @this) + public static string ToFramework (this ApplePlatform @this, string? netVersion = null) { - var netVersion = "net7.0"; + if (netVersion is null) + netVersion = "net7.0"; + switch (@this) { case ApplePlatform.iOS: return netVersion + "-ios"; From be73bfadaeff5b067097dc888e876b8488161bbf Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 30 Jun 2022 14:06:08 +0200 Subject: [PATCH 05/13] [dotnet] Remove any global usings added by the .NET 6 SDK pack. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index ca22b4f1cb..4f2c81b227 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1867,6 +1867,20 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B + + + + + + From b42a1529a4fa0fcf00dd238fc26296e2d8d10ecd Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Mon, 22 Aug 2022 17:20:29 +0200 Subject: [PATCH 06/13] [devops] Install template packs too on bots. --- tools/devops/automation/templates/tests/run-tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/devops/automation/templates/tests/run-tests.yml b/tools/devops/automation/templates/tests/run-tests.yml index ba43488990..1bdde4e792 100644 --- a/tools/devops/automation/templates/tests/run-tests.yml +++ b/tools/devops/automation/templates/tests/run-tests.yml @@ -140,10 +140,16 @@ steps: PLATFORMS="$PLATFORMS $CURRENT" done + pushd . + cd $(Build.SourcesDirectory)/xamarin-macios/builds/downloads/dotnet-*/ + mkdir -p template-packs + popd + for platform in $DOTNET_PLATFORMS; do unzip -l $DOTNET_NUPKG_DIR/Microsoft.$platform.Bundle.*.zip unzip $DOTNET_NUPKG_DIR/Microsoft.$platform.Bundle.*.zip -d tmpdir rsync -av tmpdir/dotnet/sdk-manifests/* $(Build.SourcesDirectory)/xamarin-macios/builds/downloads/dotnet-*/sdk-manifests/ + rsync -av tmpdir/dotnet/template-packs/* $(Build.SourcesDirectory)/xamarin-macios/builds/downloads/dotnet-*/template-packs/ done find $(Build.SourcesDirectory)/xamarin-macios/builds/downloads/dotnet-* From 2ad32b8311789a89420dafbbb1b80fd5b565bda9 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 24 Aug 2022 18:49:05 +0200 Subject: [PATCH 07/13] [NuGet.Config] Add temporary feed to find some newer .NET 6 packs. --- NuGet.config | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NuGet.config b/NuGet.config index 9d4dc7cc09..f007d4d4f6 100644 --- a/NuGet.config +++ b/NuGet.config @@ -24,6 +24,10 @@ + + + + From 934f677c47ddac105f821c8c98cd724eb348a438 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Fri, 26 Aug 2022 11:28:56 -0400 Subject: [PATCH 08/13] Add MSI and VS Drop changes needed for multitargeting --- dotnet/Workloads/vs-workload.template.props | 5 +++++ .../templates/release/vs-insertion-prep.yml | 15 ++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dotnet/Workloads/vs-workload.template.props b/dotnet/Workloads/vs-workload.template.props index e70b9d2034..e69eb3329d 100644 --- a/dotnet/Workloads/vs-workload.template.props +++ b/dotnet/Workloads/vs-workload.template.props @@ -29,5 +29,10 @@ + + + + + diff --git a/tools/devops/automation/templates/release/vs-insertion-prep.yml b/tools/devops/automation/templates/release/vs-insertion-prep.yml index e7f9fbc52d..aec1eebdab 100644 --- a/tools/devops/automation/templates/release/vs-insertion-prep.yml +++ b/tools/devops/automation/templates/release/vs-insertion-prep.yml @@ -25,7 +25,7 @@ stages: usePipelineArtifactTasks: true # Check - "xamarin-macios (Prepare Release Convert NuGet to MSI)" - - template: nuget-msi-convert/job/v2.yml@templates + - template: nuget-msi-convert/job/v3.yml@templates parameters: yamlResourceName: templates dependsOn: signing @@ -100,6 +100,19 @@ stages: artifactName: vsdrop-signed downloadPath: $(Build.SourcesDirectory)/vs-insertion + - template: templates/common/upload-vs-insertion-artifacts.yml@sdk-insertions + parameters: + githubToken: $(GitHub.Token) + githubContext: $(MultiTargetVSDropCommitStatusName) + blobName: $(MultiTargetVSDropCommitStatusName) + packagePrefix: xamarin-macios + artifactsPath: $(Build.StagingDirectory)\$(MultiTargetVSDropCommitStatusName) + downloadSteps: + - task: DownloadPipelineArtifact@2 + inputs: + artifactName: vsdrop-multitarget-signed + downloadPath: $(Build.StagingDirectory)\$(MultiTargetVSDropCommitStatusName) + # Check - "xamarin-macios (VS Insertion Wait For Approval)" # Check - "xamarin-macios (VS Insertion Create VS Drop and Open PR)" - template: vs-insertion/stage/v1.yml@templates From e9e037f70c12b754c44d7add9fca89bbe0903d13 Mon Sep 17 00:00:00 2001 From: Peter Collins Date: Wed, 31 Aug 2022 04:18:11 -0400 Subject: [PATCH 09/13] [workloads] Fix manifest.json platform replacement (#15822) Fixes a string replacement related typo in the generated pack name for `Microsoft.@PLATFORM@.Windows.Sdk.Aliased.net7`. --- dotnet/generate-workloadmanifest-json.csharp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dotnet/generate-workloadmanifest-json.csharp b/dotnet/generate-workloadmanifest-json.csharp index fa88de4e01..fba129d08c 100755 --- a/dotnet/generate-workloadmanifest-json.csharp +++ b/dotnet/generate-workloadmanifest-json.csharp @@ -75,7 +75,7 @@ using (TextWriter writer = new StreamWriter (outputPath)) { writer.WriteLine ($" }}"); writer.WriteLine ($" }},"); if (hasWindows) { - writer.WriteLine ($" \"Microsoft.@PLATFORM@.Windows.Sdk.Aliased.net7\": {{"); + writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net7\": {{"); writer.WriteLine ($" \"kind\": \"sdk\","); writer.WriteLine ($" \"version\": \"{version}\","); writer.WriteLine ($" \"alias-to\": {{"); From 4bf4d14d689804d61eec912989bcb05e016821e6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 6 Sep 2022 09:44:10 +0200 Subject: [PATCH 10/13] Bump dotnet/runtime. --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 644119c8c2..5ae113a015 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -8,9 +8,9 @@ https://github.com/dotnet/linker 313671b195b1b36d56a8888a9a0e12edaac52c57 - + https://github.com/dotnet/runtime - 608da95fedbb4686789cdd98102a94f341a41fb8 + ce7e86468f5c3d21d9370ebdde110a532534a9ad diff --git a/eng/Versions.props b/eng/Versions.props index 641a0331e6..2abb78d83c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -5,7 +5,7 @@ 7.0.100-1.22423.4 6.0.0-beta.21212.6 6.0.0-rc.2.21468.3 - 7.0.0-rc.2.22451.3 + 7.0.0-rc.2.22452.13 7.0.0-rc.2.22430.5 7.0.100-alpha.1.21601.1 From cbaa5890dae86782a9d93f673eb3114a30aaced6 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 6 Sep 2022 10:21:43 +0200 Subject: [PATCH 11/13] [builds] More .NET workarounds. --- builds/Makefile | 6 ++++++ builds/package-download/download-packages.proj | 2 ++ 2 files changed, 8 insertions(+) diff --git a/builds/Makefile b/builds/Makefile index a8ec5835bb..989d129102 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -135,10 +135,16 @@ endif ifeq ($(SKIP_CUSTOM_DOTNET_RUNTIME_INSTALL),1) $(Q) echo "Skipped custom .NET runtime install" else + @# mono toolchain $(Q) mv ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net7 $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.mono.toolchain.net7.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(DOWNLOAD_DOTNET_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net7/ + $(Q) mkdir -p ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net6/ + $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.mono.toolchain.net6.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(DOWNLOAD_DOTNET_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net6/ + @# emscripten, which mono depens on $(Q) mv ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net7 $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.emscripten.net7.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net7/ + $(Q) mkdir -p ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net6/ + $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.emscripten.net6.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net6/ $(Q) touch $@ endif diff --git a/builds/package-download/download-packages.proj b/builds/package-download/download-packages.proj index bdeaa2ebc7..9e316e9133 100644 --- a/builds/package-download/download-packages.proj +++ b/builds/package-download/download-packages.proj @@ -21,9 +21,11 @@ + + From 7858937c337b9f19afa2ce1e39aa673a0cd5f14b Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 6 Sep 2022 14:41:21 +0200 Subject: [PATCH 12/13] =?UTF-8?q?=F0=9F=AA=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- builds/Makefile | 13 ++++++++++--- .../automation/scripts/bash/install-workloads.sh | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/builds/Makefile b/builds/Makefile index 989d129102..67e44d2caa 100644 --- a/builds/Makefile +++ b/builds/Makefile @@ -132,9 +132,6 @@ endif endif .stamp-install-custom-dotnet-runtime-workloads: -ifeq ($(SKIP_CUSTOM_DOTNET_RUNTIME_INSTALL),1) - $(Q) echo "Skipped custom .NET runtime install" -else @# mono toolchain $(Q) mv ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net7 $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.mono.toolchain.net7.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(DOWNLOAD_DOTNET_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net7/ @@ -145,8 +142,18 @@ else $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.emscripten.net7.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net7/ $(Q) mkdir -p ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net6/ $(Q) $(CP) $(TOP)/packages/microsoft.net.workload.emscripten.net6.manifest-$(TOOLCHAIN_MANIFEST_VERSION_BAND)/$(EMSCRIPTEN_MANIFEST_PACKAGE_VERSION)/data/WorkloadManifest.* ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net6/ + $(Q) make .stamp-copy-stuff-everywhere $(Q) touch $@ + +.stamp-copy-stuff-everywhere: +ifeq ($(CUSTOM_DOTNET_RUNTIME_INSTALL),1) + $(Q) mkdir -p ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)-rc.2 + $(Q) $(CP) -r ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net7 ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)-rc.2/microsoft.net.workload.mono.toolchain.net7 + $(Q) $(CP) -r ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.mono.toolchain.net6 ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)-rc.2/microsoft.net.workload.mono.toolchain.net6 + $(Q) $(CP) -r ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net7 ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)-rc.2/microsoft.net.workload.emscripten.net7 + $(Q) $(CP) -r ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)/microsoft.net.workload.emscripten.net6 ./downloads/$(DOTNET_INSTALL_NAME)/sdk-manifests/$(DOTNET_MANIFEST_VERSION_BAND)-rc.2/microsoft.net.workload.emscripten.net6 endif + $(Q) touch $@ .stamp-download-dotnet-packages: $(TOP)/Make.config downloads/$(DOTNET_INSTALL_NAME) $(Q_GEN) cd package-download && $(DOTNET) \ diff --git a/tools/devops/automation/scripts/bash/install-workloads.sh b/tools/devops/automation/scripts/bash/install-workloads.sh index 0e86586fdf..9733c0435d 100755 --- a/tools/devops/automation/scripts/bash/install-workloads.sh +++ b/tools/devops/automation/scripts/bash/install-workloads.sh @@ -6,7 +6,7 @@ IFS=$'\n\t ' env | sort make global.json -make -C builds dotnet SKIP_CUSTOM_DOTNET_RUNTIME_INSTALL=1 +make -C builds dotnet CUSTOM_DOTNET_RUNTIME_INSTALL=1 var=$(make -C "$BUILD_SOURCESDIRECTORY/xamarin-macios/tools/devops" print-variable VARIABLE=DOTNET) DOTNET=${var#*=} From a0250da042eedeaf4fa8ff1089b340bcd2c63a08 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 6 Sep 2022 18:49:30 +0200 Subject: [PATCH 13/13] Revert "[tests] Update expected error message texts." This reverts commit de7e738c111ff21fe05bf0a58e7667473b3d3b11. --- tests/dotnet/UnitTests/ProjectTest.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index 47a147a134..c0703c50b6 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -478,10 +478,10 @@ namespace Xamarin.Tests { } [Test] - [TestCase (ApplePlatform.iOS, "win10-x86", "Error getting pack version: Pack 'Microsoft.NETCore.App.Runtime.Mono.win-x86' was not present in workload manifests.")] - [TestCase (ApplePlatform.TVOS, "win10-x64", "Error getting pack version: Pack 'Microsoft.NETCore.App.Runtime.Mono.win-x64' was not present in workload manifests.")] + [TestCase (ApplePlatform.iOS, "win10-x86", null)] + [TestCase (ApplePlatform.TVOS, "win10-x64", null)] [TestCase (ApplePlatform.MacOSX, "win10-arm", null)] - [TestCase (ApplePlatform.MacCatalyst, "win10-arm64", "Error getting pack version: Pack 'Microsoft.NETCore.App.Runtime.Mono.win-arm64' was not present in workload manifests.")] + [TestCase (ApplePlatform.MacCatalyst, "win10-arm64", "Unable to find package Microsoft.NETCore.App.Runtime.Mono.win-arm64. No packages exist with this id in source[(]s[)]:.*")] public void InvalidRuntimeIdentifier_Restore (ApplePlatform platform, string runtimeIdentifier, string? failureMessagePattern) { var project = "MySimpleApp";