Skip to content

[msbuild/mac] Skip reference assemblies passed to mmp - #3991

Merged
VincentDondain merged 2 commits into
dotnet:masterfrom
VincentDondain:mac-fix-issue-3199
Apr 27, 2018
Merged

VincentDondain merged 2 commits into
dotnet:masterfrom
VincentDondain:mac-fix-issue-3199

Conversation

@VincentDondain

Copy link
Copy Markdown
Contributor

Problem

Given a Nuget Package added via the "package reference" mechanism and the said package having netstandard lib and ref folders;
mmp, if given --aot:all was getting reference assemblies and couldn't AOT them as those assemblies are only facades.

Solution

Skipping the assemblies that have /ref/ in their path seems like the simplest and yet most functional solution to the problem.

As it turn out, there is some logic already in place that copies the lib assemblies to the destination folder. It seems equivalent to marking them as "Local Copy".
What this does is that it makes those assemblies available to msbuild via @(ReferenceCopyLocalPaths). This gives us the opportunity to safely remove the ref assemblies from @(ReferencePath).

Note: mmp is getting the assemblies to reference via a combination of @(ReferencePath) and @(ReferenceCopyLocalPaths).

- Similar to issue dotnet#3199: Could not AOT the assembly System.Runtime.CompilerServices.Unsafe.dll (MT3001)
  (dotnet#3199)
- Test case: https://www.dropbox.com/s/49jxl8iftmlymes/Issue3199Test3.zip?dl=0

Problem
=======

Given a Nuget Package added via the "package reference" mechanism and the said package having netstandard `lib` **and** `ref` folders;
`mmp`, if given `--aot:all` was getting reference assemblies and couldn't AOT them as those assemblies are only facades.

Solution
========

Skipping the assemblies that have `/ref/` in their path seems like the simplest and yet most functional solution to the problem.

As it turn out, there is some logic already in place that copies the `lib` assemblies to the destination folder. It seems equivalent to marking them as "Local Copy".
What this does is that it makes those assemblies available to msbuild via `@(ReferenceCopyLocalPaths)`. This gives us the opportunity to safely remove the `ref` assemblies from `@(ReferencePath)`.

*Note: `mmp` is getting the assemblies to reference via a combination of `@(ReferencePath)` and `@(ReferenceCopyLocalPaths)`.*
@VincentDondain

Copy link
Copy Markdown
Contributor Author

@spouliot mmh it's too late to get anything into d15-7 anymore isn't it?

@VincentDondain

Copy link
Copy Markdown
Contributor Author

Also it's important to point out that I believe this is not as big of an issue on the Mac side of the house given that it's only an option to AOT compile as opposed to a requirement on iOS. The likelihood of users running into this is therefore lower.

@chamons chamons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really want a test for this in https://github.com/xamarin/xamarin-macios/tree/master/tests/mmptest

You can file an issue and punt it to me, specially if we are trying to hit 15.7 timetable, but this should have tests.

@monojenkins

Copy link
Copy Markdown
Contributor

Build failure
Build comment file:

✅ Provisioning succeeded
🔥 Build failed 🔥


@spouliot

Copy link
Copy Markdown
Contributor

@VincentDondain yes, much too late for d15.7. If it turns out to be a problem (has not so far for XM) we can re-evaluate for a service release (there's still the old workaround that can be used).

@VincentDondain

Copy link
Copy Markdown
Contributor Author

@chamons I agree with you on the need for a test but unless mmp tests are using msbuild it's the same issue reported here: #3810

I added Mac tags, feel free to subscribe to it.

@chamons chamons left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Beautiful. An issue is all I ask.

@monojenkins

Copy link
Copy Markdown
Contributor

Build success
Build comment file:

✅ Provisioning succeeded
✅ Build succeeded
✅ API Diff (from stable)
✅ API Diff (from PR only)
✅ Generator Diff
✅ Test run succeeded


@VincentDondain
VincentDondain merged commit bb98da4 into dotnet:master Apr 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants