Skip to content

Commit

Permalink
[net8.0] Merge main into net8.0. (#18721)
Browse files Browse the repository at this point in the history
  • Loading branch information
rolfbjarne authored Aug 15, 2023
2 parents f8b7b53 + b7a7b4d commit c9032f2
Show file tree
Hide file tree
Showing 26 changed files with 159 additions and 60 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/update-single-platform-branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ jobs:
set -ex
git config user.email "[email protected]"
git config user.name "GitHub Actions Single Platform Branch Updater"
for platform in iOS tvOS MacCatalyst macOS; do
git checkout -b release-test/only-dotnet-$platform origin/release-test/only-dotnet-$platform
for platform in dotnet-iOS dotnet-tvOS dotnet-MacCatalyst dotnet-macOS dotnet legacy legacy-iOS legacy-macOS; do
git checkout -b release-test/only-$platform origin/release-test/only-$platform
git merge origin/main
git push
done
12 changes: 6 additions & 6 deletions Make.config
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ $(TOP)/Make.config.inc: $(TOP)/Make.config $(TOP)/mk/mono.mk

include $(TOP)/Make.versions

APIDIFF_REFERENCES_iOS=https://dl.internalx.com/wrench/xcode14.1/6714e055b242715aaa682b578f898070facf243a/7021940/package/bundle.zip
APIDIFF_REFERENCES_Mac=https://dl.internalx.com/wrench/xcode14.1/6714e055b242715aaa682b578f898070facf243a/7021940/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_iOS=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_tvOS=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_macOS=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_MacCatalyst=https://dl.internalx.com/wrench/7.0.1xx/c51a20dbde7bb30d896019f178e0055559071177/6999758/package/bundle.zip
APIDIFF_REFERENCES_iOS=https://dl.internalx.com/wrench/xcode14.3/97731c92cc6d147825c1a39ed2c5c530a5f9a12b/7611701/package/bundle.zip
APIDIFF_REFERENCES_Mac=https://dl.internalx.com/wrench/xcode14.3/97731c92cc6d147825c1a39ed2c5c530a5f9a12b/7611701/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_iOS=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_tvOS=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_macOS=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip
APIDIFF_REFERENCES_DOTNET_MacCatalyst=https://dl.internalx.com/wrench/7.0.3xx/43ae6c749407e47fdf5fa07295119b87f7328ea6/8004688/package/bundle.zip

PACKAGE_HEAD_REV=$(shell git rev-parse HEAD)

Expand Down
4 changes: 4 additions & 0 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -1019,11 +1019,15 @@
<_IsDedupEnabled Condition="'$(_IsDedupEnabled)' == ''">true</_IsDedupEnabled>
<_DedupAssembly Condition="'$(_RunAotCompiler)' == 'true' And '$(IsMacEnabled)' == 'true' And '$(_IsDedupEnabled)' == 'true'">$(IntermediateOutputPath)aot-instances.dll</_DedupAssembly>

<!-- default to 'static' for Mac Catalyst to work around https://github.com/xamarin/xamarin-macios/issues/14686 -->
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And '$(_PlatformName)' == 'MacCatalyst'">static</_LibMonoLinkMode>
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == '' And ('$(ComputedPlatform)' != 'iPhone' Or '$(_PlatformName)' == 'macOS')">dylib</_LibMonoLinkMode>
<_LibMonoLinkMode Condition="'$(_LibMonoLinkMode)' == ''">static</_LibMonoLinkMode>
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'dylib'">dylib</_LibMonoExtension>
<_LibMonoExtension Condition="'$(_LibMonoLinkMode)' == 'static'">a</_LibMonoExtension>

<!-- default to 'static' for Mac Catalyst to work around https://github.com/xamarin/xamarin-macios/issues/14686 -->
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(_PlatformName)' == 'MacCatalyst'">static</_LibXamarinLinkMode>
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == '' And '$(ComputedPlatform)' != 'iPhone' And '$(_PlatformName)' != 'macOS'">dylib</_LibXamarinLinkMode>
<_LibXamarinLinkMode Condition="'$(_LibXamarinLinkMode)' == ''">static</_LibXamarinLinkMode>
<_LibXamarinExtension Condition="'$(_LibXamarinLinkMode)' == 'dylib'">dylib</_LibXamarinExtension>
Expand Down
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
<Uri>https://github.com/dotnet/templating</Uri>
<Sha />
</Dependency>
<Dependency Name="Microsoft.DotNet.XHarness.iOS.Shared" Version="8.0.0-prerelease.23403.1">
<Dependency Name="Microsoft.DotNet.XHarness.iOS.Shared" Version="8.0.0-prerelease.23407.2">
<Uri>https://github.com/dotnet/xharness</Uri>
<Sha>7e3f2975a8767cd416594d7194ba617f6ef8e88e</Sha>
<Sha>480b9159eb7e69b182a87581d5a336e97e0b6dae</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>7.0.7</MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>
<MicrosoftTemplateEngineTasksVersion>7.0.100-alpha.1.21601.1</MicrosoftTemplateEngineTasksVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.23360.2</MicrosoftDotNetCecilPackageVersion>
<MicrosoftDotNetXHarnessiOSSharedPackageVersion>8.0.0-prerelease.23403.1</MicrosoftDotNetXHarnessiOSSharedPackageVersion>
<MicrosoftDotNetXHarnessiOSSharedPackageVersion>8.0.0-prerelease.23407.2</MicrosoftDotNetXHarnessiOSSharedPackageVersion>
<!-- Manually updated versions -->
<Emscriptennet7WorkloadVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion)</Emscriptennet7WorkloadVersion>
<EmscriptenWorkloadVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100TransportVersion)</EmscriptenWorkloadVersion>
Expand Down
4 changes: 4 additions & 0 deletions src/ObjCRuntime/NativeHandle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ public IntPtr Handle {
get { return handle; }
}

#if XAMCORE_5_0
public readonly static NativeHandle Zero = default (NativeHandle);
#else
public static NativeHandle Zero = default (NativeHandle);
#endif

public NativeHandle (IntPtr handle)
{
Expand Down
8 changes: 8 additions & 0 deletions src/spritekit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2294,15 +2294,23 @@ partial interface SKAction : NSSecureCoding, NSCopying {
SKAction FollowPath (CGPath path, double sec);

[Static, Export ("followPath:asOffset:orientToPath:duration:")]
#if XAMCORE_5_0
SKAction FollowPath (CGPath path, bool offset, bool orientToPath, double sec);
#else
SKAction FollowPath (CGPath path, bool offset, bool orient, double sec);
#endif

[MacCatalyst (13, 1)]
[Static, Export ("followPath:speed:")]
SKAction FollowPath (CGPath path, nfloat speed);

[MacCatalyst (13, 1)]
[Static, Export ("followPath:asOffset:orientToPath:speed:")]
#if XAMCORE_5_0
SKAction FollowPath (CGPath path, bool offset, bool orientToPath, nfloat speed);
#else
SKAction FollowPath (CGPath path, bool offset, bool orient, nfloat speed);
#endif

[Static, Export ("speedBy:duration:")]
SKAction SpeedBy (nfloat speed, double sec);
Expand Down
7 changes: 6 additions & 1 deletion tests/common/BinLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ public static IEnumerable<string> PrintToLines (string path)

public static IEnumerable<BuildLogEvent> GetBuildLogWarnings (string path)
{
return GetBuildMessages (path).Where (v => v.Type == BuildLogEventType.Warning);
return GetBuildMessages (path)
// Filter to warnings
.Where (v => v.Type == BuildLogEventType.Warning)
// We're often referencing earlier .NET projects (Touch.Unit/MonoTouch.Dialog), so ignore any out-of-support warnings.
.Where (v => v.Message?.Contains ("is out of support and will not receive security updates in the future") != true)
;
}

public static IEnumerable<BuildLogEvent> GetBuildLogErrors (string path)
Expand Down
3 changes: 2 additions & 1 deletion tests/common/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ static void ParseConfigFiles ()
}
if (test_config.Any ())
ParseConfigFiles (test_config);
ParseConfigFiles (FindConfigFiles ("configure.inc"));
ParseConfigFiles (FindConfigFiles ("Make.config.local"));
ParseConfigFiles (FindConfigFiles ("Make.config"));
}
Expand All @@ -195,7 +196,7 @@ static void ParseConfigFile (string file)
if (string.IsNullOrEmpty (file))
return;

foreach (var line in File.ReadAllLines (file)) {
foreach (var line in File.ReadAllLines (file).Reverse ()) {
var eq = line.IndexOf ('=');
if (eq == -1)
continue;
Expand Down
15 changes: 15 additions & 0 deletions tests/common/DotNet.cs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,21 @@ public static ExecutionResult Execute (string verb, string project, Dictionary<s
var outputStr = output.ToString ();
Console.WriteLine ($"'{Executable} {StringUtils.FormatArguments (args)}' failed with exit code {rv.ExitCode}.");
Console.WriteLine (outputStr);
if (rv.ExitCode != 0) {
var msg = new StringBuilder ();
msg.AppendLine ($"'dotnet {verb}' failed with exit code {rv.ExitCode}");
msg.AppendLine ($"Full command: {Executable} {StringUtils.FormatArguments (args)}");
#if !MSBUILD_TASKS
var errors = BinLog.GetBuildLogErrors (binlogPath).ToArray ();
if (errors.Any ()) {
var errorsToList = errors.Take (10).ToArray ();
msg.AppendLine ($"Listing first {errorsToList.Length} error(s) (of {errors.Length} error(s)):");
foreach (var error in errorsToList)
msg.AppendLine ($" {string.Join ($"{Environment.NewLine} ", error.ToString ().Split ('\n', '\r'))}");
}
#endif
Assert.Fail (msg.ToString ());
}
Assert.AreEqual (0, rv.ExitCode, $"Exit code: {Executable} {StringUtils.FormatArguments (args)}");
}
return new ExecutionResult (output, output, rv.ExitCode) {
Expand Down
9 changes: 0 additions & 9 deletions tests/dotnet/UnitTests/ProjectTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1231,15 +1231,6 @@ public void CustomizedCodeSigning (ApplePlatform platform, string runtimeIdentif
var signedDylibs = new List<string> {
Path.Combine (sharedSupportDir, "app2.app", dylibDir, "lib2.dylib"),
};
if (platform == ApplePlatform.MacCatalyst) {
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Globalization.Native.dylib"));
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.IO.Compression.Native.dylib"));
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Native.dylib"));
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Net.Security.Native.dylib"));
signedDylibs.Add (Path.Combine (dylibDir, "libSystem.Security.Cryptography.Native.Apple.dylib"));
signedDylibs.Add (Path.Combine (dylibDir, "libmonosgen-2.0.dylib"));
signedDylibs.Add (Path.Combine (dylibDir, "libxamarin-dotnet-debug.dylib"));
}

foreach (var dylib in signedDylibs) {
var path = Path.Combine (appPath, dylib);
Expand Down
18 changes: 17 additions & 1 deletion tests/introspection/ApiPInvokeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,23 @@ protected void Check (Assembly a)
path = null;
break;
case "libSystem.Native":
path += ".dylib";
var staticallyLinked = false;
#if __MACCATALYST__
// always statically linked
staticallyLinked = true;
#elif __IOS__ || __TVOS__
// statically linked on device
staticallyLinked = Runtime.Arch == Arch.DEVICE;
#elif __MACOS__
// never statically linked (by default)
#else
#error Unknown platform
#endif
if (staticallyLinked) {
path = null;
} else {
path += ".dylib";
}
break;
#endif
case "libc":
Expand Down
2 changes: 1 addition & 1 deletion tests/linker/CommonLinkAnyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void JsonSerializer_Deserialize ()
var a = JsonSerializer.Deserialize<int> ("42");
Assert.AreEqual (42, a, "deserialized 42");

var b = JsonSerializer.Deserialize<int[]> ("[42,3,14,15]");
var b = JsonSerializer.Deserialize<int []> ("[42,3,14,15]");
CollectionAssert.AreEqual (new int [] { 42, 3, 14, 15 }, b, "deserialized array");
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion tests/monotouch-test/ObjCRuntime/BlocksTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ static TestClass ()
}
}

#if !DEVICE && !MONOMAC && !AOT // some of these tests cause the AOT compiler to assert
#if !DEVICE && !MONOMAC && !AOT && !__MACCATALYST__ // some of these tests cause the AOT compiler to assert
// No MonoPInvokeCallback
static void InvalidTrampoline1 () { }

Expand Down
3 changes: 3 additions & 0 deletions tests/xharness/Harness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ string MlaunchPath {
public bool INCLUDE_XAMARIN_LEGACY { get; }
public string SYSTEM_MONO { get; set; }
public string DOTNET_DIR { get; set; }
public string DotNetTfm { get; set; }

// Run

Expand Down Expand Up @@ -284,6 +285,7 @@ public Harness (IResultParser resultParser, HarnessAction action, HarnessConfigu
SYSTEM_MONO = config ["SYSTEM_MONO"];
DOTNET_DIR = config ["DOTNET_DIR"];
INCLUDE_XAMARIN_LEGACY = config.ContainsKey ("INCLUDE_XAMARIN_LEGACY") && !string.IsNullOrEmpty (config ["INCLUDE_XAMARIN_LEGACY"]);
DotNetTfm = config ["DOTNET_TFM"];

if (string.IsNullOrEmpty (SdkRoot))
SdkRoot = config ["XCODE_DEVELOPER_ROOT"] ?? configuration.SdkRoot;
Expand Down Expand Up @@ -615,6 +617,7 @@ Dictionary<string, string> ParseConfigFiles ()
IEnumerable<string> GetConfigFiles ()
{
return FindConfigFiles (useSystemXamarinIOSMac ? "test-system.config" : "test.config")
.Concat (FindConfigFiles ("configure.inc"))
.Concat (FindConfigFiles ("Make.config"))
.Concat (FindConfigFiles ("Make.config.local"));
}
Expand Down
1 change: 1 addition & 0 deletions tests/xharness/IHarness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public interface IHarness {
bool UseGroupedApps { get; }
string VSDropsUri { get; }
bool DisableWatchOSOnWrench { get; }
string DotNetTfm { get; }

#endregion

Expand Down
2 changes: 1 addition & 1 deletion tests/xharness/Targets/Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public abstract class Target {

public const string FSharpGuid = "{F2A71F9B-5D33-465A-A702-920D77279786}";
public const string CSharpGuid = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
public const string DotNetTfm = "net8.0";
public string DotNetTfm => Harness.DotNetTfm;

public string LanguageGuid { get { return IsFSharp ? FSharpGuid : CSharpGuid; } }

Expand Down
6 changes: 0 additions & 6 deletions tools/common/Rewriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class Rewriter {
const string classPtrName = "class_ptr";
CSToObjCMap map;
string pathToXamarinAssembly;
string? outputDirectory = null;
Dictionary<string, FieldDefinition> csTypeToFieldDef = new Dictionary<string, FieldDefinition> ();
IEnumerable<AssemblyDefinition> assemblies;
AssemblyDefinition xamarinAssembly;
Expand Down Expand Up @@ -328,11 +327,6 @@ IEnumerable<TypeDefinition> AllTypes (TypeDefinition type)
}
}

string ToOutputFileName (string pathToInputFileName)
{
return Path.Combine (outputDirectory, Path.GetFileName (pathToInputFileName));
}

void MarkForSave (AssemblyDefinition assembly)
{
var annotations = linkContext.Annotations;
Expand Down
14 changes: 13 additions & 1 deletion tools/common/StaticRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3309,6 +3309,12 @@ void Specialize (AutoIndentStringBuilder sb, out string initialization_method)

bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions)
{
return HasIntPtrBoolCtor (type, exceptions, out var _);
}

bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions, [NotNullWhen (true)] out MethodDefinition? ctor)
{
ctor = null;
if (!type.HasMethods)
return false;
foreach (var method in type.Methods) {
Expand All @@ -3330,6 +3336,7 @@ bool HasIntPtrBoolCtor (TypeDefinition type, List<Exception> exceptions)
if (!method.Parameters [0].ParameterType.Is ("System", "IntPtr"))
continue;
}
ctor = method;
return true;
}
return false;
Expand Down Expand Up @@ -4528,6 +4535,11 @@ void GenerateCallToSuperForConstructor (AutoIndentStringBuilder sb, ObjCMethod m
}

public TypeDefinition GetInstantiableType (TypeDefinition td, List<Exception> exceptions, string descriptiveMethodName)
{
return GetInstantiableType (td, exceptions, descriptiveMethodName, out var _);
}

public TypeDefinition GetInstantiableType (TypeDefinition td, List<Exception> exceptions, string descriptiveMethodName, out MethodDefinition ctor)
{
TypeDefinition nativeObjType = td;

Expand All @@ -4540,7 +4552,7 @@ public TypeDefinition GetInstantiableType (TypeDefinition td, List<Exception> ex
}

// verify that the type has a ctor with two parameters
if (!HasIntPtrBoolCtor (nativeObjType, exceptions))
if (!HasIntPtrBoolCtor (nativeObjType, exceptions, out ctor))
throw ErrorHelper.CreateError (4103, Errors.MT4103, nativeObjType.FullName, descriptiveMethodName);

return nativeObjType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
<RootNamespace>create_dotnet_linker_launch_json</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down
16 changes: 11 additions & 5 deletions tools/devops/automation/scripts/bash/configure-platforms.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ for platform in $DISABLED_DOTNET_PLATFORMS; do
done

echo "##vso[task.setvariable variable=INCLUDE_XAMARIN_LEGACY;isOutput=true]$INCLUDE_XAMARIN_LEGACY"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]$INCLUDE_IOS"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]$INCLUDE_TVOS"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]$INCLUDE_WATCH"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]$INCLUDE_MAC"

if test -n "$INCLUDE_XAMARIN_LEGACY"; then
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]$INCLUDE_IOS"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]$INCLUDE_TVOS"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]$INCLUDE_WATCH"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]$INCLUDE_MAC"
else
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_IOS;isOutput=true]"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_TVOS;isOutput=true]"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_WATCH;isOutput=true]"
echo "##vso[task.setvariable variable=INCLUDE_LEGACY_MAC;isOutput=true]"
fi
set -x
Loading

6 comments on commit c9032f2

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

@vs-mobiletools-engineering-service2

This comment was marked as outdated.

Please sign in to comment.