From 62e9afdb59aa517c58090cbe9c636851cdad5369 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 15 Mar 2023 17:44:56 +0100 Subject: [PATCH 1/5] [msbuild] Enable nullability and some additional improvements to the GetFileSystemEntries task. * Add support for multiple input paths. * Copy any metadata from input paths to the output paths. * Set the 'RecursiveDir' metadata on output paths, to match how globbing works in MSBuild. * Also set the 'OriginalItemSpec' metadata so that it's easier to compute derived paths afterwards. * Enable nullability. --- .../Tasks/GetFileSystemEntriesTaskBase.cs | 31 ++++++++++---- tests/dotnet/UnitTests/ProjectTest.cs | 42 +++++++++++++++++++ 2 files changed, 65 insertions(+), 8 deletions(-) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs index 4e9a56d5111..0e840903d12 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs @@ -6,15 +6,17 @@ using Microsoft.Build.Framework; using Microsoft.Build.Utilities; +#nullable enable + namespace Xamarin.MacDev.Tasks { public abstract class GetFileSystemEntriesTaskBase : XamarinTask { #region Inputs [Required] - public string DirectoryPath { get; set; } + public ITaskItem[] DirectoryPath { get; set; } = Array.Empty (); [Required] - public string Pattern { get; set; } + public string Pattern { get; set; } = string.Empty; [Required] public bool Recursive { get; set; } @@ -26,18 +28,31 @@ public abstract class GetFileSystemEntriesTaskBase : XamarinTask { #region Outputs [Output] - public ITaskItem [] Entries { get; set; } + public ITaskItem [] Entries { get; set; } = Array.Empty (); #endregion public override bool Execute () { var searchOption = Recursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly; - var entriesFullPath = IncludeDirectories ? - Directory.GetFileSystemEntries (DirectoryPath, Pattern, searchOption) : - Directory.GetFiles (DirectoryPath, Pattern, searchOption); - - Entries = entriesFullPath.Select (v => new TaskItem (v)).ToArray (); + var entries = new List (); + foreach (var item in DirectoryPath) { + var path = item.ItemSpec.TrimEnd ('\\', '/'); + var entriesFullPath = IncludeDirectories ? + Directory.GetFileSystemEntries (path, Pattern, searchOption) : + Directory.GetFiles (path, Pattern, searchOption); + + foreach (var entry in entriesFullPath) { + var recursiveDir = entry.Substring (path.Length + 1); + var newItem = new TaskItem (entry); + item.CopyMetadataTo (newItem); + newItem.SetMetadata ("RecursiveDir", recursiveDir); + newItem.SetMetadata ("OriginalItemSpec", item.ItemSpec); + entries.Add (newItem); + } + } + + Entries = entries.ToArray (); return !Log.HasLoggedErrors; } diff --git a/tests/dotnet/UnitTests/ProjectTest.cs b/tests/dotnet/UnitTests/ProjectTest.cs index 39e2beaecc2..abe7193de89 100644 --- a/tests/dotnet/UnitTests/ProjectTest.cs +++ b/tests/dotnet/UnitTests/ProjectTest.cs @@ -767,6 +767,48 @@ public void DoubleBuild (ApplePlatform platform, string runtimeIdentifiers) DotNet.AssertBuild (projectPath, GetDefaultProperties (runtimeIdentifiers)); } + [TestCase (ApplePlatform.iOS)] + [TestCase (ApplePlatform.TVOS)] + [TestCase (ApplePlatform.MacCatalyst)] + [TestCase (ApplePlatform.MacOSX)] + public void LibraryReferencingBindingLibrary (ApplePlatform platform) + { + var project = "LibraryReferencingBindingLibrary"; + Configuration.IgnoreIfIgnoredPlatform (platform); + + var projectPath = GetProjectPath (project, runtimeIdentifiers: string.Empty, platform: platform, out _); + Clean (projectPath); + + DotNet.AssertBuild (projectPath, GetDefaultProperties ()); + + var bindir = GetBinDir (projectPath, platform, string.Empty); + var bindingResourcePackages = new List () { + "BindingWithDefaultCompileInclude.resources.zip", + Path.Combine ("BindingWithUncompressedResourceBundle.resources", "libtest.a"), + Path.Combine ("BindingWithUncompressedResourceBundle.resources", "manifest"), + }; + + switch (platform) { + case ApplePlatform.iOS: + case ApplePlatform.TVOS: + bindingResourcePackages.Add (Path.Combine ("bindings-framework-test.resources", "XStaticArTest.framework", "XStaticArTest")); + bindingResourcePackages.Add (Path.Combine ("bindings-framework-test.resources", "XStaticObjectTest.framework", "XStaticObjectTest")); + bindingResourcePackages.Add (Path.Combine ("bindings-framework-test.resources", "XTest.framework", "Info.plist")); + bindingResourcePackages.Add (Path.Combine ("bindings-framework-test.resources", "XTest.framework", "XTest")); + bindingResourcePackages.Add (Path.Combine ("bindings-framework-test.resources", "manifest")); + break; + case ApplePlatform.MacCatalyst: + case ApplePlatform.MacOSX: + bindingResourcePackages.Add ("bindings-framework-test.resources.zip"); + break; + } + + foreach (var brp in bindingResourcePackages) { + var file = Path.Combine (bindir, brp); + Assert.That (file, Does.Exist, "Existence"); + } + } + void AssertThatLinkerExecuted (ExecutionResult result) { var output = BinLog.PrintToString (result.BinLogPath); From 881d380a5a626567f901919959531dcac184885c Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 15 Mar 2023 11:59:38 +0100 Subject: [PATCH 2/5] [dotnet/msbuild] Copy binding resource packages to output directories together with CopyLocal assemblies. Fixes #13910. With a project structure like this: * Executable project references a library project. * The library project references a binding project (or assembly). The binding project's assembly will be copied to the library project's output directory during the build. Unless we also make sure any binding resource packages are copied as well, the executable project won't find those, and the final app won't contain any native bits from the binding project. The solution is to add any binding resource packages to the list of files to be copied to the library's output directory. Fixes https://github.com/xamarin/xamarin-macios/issues/13910. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 68 +++++++++++++++++++ .../ApiDefinition.cs | 7 ++ .../MacCatalyst/ApiDefinition.cs | 7 ++ ...ndingWithUncompressedResourceBundle.csproj | 8 +++ .../MacCatalyst/Makefile | 1 + .../MacCatalyst/MyClass.cs | 8 +++ .../MacCatalyst/StructsAndEnums.cs | 6 ++ .../MyClass.cs | 8 +++ .../StructsAndEnums.cs | 6 ++ .../iOS/ApiDefinition.cs | 7 ++ ...ndingWithUncompressedResourceBundle.csproj | 8 +++ .../iOS/Makefile | 1 + .../iOS/MyClass.cs | 8 +++ .../iOS/StructsAndEnums.cs | 6 ++ .../macOS/ApiDefinition.cs | 7 ++ ...ndingWithUncompressedResourceBundle.csproj | 8 +++ .../macOS/Makefile | 1 + .../macOS/MyClass.cs | 8 +++ .../macOS/StructsAndEnums.cs | 6 ++ .../shared.csproj | 16 +++++ .../shared.mk | 2 + .../tvOS/ApiDefinition.cs | 7 ++ ...ndingWithUncompressedResourceBundle.csproj | 8 +++ .../tvOS/Makefile | 1 + .../tvOS/MyClass.cs | 8 +++ .../tvOS/StructsAndEnums.cs | 6 ++ .../Library.cs | 10 +++ .../LibraryReferencingBindingLibrary.csproj | 7 ++ .../MacCatalyst/Makefile | 1 + .../LibraryReferencingBindingLibrary/Makefile | 2 + .../LibraryReferencingBindingLibrary.csproj | 7 ++ .../iOS/Makefile | 1 + .../LibraryReferencingBindingLibrary.csproj | 7 ++ .../macOS/Makefile | 1 + .../shared.csproj | 11 +++ .../shared.mk | 2 + .../LibraryReferencingBindingLibrary.csproj | 7 ++ .../tvOS/Makefile | 1 + 38 files changed, 284 insertions(+) create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/ApiDefinition.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/ApiDefinition.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/BindingWithUncompressedResourceBundle.csproj create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/Makefile create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/MyClass.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/StructsAndEnums.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/MyClass.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/StructsAndEnums.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/iOS/ApiDefinition.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/iOS/BindingWithUncompressedResourceBundle.csproj create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/iOS/Makefile create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/iOS/MyClass.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/iOS/StructsAndEnums.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/macOS/ApiDefinition.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/macOS/BindingWithUncompressedResourceBundle.csproj create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/macOS/Makefile create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/macOS/MyClass.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/macOS/StructsAndEnums.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/shared.csproj create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/shared.mk create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/ApiDefinition.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/BindingWithUncompressedResourceBundle.csproj create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/Makefile create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/MyClass.cs create mode 100644 tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/StructsAndEnums.cs create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/Library.cs create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/LibraryReferencingBindingLibrary.csproj create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/Makefile create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/Makefile create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/iOS/LibraryReferencingBindingLibrary.csproj create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/iOS/Makefile create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/macOS/LibraryReferencingBindingLibrary.csproj create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/macOS/Makefile create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/shared.csproj create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/shared.mk create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/tvOS/LibraryReferencingBindingLibrary.csproj create mode 100644 tests/dotnet/LibraryReferencingBindingLibrary/tvOS/Makefile diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index b98b59cff60..0a7f9c73e64 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -1956,6 +1956,74 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B + + + + + + <_CompressedBindingPackagesFromReferencedAssembliesCandidates Include="@(ReferenceCopyLocalPaths -> '%(RootDir)%(Directory)%(Filename).resources.zip')" /> + + <_CompressedBindingPackagesFromReferencedAssemblies Include="@(_CompressedBindingPackagesFromReferencedAssembliesCandidates->Distinct())" Condition="Exists('%(Identity)')" /> + + + <_BindingPackagesFromReferencedAssembliesDirectoriesCandidates Include="@(ReferenceCopyLocalPaths -> '%(RootDir)%(Directory)%(Filename).resources')" /> + + <_BindingPackagesFromReferencedAssembliesDirectoriesExists Include="@(_BindingPackagesFromReferencedAssembliesDirectoriesCandidates->Distinct())" Condition="Exists('%(Identity)')" /> + + + + + + + + + + <_BindingPackagesFromReferencedAssembliesWithDestinationDir Include="@(_BindingPackagesFromReferencedAssemblies)"> + $([System.IO.Path]::GetFileName('%(OriginalItemSpec)'))\$([System.IO.Path]::GetDirectoryName('%(RecursiveDir)'))\ + + + + + + diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/ApiDefinition.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/ApiDefinition.cs new file mode 100644 index 00000000000..32816584e86 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/ApiDefinition.cs @@ -0,0 +1,7 @@ +using Foundation; + +namespace BindingWithUncompressedResourceBundle { + [BaseType (typeof (NSObject))] + interface MyNativeClass { + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/ApiDefinition.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/ApiDefinition.cs new file mode 100644 index 00000000000..32816584e86 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/ApiDefinition.cs @@ -0,0 +1,7 @@ +using Foundation; + +namespace BindingWithUncompressedResourceBundle { + [BaseType (typeof (NSObject))] + interface MyNativeClass { + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/BindingWithUncompressedResourceBundle.csproj b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/BindingWithUncompressedResourceBundle.csproj new file mode 100644 index 00000000000..02fabd2f826 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/BindingWithUncompressedResourceBundle.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst + + + + diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/Makefile b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/MyClass.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/MyClass.cs new file mode 100644 index 00000000000..95db31039db --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/MyClass.cs @@ -0,0 +1,8 @@ +using System; +namespace BindingWithUncompressedResourceBundle { + public class MyClass { + public MyClass () + { + } + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/StructsAndEnums.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/StructsAndEnums.cs new file mode 100644 index 00000000000..3f021cafc38 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/MacCatalyst/StructsAndEnums.cs @@ -0,0 +1,6 @@ +namespace BindingWithUncompressedResourceBundle { + public struct MyStruct { + public int A; + public int B; + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/MyClass.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/MyClass.cs new file mode 100644 index 00000000000..95db31039db --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/MyClass.cs @@ -0,0 +1,8 @@ +using System; +namespace BindingWithUncompressedResourceBundle { + public class MyClass { + public MyClass () + { + } + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/StructsAndEnums.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/StructsAndEnums.cs new file mode 100644 index 00000000000..3f021cafc38 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/StructsAndEnums.cs @@ -0,0 +1,6 @@ +namespace BindingWithUncompressedResourceBundle { + public struct MyStruct { + public int A; + public int B; + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/ApiDefinition.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/ApiDefinition.cs new file mode 100644 index 00000000000..32816584e86 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/ApiDefinition.cs @@ -0,0 +1,7 @@ +using Foundation; + +namespace BindingWithUncompressedResourceBundle { + [BaseType (typeof (NSObject))] + interface MyNativeClass { + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/BindingWithUncompressedResourceBundle.csproj b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/BindingWithUncompressedResourceBundle.csproj new file mode 100644 index 00000000000..bb9259517c6 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/BindingWithUncompressedResourceBundle.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-ios + + + + diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/Makefile b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/MyClass.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/MyClass.cs new file mode 100644 index 00000000000..95db31039db --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/MyClass.cs @@ -0,0 +1,8 @@ +using System; +namespace BindingWithUncompressedResourceBundle { + public class MyClass { + public MyClass () + { + } + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/StructsAndEnums.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/StructsAndEnums.cs new file mode 100644 index 00000000000..3f021cafc38 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/iOS/StructsAndEnums.cs @@ -0,0 +1,6 @@ +namespace BindingWithUncompressedResourceBundle { + public struct MyStruct { + public int A; + public int B; + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/ApiDefinition.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/ApiDefinition.cs new file mode 100644 index 00000000000..32816584e86 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/ApiDefinition.cs @@ -0,0 +1,7 @@ +using Foundation; + +namespace BindingWithUncompressedResourceBundle { + [BaseType (typeof (NSObject))] + interface MyNativeClass { + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/BindingWithUncompressedResourceBundle.csproj b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/BindingWithUncompressedResourceBundle.csproj new file mode 100644 index 00000000000..71b28ba48c7 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/BindingWithUncompressedResourceBundle.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-macos + + + + diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/Makefile b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/MyClass.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/MyClass.cs new file mode 100644 index 00000000000..95db31039db --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/MyClass.cs @@ -0,0 +1,8 @@ +using System; +namespace BindingWithUncompressedResourceBundle { + public class MyClass { + public MyClass () + { + } + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/StructsAndEnums.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/StructsAndEnums.cs new file mode 100644 index 00000000000..3f021cafc38 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/macOS/StructsAndEnums.cs @@ -0,0 +1,6 @@ +namespace BindingWithUncompressedResourceBundle { + public struct MyStruct { + public int A; + public int B; + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/shared.csproj b/tests/dotnet/BindingWithUncompressedResourceBundle/shared.csproj new file mode 100644 index 00000000000..081fa7d0598 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/shared.csproj @@ -0,0 +1,16 @@ + + + + true + + + + + + + + + Static + + + diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/shared.mk b/tests/dotnet/BindingWithUncompressedResourceBundle/shared.mk new file mode 100644 index 00000000000..f555cad4e80 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/shared.mk @@ -0,0 +1,2 @@ +TOP=../../../.. +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/ApiDefinition.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/ApiDefinition.cs new file mode 100644 index 00000000000..32816584e86 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/ApiDefinition.cs @@ -0,0 +1,7 @@ +using Foundation; + +namespace BindingWithUncompressedResourceBundle { + [BaseType (typeof (NSObject))] + interface MyNativeClass { + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/BindingWithUncompressedResourceBundle.csproj b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/BindingWithUncompressedResourceBundle.csproj new file mode 100644 index 00000000000..388e767c58e --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/BindingWithUncompressedResourceBundle.csproj @@ -0,0 +1,8 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-tvos + + + + diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/Makefile b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/MyClass.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/MyClass.cs new file mode 100644 index 00000000000..95db31039db --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/MyClass.cs @@ -0,0 +1,8 @@ +using System; +namespace BindingWithUncompressedResourceBundle { + public class MyClass { + public MyClass () + { + } + } +} diff --git a/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/StructsAndEnums.cs b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/StructsAndEnums.cs new file mode 100644 index 00000000000..3f021cafc38 --- /dev/null +++ b/tests/dotnet/BindingWithUncompressedResourceBundle/tvOS/StructsAndEnums.cs @@ -0,0 +1,6 @@ +namespace BindingWithUncompressedResourceBundle { + public struct MyStruct { + public int A; + public int B; + } +} diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/Library.cs b/tests/dotnet/LibraryReferencingBindingLibrary/Library.cs new file mode 100644 index 00000000000..2429f6a06a0 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/Library.cs @@ -0,0 +1,10 @@ +using System; + +namespace LibraryReferencingBindingLibrary { + public class Library { + public static void DoSomething () + { + Console.WriteLine (typeof (MyClassLibrary.MyClass)); + } + } +} diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/LibraryReferencingBindingLibrary.csproj b/tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/LibraryReferencingBindingLibrary.csproj new file mode 100644 index 00000000000..6b0e2c77318 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/LibraryReferencingBindingLibrary.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-maccatalyst + + + diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/Makefile b/tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/MacCatalyst/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/Makefile b/tests/dotnet/LibraryReferencingBindingLibrary/Makefile new file mode 100644 index 00000000000..6affa45ff12 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/Makefile @@ -0,0 +1,2 @@ +TOP=../../.. +include $(TOP)/tests/common/shared-dotnet-test.mk diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/iOS/LibraryReferencingBindingLibrary.csproj b/tests/dotnet/LibraryReferencingBindingLibrary/iOS/LibraryReferencingBindingLibrary.csproj new file mode 100644 index 00000000000..86d408734aa --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/iOS/LibraryReferencingBindingLibrary.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-ios + + + diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/iOS/Makefile b/tests/dotnet/LibraryReferencingBindingLibrary/iOS/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/iOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/macOS/LibraryReferencingBindingLibrary.csproj b/tests/dotnet/LibraryReferencingBindingLibrary/macOS/LibraryReferencingBindingLibrary.csproj new file mode 100644 index 00000000000..a77287b9ba0 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/macOS/LibraryReferencingBindingLibrary.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-macos + + + diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/macOS/Makefile b/tests/dotnet/LibraryReferencingBindingLibrary/macOS/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/macOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/shared.csproj b/tests/dotnet/LibraryReferencingBindingLibrary/shared.csproj new file mode 100644 index 00000000000..9d005c62496 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/shared.csproj @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/shared.mk b/tests/dotnet/LibraryReferencingBindingLibrary/shared.mk new file mode 100644 index 00000000000..f555cad4e80 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/shared.mk @@ -0,0 +1,2 @@ +TOP=../../../.. +include $(TOP)/tests/common/shared-dotnet.mk diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/tvOS/LibraryReferencingBindingLibrary.csproj b/tests/dotnet/LibraryReferencingBindingLibrary/tvOS/LibraryReferencingBindingLibrary.csproj new file mode 100644 index 00000000000..bd487ddcd88 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/tvOS/LibraryReferencingBindingLibrary.csproj @@ -0,0 +1,7 @@ + + + + net$(BundledNETCoreAppTargetFrameworkVersion)-tvos + + + diff --git a/tests/dotnet/LibraryReferencingBindingLibrary/tvOS/Makefile b/tests/dotnet/LibraryReferencingBindingLibrary/tvOS/Makefile new file mode 100644 index 00000000000..110d078f457 --- /dev/null +++ b/tests/dotnet/LibraryReferencingBindingLibrary/tvOS/Makefile @@ -0,0 +1 @@ +include ../shared.mk From 3f69c422043b99c2968f94fb3be7296f6ec8208a Mon Sep 17 00:00:00 2001 From: GitHub Actions Autoformatter Date: Wed, 15 Mar 2023 18:31:17 +0000 Subject: [PATCH 3/5] Auto-format source code --- .../Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs index 0e840903d12..bef00a20451 100644 --- a/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs +++ b/msbuild/Xamarin.MacDev.Tasks/Tasks/GetFileSystemEntriesTaskBase.cs @@ -13,7 +13,7 @@ public abstract class GetFileSystemEntriesTaskBase : XamarinTask { #region Inputs [Required] - public ITaskItem[] DirectoryPath { get; set; } = Array.Empty (); + public ITaskItem [] DirectoryPath { get; set; } = Array.Empty (); [Required] public string Pattern { get; set; } = string.Empty; From cf6f005be26214659030d327f07f3f9e93388a7e Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Thu, 16 Mar 2023 09:29:03 +0100 Subject: [PATCH 4/5] Copy to output directory, but don't publish. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 0a7f9c73e64..8276087f98e 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -2019,8 +2019,13 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B <_BindingPackagesFromReferencedAssembliesWithDestinationDir Include="@(_BindingPackagesFromReferencedAssemblies)"> $([System.IO.Path]::GetFileName('%(OriginalItemSpec)'))\$([System.IO.Path]::GetDirectoryName('%(RecursiveDir)'))\ - - + + + None + + + None + From de081a22c90b5fe5b028e722646779db0bd5339a Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Tue, 21 Mar 2023 18:36:08 +0100 Subject: [PATCH 5/5] Correct comment. --- dotnet/targets/Xamarin.Shared.Sdk.targets | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dotnet/targets/Xamarin.Shared.Sdk.targets b/dotnet/targets/Xamarin.Shared.Sdk.targets index 8276087f98e..99775864ba5 100644 --- a/dotnet/targets/Xamarin.Shared.Sdk.targets +++ b/dotnet/targets/Xamarin.Shared.Sdk.targets @@ -2002,7 +2002,11 @@ global using nfloat = global::System.Runtime.InteropServices.NFloat%3B kind of tricky, because globs in item transformations aren't treated as globs. The workaround is to use a custom task for this. - Note that this task should run on Windows for remote builds (so we're not conditioning this task on IsMacEnabled). + Note that this task should run remotely from Windows when there's + a Mac connected, but locally when there's not a Mac connected (for + Hot Restart builds for instance), so we're not conditioning this + task on IsMacEnabled. + -->