Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/net9.0' into darc-net9.0-143f4b9…
Browse files Browse the repository at this point in the history
…e-2f0b-47d4-a494-885f96d56307
  • Loading branch information
rolfbjarne committed Jun 21, 2024
2 parents e994fdb + 440e7da commit f978d0e
Show file tree
Hide file tree
Showing 49 changed files with 2,526 additions and 626 deletions.
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>9.0.0-alpha.1.23556.4</MicrosoftNETRuntimeMonoTargetsSdkPackageVersion>
<MicrosoftTemplateEngineTasksVersion>7.0.100-alpha.1.21601.1</MicrosoftTemplateEngineTasksVersion>
<MicrosoftDotNetCecilPackageVersion>0.11.4-alpha.24313.1</MicrosoftDotNetCecilPackageVersion>
<MicrosoftDotNetXHarnessiOSSharedPackageVersion>9.0.0-prerelease.24304.1</MicrosoftDotNetXHarnessiOSSharedPackageVersion>
<MicrosoftDotNetXHarnessiOSSharedPackageVersion>9.0.0-prerelease.24312.3</MicrosoftDotNetXHarnessiOSSharedPackageVersion>
<!-- Manually updated versions -->
<Emscriptennet7WorkloadVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version)</Emscriptennet7WorkloadVersion>
<EmscriptenWorkloadVersion>$(MicrosoftNETWorkloadEmscriptenCurrentManifest80100Version)</EmscriptenWorkloadVersion>
Expand Down
2 changes: 1 addition & 1 deletion msbuild/Xamarin.MacDev.Tasks/Tasks/CompileAppManifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ void SetXcodeValues (PDictionary plist, IAppleSdk currentSDK)
SetValueIfNotNull (plist, "DTCompiler", sdkSettings.DTCompiler);
SetValueIfNotNull (plist, "DTPlatformBuild", dtSettings.DTPlatformBuild);
SetValueIfNotNull (plist, "DTSDKBuild", sdkSettings.DTSDKBuild);
SetValueIfNotNull (plist, "DTPlatformName", SdkPlatform.ToLowerInvariant ());
SetValueIfNotNull (plist, "DTPlatformName", PlatformUtils.GetTargetPlatform (SdkPlatform, IsWatchApp));
SetValueIfNotNull (plist, "DTPlatformVersion", dtSettings.DTPlatformVersion);
SetValueIfNotNull (plist, "DTSDKName", sdkSettings.CanonicalName);
SetValueIfNotNull (plist, "DTXcode", AppleSdkSettings.DTXcode);
Expand Down
9 changes: 5 additions & 4 deletions runtime/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,12 @@ delegates.%: delegates.%.t4 delegates.t4
Delegates.generated.cs: Delegates.cs.t4 delegates.t4
$(Q_GEN) $(TT) $< -o $@

bindings-generator.exe: bindings-generator.cs
$(Q) $(SYSTEM_CSC) $< -out:$@ -debug:full -features:strict
BINDINGS_GENERATOR=bin/Debug/bindings-generator.dll
$(BINDINGS_GENERATOR): bindings-generator.cs bindings-generator.csproj
$(Q) $(DOTNET) build bindings-generator.csproj $(DOTNET_BUILD_VERBOSITY)

bindings-generated.m: bindings-generator.exe
$(Q_GEN) $(SYSTEM_MONO) --debug $< $@
bindings-generated.m: $(BINDINGS_GENERATOR)
$(Q_GEN) $(DOTNET) exec $< $@

# our makefiles don't support building the same source file multiple times with different defines,
# so just symlink extension-main.m to another file and compile that instead.
Expand Down
61 changes: 27 additions & 34 deletions runtime/bindings-generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,7 @@ static IEnumerable<FunctionData> GetFunctionData (bool isDotNet = false)
{
var data = new List<FunctionData> ();

Types.NativeHandleType = isDotNet ? Types.NativeHandle : Types.IntPtr;
Types.Vector2d = isDotNet ? Types.NVector2d : Types.OpenTK_Vector2d;
Types.Vector4d = isDotNet ? Types.NVector4d : Types.OpenTK_Vector4d;
Types.Vector2i = isDotNet ? Types.NVector2i : Types.OpenTK_Vector2i;
Types.Vector3i = isDotNet ? Types.NVector3i : Types.OpenTK_Vector3i;
Types.Vector4i = isDotNet ? Types.NVector4i : Types.OpenTK_Vector4i;
Types.Matrix3f = isDotNet ? Types.RMatrix3f : Types.OpenTK_Matrix3f;
Types.Matrix4f = isDotNet ? Types.Numerics_Matrix4f : Types.OpenTK_Matrix4f;
Types.QuatD = isDotNet ? Types.NQuaterniond : Types.OpenTK_QuatD;
Types.MDLVoxelIndexExtent = isDotNet ? Types.MDLVoxelIndexExtent_DotNet : Types.MDLVoxelIndexExtent2;
Types.IsDotNet = isDotNet;

data.Add (
new FunctionData {
Expand Down Expand Up @@ -2992,7 +2983,7 @@ static string GetFuncName (FunctionData func, string overload)
return funcName.ToString ();
}

static void WriteParametersMarshal (StringWriter writer, ParameterData [] ps)
static void WriteParametersMarshal (StringWriter writer, ParameterData []? ps)
{
if (ps is null)
return;
Expand All @@ -3007,7 +2998,7 @@ static void WriteParametersMarshal (StringWriter writer, ParameterData [] ps)
}
}

static void WriteParametersInvoke (StringWriter writer, ParameterData [] ps)
static void WriteParametersInvoke (StringWriter writer, ParameterData []? ps)
{
if (ps is null)
return;
Expand All @@ -3025,7 +3016,7 @@ static void WriteParametersInvoke (StringWriter writer, ParameterData [] ps)
}
}

static void WriteParametersNativeDeclaration (StringWriter writer, ParameterData [] parameters, bool isTypedef, FunctionData func)
static void WriteParametersNativeDeclaration (StringWriter writer, ParameterData []? parameters, bool isTypedef, FunctionData func)
{
if (parameters is null)
return;
Expand Down Expand Up @@ -3122,7 +3113,7 @@ static void Write_objc_msgSend (StringWriter writer, FunctionData func)
// body
writer.WriteLine ("{");
if (tmpReturnValue) {
writer.WriteLine ("\t{0} rv;", func.ReturnType.NativeType);
writer.WriteLine ("\t{0} rv;", func.ReturnType!.NativeType);
}

// marshal managed parameters to native format
Expand Down Expand Up @@ -3185,7 +3176,7 @@ static void Write_objc_msgSendSuper (StringWriter writer, FunctionData func)
// body
writer.WriteLine ("{");
if (tmpReturnValue) {
writer.WriteLine ("\t{0} rv;", func.ReturnType.NativeType);
writer.WriteLine ("\t{0} rv;", func.ReturnType!.NativeType);
}

// marshal managed parameters to native format
Expand Down Expand Up @@ -3354,6 +3345,7 @@ static void Write_objc_msgSendSuper_stret (StringWriter writer, FunctionData fun
}

public static class Types {
public static bool IsDotNet;
public static TypeData Vector2 = new TypeData {
ManagedType = "Vector2",
NativeType = "vector_float2",
Expand Down Expand Up @@ -3385,7 +3377,7 @@ public static class Types {
NativeWrapperType = "struct Vector4f",
RequireMarshal = true,
};
public static TypeData Vector2i;
public static TypeData Vector2i { get => IsDotNet ? Types.NVector2i : Types.OpenTK_Vector2i; }
public static TypeData OpenTK_Vector2i = new TypeData {
ManagedType = "Vector2i",
NativeType = "vector_int2",
Expand All @@ -3400,7 +3392,7 @@ public static class Types {
RequireMarshal = true,
IsX86Stret = true,
};
public static TypeData Vector3i;
public static TypeData Vector3i { get => IsDotNet ? Types.NVector3i : Types.OpenTK_Vector3i; }
public static TypeData OpenTK_Vector3i = new TypeData {
ManagedType = "Vector3i",
NativeType = "vector_int3",
Expand All @@ -3413,7 +3405,7 @@ public static class Types {
NativeWrapperType = "struct Vector3i",
RequireMarshal = true,
};
public static TypeData Vector4i;
public static TypeData Vector4i { get => IsDotNet ? Types.NVector4i : Types.OpenTK_Vector4i; }
public static TypeData OpenTK_Vector4i = new TypeData {
ManagedType = "Vector4i",
NativeType = "vector_int4",
Expand All @@ -3426,7 +3418,7 @@ public static class Types {
NativeWrapperType = "struct Vector4i",
RequireMarshal = true,
};
public static TypeData Vector2d;
public static TypeData Vector2d { get => IsDotNet ? NVector2d : OpenTK_Vector2d; }
public static TypeData OpenTK_Vector2d = new TypeData {
ManagedType = "Vector2d",
NativeType = "vector_double2",
Expand All @@ -3451,7 +3443,7 @@ public static class Types {
NativeWrapperType = "struct Vector4d", // Yes, Vector4d, since NVector3d has 4 doubles.
RequireMarshal = true,
};
public static TypeData Vector4d;
public static TypeData Vector4d { get => IsDotNet ? Types.NVector4d : Types.OpenTK_Vector4d; }
public static TypeData OpenTK_Vector4d = new TypeData {
ManagedType = "Vector4d",
NativeType = "vector_double4",
Expand Down Expand Up @@ -3482,7 +3474,7 @@ public static class Types {
IsX86Stret = true,
IsX64Stret = false,
};
public static TypeData Matrix3f;
public static TypeData Matrix3f { get => IsDotNet ? Types.RMatrix3f : Types.OpenTK_Matrix3f; }
public static TypeData OpenTK_Matrix3f = new TypeData {
ManagedType = "Matrix3",
NativeType = "matrix_float3x3",
Expand Down Expand Up @@ -3510,7 +3502,7 @@ public static class Types {
IsX86Stret = true,
IsX64Stret = true,
};
public static TypeData Matrix4f;
public static TypeData Matrix4f { get => IsDotNet ? Types.Numerics_Matrix4f : Types.OpenTK_Matrix4f; }
public static TypeData OpenTK_Matrix4f = new TypeData {
ManagedType = "Matrix4",
NativeType = "matrix_float4x4",
Expand Down Expand Up @@ -3570,7 +3562,7 @@ public static class Types {
NativeWrapperType = "void *",
RequireMarshal = false,
};
public static TypeData NativeHandleType;
public static TypeData NativeHandleType { get => IsDotNet ? NativeHandle : IntPtr; }
public static TypeData NativeHandle = new TypeData {
ManagedType = "NativeHandle",
NativeType = "void *",
Expand Down Expand Up @@ -3708,7 +3700,7 @@ public static class Types {
RequireMarshal = true,
};

public static TypeData QuatD;
public static TypeData QuatD { get => IsDotNet ? Types.NQuaterniond : Types.OpenTK_QuatD; }
public static TypeData OpenTK_QuatD = new TypeData {
ManagedType = "Quaterniond",
NativeType = "simd_quatd",
Expand All @@ -3734,7 +3726,7 @@ public static class Types {
IsX64Stret = true,
};

public static TypeData MDLVoxelIndexExtent;
public static TypeData MDLVoxelIndexExtent { get => IsDotNet ? Types.MDLVoxelIndexExtent_DotNet : Types.MDLVoxelIndexExtent2; }

public static TypeData MDLVoxelIndexExtent_DotNet = new TypeData {
ManagedType = "MDLVoxelIndexExtent",
Expand Down Expand Up @@ -3777,9 +3769,9 @@ enum Variants {
}

class TypeData {
public string ManagedType;
public string NativeWrapperType;
public string NativeType;
public string ManagedType = string.Empty;
public string NativeWrapperType = string.Empty;
public string NativeType = string.Empty;
public bool RequireMarshal;
public bool IsX86Stret;
#pragma warning disable 649
Expand All @@ -3790,8 +3782,8 @@ class TypeData {
#pragma warning restore 649
public bool IsAnyStret { get { return IsX86Stret || IsX64Stret || IsARMStret; } }
public bool IsNativeType;
public TypeData Bit32Type;
public TypeData Bit64Type;
public TypeData? Bit32Type;
public TypeData? Bit64Type;

public TypeData AsSpecificNativeType (bool as32bit)
{
Expand All @@ -3802,21 +3794,22 @@ public TypeData AsSpecificNativeType (bool as32bit)
}

class ParameterData {
public TypeData TypeData;
TypeData? typeData;
public TypeData TypeData { get => typeData!; set => typeData = value; }
public bool IsRef;
}

class FunctionData {
public string Comment;
public string? Comment;
public string Prefix = string.Empty;
// Variants is a [Flags] enum, specifying which of the objc_msgSend variants
// should be generated. You'll usually use "All", which will generate all 4,
// or "NonStret", which will just generate objc_msgSend and objc_msgSendSuper.
public Variants Variants;
// The return type of the function. Use null for void.
public TypeData ReturnType;
public TypeData? ReturnType;
// The parameters. Use null for void.
public ParameterData [] Parameters;
public ParameterData []? Parameters;
public bool MarshalExceptions;

public bool HasNativeType {
Expand Down
48 changes: 10 additions & 38 deletions runtime/bindings-generator.csproj
Original file line number Diff line number Diff line change
@@ -1,45 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{6B616492-49F0-43EF-8390-F9D1B4CCC632}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>zzg</RootNamespace>
<AssemblyName>bindings-generator</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<TargetFramework>net$(BundledNETCoreAppTargetFrameworkVersion)</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<EnableDefaultItems>false</EnableDefaultItems>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Externalconsole>true</Externalconsole>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(RunConfiguration)' == 'Default' ">
<StartAction>Project</StartAction>
<StartArguments>${ProjectDir}/bindings-generated.m</StartArguments>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>

<ItemGroup>
<Compile Include="bindings-generator.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

</Project>
7 changes: 4 additions & 3 deletions system-dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1017,11 +1017,12 @@ function check_simulators ()

IFS=', ' read -r -a SIMS <<< "$EXTRA_SIMULATORS"
arraylength=${#SIMS[@]}
INSTALL_SIMULATORS=
for (( i=1; i<arraylength+1; i++ )); do
SIMS[$i-1]="--install=${SIMS[$i-1]}"
INSTALL_SIMULATORS="$INSTALL_SIMULATORS --install=${SIMS[$i-1]}"
done

if ! FAILED_SIMULATORS=$(mono --debug tools/siminstaller/bin/Debug/siminstaller.exe -q --xcode "$XCODE" --only-check "${SIMS[@]}"); then
if ! FAILED_SIMULATORS=$(make -C tools/siminstaller only-check INSTALL_SIMULATORS="$INSTALL_SIMULATORS" 2>/dev/null); then
local action=warn
if test -z $OPTIONAL_SIMULATORS; then
action=fail
Expand All @@ -1034,7 +1035,7 @@ function check_simulators ()
$action " Another possibility is that Apple is not shipping any simulators (yet?) for the new version of Xcode (if the previous list shows no simulators)."
else
if ! test -z $PROVISION_SIMULATORS; then
if ! mono --debug tools/siminstaller/bin/Debug/siminstaller.exe -q --xcode "$XCODE" "${SIMS[@]}"; then
if ! make -C tools/siminstaller install-simulators INSTALL_SIMULATORS="$INSTALL_SIMULATORS"; then
$action "Failed to install extra simulators."
else
ok "Extra simulators installed successfully: '${FAILED_SIMULATORS//$'\n'/', '}'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,13 @@ public void MacCatalystVersionCheckUnmappedError ()
}

[Test]
[TestCase (ApplePlatform.iOS, true)]
[TestCase (ApplePlatform.iOS, false)]
[TestCase (ApplePlatform.MacCatalyst, false)]
[TestCase (ApplePlatform.TVOS, true)]
[TestCase (ApplePlatform.TVOS, false)]
[TestCase (ApplePlatform.MacOSX, false)]
public void XcodeVariables (ApplePlatform platform, bool isSimulator)
[TestCase (ApplePlatform.iOS, true, "iphonesimulator")]
[TestCase (ApplePlatform.iOS, false, "iphoneos")]
[TestCase (ApplePlatform.MacCatalyst, false, "macosx")]
[TestCase (ApplePlatform.TVOS, true, "appletvsimulator")]
[TestCase (ApplePlatform.TVOS, false, "appletvos")]
[TestCase (ApplePlatform.MacOSX, false, "macosx")]
public void XcodeVariables (ApplePlatform platform, bool isSimulator, string expectedDTPlatformName)
{
var task = CreateTask (platform: platform);
task.SdkIsSimulator = isSimulator;
Expand All @@ -165,6 +165,7 @@ public void XcodeVariables (ApplePlatform platform, bool isSimulator)
var value = plist.GetString (variable)?.Value;
Assert.That (value, Is.Not.Null.And.Not.Empty, variable);
}
Assert.AreEqual (expectedDTPlatformName, plist.GetString ("DTPlatformName")?.Value, "Expected DTPlatformName");
}
}
}
9 changes: 5 additions & 4 deletions tests/test-libraries/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,12 @@ GENERATED_FILES_PATTERN = \
RegistrarTest.generated%cs \
TrampolineTest.generated%cs \

testgenerator.exe: testgenerator.cs Makefile
$(Q) $(SYSTEM_CSC) -out:$@ $<
TESTGENERATOR=bin/Debug/testgenerator.dll
$(TESTGENERATOR): testgenerator.cs Makefile
$(Q) unset MSBUILD_EXE_PATH && $(DOTNET) build testgenerator.csproj $(DOTNET_BUILD_VERBOSITY)

$(GENERATED_FILES_PATTERN): testgenerator.exe
$(Q) mono --debug $<
$(GENERATED_FILES_PATTERN): $(TESTGENERATOR)
$(Q) $(DOTNET) exec $<

libtest-object.m libtest-ar.m:
$(Q) ln -fhs libtest.m $@
Expand Down
Loading

3 comments on commit f978d0e

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥 [CI Build] Build failed 🔥

Build failed for the job 'Build macOS tests'

Pipeline on Agent
Hash: f978d0e6452045f8f011e0ef18029b67ec0d0db2 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: f978d0e6452045f8f011e0ef18029b67ec0d0db2 [CI build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📚 [CI Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [CI build]

Please sign in to comment.