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

488 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 953a2b4564
[src] Remove legacy build logic. (#21353) 2024-10-10 11:26:25 +02:00
Rolf Bjarne Kvinge 26fd71af2b
[mmp] Add PreserveSmartEnumConversionsSubStep to the linker sub steps. Fixes #19712. (#19836)
Looks like this was substep was only added to mtouch, never to mmp, so
let's fix that.

This also makes it possible to remove a test that was only there for the
linker to keep some required methods so that the test app would build
correctly.

Fixes https://github.com/xamarin/xamarin-macios/issues/19712.
2024-01-22 22:20:47 +01:00
Rolf Bjarne Kvinge 1ddc0b4b74
Get Mono.Cecil from NuGet everywhere. (#19535)
Also:

* Store the version in Directory.Build.props, which makes it much easier to update.
* Bump all versions to latest (0.11.5).
2023-12-04 20:15:03 +01:00
Rolf Bjarne Kvinge 8b0eee1092
[mmp] Don't run pkg-config when generating partial static registrar code. (#19473)
Lately I've been seeing an increase in a build failure on boths due to
pkg-config crashing when generating the partial static registrar code in mmp.

Turns out it's not necessary to run pkg-config when generating the partial
static registrar code, so just skip it in that case.

Example crash:

    Process exited with code 134, command:
    /Library/Frameworks/Mono.framework/Versions/Current/bin/pkg-config --variable=prefix mono-2
    mono_os_sem_post: semaphore_signal failed with error 15

    =================================================================
    	Native Crash Reporting
    =================================================================
    Got a abrt while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    	Native stacktrace:
    =================================================================
    	0x1018d2639 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_dump_native_crash_info
    	0x10186a3ee - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_handle_native_crash
    	0x1018d1bff - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : sigabrt_signal_handler
    	0x7ff819ca35ed - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x7ff819b9cb45 - /usr/lib/system/libsystem_c.dylib : abort
    	0x101abee97 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : monoeg_assert_abort
    	0x101a9fcff - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_log_write_logfile
    	0x101abf32e - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : monoeg_g_logv_nofree
    	0x101abf3e2 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : monoeg_g_log
    	0x101a42017 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_gc_finalize_notify
    	0x10192c512 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_sigchld_signal_handler
    	0x7ff819ca35ed - /usr/lib/system/libsystem_platform.dylib : _sigtramp
    	0x0 - Unknown
    	0x101d9b6c7 - /Users/builder/azdo/_work/_temp/codeql3000/distribution/codeql/tools/osx64/libtrace.dylib : _ZL18execve_with_tracerPKcS0_PKPcS3_i
    	0x101d9afc7 - /Users/builder/azdo/_work/_temp/codeql3000/distribution/codeql/tools/osx64/libtrace.dylib : codeql_execve
    	0x10192915c - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : process_create
    	0x101929d26 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : ves_icall_System_Diagnostics_Process_CreateProcess_internal
    	0x101985a5f - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : ves_icall_System_Diagnostics_Process_CreateProcess_internal_raw
    	0x104538e11 - Unknown
    	0x10453702b - Unknown
    	0x10531156b - /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5/mscorlib.dll.dylib : System_Threading_ThreadHelper_ThreadStart_Context_object
    	0x10530ec23 - /Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/4.5/mscorlib.dll.dylib : System_Threading_ExecutionContext_Run_System_Threading_ExecutionContext_System_Threading_ContextCallback_object_bool
    	0x1017c7332 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_jit_runtime_invoke
    	0x1019d6db7 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_runtime_invoke_checked
    	0x1019dd6b0 - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : mono_runtime_delegate_try_invoke
    	0x101a01c5d - /Library/Frameworks/Mono.framework/Versions/6.12.0/bin/mono-sgen64 : start_wrapper
    	0x7ff819c761d3 - /usr/lib/system/libsystem_pthread.dylib : _pthread_start
    	0x7ff819c71bd3 - /usr/lib/system/libsystem_pthread.dylib : thread_start

    =================================================================
    	Telemetry Dumper:
    =================================================================
    Pkilling 0x140704692385536x from 0x123145518841856x
    Pkilling 0x123145515659264x from 0x123145518841856x
    Entering thread summarizer pause from 0x123145518841856x
    Finished thread summarizer pause from 0x123145518841856x.
    Failed to create breadcrumb file (null)/crash_hash_0x4409842f2

    Waiting for dumping threads to resume

    =================================================================
    	External Debugger Dump:
    =================================================================

    =================================================================
    	Basic Fault Address Reporting
    =================================================================
    Memory around native instruction pointer (0x7ff819c3e1e2):0x7ff819c3e1d2  ff ff c3 90 90 90 b8 48 01 00 02 49 89 ca 0f 05  .......H...I....
    0x7ff819c3e1e2  73 08 48 89 c7 e9 df 9a ff ff c3 90 90 90 b8 53  s.H............S
    0x7ff819c3e1f2  00 00 02 49 89 ca 0f 05 73 08 48 89 c7 e9 c7 9a  ...I....s.H.....
    0x7ff819c3e202  ff ff c3 90 90 90 b8 83 01 00 02 49 89 ca 0f 05  ...........I....

    =================================================================
    	Managed Stacktrace:
    =================================================================
    	  at <unknown> <0xffffffff>
    	  at System.Diagnostics.Process:CreateProcess_internal <0x000a0>
    	  at System.Diagnostics.Process:StartWithCreateProcess <0x0075a>
    	  at System.Diagnostics.Process:Start <0x000ba>
    	  at System.Diagnostics.Process:Start <0x000a2>
    	  at <>c__DisplayClass24_1:<RunAsync>b__0 <0x0031a>
    	  at System.Threading.ThreadHelper:ThreadStart_Context <0x000aa>
    	  at System.Threading.ExecutionContext:RunInternal <0x001a9>
    	  at System.Threading.ExecutionContext:Run <0x00042>
    	  at System.Threading.ExecutionContext:Run <0x00067>
    	  at System.Threading.ThreadHelper:ThreadStart <0x00042>
    	  at System.Object:runtime_invoke_void__this__ <0x000b0>
    =================================================================

    error MM5312: pkg-config failed with an error code '134'. Check build log for details.
2023-11-20 07:54:19 +01:00
Rolf Bjarne Kvinge f9ba5467e8
Use Mono.Options NuGet instead of building from source in a few projects. (#19438)
This reduces a source dependency on the legacy Mono package.
2023-11-14 10:32:23 +01:00
Rolf Bjarne Kvinge 673dd5782b [net8.0-xcode15] Merge net8.0 into net8.0-xcode15. 2023-09-08 10:31:44 +02:00
Rolf Bjarne Kvinge 45225dc88d
[dotnet] Parameterize the pack names. (#18732)
We're going to change the pack names to support multi-targeting, so ahead
of the pack name change I'm changing the existing logic to use a variable
for the pack name in most places (this will make the rename much easier and
simpler).

These changes should have no effect by themselves.
2023-08-29 10:06:46 +02:00
Rolf Bjarne Kvinge 7988d051ee
[net8.0-xcode15] [tools] Improve enforcement of the classic linker. (#18719)
* Only ask for the classic linker if we're using Xcode 15+.
* Implement a way out of the enforcing the classic linker.
2023-08-15 08:19:20 +02:00
Alex Soto ed6affbb50
[xcode15] Bump Xcode 15 to Beta 6 (#18668) 2023-08-12 07:10:00 -04:00
Rolf Bjarne Kvinge 94d63853fe [mmp] Use the old linker (ld64). 2023-08-04 11:49:45 -04:00
Manuel de la Pena 72865626fe
[Policheck] Fix all policheck issues that are not part of the apple APIs. (#18544) 2023-07-10 14:38:21 -04:00
Steve Hawley a36cd71174
[dotnet] Integrate class handle rewriting into static registrar process. (#18456)
Integrate class handle rewriting into static registrar.
2023-06-23 10:12:35 -04:00
Rolf Bjarne Kvinge 36af029204
Change all null checking expressions to use 'is' and 'is not'. (#18176)
Change all null checking expressions to use 'is null' and 'is not null'
instead of '== null' and '!= null'.

This was mostly done with sed, so code can probably be improved in many
other ways with manual inspection, but that will come over time.

Also add code to the autoformat script to automatically fix these issues in the future.
2023-05-05 17:52:19 +02:00
Rolf Bjarne Kvinge d12c04689f
Enable nullability in various places (#18082)
I started fixing nullability in one place, and then it snowballed a bit
and I had to fix nullability in a lot of places.

Most are trivial, except for the `generate-frameworks-constants`
project: I had to create a .NET version of the project in order to
compile a .NET version of the tool.
2023-05-04 07:39:56 +02:00
Steve Hawley 2ec000df27
[dotnet] Use the type_map_path arg (#18175)
Removed the default argument value
Added `Application.ClassMapPath`
Added options and setter for `ClassMapPath`
Integrated usage.
2023-05-01 14:48:09 -04:00
Steve Hawley 935ec25827
[dotnet] integrate writing out class map into static registrar (#18141)
Replaced the existing type map in StaticRegistrar.cs with a
`CSToObjCMap`.
Added code to write it out to a specified path as XML.
Currently the path is a parameter that defaults to null and is not (yet)
used.
2023-04-26 11:57:07 -04:00
Rolf Bjarne Kvinge 6c04f7621a
[tools] Update SdkVersions.cs after the latest Xcode 14.2 bump. (#17101)
* Update `SdkVersions.cs` after the latest Xcode 14.2 bump.
* Rename `[SdkVersions|ProductConstants].cs.in` to `[SdkVersions|ProductConstants].in.cs`.
  This way the autoformatter makes sure it's formatted correctly.
2022-12-21 17:44:27 +01:00
Rolf Bjarne Kvinge d6cb31402f
[tools] Split tools/common/SdkVersions.cs in two files. (#17067)
We need parts of tools/common/SdkVersions.cs when building tests on Windows.
In order to simplify our Windows-life, we're going to check in the generated
SdkVersions.cs file, that way it won't have to be re-generated on Windows (the
logic is very make-based, and not easily executed on Windows).

However, parts of SdkVersions.cs would change every commit, which would make
the above solution rather annoying. So split out those parts into a new file
(ProductConstants.cs), which is still generated during the build (and not
checked in).
2022-12-16 15:25:53 +01:00
Rolf Bjarne Kvinge 1296e35205
[registrar] Deduplicate the code to compute the initialization method name for the generated static registrar code. (#16649)
This is a step towards having a registration map (and initialization method) for each assembly.

Ref: https://github.com/xamarin/xamarin-macios/issues/11309

Co-authored-by: Manuel de la Pena <mandel@microsoft.com>
2022-11-10 08:56:37 +01:00
Rolf Bjarne Kvinge cdc62aeae9 Merge remote-tracking branch 'origin/net7.0-xcode14.1' into main-net7.0-xcode14.1 2022-11-03 08:21:55 +01:00
Rolf Bjarne Kvinge 73101f2689
[msbuild] Fix dirty working copy with Errors.designer.cs. (#16404)
The Xamarin.MacDev.Tasks.sln solution is built with dotnet, while other projects
are still built with msbuild. This becomes a problem when generating Errors.designer.cs,
because depending on the runtime the output is different.

This means that the Errors.designer.cs will sometimes randomly change (depending
on which project re-generated the file), leaving the file modified in git. This is
quite annoying, but it also breaks the api comparison, which depends on the build
not leaving modified files behind. So for now, we generate Errors.designer.cs separately
for Xamarin.MacDev.Tasks.sln to not conflict with the mtouch version.

Also fix capitalization in numerous places to be consistent (it's Errors.designer.cs,
not Errors.Designer.cs).
2022-10-24 18:56:06 +02:00
Rolf Bjarne Kvinge 18962171b9 Merge main into net7.0. 2022-10-13 13:36:40 +02:00
Rolf Bjarne Kvinge ee7e95dd69
[autoformat] Add mmp.csproj. (#16313) 2022-10-11 22:36:58 +02:00
Rolf Bjarne Kvinge 4922bf4570 Merge remote-tracking branch 'origin/main' into bump-main-in-net7.0-2022-08-31 2022-08-31 13:45:17 +02:00
Rolf Bjarne Kvinge a09b971788 [src] Quiet the build a bit. (#15737) 2022-08-29 14:15:02 +02:00
Rolf Bjarne Kvinge efba4cd38f Merge remote-tracking branch 'origin/main' into net7.0 2022-06-09 14:08:52 +02:00
Rolf Bjarne Kvinge 77b8b61639
[tools] Make sure to finish the P/Invoke generator output before running the static registrar. Fixes #15190. (#15214)
Otherwise the P/Invoke generator leaves partial results in the static
registrar class, essentially saying things like "we've processed CoreMidi, no
need to add an #include for this framework", and then we'd generate the static
registrar code and that code would lack the #include for CoreMidi.

Finishing the P/Invoke generator output will clear out any state stored in the
static registrar.

Also fix a few other issues to make the generated P/Invoke wrapper code work,
and add a test.

Fixes https://github.com/xamarin/xamarin-macios/issues/15190.
2022-06-09 07:38:45 +02:00
Rolf Bjarne Kvinge f5dfe434bd Merge remote-tracking branch 'origin/main' into net7.0 2022-05-19 23:20:20 +02:00
Rolf Bjarne Kvinge f8314a435e
Add a [NativeName] attribute we can use to declare the native name for a type (enum/struct). (#14918)
We already have a few attributes that can specify the native name for a type, whenever the native name doesn't match the managed name:

* [Register ("DifferentClassName"): specifies the Objective-C class name
* [Native ("DifferentEnumName")]: specifies the Objective-C enum name (and also that it's a native-sized enum)
* [Protocol ("DifferentProtocolName")]: specifies the Objective-C protocol name
* [Category ("DifferentCategoryName")]: specifies the Objective-C category name

Unfortunately this leaves (at least) two cracks:

* Objective-C structs.
* Objective-C enums which aren't native-sized.

So I'm adding a [NativeName] attribute for this purpose, and updating numerous
types to specify the native name (either using an existing [Native] attribute
for enums that already have one, or by adding a new [NativeName] attribute).

The static registrar needs to know the native name for such types, in case
they appear as parameter types in function signatures.

This also allows us to simplify xtro a bit, to not have a separate map of
managed name given a native name, because we can now build that map
dynamically.
2022-05-09 22:16:17 +02:00
Rolf Bjarne Kvinge 6af4b9607c
[tools] Make the TargetFramework.DotNet* variables version-agnostic. (#14669)
This minimizes the code changes required for .NET 7.
2022-04-06 21:33:46 +02:00
Rolf Bjarne Kvinge f8052c82f9 [build] Remove the DOTNET_SYSTEM_RUNTIME_INTEROPSERVICES_REF_ASSEMBLY_DIR variable, it's no longer needed. 2022-03-28 14:29:41 +02:00
Rolf Bjarne Kvinge 84669f23d4 [tools] Make the TargetFramework.DotNet* variables version-agnostic. 2022-03-25 14:16:03 +01:00
Rolf Bjarne Kvinge e44d0fd047
[.NET] Rename several DOTNET6_* variables to to DOTNET_*. (#14463)
Also rename DOTNET_VERSION to SYSTEM_DOTNET_VERSION to make it clear what it's
referring to (and to not clash with DOTNET6_VERSION which has now been renamed
to DOTNET_VERSION).

.NET 7 is right around the corner.
2022-03-23 08:07:34 +01:00
Rolf Bjarne Kvinge 0b28152b51 [.NET] Rename DOTNET6_BCL_DIR to DOTNET_BCL_DIR.
.NET 7 is right around the corner.
2022-03-11 14:38:19 +01:00
Rolf Bjarne Kvinge bd97933b60
[runtime] Remove ObjCRuntime.nfloat in favor of System.Runtime.InteropServices.NFloat. (#14197)
* Remove ObjCRuntime.nfloat (in favor of   System.Runtime.InteropServices.NFloat).
* Automatically add a reference to the System.Runtime.InteropServices.Internal
  package, so that developers get the new NFloat API (with operators) we've
  added post .NET 6 (but don't do this for .NET 7).
* Automatically add a global using alias for
  System.Runtime.InteropServices.NFloat -> nfloat. This is not behind the
  usual `ImplicitUsings` condition our other implicit usings are, because
  they're off by default for existing projects, and the main target for the
  global using alias for nfloat is upgraded projects.
* Automatically generate a global using alias (like above) in the generator
  for all code the generator compiles.
* Update xtro entries to reference System.Runtime.InteropServices.NFloat
  instead of ObjCRuntime.nfloat.
* Add a workaround for a hopefully temporary issue with .NET/CoreCLR where the
  wrong runtime pack is selected otherwise (without the new NFloat API, so
  nothing works at runtime).

Ref: https://github.com/xamarin/xamarin-macios/issues/13087
2022-02-24 16:51:12 +01:00
Rolf Bjarne Kvinge e25163f573
[.NET] Rename our product assemblies. Fixes #13748. (#13847)
Rename our product assemblies to:

* Microsoft.iOS.dll
* Microsoft.tvOS.dll
* Microsoft.macOS.dll
* Microsoft.MacCatalyst.dll

This makes it easy to distinguish between legacy Xamarin and .NET whenever the
product assembly is mentioned, and I've also chosen the platform part of the
name to match how the platforms are named elsewhere (this also makes it
possible to simplify our build logic, since we can remove a lot of special
casing).

Fixes https://github.com/xamarin/xamarin-macios/issues/13748.
2022-02-16 21:30:32 +01:00
Rolf Bjarne Kvinge a94e575806
[tools] Unify Application.link_flags and Application.gcc_flags from mtouch and mmp into Application.CustomLinkFlags. (#13509)
* [tools] Unify Application.link_flags and Application.gcc_flags from mtouch and mmp into Application.CustomLinkFlags.

* [tests] Update mtouch tests according to mtouch changes.
2021-12-09 17:16:45 +01:00
Rolf Bjarne Kvinge 5329b19f62
[introspection] Migrate .NET code to use the new .NET-style availability attributes. (#13363)
* [tools] Extract the logic to parse OSPlatformAttribute platform names to a separate file/class.

* [introspection] Migrate .NET code to use the new .NET-style availability attributes.

This also means using the 'ApplePlatform' enum instead of the 'PlatformName'
enum, because the latter will be removed in .NET.

* [FileProvider] Exclude some deprecated API from .NET.

* [AVFoundation] Adjust availability attribute for AVCaptureStillImageOutput.HighResolutionStillImageOutputEnabled.

* Update tests.
2021-11-22 20:54:07 +01:00
Rolf Bjarne Kvinge 88eb5e1ac8
Rename any *OSX_SDK_VERSION variables to *MACOS_SDK_VERSION. (#13411)
This makes it easier to iterate over all the *_SDK_VERSION variables in
template code, because they're all named using the standard platform names we
use elsewhere.
2021-11-22 18:48:05 +01:00
Manuel de la Pena a9a0af807b
[MMP] If we disable mac do not try to build for dotnet. (#12739) 2021-09-15 20:54:52 -04:00
Filip Navara 454831f613
Fix lstat P/Invoke on arm64 (#12437)
* Fix lstat P/Invoke on arm64

* Bump TargetFrameworkVersion for mmp (to match mtouch)
2021-08-16 16:21:21 +02:00
Rolf Bjarne Kvinge 2972e1b715
Fix some whitespace issues in various files. (#12399)
* Remove BOM
* Add EOL at end of file.
2021-08-11 10:06:46 +02:00
Sebastien Pouliot 9307052231
[objcruntime] Enable nullable on `ErrorHelper` and `RuntimeException` (#12377)
also avoid intermediate/chained calls to help the linker eliminate
some methods
2021-08-09 10:36:56 -04:00
Rolf Bjarne Kvinge ad7d08a63d
Always create binlogs during the build. (#12331)
On CI we'll collect all the binlogs in the repository and make them available
for post-build analysis if need be, so this will make it easier to diagnose
build problems.
2021-08-04 09:30:16 +02:00
Rolf Bjarne Kvinge 8bd702ca10
[mmp] Link symbols if and only if we're packaging debug symbols. Fixes #12263. (#12286)
This makes it possible to preserve embedded debug symbols for a release build:
by passing "--package-debug-symbols=true" to mmp. Previously we'd remove the
symbols unconditionally for release builds.

This also conserves the old behavior (strip symbols in release builds), unless
users have explicitly passed "--package-debug-symbols=true" to mmp (because
PackageManagedDebugSymbols defaults to the same value as EnableDebug).

Fixes https://github.com/xamarin/xamarin-macios/issues/12263.
2021-07-30 09:48:21 +02:00
Rolf Bjarne Kvinge ba83560abb [tools] Move parts of the binary file comparison to a helper file to make it usable in more places 2021-06-18 10:24:28 +02:00
Rolf Bjarne Kvinge 7aec86fa04 ools] Create a PathUtils class and move some shareable code there. 2021-06-18 10:24:28 +02:00
TJ Lambert e06ee8e653
[Localization] Test to make sure the new resx files are compiled to Resources (Edited) (#11737)
* making sure new strings get added to designer and resources plus the test

* Next wave of changes to csproj to incorporate Rolf's changes

* fixing path

* Update tests/msbuild/Xamarin.MacDev.Tasks.Tests/TaskTests/LocalizationStringTest.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* Update tests/mtouch/LocalizationTests.cs

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>

* forgot the include

Co-authored-by: tj_devel709 <antlambe@microsoft.com>
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2021-06-02 11:11:15 -05:00
Rolf Bjarne Kvinge 1b655344df
[mmp] Don't define CORECLR_RUNTIME when compiling the partial static registrar code (#11618)
We already define it in the generated code, so the native compiler shows a warning:

    Microsoft.macOS.registrar.coreclr.x86_64.m:1:9: warning: 'CORECLR_RUNTIME' macro redefined [-Wmacro-redefined]
    #define CORECLR_RUNTIME
            ^
    <command line>:2:9: note: previous definition is here
    #define CORECLR_RUNTIME 1
            ^
2021-05-20 07:35:52 +02:00
TJ Lambert 4fb1707e11
initial changes to Change languageSet and Dependencies (#11512)
Co-authored-by: tj_devel709 <antlambe@microsoft.com>
2021-05-13 08:35:08 -05:00