Граф коммитов

264 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge ad4af52393
[dotnet] Improve error message when someone tries to disable trimming by setting PublishTrimmed=false. (#17568)
Make it more actionable, by telling users what they can do instead.
2023-02-21 14:54:44 +01:00
Rolf Bjarne Kvinge afb6505f8c
[tests] Bump Microsoft.NET.Test.Sdk version to latest stable. (#17462)
The older version of Microsoft.NET.Test.Sdk depends on an older version of
Newtonsoft.Json, which triggers automated security warnings.

Ref: https://devdiv.visualstudio.com/DevDiv/_componentGovernance/113130/alert/7090885?typeId=12169115
2023-02-07 14:52:45 +01:00
Andoni Morales Alastruey 97ab14801f
[dotnet] Add support for .so files (#16887)
Autotools-based project using libtool's -module flag generate plugins
with the .so extension that needs to be treated like DynamicLibraries in
terms of deployment location and relocation, except they are not linked
to the app.

This PR adds support for such .so files: they're treated as .dylib files, except
that they're not linked to the app.
2023-02-03 09:16:40 +01:00
Rolf Bjarne Kvinge eb7914cfc2 [tests] Update the .NET template tests.
* Make these tests be able to build Visual Basic templates.
* Add the new Visual Basic templates.
2023-01-31 13:01:46 +01:00
Rolf Bjarne Kvinge 1130e1c472 [dotnet] Move templates around a bit to make room for more language-specific project templates. 2023-01-30 17:21:22 +01:00
dustin-wojciechowski 51bee958f0
Added GPSLatitudeRef and GPSLongitudeRef to CGImagePropertiesGPS. (#17166)
Fixes #17162

Added GPSLatitudeRef and GPSLongitudeRef to CGImagePropertiesGPS. 
Added new photo to all resources folders that has GPS data. 
Created new test that reads GPS information off a photo and verifies that it is correct.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2023-01-28 09:31:25 -08:00
Rolf Bjarne Kvinge 10accc2cd7
[dotnet/msbuild] Only compile entitlements once for universal builds. Fixes #15632. (#17096)
Fixes https://github.com/xamarin/xamarin-macios/issues/15632.
2023-01-19 16:01:34 +01:00
Rolf Bjarne Kvinge dc5d3b2a99
[tests] Hardcode the SupportedOSPlatformVersion for the .NET 6 tests. (#17248)
.NET 6 doesn't define the minimum supported OS version property, which means
we can't use the existing logic to automatically determine the min OS version
to use as the default SupportedOSPlatformVersion in the .NET 6, so hardcode
the value.
2023-01-17 17:09:47 +01:00
Rolf Bjarne Kvinge 6a5176ad50
Bump to MSBuild.StructuredLogger v2.1.758. (#17229)
To get new log format:

> System.NotSupportedException : Unsupported log file format. Latest
supported version is 14, the log file has version 15.
2023-01-16 07:32:45 +01:00
Rolf Bjarne Kvinge 74d7337dcc
[dotnet] Create an MSBuild property for the current min OS version. (#17034)
Create an MSBuild property for the minimum OS version
(`SupportedOSPlatformVersion`) we support for a given platform (named
`[platform]MinSupportedOSPlatformVersion`), and use it in most tests instead
of hardcoding the min OS version (which would otherwise have to be updated
every time we bump the min OS version).
2023-01-10 21:18:39 +01:00
Timothé Larivière 3b73bb658b
Add an additional F# template for Microsoft.iOS.iOSApp (#16823)
Closes #16822 

This PR adds an F# template to the basic Microsoft.iOS.iOSApp template.
This should allow being able to do either:

```
dotnet new ios -lang C# -n MyApp
dotnet new ios -lang F# -n MyApp
```

I had to move the C# template into a `csharp` folder.
Also added the `groupIdentity` `Microsoft.iOS.iOSApp` and set the identity for both C# and F# respectively to `Microsoft.iOS.iOSApp.CSharp` and `Microsoft.iOS.iOSApp.FSharp`

Co-authored-by: Timothé LARIVIERE <timothe.lariviere@fundourselves.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-22 12:04:36 +01:00
Andoni Morales Alastruey efad190de9
[msbuild] Validate OutputType property (#16871)
Fixes #16865

```
➜  test dotnet build  -bl:msbuild.binlog
MSBuild version 17.3.2+561848881 for .NET
/usr/local/share/dotnet/sdk/6.0.403/MSBuild.dll -bl:msbuild.binlog -consoleloggerparameters:Summary -distributedlogger:Microsoft.DotNet.Tools.MSBuild.MSBuildLogger,/usr/local/share/dotnet/sdk/6.0.403/dotnet.dll*Microsoft.DotNet.Tools.MSBuild.MSBuildForwardingLogger,/usr/local/share/dotnet/sdk/6.0.403/dotnet.dll -maxcpucount -restore -verbosity:m ./test.csproj
  Determining projects to restore...
  All projects are up-to-date for restore.
/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/12.3.471/targets/Xamarin.Shared.Sdk.targets(284,3): error : WinExe is not a valid output type for macOS [/Users/andoni/Downloads/test/test.csproj]

Build FAILED.

/usr/local/share/dotnet/packs/Microsoft.macOS.Sdk/12.3.471/targets/Xamarin.Shared.Sdk.targets(284,3): error : WinExe is not a valid output type for macOS [/Users/andoni/Downloads/test/test.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:01.14
```

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2022-12-22 07:36:04 +01:00
Rolf Bjarne Kvinge 834bb92cb0
[tests] Update .NET tests to cope with updated min OS version and no more 32-bit iOS support. (#17088) 2022-12-21 18:15:28 +01:00
Rolf Bjarne Kvinge e99c71ad36
[tests] Fix a few nullability issues in cecil-tests and the .NET tests. (#17095)
Also make any nullability warnings show up as errors.
2022-12-21 10:19:13 +01:00
Rolf Bjarne Kvinge 01123bfb0e
[tests] Fix the AppWithNativeDynamicLibrariesInPackageReference to work when not all platforms are enabled. (#17081) 2022-12-19 18:37:10 +01:00
Andoni Morales Alastruey 4cfccff38e
Fix libs reidentification deployed in a subdirectory (#16706)
Dynamic libraries might be deployed in subdirectories such as libclrjit.dylib from the nuget package cefglue.common:
Contents/MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

The library ID for that library should be: @executable_path/../MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

Instead of: @executable_path/../MonoBundle/libclrjit.dylib

Beside the library ID being wrong, when it's combined with the nuget package microsoft.netcore.app.runtime.osx-x64 providing a library with the same name, both uses the same `ReidentifiedPath`, which can cause a failure in the InstallNameTool tasks that are run in parallel operating on the same temporary file.

The following patch uses the `RelativePath` for the tempory file used by `InstallNameTool` so that there are no clashes with other files with the same name deployed in other directories. It also uses the `RelativePath` to create the correct library id: @executable_path/../../Contents/MonoBundle/CefGlueBrowserProcess/libclrjit.dylib

Partially fixes https://github.com/xamarin/xamarin-macios/issues/15173 for this scenario
2022-12-16 09:17:01 +01:00
Rolf Bjarne Kvinge 3ff320805b
[tests] Enable nullability for numerous files in the .NET tests. (#16976) 2022-12-12 17:13:02 +01:00
Rolf Bjarne Kvinge 0076cd9920
[autoformat] Add .NET tests. (#16811) 2022-11-21 09:45:49 +01:00
Rolf Bjarne Kvinge 5ba78a77cd
[tests] Update the size-comparison test to work on .NET 7+. (#16818) 2022-11-21 09:36:46 +01:00
Rolf Bjarne Kvinge 328f56fd4f
[tests] Ensure all .NET tests use the current .NET version. (#16820) 2022-11-21 09:35:04 +01:00
Rolf Bjarne Kvinge a79e2f87d3 Merge main into net7.0. 2022-10-18 08:12:46 +02:00
Rolf Bjarne Kvinge ddb00021c4
[test] Adjust ProjectTest.AppWithGenericLibraryReference to not fail when only macOS is enabled. (#16346)
This test requires another platform to be enabled in addition to the current
platform being tested: that other platform is iOS when testing macOS, and
macOS for all other platforms.

This can be seen in the target frameworks for the referenced library projects:

    MacCatalyst/Library.csproj:     <TargetFrameworks>net$(BundledNETCoreAppTargetFrameworkVersion)-macos;netstandard2.1</TargetFrameworks>
    iOS/Library.csproj:             <TargetFrameworks>net$(BundledNETCoreAppTargetFrameworkVersion)-macos;netstandard2.1</TargetFrameworks>
    macOS/Library.csproj:           <TargetFrameworks>net$(BundledNETCoreAppTargetFrameworkVersion)-ios;netstandard2.1</TargetFrameworks>
    tvOS/Library.csproj:            <TargetFrameworks>net$(BundledNETCoreAppTargetFrameworkVersion)-macos;netstandard2.1</TargetFrameworks>
2022-10-17 13:32:05 +02:00
Rolf Bjarne Kvinge 319de6759e Fix merge conflict. 2022-10-13 09:29:53 +02:00
Rolf Bjarne Kvinge 9d306f3862 Merge main into net7.0. 2022-10-10 13:01:32 +02:00
Rolf Bjarne Kvinge acf4edbfed
[dotnet] Add numerous item templates. Fixes #15836. (#16287)
Add the following item templates for all platforms:

* Controller (View Controller with UI written in code)
* View
* View Controller (View Controller with UI written in XIB)
* Storyboard

Item templates won't show up in VSMac until this is released:
https://github.com/xamarin/vsmac/pull/9133.

Fixes https://github.com/xamarin/xamarin-macios/issues/15836.

Also update the template tests accordingly.

This PR might be easier to review commit-by-commit due to the large number of generated localization files.
2022-10-10 08:09:34 +02:00
Rolf Bjarne Kvinge fa778b50e8
[autoformat] Add the DotNetUnitTests project to the projects to autoformat. (#16257) 2022-10-07 08:05:53 +02:00
Rolf Bjarne Kvinge 6d6c3b8570
[dotnet] Add class library project templates for tvOS, macOS and Mac Catalyst. (#16263)
These new project templates won't show up in VSMac until the new templates are
added to VSMac.

Ref: 61afbd1cd1/Xamarin.Addins.Core/Xamarin.Ide.Templating/TemplateDescriptionProvider.cs (L207-L216)

Also update the corresponding template tests.

This PR might be easier to review commit-by-commit due to the large number of generated localization files.
2022-10-06 16:47:06 +02:00
Rolf Bjarne Kvinge ed612dcd6e Merge main into net7.0. 2022-09-28 17:17:10 +02:00
Rolf Bjarne Kvinge 00578621d4
[dotnet] Don't try to ILStrip assemblies unless we're connected to a Mac. (#16160)
Fixes this error:

	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018: The "Xamarin.MacDev.Tasks.ILStrip" task failed unexpectedly.
	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018: System.ArgumentException: 'Assemblies' is required. (Parameter 'Assemblies')
	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018:    at ILStrip.Execute()
	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018:    at ILStripTasks.ILStripBase.Execute() in /Users/rolf/work/maccore/main/xamarin-macios/msbuild/Xamarin.iOS.Tasks/Tasks/ILStripBase.cs:line 18
	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018:    at Xamarin.MacDev.Tasks.ILStrip.Execute() in /Users/rolf/work/maccore/main/xamarin-macios/msbuild/Xamarin.iOS.Tasks/Tasks/ILStrip.cs:line 16
	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
	targets/Xamarin.Shared.Sdk.targets(754,3): error MSB4018:    at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)
     0 Warning(s)
     1 Error(s)
2022-09-28 07:29:52 +02:00
Rolf Bjarne Kvinge e9e097c794
[dotnet] Don't try to collect RID-specific items to codesign unless we're connected to (or building on) a Mac. (#16153)
Fixes this problem when building universal Mac Catalyst apps on Windows:

    Target Name=_CollectRidSpecificCodesignItems Project=D:\a\_work\1\s\src\Graphics\samples\GraphicsTester.Skia.Mac\GraphicsTester.Skia.Mac.csproj
        ReadItemsFromFile
            Assembly = D:\a\_work\1\s\bin\dotnet\packs\Microsoft.MacCatalyst.Sdk\15.4.1173-rc.2\tools\msbuild\iOS\..\iOS\Xamarin.iOS.Tasks.dll
            Parameters
                File = obj\Release\net7.0-macos\codesignitems-osx-x64.items
            Errors
                D:\a\_work\1\s\bin\dotnet\packs\Microsoft.macOS.Sdk\12.3.1173-rc.2\targets\Xamarin.Shared.Sdk.targets(1303,3): error MSB4018: The "ReadItemsFromFile" task failed unexpectedly.
    System.IO.FileNotFoundException: Could not find file 'D:\a\_work\1\s\src\Graphics\samples\GraphicsTester.Skia.Mac\obj\Release\net7.0-macos\codesignitems-osx-x64.items'.
    File name: 'D:\a\_work\1\s\src\Graphics\samples\GraphicsTester.Skia.Mac\obj\Release\net7.0-macos\codesignitems-osx-x64.items'
       at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options)
       at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
       at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize, Nullable`1 unixCreateMode)
       at System.Xml.XmlDownloadManager.GetStream(Uri uri, ICredentials credentials, IWebProxy proxy)
       at System.Xml.XmlTextReaderImpl.FinishInitUriString()
       at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext)
       at System.Xml.Linq.XDocument.Load(String uri, LoadOptions options)
       at Xamarin.MacDev.Tasks.ReadItemsFromFileBase.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFileBase.cs:line 39
       at Xamarin.MacDev.Tasks.ReadItemsFromFile.Execute() in /Users/builder/azdo/_work/1/s/xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Tasks/ReadItemsFromFile.cs:line 15
       at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
       at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [D:\a\_work\1\s\src\Graphics\samples\GraphicsTester.Skia.Mac\GraphicsTester.Skia.Mac.csproj]
2022-09-27 17:29:58 +02:00
Rolf Bjarne Kvinge 56165a77ec Merge main into net7.0. 2022-09-26 22:44:48 +02:00
Rolf Bjarne Kvinge afbd3336ba
[tests] Ignore the CustomizedCodeSigning test when the selected platform isn't enabled. (#16101) 2022-09-23 20:55:53 +02:00
Rolf Bjarne Kvinge 5837d5a1e0
[tests] Update tests to cope with a different default platform than the latest version. (#16063) 2022-09-23 14:08:40 +02:00
Rolf Bjarne Kvinge 15e9683a53 Bump main in net7.0. 2022-09-22 07:55:18 +02:00
Rolf Bjarne Kvinge 8e92e9e5c5
[tests] Ignore tests that require platforms not included in the current build. (#16000) 2022-09-22 07:33:42 +02:00
Rolf Bjarne Kvinge 52a332cb9b
[dotnet/msbuild] Add support for skipping/adding items (and bundles) to be signed. Fixes #15594. (#15894)
Add support for two new MSBuild item groups:

* CodesignBundle: lists additional app bundles inside the main bundle which should
  be signed (typically manually copied into the app bundle by the developer).
* SkipCodesignItems: lists files we'd sign by default, but which shouldn't be signed.

Fixes https://github.com/xamarin/xamarin-macios/issues/15594.
2022-09-21 11:38:03 +02:00
Rolf Bjarne Kvinge 5a613f7c86 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-15 2022-09-15 09:30:29 +02:00
Rolf Bjarne Kvinge 40199966b6
[msbuild] Automatically add the 'com.apple.security.cs.allow-jit' entitlement for desktop release builds. Fixes #15745. (#15927)
* Add support for specifying custom entitlements with an MSBuild item group.
* Use this new support to automatically add the 'com.apple.security.cs.allow-jit'
  entitlement to .NET desktop apps when building for release, since all apps that
  go through notarization will need it in order to be able to use the JIT.

It's possible to override the default behavior by adding something like this to the project file:

    <ItemGroup>
        <CustomEntitlements Include="com.apple.security.cs.allow-jit" Type="Remove" />
    </ItemGroup>

Fixes https://github.com/xamarin/xamarin-macios/issues/15745.
2022-09-13 17:41:22 +02:00
Rolf Bjarne Kvinge 7df80a40da
[msbuild] Remove MS7068 so allow creating binding projects without native libraries. Fixes #15489. (#15926)
Fixes https://github.com/xamarin/xamarin-macios/issues/15489.
2022-09-13 17:40:43 +02:00
Rolf Bjarne Kvinge 17821f0585 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-12 2022-09-12 11:28:02 +02:00
Rolf Bjarne Kvinge e84cca8cb6
[dotnet] Add binding templates for tvOS and macOS. Fixes #15839. (#15921)
Fixes https://github.com/xamarin/xamarin-macios/issues/15839.
2022-09-12 10:21:47 +02:00
Rolf Bjarne Kvinge 9f0b794d28 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-09 2022-09-09 16:55:20 +02:00
Rolf Bjarne Kvinge cec44fba3d Fix merge failure. 2022-09-08 11:10:29 +02:00
Rolf Bjarne Kvinge aa8ded8e51
[runtime] Store assemblies' MVID in the generated static registrar code. (#15795)
This will increase app size a little bit: the space for the MVID + 4 bytes for each
assembly, but we'll be able to validate and show a helpful error message if the generated
static registrar code does not match the assembly loaded at runtime.

It's also a step toward per-assembly static registration (ref: #12067).
2022-09-08 10:34:05 +02:00
Rolf Bjarne Kvinge 681fce6036 Merge remote-tracking branch 'origin/net7.0' into bump-main-in-net7.0-2022-09-07 2022-09-07 11:38:51 +02:00
Rolf Bjarne Kvinge 62bc02760a
[msbuild] Compute _AppContainerDir from AppBundleDir if AppBundleDir is set by the developer. Fixes #15014. (#15869)
Fixes https://github.com/xamarin/xamarin-macios/issues/15014.
2022-09-07 11:33:39 +02:00
Rolf Bjarne Kvinge ea4b193303 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-09-07 2022-09-07 10:57:58 +02:00
Rolf Bjarne Kvinge 2415050767
[dotnet] Fix issue with frameworks with dots. Fixes #15727. (#15872)
Since executables in frameworks usually don't have dots, `%(Filename)` will be
the entire filename, because `%(Extension)` is empty. However, if the
executable happens to have a dot, then we need to include the extension:
`%(Filename)%(Extension)`.

Fixes https://github.com/xamarin/xamarin-macios/issues/15727.
2022-09-07 10:43:33 +02:00
Rolf Bjarne Kvinge 95d728304b
[msbuild] Add additional app extensions to the list of items we need to sign. Fixes #15598. (#15829)
* Add additional app extensions to the list of items we need to sign.
* Improve msbuild test for additional app extensions:
    * Build for both device and simulator.
    * Hopefully fix the signing problems that occurred on the bots last time we tried.
    * Assert that both the container and extension are signed during the build when we build for device.

A 10-line fix with 3300 lines of tests...

Fixes https://github.com/xamarin/xamarin-macios/issues/15598.
2022-09-07 10:39:05 +02:00
Rolf Bjarne Kvinge a0250da042 Revert "[tests] Update expected error message texts."
This reverts commit de7e738c11.
2022-09-06 18:49:30 +02:00