[dotnet] Implement support for building net6.0-* apps with .NET 7. Fixes #15672. (#15785)

"Backport" of #15761.

This required a few changes:

* 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.

There were a few other related changes:

* Bump MonoTouch.Dialog and Touch.Unit to a get a version where the project
  files uses 'net6.0'. This way these projects partly work as tests.
* We need to remove any global nfloat usings added by any .NET 6 packs because
  we implement the same functionality different in .NET 7 (and they clash).
* Add a test.

Fixes https://github.com/xamarin/xamarin-macios/issues/15672.

[1]: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-manifest.md#side-by-side-workload-pattern
This commit is contained in:
Rolf Bjarne Kvinge 2022-09-07 11:35:46 +02:00 коммит произвёл GitHub
Родитель 66711a9d62 a0250da042
Коммит 23afb03a58
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
37 изменённых файлов: 344 добавлений и 260 удалений

Просмотреть файл

@ -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

Просмотреть файл

@ -132,15 +132,28 @@ 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/
$(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) 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) \

Просмотреть файл

@ -21,9 +21,11 @@
<!-- and get the mono workload as well -->
<PackageDownload Include="Microsoft.NET.Workload.Mono.ToolChain.net7.Manifest-$(ToolChainManifestVersionBand)" Version="[$(ActualPackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.Mono.ToolChain.net6.Manifest-$(ToolChainManifestVersionBand)" Version="[$(ActualPackageVersion)]" />
<!-- and get the emscripten workload as well -->
<PackageDownload Include="Microsoft.NET.Workload.Emscripten.net7.Manifest-$(ToolChainManifestVersionBand)" Version="[$(MicrosoftNETWorkloadEmscriptennet7Manifest70100PackageVersion)]" />
<PackageDownload Include="Microsoft.NET.Workload.Emscripten.net6.Manifest-$(ToolChainManifestVersionBand)" Version="[$(MicrosoftNETWorkloadEmscriptennet7Manifest70100PackageVersion)]" />
</ItemGroup>
<!-- target to write out the BundledNETCorePlatformsPackageVersion to a file -->

Просмотреть файл

@ -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
@ -150,14 +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/@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
@ -169,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))))
$(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

Просмотреть файл

@ -1,5 +1,8 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.MacCatalyst.Sdk.net6" Condition="'$(TargetPlatformIdentifier)' == 'MacCatalyst'" />
<ImportGroup Condition=" '$(TargetPlatformIdentifier)' == 'MacCatalyst' ">
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net7" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) " />
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net6" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')) " />
</ImportGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '6.0')) ">
<SdkSupportedTargetPlatformIdentifier Include="maccatalyst" DisplayName="Mac Catalyst" />

Просмотреть файл

@ -1,6 +1,10 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.iOS.Sdk.net6" Condition="'$(TargetPlatformIdentifier)' == 'iOS'" />
<Import Project="Sdk.props" Sdk="Microsoft.iOS.Windows.Sdk.Aliased.net6" Condition=" '$(TargetPlatformIdentifier)' == 'iOS' and $([MSBuild]::IsOSPlatform('windows'))" />
<ImportGroup Condition=" '$(TargetPlatformIdentifier)' == 'iOS' ">
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net7" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) " />
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net6" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')) " />
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Windows.Sdk.Aliased.net7" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And $([MSBuild]::IsOSPlatform('windows'))" />
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Windows.Sdk.Aliased.net6" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')) And $([MSBuild]::IsOSPlatform('windows'))" />
</ImportGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '6.0')) ">
<SdkSupportedTargetPlatformIdentifier Include="ios" DisplayName="iOS" />

Просмотреть файл

@ -1,5 +1,8 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.macOS.Sdk.net6" Condition="'$(TargetPlatformIdentifier)' == 'macOS'" />
<ImportGroup Condition=" '$(TargetPlatformIdentifier)' == 'macOS' ">
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net7" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) " />
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net6" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')) " />
</ImportGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '6.0')) ">
<SdkSupportedTargetPlatformIdentifier Include="macos" DisplayName="macOS" />

Просмотреть файл

@ -1,5 +1,8 @@
<Project>
<Import Project="Sdk.props" Sdk="Microsoft.tvOS.Sdk.net6" Condition="'$(TargetPlatformIdentifier)' == 'tvOS'" />
<ImportGroup Condition=" '$(TargetPlatformIdentifier)' == 'tvOS' ">
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net7" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) " />
<Import Project="Sdk.props" Sdk="Microsoft.$(TargetPlatformIdentifier).Sdk.net6" Condition=" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '6.0')) " />
</ImportGroup>
<ItemGroup Condition=" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '6.0')) ">
<SdkSupportedTargetPlatformIdentifier Include="tvos" DisplayName="tvOS" />

Просмотреть файл

@ -0,0 +1,137 @@
#!/usr/bin/env /Library/Frameworks/Mono.framework/Commands/csharp
// arguments are: <platform> <outputPath>
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);

Просмотреть файл

@ -11,4 +11,20 @@
<ItemGroup>@VALID_RUNTIME_IDENTIFIERS@
</ItemGroup>
<!-- Declare the XI/XM framework bundled with this version of the SDK. See Microsoft.NETCoreSdk.BundledVersions.props -->
<ItemGroup>
<KnownFrameworkReference
Include="Microsoft.@PLATFORM@"
TargetFramework="@DOTNET_TFM@"
RuntimeFrameworkName="Microsoft.@PLATFORM@"
DefaultRuntimeFrameworkVersion="@NUGET_VERSION_NO_METADATA@"
LatestRuntimeFrameworkVersion="@NUGET_VERSION_NO_METADATA@"
TargetingPackName="Microsoft.@PLATFORM@.Ref"
TargetingPackVersion="@NUGET_VERSION_NO_METADATA@"
RuntimePackNamePatterns="Microsoft.@PLATFORM@.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@RUNTIME_PACK_RUNTIME_IDENTIFIERS@"
Profile="@PLATFORM@"
/>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,43 +0,0 @@
{
"version": "@VERSION@",
"workloads": {
"@PLATFORM_LOWERCASE@": {
"description": ".NET SDK Workload for building macOS applications with @PLATFORM@.",
"packs": [
"Microsoft.@PLATFORM@.Sdk.net6",
"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.net6": {
"kind": "sdk",
"version": "@VERSION@",
"alias-to": {
"any": "Microsoft.@PLATFORM@.Sdk"
}
},
"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@"
}
}
}

Просмотреть файл

@ -1,68 +0,0 @@
{
"version": "@VERSION@",
"workloads": {
"@PLATFORM_LOWERCASE@": {
"description": ".NET SDK Workload for building @PLATFORM@ applications.",
"packs": [
"Microsoft.@PLATFORM@.Sdk.net6",
"Microsoft.@PLATFORM@.Windows.Sdk.Aliased.net6",
"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.net6": {
"kind": "sdk",
"version": "@VERSION@",
"alias-to": {
"any": "Microsoft.@PLATFORM@.Sdk"
}
},
"Microsoft.@PLATFORM@.Windows.Sdk.Aliased.net6": {
"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@"
}
}
}

Просмотреть файл

@ -1,43 +0,0 @@
{
"version": "@VERSION@",
"workloads": {
"@PLATFORM_LOWERCASE@": {
"description": ".NET SDK Workload for building @PLATFORM@ applications.",
"packs": [
"Microsoft.@PLATFORM@.Sdk.net6",
"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.net6": {
"kind": "sdk",
"version": "@VERSION@",
"alias-to": {
"any": "Microsoft.@PLATFORM@.Sdk"
}
},
"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@"
}
}
}

Просмотреть файл

@ -1,48 +0,0 @@
{
"version": "@VERSION@",
"workloads": {
"@PLATFORM_LOWERCASE@": {
"description": ".NET SDK Workload for building @PLATFORM@ applications.",
"packs": [
"Microsoft.@PLATFORM@.Sdk.net6",
"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.net6": {
"kind": "sdk",
"version": "@VERSION@",
"alias-to": {
"any": "Microsoft.@PLATFORM@.Sdk"
}
},
"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@"
}
}
}

Просмотреть файл

@ -77,35 +77,11 @@
<ComputedPlatform Condition="'$(ComputedPlatform)' == ''">iPhone</ComputedPlatform>
</PropertyGroup>
<!-- Declare the XI/XM framework bundled with this version of the SDK. See Microsoft.NETCoreSdk.BundledVersions.props -->
<PropertyGroup>
<!-- Runtime pack identifiers -->
<_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'iOS' ">iossimulator-x64;ios-arm64;ios-arm;iossimulator-x86;iossimulator-arm64</_RuntimePackRuntimeIdentifiers>
<_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'tvOS' ">tvossimulator-x64;tvos-arm64;tvossimulator-arm64</_RuntimePackRuntimeIdentifiers>
<_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'watchOS' ">watchos-x86;watchos-x64;watchos-arm</_RuntimePackRuntimeIdentifiers>
<_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'macOS' ">osx-x64;osx-arm64</_RuntimePackRuntimeIdentifiers>
<_RuntimePackRuntimeIdentifiers Condition=" '$(_PlatformName)' == 'MacCatalyst' ">maccatalyst-x64;maccatalyst-arm64</_RuntimePackRuntimeIdentifiers>
</PropertyGroup>
<PropertyGroup>
<_RuntimeFrameworkVersion>$(BundledNETCorePlatformsPackageVersion)</_RuntimeFrameworkVersion>
<_RuntimeFrameworkVersion Condition="'$(CUSTOM_DOTNET_VERSION)' != ''">$(CUSTOM_DOTNET_VERSION)</_RuntimeFrameworkVersion>
</PropertyGroup>
<ItemGroup>
<KnownFrameworkReference Include="Microsoft.$(_PlatformName)"
TargetFramework="net7.0"
RuntimeFrameworkName="Microsoft.$(_PlatformName)"
DefaultRuntimeFrameworkVersion="**FromWorkload**"
LatestRuntimeFrameworkVersion="**FromWorkload**"
TargetingPackName="Microsoft.$(_PlatformName).Ref"
TargetingPackVersion="**FromWorkload**"
RuntimePackNamePatterns="Microsoft.$(_PlatformName).Runtime.**RID**"
RuntimePackRuntimeIdentifiers="$(_RuntimePackRuntimeIdentifiers)"
Profile="$(_PlatformName)"
/>
</ItemGroup>
<ItemGroup Condition="'$(DisableImplicitFrameworkReferences)' != 'true'">
<FrameworkReference Include="Microsoft.$(_PlatformName)" IsImplicitlyDefined="true" Pack="false" PrivateAssets="All" />
</ItemGroup>

Просмотреть файл

@ -1866,6 +1866,20 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B
</ItemGroup>
</Target>
<!--
The .NET 6 sdk pack will add a global using directive by adding to the
'Using' item group, but we don't want that anymore in .NET 7 (we
manually generate the global using to avoid a C# warning), so remove
any global using that may have been added by the .NET sdk pack. The
.NET 6 sdk pack will one day condition the inclusion on the current
target framework version, and at that point we can remove this
workaround (https://github.com/xamarin/xamarin-macios/pull/15385).
-->
<Target Name="RemoveGlobalnfloatUsingItemGroup" BeforeTargets="PrepareForBuild">
<ItemGroup>
<Using Remove="System.Runtime.InteropServices.NFloat" />
</ItemGroup>
</Target>
<!-- Import existing targets -->

Просмотреть файл

@ -8,9 +8,9 @@
<Uri>https://github.com/dotnet/linker</Uri>
<Sha>313671b195b1b36d56a8888a9a0e12edaac52c57</Sha>
</Dependency>
<Dependency Name="Microsoft.NETCore.App.Ref" Version="7.0.0-rc.2.22451.3">
<Dependency Name="Microsoft.NETCore.App.Ref" Version="7.0.0-rc.2.22452.13">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>608da95fedbb4686789cdd98102a94f341a41fb8</Sha>
<Sha>ce7e86468f5c3d21d9370ebdde110a532534a9ad</Sha>
</Dependency>
<!-- This is required for our test apps to build; in some cases Microsoft.AspNetCore.App is pulled in, and when building test apps the build needs to be able to resolve that -->
<Dependency Name="Microsoft.AspNetCore.App.Ref" Version="7.0.0-rc.2.22426.4" CoherentParentDependency="Microsoft.Dotnet.Sdk.Internal">

Просмотреть файл

@ -5,7 +5,7 @@
<MicrosoftNETILLinkTasksPackageVersion>7.0.100-1.22423.4</MicrosoftNETILLinkTasksPackageVersion>
<MicrosoftDotNetBuildTasksFeedPackageVersion>6.0.0-beta.21212.6</MicrosoftDotNetBuildTasksFeedPackageVersion>
<MicrosoftNETILStripTasksPackageVersion>6.0.0-rc.2.21468.3</MicrosoftNETILStripTasksPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>7.0.0-rc.2.22451.3</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>7.0.0-rc.2.22452.13</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftNETWorkloadEmscriptennet7Manifest70100PackageVersion>7.0.0-rc.2.22430.5</MicrosoftNETWorkloadEmscriptennet7Manifest70100PackageVersion>
<MicrosoftTemplateEngineTasksVersion>7.0.100-alpha.1.21601.1</MicrosoftTemplateEngineTasksVersion>
</PropertyGroup>

2
external/MonoTouch.Dialog поставляемый

@ -1 +1 @@
Subproject commit eaa22021dda3969a73117959a8f638f78a565690
Subproject commit 558958b0a2de19036cf6fdd21401573a65239017

2
external/Touch.Unit поставляемый

@ -1 +1 @@
Subproject commit be3a8d0855b8291848d02c9c9d99748cb41c56c2
Subproject commit 564433f35c8ab6b7bb0709f83e1b81a89c406956

Просмотреть файл

@ -10,6 +10,10 @@ ifeq ($(TESTNAME),)
TESTNAME:=$(notdir $(shell dirname "$(shell dirname "$(CURDIR)")"))
endif
ifeq ($(TEST_TFM),)
TEST_TFM=$(DOTNET_TFM)
endif
ifeq ($(CONFIG),)
CONFIG=Debug
else
@ -40,12 +44,12 @@ run: prepare
$(Q) $(DOTNET) build "/bl:$(abspath $@-$(BINLOG_TIMESTAMP).binlog)" *.?sproj $(MSBUILD_VERBOSITY) $(BUILD_ARGUMENTS) $(CONFIG_ARGUMENT) -t:Run
run-bare:
$(Q) "$(abspath .)"/bin/$(CONFIG)/$(DOTNET_TFM)-*/*/"$(TESTNAME)".app/Contents/MacOS/"$(TESTNAME)" --autostart --autoexit
$(Q) "$(abspath .)"/bin/$(CONFIG)/$(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/$(CONFIG)/$(DOTNET_TFM)-*/*/"$(TESTNAME)".app $(USER)@$(REMOTE_HOST):/tmp/test-run-remote-execution/
rsync -avz ./bin/$(CONFIG)/$(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)..."

Просмотреть файл

@ -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;
}
}
}

Просмотреть файл

@ -0,0 +1 @@
include ../shared.mk

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-maccatalyst</TargetFramework>
</PropertyGroup>
<Import Project="..\shared.csproj" />
</Project>

Просмотреть файл

@ -0,0 +1,2 @@
TOP=../../..
include $(TOP)/tests/common/shared-dotnet-test.mk

Просмотреть файл

@ -0,0 +1 @@
include ../shared.mk

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-ios</TargetFramework>
</PropertyGroup>
<Import Project="..\shared.csproj" />
</Project>

Просмотреть файл

@ -0,0 +1 @@
include ../shared.mk

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-macos</TargetFramework>
</PropertyGroup>
<Import Project="..\shared.csproj" />
</Project>

Просмотреть файл

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<OutputType>Exe</OutputType>
<ApplicationTitle>MySimpleApp</ApplicationTitle>
<ApplicationId>com.xamarin.mysimpleapp</ApplicationId>
<ApplicationVersion>6.0</ApplicationVersion>
</PropertyGroup>
<Import Project="../../common/shared-dotnet.csproj" />
<ItemGroup>
<Compile Include="../*.cs" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,4 @@
TOP=../../../..
TESTNAME=Net6_0SimpleApp
TEST_TFM=net6.0
include $(TOP)/tests/common/shared-dotnet.mk

Просмотреть файл

@ -0,0 +1 @@
include ../shared.mk

Просмотреть файл

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-tvos</TargetFramework>
</PropertyGroup>
<Import Project="..\shared.csproj" />
</Project>

Просмотреть файл

@ -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";
@ -939,6 +939,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.

Просмотреть файл

@ -27,18 +27,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;
}

Просмотреть файл

@ -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";

Просмотреть файл

@ -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#*=}