Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[net9.0] Add a dependency on the xcode16 packages. #21124

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Make.versions
Original file line number Diff line number Diff line change
Expand Up @@ -151,3 +151,10 @@ SUPPORTED_API_VERSIONS_IOS+=net8.0-17.5
SUPPORTED_API_VERSIONS_TVOS+=net8.0-17.5
SUPPORTED_API_VERSIONS_MACOS+=net8.0-14.5
SUPPORTED_API_VERSIONS_MACCATALYST+=net8.0-17.5

# Add newer (beta) versions here!

SUPPORTED_API_VERSIONS_IOS+=net8.0-18.0
SUPPORTED_API_VERSIONS_TVOS+=net8.0-18.0
SUPPORTED_API_VERSIONS_MACOS+=net8.0-15.0
SUPPORTED_API_VERSIONS_MACCATALYST+=net8.0-18.0
9 changes: 7 additions & 2 deletions dotnet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -178,15 +178,20 @@ Microsoft.$(1).Sdk/targets/Microsoft.$(1).Sdk.SupportedTargetPlatforms.props: $(
endef
$(foreach platform,$(DOTNET_PLATFORMS),$(eval $(call SupportedTargetPlatforms,$(platform),$(shell echo $(platform) | tr a-z A-Z))))

GENERATE_WORKLOADMANIFEST_TARGETS=./tools/generate-workloadmanifest-targets/bin/Debug/$(DOTNET_TFM)/generate-workloadmanifest-targets.dll
GENERATE_WORKLOADMANIFEST_TARGETS_EXEC=$(DOTNET) exec $(GENERATE_WORKLOADMANIFEST_TARGETS)
$(GENERATE_WORKLOADMANIFEST_TARGETS):
$(Q) $(DOTNET) build ./tools/generate-workloadmanifest-targets/*.csproj

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)" "$(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)
Workloads/Microsoft.NET.Sdk.$(1)/WorkloadManifest.targets: Makefile $(TOP)/Make.config.inc $(GIT_DIRECTORY)/HEAD $(GIT_DIRECTORY)/index Makefile $(GENERATE_WORKLOADMANIFEST_TARGETS) | Workloads/Microsoft.NET.Sdk.$(1)
$$(Q) rm -f $$@.tmp
$$(Q_GEN) ./generate-workloadmanifest-targets.csharp "$(1)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))"
$$(Qx_GEN) $(GENERATE_WORKLOADMANIFEST_TARGETS_EXEC) "$(1)" "$$@.tmp" "$$(DOTNET_WINDOWS_PLATFORMS)" "$(DOTNET_TFM)_$$($(4)_NUGET_OS_VERSION)" "$(SUPPORTED_API_VERSIONS_$(4))"
$$(Q) mv $$@.tmp $$@

Workloads/Microsoft.NET.Sdk.$(1)/LICENSE: $(TOP)/LICENSE | Workloads/Microsoft.NET.Sdk.$(1)
Expand Down
103 changes: 0 additions & 103 deletions dotnet/generate-workloadmanifest-targets.csharp

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
// arguments are: <platform> <outputPath>

var expectedArgumentCount = 5;
if (args.Length != expectedArgumentCount) {
Console.WriteLine ($"Need {expectedArgumentCount} arguments, got {args.Length}");
Environment.Exit (1);
return;
}

var argumentIndex = 0;
var platform = args [argumentIndex++];
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++];

var platformLowerCase = platform.ToLowerInvariant ();
// var tfm = currentApiVersion;

var supportedTFMs = new List<string> ();
supportedTFMs.AddRange (supportedApiVersions.Split (' ').Select (v => v.Replace ('-', '_')));
supportedTFMs.Sort ();

var supportedTFVs = new List<string> ();

var tfmToTpvAndTfv = new Func<string, (string Tfv, string Tpv)> (tfm => {
var tfv = tfm.Replace ("net", "");
var sep = tfv.IndexOfAny (new char [] { '-', '_' });
var tpv = "";
if (sep >= 0) {
tpv = tfv.Substring (sep + 1);
tfv = tfv.Substring (0, sep);
}
return (tfv, tpv);
});

var separators = new char [] { '-', '_' };

// Find the latest TFM for each major .NET version, skipping any TFM where the OS version is higher than the current OS version (those are preview versions)
// We import the workload for this TFM if there's no TPV specified in the TargetFramework.
var currentOSVersion = float.Parse (currentApiVersion.Split (new char [] { '-', '_' }).Last ());

using (var writer = new StreamWriter (outputPath)) {
writer.WriteLine ($"<Project>");
// Add one import for each TFM we support, with an explicit check on the TargetPlatfromVersion version.
foreach (var tfm in supportedTFMs) {
var parsed = tfmToTpvAndTfv (tfm);
var tfv = parsed.Tfv;
var tpv = parsed.Tpv;
supportedTFVs.Add (tfv);
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.{tfm}\" />");
if (hasWindows) {
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Windows.Sdk.Aliased.{tfm}\" Condition=\" $([MSBuild]::IsOSPlatform('windows'))\" />");
}
writer.WriteLine ($" </ImportGroup>");
writer.WriteLine ();
}

// Add one import for each TargetFramework (version) we support, with no check on the TargetPlatfromVersion version.
// This is the default import if the TargetPlatformVersion isn't set.
// The imported workload is the one for the last OS version in supportedTFMs that isn't
// a preview version (and we define "preview version" as a version where OS version is > current OS version)
var supportedTargetFrameworks = supportedTFMs.Select (v => v.Split (new char [] { '-', '_' }) [0]).Distinct ();
foreach (var supportedTargetFramework in supportedTargetFrameworks.OrderByDescending (v => float.Parse (v.Replace ("net", "")))) {
var lastOSVersionForTargetFramework = supportedTFMs
.Where (v => v.StartsWith (supportedTargetFramework, StringComparison.Ordinal))
.Where (v => float.Parse (v.Split (separators).Last ()) <= currentOSVersion)
.OrderByDescending (v => float.Parse (v.Split (separators).Last ()) <= currentOSVersion)
.Last ();

var parsed = tfmToTpvAndTfv (lastOSVersionForTargetFramework);

writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' And '$(UsingAppleNETSdk)' != 'true' And $([MSBuild]::VersionEquals($(TargetFrameworkVersion), '{parsed.Tfv}'))\">");
writer.WriteLine ($" <!-- this SDK version will validate the TargetPlatformVersion and show an error (in .NET 9+) or a warning (.NET 8) if it's not valid -->");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Sdk.{lastOSVersionForTargetFramework}\" />");
if (hasWindows) {
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Windows.Sdk.Aliased.{lastOSVersionForTargetFramework}\" Condition=\" $([MSBuild]::IsOSPlatform('windows'))\" />");
}
writer.WriteLine ($" </ImportGroup>");
writer.WriteLine ();
}

var earliestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).First ();
var latestSupportedTFV = supportedTFVs.Select (v => Version.Parse (v)).OrderBy (v => v).Last ();
writer.WriteLine ($" <ImportGroup Condition=\" '$(TargetPlatformIdentifier)' == '{platform}' And '$(UsingAppleNETSdk)' != 'true'\">");
writer.WriteLine ($" <Import Project=\"Sdk-eol.props\" Sdk=\"Microsoft.{platform}.Sdk.{currentApiVersion}\" Condition=\" $([MSBuild]::VersionLessThan($(TargetFrameworkVersion), '{earliestSupportedTFV}'))\" />");
writer.WriteLine ($" <Import Project=\"Sdk.props\" Sdk=\"Microsoft.{platform}.Sdk.{currentApiVersion}\" Condition=\" $([MSBuild]::VersionGreaterThan($(TargetFrameworkVersion), '{latestSupportedTFV}'))\" />");
writer.WriteLine ($" </ImportGroup>");
writer.WriteLine ();
writer.WriteLine ($" <ItemGroup Condition=\" '$(TargetFrameworkIdentifier)' == '.NETCoreApp' and $([MSBuild]::VersionGreaterThanOrEquals($(TargetFrameworkVersion), '6.0')) \">");
writer.WriteLine ($" <SdkSupportedTargetPlatformIdentifier Include=\"{platformLowerCase}\" DisplayName=\"{platform}\" />");
writer.WriteLine ($" </ItemGroup>");

writer.WriteLine ($"</Project>");
writer.WriteLine ();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
21 changes: 21 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@
<Uri>https://github.com/dotnet/runtime</Uri>
<Sha>cf47d9ff6827a3e1d6f2acbf925cd618418f20dd</Sha>
</Dependency>
<!-- This is a subscription of the .NET 8/Xcode 16.0 versions of our packages -->
<Dependency Name="Microsoft.MacCatalyst.Sdk.net8.0_18.0" Version="18.0.8242-xcode16">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>0f285bba1cc10f81a5e5ba02a7dcab3d51958d8c</Sha>
</Dependency>
<Dependency Name="Microsoft.macOS.Sdk.net8.0_15.0" Version="15.0.8242-xcode16">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>0f285bba1cc10f81a5e5ba02a7dcab3d51958d8c</Sha>
</Dependency>
<Dependency Name="Microsoft.iOS.Sdk.net8.0_18.0" Version="18.0.8242-xcode16">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>0f285bba1cc10f81a5e5ba02a7dcab3d51958d8c</Sha>
</Dependency>
<Dependency Name="Microsoft.tvOS.Sdk.net8.0_18.0" Version="18.0.8242-xcode16">
<Uri>https://github.com/xamarin/xamarin-macios</Uri>
<Sha>0f285bba1cc10f81a5e5ba02a7dcab3d51958d8c</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>
</Dependency>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Feed" Version="9.0.0-beta.24408.2">
Expand Down
5 changes: 5 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,10 @@
<MicrosoftmacOSSdknet80_140PackageVersion>14.0.8523</MicrosoftmacOSSdknet80_140PackageVersion>
<MicrosoftiOSSdknet80_170PackageVersion>17.0.8523</MicrosoftiOSSdknet80_170PackageVersion>
<MicrosofttvOSSdknet80_170PackageVersion>17.0.8523</MicrosofttvOSSdknet80_170PackageVersion>
<!-- This is a subscription to the .NET 8/Xcode 16.0 versions of our packages -->
<MicrosoftMacCatalystSdknet80_180PackageVersion>18.0.8242-xcode16</MicrosoftMacCatalystSdknet80_180PackageVersion>
<MicrosoftmacOSSdknet80_150PackageVersion>15.0.8242-xcode16</MicrosoftmacOSSdknet80_150PackageVersion>
<MicrosoftiOSSdknet80_180PackageVersion>18.0.8242-xcode16</MicrosoftiOSSdknet80_180PackageVersion>
<MicrosofttvOSSdknet80_180PackageVersion>18.0.8242-xcode16</MicrosofttvOSSdknet80_180PackageVersion>
</PropertyGroup>
</Project>
6 changes: 4 additions & 2 deletions tests/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ test.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.De
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_REF_NAME=$($(platform)_NUGET_REF_NAME)\\n)" | sed 's/^ //' >> $@
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(rid)_NUGET_RUNTIME_NAME=$($(rid)_NUGET_RUNTIME_NAME)\\n))" | sed 's/^ //' >> $@
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),SUPPORTED_API_VERSIONS_$(platform)='$(SUPPORTED_API_VERSIONS_$(platform))'\\n)" | sed 's/^ //' >> $@
@printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)" >> $@
@printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)\n" >> $@
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_OS_VERSION=$($(platform)_NUGET_OS_VERSION)\\n)" | sed 's/^ //' >> $@

test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Version.Details.xml
@rm -f $@
Expand Down Expand Up @@ -119,7 +120,8 @@ test-system.config: Makefile $(TOP)/Make.config $(TOP)/mk/mono.mk $(TOP)/eng/Ver
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_REF_NAME=$($(platform)_NUGET_REF_NAME)\\n)" | sed 's/^ //' >> $@
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(foreach rid,$(DOTNET_$(platform)_RUNTIME_IDENTIFIERS),$(rid)_NUGET_RUNTIME_NAME=$($(rid)_NUGET_RUNTIME_NAME)\\n))" | sed 's/^ //' >> $@
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),SUPPORTED_API_VERSIONS_$(platform)='$(SUPPORTED_API_VERSIONS_$(platform))'\\n)" | sed 's/^ //' >> $@
@printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)" >> $@
@printf "ENABLE_XAMARIN=$(ENABLE_XAMARIN)\n" >> $@
@printf "$(foreach platform,$(DOTNET_PLATFORMS_UPPERCASE),$(platform)_NUGET_OS_VERSION=$($(platform)_NUGET_OS_VERSION)\\n)" | sed 's/^ //' >> $@

clean-local::
$(Q) $(SYSTEM_XBUILD) /t:Clean /p:Platform=iPhoneSimulator /p:Configuration=$(CONFIG) $(XBUILD_VERBOSITY) tests.sln
Expand Down
1 change: 1 addition & 0 deletions tests/dotnet/UnitTests/PackTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ public void MultiTargetLibraryProject (ApplePlatform platform)
Clean (project_path);

var properties = GetDefaultProperties ();
DotNetProjectTest.AddNoWarnForPreviewOSVersions (properties, supportedApiVersion, platform);
properties ["cmdline:AllTheTargetFrameworks"] = targetFrameworks;

DotNet.AssertPack (project_path, properties);
Expand Down
34 changes: 34 additions & 0 deletions tests/dotnet/UnitTests/ProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,6 +1791,7 @@ public void MultiTargetLibrary (ApplePlatform platform)
var project_path = GetProjectPath (project, platform: platform);
Clean (project_path);
var properties = GetDefaultProperties ();
DotNetProjectTest.AddNoWarnForPreviewOSVersions (properties, supportedApiVersion, platform);
properties ["cmdline:AllTheTargetFrameworks"] = targetFrameworks;
var rv = DotNet.AssertBuild (project_path, properties);
rv.AssertNoWarnings ();
Expand All @@ -1809,6 +1810,39 @@ internal static IList<string> RemovePostCurrentOnMacCatalyst (IList<string> self
return self;
}

internal static void AddNoWarnForPreviewOSVersions (Dictionary<string, string> properties, IList<string> tfms, ApplePlatform platform)
{
var currentVersion = Version.Parse (Configuration.GetNuGetOsVersion (platform));
var postVersions = tfms
.Select (v => v [(1 + v.IndexOfAny (new char [] { '-', '_' }))..])
.Select (Version.Parse)
.Where (v => v > currentVersion);

if (!properties.TryGetValue ("NoWarn", out var nowarn))
nowarn = "";

foreach (var pv in postVersions) {
Version xcodeVersion;
// Computing the Xcode version like this is just a guess, and will eventually fail for minor versions.
switch (platform) {
case ApplePlatform.iOS:
case ApplePlatform.TVOS:
case ApplePlatform.MacCatalyst:
xcodeVersion = new Version (pv.Major - 2, pv.Minor);
break;
case ApplePlatform.MacOSX:
xcodeVersion = new Version (pv.Major + 1, pv.Minor);
break;
default:
throw new ArgumentOutOfRangeException ($"Unknown platform: {platform}");
}
nowarn += $";XCODE_{xcodeVersion.Major}_{xcodeVersion.Minor}_PREVIEW";
}
nowarn = nowarn.Trim (';');
if (!string.IsNullOrEmpty (nowarn))
properties ["NoWarn"] = nowarn;
}

[Test]
[TestCase (ApplePlatform.MacCatalyst)]
[TestCase (ApplePlatform.iOS)]
Expand Down