-
Notifications
You must be signed in to change notification settings - Fork 510
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
[msbuild] Add @(XcodeProject) action #21232
base: net9.0
Are you sure you want to change the base?
Conversation
Introduces a `@(MaciOSXcodeProject)` build action which can be used to build and consume the outputs of Xcode framework projects. The following metadata is supported on this item: <MaciOSXcodeProject Include="path/to/project.xcodeproj"> <Configuration>Release</Configuration> <Kind>Framework</Kind> <OutputPath></OutputPath> <ReferenceXcFramework>true</ReferenceXcFramework> <SchemeName></SchemeName> <SharpieBind>true</SharpieBind> <SharpieNamespace></SharpieNamespace> <SmartLink>true</SmartLink> </MaciOSXcodeProject> * `%(Configuration)`: The name of the configuration to use to build the project. The default value is `Release`. * `%(OutputPath)`: Can be set to override the XCARCHIVE and XCFRAMEWORK output path of the Xcode project. * `%(ReferenceXcFramework)`: Output XCFRAMEWORK files will be added as a `@(NativeReference)` to be bound or otherwise used by the project. Metadata supported by `@(NativeReference)` like `%(Kind)` or `%(SmartLink)` will be forwarded if set. * `%(SchemeName)`: The name of the build scheme that should be used to build the project. The default value is `$(IntermediateOutputPath)xcode/{SchemeName}-{Hash}`. * `%(SharpieBind)`: Output XCFRAMEWORK files will be bound using Objective Sharpie. The default value is `true`. * `%(SharpieNamespace)`: The namespace to use when binding output XCFRAMEWORK files with Objective Sharpie. A new `_BuildMaciOSXcodeProjectFrameworks` target will attempt to build XCARCHIVE and XCFRAMEWORK files for each `@(MaciOSXcodeProject)` item. These outputs will be created for the platform specified in the target framework. If multiple target frameworks are specified, the project will be built for each platform during each inner build. The built XCFRAMEWORK files will be added as `@(NativeReference)` items automatically, unless the `%(ReferenceXcFramework)` metadata is set to `false`. A new `$(MaciOSPrepareForBuildDependsOn)` build extension point has been added to allow customer projects to more easily hook into the beginning of the build process.
Putting this up for some early review while it is still in progress, as I am not sure if I am adding these tasks/targets and tests to the best locations. The Android counterpart for these changes can be found in dotnet/android#9270. |
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great, just a few minor things.
Love all tests!
[Test] | ||
public void BuildMultiTargeting () | ||
{ | ||
var testDir = Cache.CreateTemporaryDirectory (TestName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want the test to run when all platforms are available, you can do this:
Configuration.IgnoreIfAnyIgnoredPlatforms ();
otherwise you need to assert that at least iOS is available:
Configuration.IgnoreIfIgnoredPlatform (ApplePlatform.iOS);
(although the test seems to need at least another platform, and you'll have to pick one if you don't want to just require all of them).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured this would safely run against all enabled platforms, and that it would be pretty rare for a branch to exist that only supports one platform? Even in that case it's probably fine for this to still run and not truly test multitargeting, as there should be a corresponding branch that will have multiple platforms enabled and be testing a multitargeted project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all branches, we run these tests concurrently in 5 modes (in 5 different bots; this is to speed up the test run):
- iOS enabled, all other platforms disabled + excluding tests with the "Multiplatform" category.
- tvOS enabled, all other platforms disabled + excluding tests with the "Multiplatform" category.
- macOS enabled, all other platforms disabled + excluding tests with the "Multiplatform" category.
- Mac Catalyst enabled, all other platforms disabled + excluding tests with the "Multiplatform" category.
- All available platforms enabled, only tests with the "Multiplatform" category.
So while it's technically really rare that a branch exists that only supports one platform, we run these tests with only one platform all the time.
It's not as rare to have a branch where iOS is completely disabled (we've done macOS/Mac Catalyst-only release branches in the past), in which case the multi platform variation will fail as it stands, because iOS won't be enabled for creating a a new "iosbinding" project.
This is why you need either of the Configuration.IgnoreIf[...]
statements I mentioned.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the context, I'll make a couple of changes here to check for an enabled platform to create the template.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should now work as long as some platform is enabled
This comment has been minimized.
This comment has been minimized.
Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
📚 [CI Build] Artifacts 📚Artifacts were not provided. Pipeline on Agent |
💻 [CI Build] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
Context: https://github.com/CommunityToolkit/Maui.NativeLibraryInterop
Introduces a
@(XcodeProject)
build action which can be used to build and consume the outputs of Xcode framework projects.The following metadata is supported on this item:
%(SchemeName)
: The name of the build scheme that should be used to build the project.%(Configuration)
: The name of the configuration to use to build the project. The default value isRelease
.%(CreateNativeReference)
: Output XCFRAMEWORK files will be added as a@(NativeReference)
to be bound or otherwise used by the project. Metadata supported by@(NativeReference)
like%(Kind)
,%(Frameworks)
, or%(SmartLink)
will be forwarded if set.%(OutputPath)
: Can be set to override the XCARCHIVE and XCFRAMEWORK output path of the Xcode project. The default value is$(IntermediateOutputPath)xcode/{SchemeName}-{Hash}
.A new
_BuildXcodeProjects
target will attempt to build XCARCHIVE and XCFRAMEWORK files for each@(XcodeProject)
item. These outputs will be created for the platform specified in the target framework. If multiple target frameworks are specified, the project will be built for each platform during each inner build.The built XCFRAMEWORK files will be added as
@(NativeReference)
items automatically, unless the%(CreateNativeReference)
metadata is set tofalse
.A new
$(MaciOSPrepareForBuildDependsOn)
build extension point has been added to allow customer projects to more easily hook into the beginning of the build process.