Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dotnet] Fix linker path on Windows #18285

Merged
merged 6 commits into from
May 17, 2023
Merged

[dotnet] Fix linker path on Windows #18285

merged 6 commits into from
May 17, 2023

Conversation

emaf
Copy link
Contributor

@emaf emaf commented May 17, 2023

When building from Windows, we need to pass the path to the illink assembly located on the Mac to the linker task. The educated guess we've been using is a bit fragile and has been getting us problems almost on each new .NET major release. On top of that, from .NET 8 the linker is in a separate NuGet package, so the assembly is no longer located in the SDK directory on the Mac.

The fix is to follow the same approach we use to find the AOT compiler on the Mac by running a target that finds that information on the remote Mac, and brings it back to Windows, where it is cached and use across build.

Created a new XamarinBuildTask class to share most of the code needed for this approach.

When building from Windows, we need to pass the path to the illink assembly located on the Mac to the linker task. The educated guess we've been using is a bit fragile and has been getting us problems almost on each new .NET major release. On top of that, from .NET 8 the linker is in a separate NuGet package, so the assembly is no longer located in the SDK directory on the Mac.

The fix is to follow the same approach we use to find the AOT compiler on the Mac by running a target that finds that information on the remote Mac, and brings it back to Windows, where it is cached and use across build.

Created a new XamarinBuildTask class to share most of the code needed for this approach.
@emaf emaf requested review from mauroa and rolfbjarne as code owners May 17, 2023 07:00
@github-actions
Copy link
Contributor

⚠️ Your code has been reformatted. ⚠️

If this is not desired, add the actions-disable-autoformat label, and revert the reformatting commit.

If files unrelated to your change were modified, try reverting the reformatting commit + merging with the target branch (and push those changes).

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

…for the XamarinBuild task.

This speeds up the XamarinBuild task tremendously when /tmp is full of
stuff: .NET projects will implicity include a lot of files in the project
directory, and if we put the project file in /tmp, then MSBuild will search
all of /tmp for files to include (and include some of them). This is avoided
by putting the project file in a subdirectory with nothing else in it.

Also add the binlogs and the output text file in the new temporary directory,
which means we can simplify the cleanup code as well (to just remove the
temporary directory, instead of each individual file).
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build] Windows Integration Tests passed 💻

All Windows Integration Tests passed.

Pipeline on Agent
Hash: 5d9029c928e93de73414cedbdd923c5dc8b16f9a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

📚 [PR Build] Artifacts 📚

Packages generated

View packages

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

Legacy Xamarin (No breaking changes)
  • iOS (no change detected)
  • tvOS (no change detected)
  • watchOS (no change detected)
  • macOS (no change detected)
NET (empty diffs)
  • iOS: (empty diff detected)
  • tvOS: (empty diff detected)
  • MacCatalyst: (empty diff detected)
  • macOS: (empty diff detected)

✅ API diff vs stable

Legacy Xamarin (No breaking changes)
.NET (No breaking changes)
Legacy Xamarin (stable) vs .NET

✅ Generator diff

Generator diff is empty

Pipeline on Agent
Hash: 5d9029c928e93de73414cedbdd923c5dc8b16f9a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Ventura (13.0) passed 💻

All tests on macOS M1 - Mac Ventura (13.0) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [PR Build] Tests on macOS M1 - Mac Big Sur (11.5) passed 💻

All tests on macOS M1 - Mac Big Sur (11.5) passed.

Pipeline on Agent
Hash: [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build] Test results 🚀

Test results

✅ All tests passed on VSTS: simulator tests.

🎉 All 227 tests passed 🎉

Tests counts

✅ bcl: All 69 tests passed. Html Report (VSDrops) Download
✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests: All 1 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 7 tests passed. Html Report (VSDrops) Download
✅ framework: All 8 tests passed. Html Report (VSDrops) Download
✅ generator: All 2 tests passed. Html Report (VSDrops) Download
✅ interdependent_binding_projects: All 7 tests passed. Html Report (VSDrops) Download
✅ install_source: All 1 tests passed. Html Report (VSDrops) Download
✅ introspection: All 8 tests passed. Html Report (VSDrops) Download
✅ linker: All 65 tests passed. Html Report (VSDrops) Download
✅ mac_binding_project: All 1 tests passed. Html Report (VSDrops) Download
✅ mmp: All 2 tests passed. Html Report (VSDrops) Download
✅ mononative: All 12 tests passed. Html Report (VSDrops) Download
✅ monotouch: All 27 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ mtouch: All 1 tests passed. Html Report (VSDrops) Download
✅ xammac: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 8 tests passed. Html Report (VSDrops) Download
✅ xtro: All 2 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 5d9029c928e93de73414cedbdd923c5dc8b16f9a [PR build]

@rolfbjarne rolfbjarne merged commit 73fefdb into main May 17, 2023
@rolfbjarne
Copy link
Member

/sudo backport release/7.0.2xx-xcode14.3

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Backport Job to branch release/7.0.2xx-xcode14.3 Created! The magic is happening here

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Oh no! Backport failed! Please see https://devdiv.visualstudio.com/DevDiv/_build/results?buildId=7788839 for more details.

rolfbjarne pushed a commit to rolfbjarne/xamarin-macios that referenced this pull request May 18, 2023
When building from Windows, we need to pass the path to the illink
assembly located on the Mac to the linker task. The educated guess we've
been using is a bit fragile and has been getting us problems almost on
each new .NET major release. On top of that, from .NET 8 the linker is
in a separate NuGet package, so the assembly is no longer located in the
SDK directory on the Mac.

The fix is to follow the same approach we use to find the AOT compiler
on the Mac by running a target that finds that information on the remote
Mac, and brings it back to Windows, where it is cached and use across
build.

Created a new XamarinBuildTask class to share most of the code needed
for this approach.

Backport of xamarin#18285.
rolfbjarne added a commit that referenced this pull request May 19, 2023
When building from Windows, we need to pass the path to the illink
assembly located on the Mac to the linker task. The educated guess we've
been using is a bit fragile and has been getting us problems almost on
each new .NET major release. On top of that, from .NET 8 the linker is
in a separate NuGet package, so the assembly is no longer located in the
SDK directory on the Mac.

The fix is to follow the same approach we use to find the AOT compiler
on the Mac by running a target that finds that information on the remote
Mac, and brings it back to Windows, where it is cached and use across
build.

Created a new XamarinBuildTask class to share most of the code needed
for this approach.

Backport of #18285.

Co-authored-by: Emanuel Fernandez Dell'Oca <[email protected]>
@rolfbjarne rolfbjarne deleted the dev/ema/linker branch October 9, 2024 06:22
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.

5 participants