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

1235 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 76eb0bb573
[msbuild] Fix a few duplicate compile items warnings. (#15792)
Fixes:

	CSC : warning CS2002: Source file 'xamarin-macios/msbuild/Xamarin.Localization.MSBuild/MSBStrings.Designer.cs' specified multiple times [xamarin-macios/msbuild/Xamarin.Localization.MSBuild/Xamarin.Localization.MSBuild.csproj]
    CSC : warning CS2002: Source file 'xamarin-macios/tools/mtouch/Errors.Designer.cs' specified multiple times [xamarin-macios/msbuild/Xamarin.MacDev.Tasks/Xamarin.MacDev.Tasks.csproj]
2022-08-31 18:26:10 +02:00
Rolf Bjarne Kvinge a09b971788 [src] Quiet the build a bit. (#15737) 2022-08-29 14:15:02 +02:00
Rolf Bjarne Kvinge b9a60c4d7e
[msbuild] Remove the Xamarin.*.Task.Core assemblies. (#15768)
We used to do the following:

1. Have abstract task classes in the Xamarin.*.Task.Core assembly (with all
   the actual code for the task in question to work properly on macOS).
2. Subclassed task in the Xamarin.*.Task assembly, which did nothing.
3. On Windows we'd inject a different Xamarin.*.Task assembly, with
   Windows-specific overrides for the implementation in the abstract base
   class.

However, we no longer do point 3, which means that we no longer need to split
our tasks across two assemblies.

This means that we can remove the Xamarin.\*.Task.Core assemblies, and move all
the code into the corresponding Xamarin.\*.Task assembly instead.

This simplifies our code and speeds up the build.

There are more simplifications that can be done; those will come in later PRs.
2022-08-29 11:59:28 +02:00
Emanuel Fernandez Dell'Oca b1a732d526
[dotnet] macOS/MacCatalyst Archive and publishing support (#15720)
These changes are required to support Archive and Publishing for .NET macOS/MacCatalyst projects from VS for Mac.

Co-authored-by: Alex Soto <alex@alexsoto.me>
2022-08-26 08:18:43 +02:00
Rolf Bjarne Kvinge 408cd7ac52
[msbuild] Automatically detect any Entitlements.plist files in the root project in .NET. (#15729)
Also provide a way out by setting EnableDefaultCodesignEntitlements=false.

Fixes https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1595888.
2022-08-26 08:06:48 +02:00
Rolf Bjarne Kvinge a09c1e976c
[dotnet] Honor existing values for BuildIpa and CreatePackage. Fixes #15696. (#15697)
Don't blindly set the BuildIpa and CreatePackage values, but instead only set
them (when publishing) if they're not already set.

This makes it possible to publish and not create a package.

Fixes https://github.com/xamarin/xamarin-macios/issues/15696.
2022-08-25 11:05:09 +02:00
Rolf Bjarne Kvinge ceb3f97e90
[msbuild] Build for iOS if any platform except macOS is enabled. (#15755)
This is because we use the iOS assemblies for all other platforms except for
macOS.
2022-08-25 09:26:21 +02:00
Rolf Bjarne Kvinge 2b619955db
[msbuild] Unify the DetectSigningIdentity task between iOS and Mac. (#15698)
I've chosen the iOS implementation, since it's a bit more advanced to support
remote builds (the Mac implementation didn't do anything at all).

This should have no effect, since we don't support remote builds for macOS
anyways.
2022-08-24 18:55:07 +02:00
Mauro Agnoletti 6617121585
Fixed remote archiving with iOS app extensions (#15726)
- Fix AppExtensionReferences ItemSpec in Archive:
 when the build is a remote build, we need to fix the ItemSpec of the AppExtensionReferences items so it uses the build server path correctly

- Shorten temp directory for remote zip extractions to avoid long path potential conflicts

Fixes Feedbak Ticket issue: https://developercommunity.visualstudio.com/t/Xamarin-iOS-project-wont-archive-anymor/1587820
2022-08-23 12:21:17 +02:00
Mauro Agnoletti 028afc2eab
Updated Xamarin.Messaging to 1.7.9 (#15714) 2022-08-19 16:30:35 -04:00
Rolf Bjarne Kvinge e54019a336
[dotnet] Make it possible to specify the registrar using a 'Registrar' property in MSBuild. (#15483)
Co-authored-by: Marius Ungureanu <therzok@gmail.com>
2022-08-18 17:21:48 +02:00
Rolf Bjarne Kvinge aaee2bf794
[msbuild] Unify the CreateEmbeddedResources task between iOS and Mac. (#15500)
I've chosen the iOS implementation, since it's a bit more advanced to support
remote builds (the Mac implementation didn't do anything at all).

This should have no effect, since we don't support remote builds for macOS
anyways.
2022-08-18 16:56:23 +02:00
Rolf Bjarne Kvinge 78020cbaba
[msbuild] Remove dead code from the Codesign task. (#15519)
Fixes this warning:

    xamarin-macios/msbuild/Xamarin.iOS.Tasks.Windows/Tasks/Codesign.cs(12,27): warning CS0649: Field 'Codesign.cancellationSource' is never assigned to, and will always have its default value null [xamarin-macios/msbuild/Xamarin.iOS.Tasks.Windows/Xamarin.iOS.Tasks.Windows.csproj]
2022-07-27 10:21:45 -04:00
Rolf Bjarne Kvinge 8cc194ac86
[msbuild] Ignore CS0169 in a few places. (#15520)
Fixes these warnings:

    msbuild/Xamarin.iOS.Tasks/Model/DataItem.cs(25,31): warning CS0169: The field 'DataItem.UnsupportedData' is never used [xamarin-macios/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj]
    msbuild/Xamarin.iOS.Tasks/Model/DataSet.cs(12,31): warning CS0169: The field 'DataSet.JsonData' is never used [xamarin-macios/msbuild/Xamarin.iOS.Tasks/Xamarin.iOS.Tasks.csproj]

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-07-26 11:42:06 -04:00
Mauro Agnoletti 17ebe77a94
Set custom home env var from XMA Build Agent (#15571)
Overriding HOME is dangerous because it could cause unwanted side effects, like breaking the keychain API logic.

For this reason, we need to use a custom environment variable to store the custom home used by the XMA dotnet SDK.

This custom home should be passed everywhere as environment settings when we invoke the dotnet tool
2022-07-25 20:53:25 -04:00
Emanuel Fernandez Dell'Oca c957b0402a
Ensure the Hot Restart bundle does not have any entitlements set (#15558)
Hot Restart expects the archived-expanded-entitlements.xcent to be empty. If any entitlements are added to that file, the new app signature will be invalid.

These changes ensure that file will be an empty plist when extracting the PreBuilt app.

Partial fix for https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1550700
2022-07-21 16:17:20 -04:00
Emanuel Fernandez Dell'Oca 9bc3e3b238
Bump Xamarin.Messaging to 1.6.60 (#15370)
* Bump Xamarin.Messaging to 1.6.60

* Bump GitInfo to match Xamarin.Messaging

Co-authored-by: Alex Soto <alex@alexsoto.me>
2022-07-20 11:25:51 -04:00
Rolf Bjarne Kvinge 9facd8187d
[msbuild] Unify the PrepareNativeReferences task between iOS and Mac. (#15473) 2022-07-14 16:21:10 +02:00
Rolf Bjarne Kvinge 72c065cd80
[msbuild] Unify the CompileAppManifest task logic between iOS and Mac. (#15474) 2022-07-14 16:20:56 +02:00
Rolf Bjarne Kvinge 1f1c03b435
[msbuild] Copy partial app manifests to build server if they exists on Windows. Fixes #15267. (#15328)
The exclusion of partial app manifests happened here, but the commit doesn't explain why:

f4a4b232f8 (diff-178de6110858688b9f7c2e8e57a873f5ac9498b355a456bfc18547ab2df876bc)

It's certainly wrong if the partial app manifest is a part of the project, but
this exclusion might be because partial app manifests might be added as a part
of the build as well.

So change the logic to copy partial app manifests from Windows if they exist
there and they're not empty.

Fixes https://github.com/xamarin/xamarin-macios/issues/15267.
2022-07-11 20:39:07 +02:00
Rolf Bjarne Kvinge 840d2e9115
[msbuild] Remove code for watchOS 1 extensions, which we no longer support. (#15327) 2022-07-11 10:54:19 +02:00
Rolf Bjarne Kvinge abbd6ef466
[msbuild/tools] Fix path issues in the FilterStaticFrameworks task and ExtractBindingLibraries step. Fixes #15289. (#15321)
In the FilterStaticFrameworks task:

* Convert Windows-style paths to Mac-style paths.
* Give a better error if a framework can't be found.
* Don't try to copy frameworks that don't exist on Windows to the Mac.

In the ExtractBindingLibrariesStep:

* Return a relative path to frameworks we've extracted to make things easier for
  remote builds.

* In the _ComputeFrameworkFilesToPublish target, don't compute the source
  directory for frameworks using RootDir + Directory, because some frameworks
  may only exist on the mac, and RootDir + Directory will be a Windows path
  when building remotely. Instead use 'Identity', which is a relative path and
  will work on both Windows and Mac.

Fixes https://github.com/xamarin/xamarin-macios/issues/15289.
2022-07-11 10:39:54 +02:00
Rolf Bjarne Kvinge 3be1d9d760
Use unix-style line endings in project files. (#15303)
This also removes the BOM in a few project files.

This is a whitespace-only change, as can be seen here: https://github.com/xamarin/xamarin-macios/pull/15303/files?w=1
2022-06-21 17:22:58 +02:00
Rolf Bjarne Kvinge ab52bb2f45
[msbuild] Unify the DetectSdkLocations task logic between iOS and Mac. (#15256)
This was mostly a clean merge, with a few minor differences:

* We no longer compute whether we're running in the simulator or not when building for Mac Catalyst.
* The task now supports building remotely for macOS (due to code sharing).
  Will be useful if we ever support building macOS apps remotely.
* We now call AppleSdkSettings.Init () on macOS. No idea why we weren't
  before, but it seems logical for macOS to behave like our other platforms.

There shouldn't be any other functional differences.
2022-06-16 23:52:43 +02:00
Rolf Bjarne Kvinge 438e312503
[msbuild] Only pass -z to dsymutil when using Xcode 13.2 or earlier. (#15254)
Apple removed the -z / --minimize option in Xocde 13.3, so now if you use it
you get a warning: "ignoring unknown option: -z".

So just don't pass -z when using Xcode >= 13.3

Ref: https://github.com/dotnet/runtime/issues/66770
Ref: 5d07dc8977
2022-06-15 14:55:51 +02:00
Rolf Bjarne Kvinge ee2af3c896
[msbuild] Only sign the prebuilt hotrestart app in CI (#15236)
Only sign the prebuilt hotrestart app in CI, to avoid making it required for
developers to configure code signing.

Also fix DetectSigningIdentity to not require a code signing certificate for
device builds when RequireCodeSigning is false.

Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
2022-06-13 17:30:22 +02:00
Rolf Bjarne Kvinge b387776ee8
[msbuild] Update ILRepack location now that we're putting all our packages in a directory in our repo. (#15228) 2022-06-09 13:23:26 -04:00
Rolf Bjarne Kvinge ed1448ae68
[msbuild] Unify the CompileSceneKitAsset task logic between iOS and Mac and improve it. (#15176)
* Unify the CompileSceneKitAsset task implementation between iOS and Mac.
  There were no real differences, so might as well use the same code
  everywhere.
* Use existing facilities for process launching.
* Parallelize compiling.
2022-06-07 16:23:44 +02:00
Rolf Bjarne Kvinge 6c5a95b56e
[msbuild] Simplify code to remove metadata. (#15185) 2022-06-07 10:32:05 +02:00
Rolf Bjarne Kvinge a1d0b6eba9
Make our local .NET the default .NET for the build. (#15086)
Make our local .NET the default .NET (in the root's global.json), and then if
a directory wants to use the system .NET, then that directory would have to
opt-in (using its own global.json).

This way we don't have to copy global.json/NuGet.config files around to run
tests with the correct .NET setup.
2022-06-07 10:11:02 +02:00
Rolf Bjarne Kvinge dcecc4dbf9
[msbuild] Fix computing the output path for SceneKitAsset items with custom Link metadata. Fixes #15104. (#15186)
Co-authored-by: Chris Hamons <chris.hamons@xamarin.com>
2022-06-07 10:08:53 +02:00
Mauro Agnoletti ac97efd395
Allow overriding HOME variable in dotnet remote builds (#15171)
With remote builds, a dedicated dotnet location is being used so the right versioning can be used and managed from VS in Windows. This dedicated dotnet location requires a custom .home location so the donet and nuget caches doesn't conflict with the global installation.

We need to consider and use this custom .home location when running dotnet commands remotely so the right caches are used

This should fix Bug: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1543495
2022-06-03 18:19:27 +02:00
Emanuel Fernandez Dell'Oca 7ad9f88939
[msbuild] Fixes Hot Restart compiled Entitlements output path (#15125)
The compiled entitlements should be placed in the intermediate Hot Restart app bundle so those can be picked up by the HotRestart Codesign task. Prior to this change, entitlements set in the project wouldn't be included in the app, making things like Keychain Access fail, even though it was configured.

Fixes https://developercommunity.visualstudio.com/t/Unable-to-use-MSAL-with-locally-connecte/1573064
2022-05-30 12:34:20 +02:00
Mauro Agnoletti f45c20505d
Updated Hot Restart Client version to 1.0.93 (#15137)
Bring changes in logging verbosity
2022-05-30 12:29:14 +02:00
Rolf Bjarne Kvinge cf7c6b5980
[msbuild] Improve logic to clean up app bundle for unwanted files. (#15080)
The current directory at launch is the root directory of the app bundle. This
means that any files written to the current directory when an app is executed,
will be placed there. This becomes a problem when the app is rebuilt (and
resigned), because a valid macOS app bundle doesn't have any files in the root
directory of the app bundle, so signing fails.

We have logic to automatically crash crash reports from the app bundle, but it
turns out this is a more common problem with other types of files (and
folders), so improve the logic a bit:

* Add support for setting a property to automatically clean up everything from
  an app bundle we don't think should be there (which is anything not in a
  Contents/ subdirectory).
* Use the same property to add support for disabling any cleaning (we already
  clean mono's crash reports by default).
* Improve detection of unwanted files to include directories inside the app
  bundle, not only files.

Ref: https://github.com/dotnet/maui/issues/7353
2022-05-30 11:34:45 +02:00
Rolf Bjarne Kvinge 6ecc102b5b
[msbuild] Use the full path to the symbols list file. Fixes #15046. (#15105)
Give the full path to the symbols list file in the extension project to the
main project, so that strip can find it.

When building a solution remotely from Windows, we can't compute a relative
path between projects, because they're laid out differently on disk. This
means that we have to use full paths when passing paths between projects (such
as the path to the symbol list file).

Fixes https://github.com/xamarin/xamarin-macios/issues/15046.
2022-05-30 11:33:11 +02:00
Mauro Agnoletti 42594a8296
Updated Messaging and Hot Restart versions (#15114) 2022-05-25 10:17:56 +02:00
VS MobileTools Engineering Service 2 61ef886513
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 6156518 (#15034) 2022-05-16 15:01:18 -04:00
Mauro Agnoletti 31c54460d5
Avoid executing _VerifyXcodeVersion when there's no connection to a Mac (#15026)
This should fix an annoying warning where the user builds an iOS project offline and get a message about that target couldn't be executed
2022-05-16 12:30:49 +02:00
Rolf Bjarne Kvinge fe6a06dbca
[msbuild] Improve error reporting when an external tool fails to print some of stderr. (#14993)
Improve error reporting when an external tool fails to print some of stderr (up to 1024 characters).

Before:

    error : clang exited with code 1

After:

    error : clang exited with code 1:
    error : [...]/xamarin-macios/tests/dotnet/MyInterpretedApp/iOS/obj/Debug/net6.0-ios/iossimulator-x64/linker-cache/main.x86_64.mm:58:25: error: use of undeclared identifier 'MONO_AOT_MODE_INTERP_ONLY'; did you mean 'MONO_AOT_MODE_INTERP'?
    error :         mono_jit_set_aot_mode (MONO_AOT_MODE_INTERP_ONLY);
    error :                                ^~~~~~~~~~~~~~~~~~~~~~~~~
    error :                                MONO_AOT_MODE_INTERP
    error : [...]/xamarin-macios/builds/downloads/dotnet-sdk-6.0.301-rtm.22254.17-osx-x64/packs/Microsoft.iOS.Runtime.iossimulator-x64/15.4.16-ci.x64-interpreter-only/runtimes/iossimulator-x64/native/xamarin/mono-runtime.h:452:2: note: 'MONO_AOT_MODE_INTERP' declared here
    error :         MONO_AOT_MODE_INTERP,
    error :         ^
2022-05-13 09:14:10 +02:00
VS MobileTools Engineering Service 2 7d9dad24fc
Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 6124703 (#14931)
Co-authored-by: TJ Lambert <50846373+tj-devel709@users.noreply.github.com>
2022-05-12 12:25:41 -05:00
Rolf Bjarne Kvinge 92eda7f353
[dotnet] Add support for selecting whether to create P/Invoke wrappers or not. Fixes #4940. (#14961)
* This is a potential mitigation for slower transition to native code when
  exception marshalling is enabled (#14812).
* A minor modification was required in the linker, to make sure any modified
  assemblies are saved.

Fixes https://github.com/xamarin/xamarin-macios/issues/4940.
2022-05-11 16:42:01 +02:00
Manuel de la Pena f66fba9c8d
[Tools] Enable nullability in StringUtils.cs (#14944) 2022-05-11 07:08:57 -04:00
Rolf Bjarne Kvinge f2bcedd441
[msbuild/dotnet] Add support for passing --aot arguments to the AOT compiler. (#14936)
Pick up --aot arguments in MtouchExtraArgs and pass them to the AOT compiler
when building a .NET project. This makes it possible to work around #14887 by
manually increasing the number of trampolines.

Ref: https://github.com/xamarin/xamarin-macios/issues/14887
2022-05-10 16:25:19 +02:00
Mauro Agnoletti ff40b22180
Updated Xamarin.Messaging to 1.6.6 (#14915) 2022-05-09 18:16:52 +02:00
Emanuel Fernandez Dell'Oca e9333bae47
Bumps Xamarin.HotRestart.Application to 1.1.5 (#14925)
This new version contains a fix for incremental deployments when using Xamarin iOS Hot Restart.
2022-05-09 10:30:22 +02:00
Rolf Bjarne Kvinge 07b9d90fee
[msbuild] Enable nullability in the AOTCompileTask class. (#14924) 2022-05-09 10:10:57 +02:00
Rolf Bjarne Kvinge ece70a6c6e
[msbuild] Copy binding resource files back to Windows. Fixes #13393. (#14702)
Fixes https://github.com/xamarin/xamarin-macios/issues/13393.
2022-04-27 08:31:42 +02:00
Rolf Bjarne Kvinge 6a43d470d9
[msbuild] Fix typo in warning message. (#14808) 2022-04-25 08:32:28 +02:00
Rolf Bjarne Kvinge a9a638553f
[msbuild/dotnet] Fix building binding projects on Windows in .NET (#14704)
When building a binding project, we need to execute bgen (and csc) on the mac. Figuring
out where these files are on the Mac is rather complicated from a remotely executed
task, so instead we execute a sub-build that computes these properties.

In legacy Xamarin this was accomplished by building the 'Xamarin.iOS.ObjCBinding.Common.props'
file using msbuild, and invoking a custom target that prints the property we're looking
for (the 'targetGetPropertyValue_*' targets).

For multiple reasons this approach doesn't work in .NET anymore (in particular it
seems that the 'Xamarin.iOS.ObjCBinding.Common.After.targets' file with the custom
'targetGetPropertyValue_*' targets is nowhere to be found, but logic has also moved
around in the .targets/.props files which makes just building the 'Xamarin.iOS.ObjCBinding.Common.props'
not work correctly since the properties we need wouldn't be set).

So I'm adding a new task that does a sub-build, using either msbuild or dotnet as
appropriate, to compute the properties we need. Instead of building the 'Xamarin.iOS.ObjCBinding.Common.props'
file, the task creates an actual binding project (an empty one), and executes the
new '_WriteRemoteGeneratorProperties' target in this binding project.

An additional advantage in this new task is that it will only execute one sub-build
where all the properties are computed (the previous approach executed one sub-msbuild
per property).

In order to keep code as similar as possible between legacy Xamarin and .NET, the
new task is being used for legacy Xamarin as well (and the old approach deleted).

This fixes building binding projects on Windows in .NET.
2022-04-22 16:17:03 +02:00