Skip to content

Commit

Permalink
[msbuild] Refactor the logic to compute the target devices for IBTool…
Browse files Browse the repository at this point in the history
…/ACTool. (#12461)

Refactor the logic to compute the target devices for IBTool/ACTool, so that it
doesn't depend on the existence of the input app manifest, but instead uses
values that either comes from the app manifest, or have a default.

This becomes an important distinction when we add support for multiple partial
app manifests, or none at all (where all the required values come from MSBuild
properties).
  • Loading branch information
rolfbjarne authored Aug 18, 2021
1 parent e3bbec4 commit db98082
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions msbuild/Xamarin.MacDev.Tasks.Core/Tasks/XcodeCompilerToolTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ protected static bool IsWatchExtension (PDictionary plist)
PDictionary extension;
PString id;

if (plist == null)
return false;

if (!plist.TryGetValue ("NSExtension", out extension))
return false;

Expand All @@ -134,34 +137,31 @@ protected static bool IsWatchExtension (PDictionary plist)

protected IEnumerable<string> GetTargetDevices ()
{
return GetTargetDevices (GetAppManifest ());
var plist = GetAppManifest ();
var devices = plist?.GetUIDeviceFamily () ?? IPhoneDeviceType.NotSet;
var watch = plist?.GetWKWatchKitApp () == true;
var watchExtension = IsWatchExtension (plist);
return GetTargetDevices (devices, watch, watchExtension);
}

IEnumerable<string> GetTargetDevices (PDictionary plist)
IEnumerable<string> GetTargetDevices (IPhoneDeviceType devices, bool watch, bool watchExtension)
{
var devices = IPhoneDeviceType.NotSet;
bool watch = false;

if (Platform == ApplePlatform.MacOSX)
yield break;

if (plist != null) {
if (!(watch = plist.GetWKWatchKitApp ())) {
// the project is either a normal iOS project or an extension
if ((devices = plist.GetUIDeviceFamily ()) == IPhoneDeviceType.NotSet) {
// library projects and extension projects will not have this key, but
// we'll want them to work for both iPhones and iPads if the
// xib or storyboard supports them
devices = IPhoneDeviceType.IPhoneAndIPad;
}

// if the project is a watch extension, we'll also want to include watch support
watch = IsWatchExtension (plist);
} else {
// the project is a WatchApp, only include watch support
if (!watch) {
// the project is either a normal iOS project or an extension
if (devices == IPhoneDeviceType.NotSet) {
// library projects and extension projects will not have this key, but
// we'll want them to work for both iPhones and iPads if the
// xib or storyboard supports them
devices = IPhoneDeviceType.IPhoneAndIPad;
}

// if the project is a watch extension, we'll also want to include watch support
watch = watchExtension;
} else {
devices = IPhoneDeviceType.IPhoneAndIPad;
// the project is a WatchApp, only include watch support
}

if ((devices & IPhoneDeviceType.IPhone) != 0)
Expand Down

5 comments on commit db98082

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ [CI Build] Tests failed on Build ❌

Tests failed on Build.

API diff

✅ API Diff from stable

View API diff

API & Generator diff

API Diff (from PR only) (no change)
Generator Diff (only version changes)

Packages generated

View packages

Test results

5 tests failed, 245 tests passed.

Failed tests

  • monotouch-test/Mac Catalyst/Debug [dotnet]: Failed (Tests run: 2638 Passed: 2489 Inconclusive: 35 Failed: 1 Ignored: 148)
  • monotouch-test/watchOS 32-bits - simulator/Debug (LinkSdk): Failed
  • link sdk/Mac [dotnet]/Debug [dotnet]: BuildFailure
  • link sdk/Mac [dotnet]/Release [dotnet]: BuildFailure
  • Documentation/All: Failed

Pipeline on Agent XAMBOT-1025.BigSur'
[msbuild] Refactor the logic to compute the target devices for IBTool/ACTool. (#12461)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests tvOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[msbuild] Refactor the logic to compute the target devices for IBTool/ACTool. (#12461)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

⚠️ Tests were not ran (VSTS: device tests iOS). ⚠️

Results were skipped for this run due to provisioning problems Azure Devops. Please contact the bot administrator.

Pipeline on Agent
[msbuild] Refactor the logic to compute the target devices for IBTool/ACTool. (#12461)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

❌ Tests failed on macOS M1 - Mac Big Sur (11.5) ❌

Tests failed on M1 - Mac Big Sur (11.5).

Failed tests are:

  • xammac_tests

Pipeline on Agent
[msbuild] Refactor the logic to compute the target devices for IBTool/ACTool. (#12461)

@vs-mobiletools-engineering-service2
Copy link
Collaborator

Choose a reason for hiding this comment

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

✅ Tests passed on macOS Mac Mojave (10.14) ✅

Tests passed

All tests on macOS X Mac Mojave (10.14) passed.

Pipeline on Agent
[msbuild] Refactor the logic to compute the target devices for IBTool/ACTool. (#12461)

Please sign in to comment.