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

33 Коммитов

Автор SHA1 Сообщение Дата
Peter Collins 7a5c28f6cc
[msbuild] Rename $(_UsingXamarinSdk) to $(UsingAppleNETSdk) (#11270)
The `$(_UsingXamarinSdk)` property has been renamed to help improve
external usability.  This change increases parity with the Android SDK,
which currently defines `$(UsingAndroidNETSdk)` for internal and
external use.
2021-04-21 21:32:33 -04:00
Rolf Bjarne Kvinge 3a0580750d
[msbuild] Share the _CollectGeneratedSources target between Xamarin.iOS and Xamarin.Mac. (#9516) 2020-08-27 08:08:03 +02:00
Rolf Bjarne Kvinge 622656acc3
[msbuild] Share the _CompressNativeFrameworkResources/_CompressFrameworks target between Xamarin.iOS and Xamarin.Mac. (#9461) 2020-08-25 10:41:50 +02:00
Rolf Bjarne Kvinge d3ea2c3a81
[msbuild] Share the _CollectNativeFrameworkResources target between Xamarin.iOS and Xamarin.Mac. (#9450) 2020-08-24 08:21:46 +02:00
Rolf Bjarne Kvinge 49511491c9
[msbuild] Set ResolveAssemblyConflicts once. (#9441)
No need to set it in every file, when we have one file that rules them all.
2020-08-21 18:38:57 +02:00
Rolf Bjarne Kvinge 587ec0dd63
[msbuild] Share the _PrepareNativeReferences target between Xamarin.iOS and Xamarin.Mac. (#9442) 2020-08-21 18:24:39 +02:00
Rolf Bjarne Kvinge 43d234de52 [tests] Add a macOS version of the bindings-test project for .NET
This required disabling some Xamarin.Mac-specific binding code in .NET mode.
2020-08-10 16:12:42 +02:00
Rolf Bjarne Kvinge e193ed7316
[msbuild] Unify all the UsingTask statements. (#8998)
Some of these have been duplicated across various targets files, and when
adding a new task it's annoying to forget to add it somewhere.

So just have them all in the same place, so that they're loaded in every file.

There are still duplicates between the iOS and Mac tasks, but those will be
unified in a later PR.
2020-07-07 15:52:06 +02:00
Rolf Bjarne Kvinge ac36305a2d
[msbuild] Unify the _GenerateBindings target and a few properties related to binding projects. (#8997) 2020-07-07 15:46:23 +02:00
Rolf Bjarne Kvinge 8d7cd46652
[msbuild] Share a few binding variables: BaseLibDllPath, BTouchToolPath and BTouchToolExe. (#8988)
Also switch to invoking bgen instead of the btouch-native/btv/bwatch wrapper
scripts, since the wrapper scripts just call bgen with an additional
--target-framework argument, which our BTouch task already does anyway, which
means it's not necessary to call the wrapper scripts anymore.

This also required:

* Moving the code to detect which Xamarin.Mac profile we're building for into
  Xamarin.Shared.props, since the binding variable logic need to know which
  Xamarin.Mac profile we're building for.

* Setting IsBindingProject property earlier in the build process, to make sure
  it's set before importing Xamarin.Shared.props.
2020-07-03 11:01:01 +02:00
Rolf Bjarne Kvinge 6e48c5a83a [msbuild] Don't import Microsoft.CSharp.targets if we're building using net5.
It's already imported.
2020-05-26 14:49:31 +02:00
Sebastien Pouliot 9f28bce6b8
[msbuild] Build bindings with the latest (stable) version of C# (#8387)
We now require C# 8 for nullability support. However we allow custom code
to be included inside binding projects and we should not support anything
(stable) that the C# compiler (installed separately) allow, so `latest`
it is.
2020-04-15 15:41:32 -04:00
Rolf Bjarne Kvinge 2ae55ac1f4
[msbuild] Compute the ComputedFrameworkMoniker later in the build. Fixes #8277. (#8279)
It might only be necessary for Xamarin.iOS builds, but modify both XI and XM
so that the logic is identical.

Fixes https://github.com/xamarin/xamarin-macios/issues/8277.
2020-04-06 12:47:01 +02:00
Rolf Bjarne Kvinge fe5fd8d11d
[msbuild] Simplify the BTouch task implementation. (#8096)
* Don't validate the TargetFrameworkIdentifier, instead pass it along to bgen
  (which will validate it). This means less validation updates when something
  changes.
* For Xamarin.Mac's GenerateCommandLineCommands' implementation:
    * We'll always have a bgen.exe, so the code for what to do if bgen isn't
      there can be removed.
    * There's no need to compute the 'isMobile' value, because now it's not used
      anymore. So we can remove the first if block in the method completely.
    * There's no need to add the -stdlib flag, because the base implementation
      in BTouchTaskBase already adds it.
    * Now there's nothing left in the method but calling base, so the entire
      override can be removed.
    * This also removes the need for the FrameworkRoot parameter to the task,
      so remove that too.
* For Xamarin.Mac's GetTargetFrameworkArgument's implementation:
    * Move the TargetFramework logic to detect the different Xamarin.Mac
      variations to the targets file, so that it can be reused by other tasks
      and targets.
    * This means we don't need an overridable function to get the target
      framework argument, so just remove inline the entire virtual method.
2020-03-13 18:04:50 +01:00
Rolf Bjarne Kvinge 26ad52257e
[msbuild] Pass the entire TargetFrameworkMoniker to tasks instead of just TargetFrameworkIdentifier/TargetFrameworkVersion. (#8048)
When .NET 5 comes, the TargetFrameworkMoniker will change, and we need the
entire moniker to distinguish between various platforms.

So change our msbuild code to consume the entire TargetFrameworkMoniker, so
that we have all the information we need when we need it.

Also redirect everything through an intermediate
_ComputedTargetFrameworkMoniker property, so that the target framework can be
overridden without affecting any other code. This becomes necessary during the
initial implementation phase, because we don't have a .NET version to test
with yet that can give us the new target frameworks. Eventually it should be
possible to remove this intermediate variable
2020-03-06 18:28:58 +01:00
Sebastien Pouliot 9fd03625b4
[msbuild] Ensure the output of `mtouch` (and friends) are included in binary logs. Fix #7035 (#7288)
and by friends I mean `mmp` and `btouch`

What does this do ?

1. Assume that output of `mtouch` (and other similar tools) is **always** of high importance. Why ?

- If not then it's not saved in the binary log (even if visible on the console/text logs).
- The logging of `mtouch` (and friends) is dynamic, based on a supplied verbosity level.
- If a verbosity level _anywhere_ then it's a clear sign that the developer wants that extra output (and that includes binary logs).

2. Assume the _global_ verbosity of `msbuild` from the console is just as valid/useful than the one from VSfM.

- CI/bots produce logs and they should be useful to diagnose build issues.
- Setting verbosity in several places is error-prone, which delay investigations and results.
- Running the same project, with the same `msbuild` verbosity, should be identical between IDE and console.

What does that mean ?

Using `msbuild /v:diag /bl:out.binlog` you get a small(er) binary log that has everything[1] you need to diagnose a Xamarin.iOS (or Mac) build. It's also identical to the output what VSfM produce (for the same `msbuild` verbosity level).

[1] we might need to review what we log if we're missing interesting stuff

References:
https://github.com/xamarin/xamarin-macios/issues/7035
2019-10-25 17:44:35 -04:00
Chris Hamons d7c2a45ca9
Add 'NoBindingEmbedding' style binding project support (#5167)
- Existing binding projects embed the native libraries within the assembly as managed resource
- This does not scale well and has performance implications
- This PR creates a new property, NoBindingEmbedding which when true processes the building and consumption of binding projects differently.
- Existing binding projects are not affected, they will continue as is
- I've written a full XM test suite and ported a subset to iOS. Since iOS only supports checked in projects, and I didn't want to make the existing situation worse by adding more, I only wrote tests that could use the existing test projects.
    -When we complete some form of msbuild testing reform, we'll revisit these tests.
- Remove two files in MyiOSFrameworkBinding that are not used (we use copies elsewhere)
- Remove unnecessary sleep and fix broken touch command
- Output failing test log to console instead of test output
    - VSfM does not handle thousands of lines of test failure message well
- Add ability to generate binding projects with LinkWith
2018-12-12 09:55:57 -05:00
Ankit Jain 73fbb53856 [msbuild] Enable nuget package conflict resolution (#4945)
Fixes https://github.com/mono/mono/issues/10602 .

From the issue:
```
We need to enable this to support the system assemblies conflict
resolution which we now rely on for any new packages to enhance
developers experience and get us out of dependency on specific package
versions.
```
2018-10-10 20:14:31 -04:00
Emanuel 0416ea042a [xvs-xm-bindings] Adds IsMacEnabled property to skip targets from VS when not connected to a Mac 2018-05-11 21:11:36 -03:00
Chris Hamons 1d72f45dfd
Binding project must use csc not mcs (#3795)
- Fix XM and XI binding projects to use csc instead of mcs
- Add BindingProjectTest to verify csc not mcs for XM
- In non-msbuild use cases, removing -sdk params requires adding System/mscorlib so btouch now knows to add those references.
- Obsolete a few arguments to btouch
2018-03-27 14:31:27 -05:00
Chris Hamons 371a1d54e7
[macos] Fix XM binding projects to work with Full
* Revert previous revert (9ba23946d1) 
* Correctly fall back to Modern if tagless binding projects
* Rework binding tests to cover all supported configurations
* Add XM_FORCE_MSBUILD env variable for mmp/msbuild mac tests for easy local checking
2018-03-21 14:27:53 -05:00
Chris Hamons 8d57e6bcf3 Revert "[macOS][msbuild] Fix binding projects under Full to resolve to correct libs (#3672)" (#3727)
This reverts commit d5b50765f5.
2018-03-13 10:38:14 +01:00
Chris Hamons d5b50765f5
[macOS][msbuild] Fix binding projects under Full to resolve to correct libs (#3672)
- Fixes https://github.com/xamarin/xamarin-macios/issues/3608
- Refactor and clean up msbuild to be more consistent between binding and "normal" workloads
- Comment on the inconsistencies that are too large to fix in one PR
- Write some actual tests for binding projects to detect regressions
- Due to lack of redirect support these tests are only xbuild current, but I ran tests with msbuild to validate locally
2018-03-09 13:02:46 -06:00
Jeffrey Stedfast 316948e5d0 [msbuild] Repack all iOS Task assemblies into Xamarin.iOS.Tasks.dll (#3168) 2018-01-08 14:29:52 -05:00
Jeffrey Stedfast 5645e3349a Revert "[msbuild] Repack all iOS Task assemblies into Xamarin.iOS.Tasks.dll (#3007)"
This reverts commit 2d4256ef15.
2017-11-29 09:22:22 -05:00
Jeffrey Stedfast 2d4256ef15
[msbuild] Repack all iOS Task assemblies into Xamarin.iOS.Tasks.dll (#3007)
* [msbuild] Pack all iOS MSBuild Task assemblies into a single assembly

* Fixed the build

* Renamed ProcessArgumentBuilder to CommandLineArgumentBuilder

This is needed to prevent symbol conflicts with Xamarin.MacDev's
ProcessArgumentBuilder (which is functionally different from
Xamarin.MacDev.Tasks.Core's class of the same name).

* Fixed ILRepack logic for filtering dll's to repack

* Fixed building of Xamarin.iOS.Tasks.Tests now that X.iOS.Tasks.dll contains all symbols

* Updated Makefile now that only 1 iOS Task assembly needs to be distributed

* ILRepack Xamarin.Mac.Tasks as well

* Fixed up *.targets to specify The One Assembly To Rule Them All

* [xharness] Build MSBuild tests with MSBuild.

* Touch the ilrepack stamp file *after* invoking ILRepack, not before.

* Same for Xamarin.Mac.Tasks
2017-11-27 14:44:09 -05:00
Jeffrey Stedfast d4091da877 [msbuild] Fixed ObjC binding targets to delete target zip files before re-zipping (#2840)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=59848
2017-10-09 16:41:37 -04:00
Emanuel Fernandez Dell'Oca d824d85360 [msbuild] Avoid running ObjCBinding tasks on VS design-time builds (#2587)
These targets were failing to build on design-time builds for mostly 2 reasons:
- When loading the project VS is not connected to the Mac, which is required for binding projects.
- Since a reduce amount of targets are ran, the ReferencePath list is empty and makes _GeneratedSourcesFileList fail

Anyway, we shouldn't run targets that we don't need on a design-time build to avoid impacting on its performance

Why these targets were being executed on design-time builds? It's a side effect of adding them to CompileDependsOn.

Reference to design-time builds: https://github.com/dotnet/project-system/blob/master/docs/design-time-builds.md#what-is-a-design-time-build

Fixes bug 387900 - Referenced component could not be found for Binding Library projects
https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_workitems/edit/387900
2017-09-07 16:31:43 -04:00
Jeffrey Stedfast 3b4c6e720e [msbuild] Add support for passing extra args to btouch (#1969)
* [msbuild] Add support for passing extra args to btouch

Partial fix for https://bugzilla.xamarin.com/show_bug.cgi?id=51753

* [msbuild] Update the Mac ObjCBinding targets as well
2017-04-10 08:14:42 +02:00
Chris Hamons abf0f4a2d9 [XM] Improve XM msbuild support and add roslyn netstandard test case (#1846)
- Significant changes to target file under msbuild, ImplicitFacade processing in particular
- Tests are disabled due to https://bugzilla.xamarin.com/show_bug.cgi?id=53164 where we can't tests local target files only global
- Requires a mono msbuild with 95ab657a90 for tests to pass
- Until then, this is a workaround:
    sudo cp /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Roslyn/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/
2017-03-14 11:08:04 -05:00
Jeffrey Stedfast f5b725e2af [msbuild] Added ProcessEnums property for ObjC Binding projects (#1557)
The new ProcessEnums property specifies whether or not to
pass /process-enums to the btouch task for iOS/Mac binding
projects.

Part of the fix for https://bugzilla.xamarin.com/show_bug.cgi?id=51753
2017-01-26 11:24:14 -05:00
Chris Hamons ff1f30b305 [XM] Fix msbuild incompatibility in binding target file (#375) 2016-07-11 13:56:04 -04:00
Rolf Bjarne Kvinge 68df944ad6 Build MSBuild targets & assemblies. 2016-04-24 14:48:44 -04:00