Merge remote-tracking branch 'origin/main' into bump-main-in-net9.0-2024-02-19

This commit is contained in:
Rolf Bjarne Kvinge 2024-02-28 18:00:53 +01:00
Родитель 05b3b9470b c303a9c7c7
Коммит c8fc59a488
10 изменённых файлов: 92 добавлений и 39 удалений

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

@ -142,4 +142,7 @@ SUPPORTED_API_VERSIONS_MACCATALYST=$(DOTNET_TFM)-$(MACCATALYST_NUGET_OS_VERSION)
# Add older versions here!
# (work on adding older versions is in progress)
SUPPORTED_API_VERSIONS_IOS+=$(DOTNET_TFM)-17.0
SUPPORTED_API_VERSIONS_TVOS+=$(DOTNET_TFM)-17.0
SUPPORTED_API_VERSIONS_MACOS+=$(DOTNET_TFM)-14.0
SUPPORTED_API_VERSIONS_MACCATALYST+=$(DOTNET_TFM)-17.0

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

@ -122,39 +122,39 @@ WorkloadManifest.targets:
<!-- Using a specific target platform version -->
<Import Project="Sdk.props"
Sdk="Microsoft.iOS.Sdk.net7.0_16.0"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '16.0'))" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '16.0'))" />
<Import Project="Sdk.props"
Sdk="Microsoft.iOS.Sdk.net7.0_16.4"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '16.4'))" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '16.4'))" />
<Import Project="Sdk.props"
Sdk="Microsoft.iOS.Sdk.net8.0_17.0"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '17.0'))" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '17.0'))" />
<Import Project="Sdk.props"
Sdk="Microsoft.iOS.Sdk.net8.0_18.0"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '18.0'))" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) And '$(TargetPlatformVersion)' != '' And $([MSBuild]::VersionEquals($(TargetPlatformVersion), '18.0'))" />
<!-- Using the default target platform version -->
<Import Project="Sdk.props"
Sdk="Microsoft.iOS.Sdk.net7.0_16.4"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And '$(TargetPlatformVersion)' == ''" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '7.0')) And '$(TargetPlatformVersion)' == ''" />
<Import Project="Sdk.props"
Sdk="Microsoft.iOS.Sdk.net8.0_17.0"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) And '$(TargetPlatformVersion)' == ''" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '8.0')) And '$(TargetPlatformVersion)' == ''" />
<!-- Using a .NET version we no longer support -->
<Import Project="Sdk-eol.props"
Sdk="Microsoft.iOS.Sdk.net8.0_17.0"
Condition="'$(_AppleSdkLoaded)' != 'true' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '7.0'))" />
Condition="'$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '7.0'))" />
<!-- Using a specific, but unsupported, target platform version -->
<Import Project="Sdk-error.props"
Sdk="Microsoft.iOS.Sdk.net8.0_17.0"
Condition="'$(_AppleSdkLoaded)' != 'true'" />
Condition="'$(UsingAppleNETSdk)' != 'true'" />
</ImportGroup>
```
Note 1: Every sdk we load sets the property `_AppleSdkLoaded=true`, this makes
Note 1: Every sdk we load sets the property `UsingAppleNETSdk=true`, this makes
it easy to avoid loading multiple sdks.
Note 2: One complication here is that TargetPlatformVersion might not be set

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

@ -176,7 +176,7 @@ $(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call SupportedTargetPlatforms,$(
define WorkloadTargets
Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.json: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile generate-workloadmanifest-json.csharp | Workloads/Microsoft.NET.Sdk.$(1)
$$(Q) rm -f $$@.tmp
$$(Q_GEN) ./generate-workloadmanifest-json.csharp "$(1)" "$(3)" "$(5)" "$$(DOTNET_$(4)_RUNTIME_IDENTIFIERS)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)"
$$(Q_GEN) ./generate-workloadmanifest-json.csharp "$(1)" "$(3)" "$(5)" "$$(DOTNET_$(4)_RUNTIME_IDENTIFIERS)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))" $(TOP)/eng/Versions.props
$$(Q) mv $$@.tmp $$@
Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.targets: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile generate-workloadmanifest-targets.csharp | Workloads/Microsoft.NET.Sdk.$(1)

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

@ -6,7 +6,7 @@ using System.IO;
using System.Xml;
var args = Args;
var expectedArgumentCount = 7;
var expectedArgumentCount = 9;
if (args.Length != expectedArgumentCount) {
Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}");
Environment.Exit (1);
@ -22,10 +22,25 @@ var outputPath = args [argumentIndex++];
var windowsPlatforms = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0;
var currentApiVersion = args [argumentIndex++];
var supportedApiVersions = args [argumentIndex++].Split (new char [] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
var versionsPropsPath = args [argumentIndex++];
var platformLowerCase = platform.ToLowerInvariant ();
var tfm = currentApiVersion;
var allApiVersions = new List<string> (supportedApiVersions);
allApiVersions = allApiVersions.Select (v => v.Replace ('-', '_')).ToList ();
var versionsPropsTable = File.ReadAllLines (versionsPropsPath).
Where (v => v.Count (f => f == '>') > 1).
Select (v => {
var split = v.Trim ().Split (new char [] { '<', '>', '/'}, StringSplitOptions.RemoveEmptyEntries);
var name = split [0];
var value = split [1];
return new Tuple<string, string> (name, value);
}).
ToDictionary (v => v.Item1, v => v.Item2, StringComparer.OrdinalIgnoreCase);
var failed = false;
using (TextWriter writer = new StreamWriter (outputPath)) {
writer.WriteLine ($"{{");
writer.WriteLine ($" \"version\": \"{version}\",");
@ -39,9 +54,9 @@ using (TextWriter writer = new StreamWriter (outputPath)) {
writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.{tfm}\",");
writer.WriteLine ($" \"Microsoft.{platform}.Windows.Sdk.Aliased.net8\",");
}
writer.WriteLine ($" \"Microsoft.{platform}.Ref.{tfm}\",");
writer.WriteLine ($" \"Microsoft.{platform}.Ref.{currentApiVersion}\",");
foreach (var rid in runtimeIdentifiers) {
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{tfm}\",");
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{currentApiVersion}\",");
}
writer.WriteLine ($" \"Microsoft.{platform}.Templates.net9\"");
writer.WriteLine ($" ],");
@ -62,6 +77,7 @@ using (TextWriter writer = new StreamWriter (outputPath)) {
writer.WriteLine ($" \"version\": \"{version}\",");
writer.WriteLine ($" }},");
writer.WriteLine ($" \"Microsoft.{platform}.Sdk.net8\": {{");
writer.WriteLine ($" \"kind\": \"sdk\",");
writer.WriteLine ($" \"version\": \"{net8Version}\",");
writer.WriteLine ($" \"alias-to\": {{");
@ -88,12 +104,12 @@ using (TextWriter writer = new StreamWriter (outputPath)) {
writer.WriteLine ($" }}");
writer.WriteLine ($" }},");
}
writer.WriteLine ($" \"Microsoft.{platform}.Ref.{tfm}\": {{");
writer.WriteLine ($" \"Microsoft.{platform}.Ref.{currentApiVersion}\": {{");
writer.WriteLine ($" \"kind\": \"framework\",");
writer.WriteLine ($" \"version\": \"{version}\"");
writer.WriteLine ($" }},");
foreach (var rid in runtimeIdentifiers) {
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{tfm}\": {{");
writer.WriteLine ($" \"Microsoft.{platform}.Runtime.{rid}.{currentApiVersion}\": {{");
writer.WriteLine ($" \"kind\": \"framework\",");
writer.WriteLine ($" \"version\": \"{version}\"");
writer.WriteLine ($" }},");
@ -109,4 +125,6 @@ using (TextWriter writer = new StreamWriter (outputPath)) {
writer.WriteLine ($"}}");
}
if (failed)
Environment.Exit (1);
Environment.Exit (0);

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

@ -20,46 +20,53 @@ var windowsPlatforms = args [argumentIndex++].Split (new char [] { ' ' }, String
var hasWindows = Array.IndexOf (windowsPlatforms, platform) >= 0;
var currentApiVersion = args [argumentIndex++];
var olderApiVersions = args [argumentIndex++];
var defaultApiVersion = args [argumentIndex++];
var supportedApiVersions = args [argumentIndex++];
var platformLowerCase = platform.ToLowerInvariant ();
var tfm = currentApiVersion;
var supportedTFMs = new List<string> ();
supportedTFMs.Add (currentApiVersion);
supportedTFMs.AddRange (olderApiVersions.Split (' '));
supportedTFMs.AddRange (supportedApiVersions.Split (' ').Select (v => v.Replace ('-', '_')));
supportedTFMs.Sort ();
var supportedTFVs = new List<string> ();
using (var writer = new StreamWriter (outputPath)) {
writer.WriteLine ($"<Project>");
writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' \">");
foreach (var tfm in supportedTFMs) {
var tfv = tfm.Replace ("net", "");
var sep = tfv.IndexOfAny (new char [] { '-', '_' });
if (sep >= 0)
var tpv = "";
if (sep >= 0) {
tpv = tfv.Substring (sep + 1);
tfv = tfv.Substring (0, sep);
}
supportedTFVs.Add (tfv);
var workloadVersion = tfm;
if (tfv [0] == '7')
workloadVersion = tfm.Replace (".0", "");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Sdk.{workloadVersion}\" Condition=\" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '{tfv}'))\" />");
}
if (hasWindows) {
writer.WriteLine ();
foreach (var tfm in supportedTFMs) {
var tfv = tfm.Replace ("net", "");
var sep = tfv.IndexOfAny (new char [] { '-', '_' });
if (sep >= 0)
tfv = tfv.Substring (0, tfv.IndexOfAny (new char [] { '-', '_' }));
var workloadVersion = tfm;
if (tfv [0] == '7')
workloadVersion = tfm.Replace (".0", "");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Windows.Sdk.Aliased.{workloadVersion}\" Condition=\" $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '{tfv}')) And $([MSBuild]::IsOSPlatform('windows'))\" />");
if (tfm == currentApiVersion) {
writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' And '$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '{tfv}'))\">");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Sdk.{workloadVersion}\" /> <!-- this SDK version will validate the TargetPlatformVersion and show an error (in .NET 9+) or a warning (.NET 8) if it's not valid -->");
} else if (tpv.Length > 0) {
writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' And '$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '{tfv}')) And '$(TargetPlatformVersion)' == '{tpv}'\">");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Sdk.{workloadVersion}\" />");
} else {
writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' And '$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '{tfv}'))\">");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Sdk.{workloadVersion}\" />");
}
if (hasWindows) {
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Windows.Sdk.Aliased.{workloadVersion}\" Condition=\" $([MSBuild]::IsOSPlatform('windows'))\" />");
}
writer.WriteLine ($" </ImportGroup>");
writer.WriteLine ();
}
writer.WriteLine ();
var earliestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).First ();
writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' And '$(UsingAppleNETSdk)' != 'true'\">");
writer.WriteLine ($" <Import Project=\"Sdk-eol.props\" Sdk=\"Microsoft.{platform}.Sdk.{tfm}\" Condition=\" $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '{earliestSupportedTFV}'))\" />");
writer.WriteLine ($" </ImportGroup>");
writer.WriteLine ();

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

@ -47,6 +47,23 @@
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>2cb9d6666fb84a59e149049f20fee18de0902129</Sha>
</Dependency>
<!-- This is a subscription of the .NET 8/Xcode 15.0 versions of our packages -->
<Dependency Name="Microsoft.MacCatalyst.Sdk.net8.0_17.0" Version="17.0.8519">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>492e53f5b423c6e9cbdb48f3d57c92a1f97b5005</Sha>
</Dependency>
<Dependency Name="Microsoft.macOS.Sdk.net8.0_17.0" Version="14.0.8519">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>492e53f5b423c6e9cbdb48f3d57c92a1f97b5005</Sha>
</Dependency>
<Dependency Name="Microsoft.iOS.Sdk.net8.0_17.0" Version="17.0.8519">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>492e53f5b423c6e9cbdb48f3d57c92a1f97b5005</Sha>
</Dependency>
<Dependency Name="Microsoft.tvOS.Sdk.net8.0_17.0" Version="17.0.8519">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>492e53f5b423c6e9cbdb48f3d57c92a1f97b5005</Sha>
</Dependency>
<Dependency Name="Microsoft.NET.Runtime.MonoTargets.Sdk" Version="9.0.0-alpha.1.23556.4">
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>cf47d9ff6827a3e1d6f2acbf925cd618418f20dd</Sha>

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

@ -7,5 +7,10 @@ namespace MySimpleApp {
{
return 42;
}
public static Type GetNSObjectType ()
{
return typeof (Foundation.NSObject);
}
}
}

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

@ -176,7 +176,6 @@ namespace Xamarin.Tests {
[TestCase (ApplePlatform.iOS)]
[TestCase (ApplePlatform.TVOS)]
[TestCase (ApplePlatform.MacOSX)]
[Ignore ("Multi-targeting support has been temporarily reverted/postponed")]
public void MultiTargetLibraryProject (ApplePlatform platform)
{
Configuration.IgnoreIfIgnoredPlatform (platform);

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

@ -1517,7 +1517,6 @@ namespace Xamarin.Tests {
[TestCase (ApplePlatform.iOS)]
[TestCase (ApplePlatform.TVOS)]
[TestCase (ApplePlatform.MacOSX)]
[Ignore ("Multi-targeting support has been temporarily reverted/postponed")]
public void MultiTargetLibrary (ApplePlatform platform)
{
Configuration.IgnoreIfIgnoredPlatform (platform);
@ -1620,6 +1619,7 @@ namespace Xamarin.Tests {
return supportedApiVersions
.Where (v => v.StartsWith (Configuration.DotNetTfm + "-", StringComparison.Ordinal))
.Select (v => v.Substring (Configuration.DotNetTfm.Length + 1))
.OrderBy (v => v)
.ToArray ();
}

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

@ -441,8 +441,12 @@ namespace Xamarin.Tests {
var failures = new List<string> ();
for (var i = 0; i < expectedMessages.Length; i++) {
if (actualMessages [i].Message != expectedMessages [i]) {
failures.Add ($"\tUnexpected {type} message #{i}:\n\t\tExpected: {expectedMessages [i]}\n\t\tActual: {actualMessages [i].Message?.TrimEnd ()}");
var actual = actualMessages [i].Message ?? string.Empty;
var expected = expectedMessages [i];
if (actual != expected) {
actual = actual.Replace ("\n", "\\n").Replace ("\r", "\\r");
expected = expected.Replace ("\n", "\\n").Replace ("\r", "\\r");
failures.Add ($"\tUnexpected {type} message #{i}:\n\t\tExpected: {expected}\n\t\tActual: {actual}");
}
}
if (!failures.Any ())