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

[mmp] Ignore, by default, frameworks that cause rejection from App Store. Fix #6039 #6107

Merged
merged 7 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/website/mmp-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,29 @@ See the [equivalent mtouch warning](~/ios/troubleshooting/mtouch-errors.md#MT521
<!-- 5215 used by mtouch -->
<!-- 5216 used by mtouch -->
<!-- 5217 used by mtouch -->
<!-- 5218 used by mtouch -->

<a name="MT5219" />

#### MM5219: Linking against framework '{nspace}'. It is prohibited (rejected) by the Mac App Store

The application has references to the `{nspace}` namespace of `Xamarin.Mac.dll`.
The associated OS framework is known to be **prohibited** in Apple's Mac App Store applications.

However `mmp` was instructed, using `--link-prohibited-framework`, to natively link to the associated framework.
You can silence this warning by adding `--nowarn=5219` to the **Additional mmp arguments** in your project's options.

<a name="MT5220" />

#### MM5220: Skipping framework '{nspace}'. It is prohibited (rejected) by the Mac App Store

The application has references to the `{nspace}` namespace of `Xamarin.Mac.dll`.
The associated OS framework is known to be **prohibited** in Apple's Mac App Store applications.
To avoid rejections `mmp` will not, by default, natively link with the mentioned framework.
Any feature that use the mentioned framework will not work and might crash at runtime.

If needed (e.g. not submitting to the App Store) you can ask `mmp` to link against the framework by adding `--link-prohibited-framework` to the **Additional mmp arguments** in your project's options.
You can silence this warning by adding `--nowarn=5220` to the **Additional mmp arguments** in your project's options.

### MM53xx: other tools

Expand Down
2 changes: 2 additions & 0 deletions docs/website/mtouch-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -2825,6 +2825,8 @@ There are two main reasons for this:
* The symbol is correct, but it's a symbol that's already preserved by normal
means (some build options causes the exact list of dynamic symbols to vary).

<!-- 5219 and 5220 used by mmp -->

### MT53xx: Other tools

<!--
Expand Down
5 changes: 5 additions & 0 deletions tests/common/BundlerTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,12 @@ static void Main ()
bundler.Linker = LinkerOption.DontLink;
bundler.AssertExecute ();
bundler.AssertWarning (4175, "The parameter 'completionHandler' in the method 'Issue4072Session.CreateDataTask(Foundation.NSUrl,Foundation.NSUrlSessionResponse)' has an invalid BlockProxy attribute (the type passed to the attribute does not have a 'Create' method).", "testApp.cs", 11);
#if __MACOS__
bundler.AssertWarning (5220, "Skipping framework 'QTKit'. It is prohibited (rejected) by the Mac App Store");
bundler.AssertWarningCount (2);
#else
bundler.AssertWarningCount (1);
#endif
}

using (var bundler = new BundlerTool ()) {
Expand Down
2 changes: 1 addition & 1 deletion tests/mmptest/src/MMPTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void Unified_HelloWorld_ShouldHaveNoWarnings (bool release)

// Due to https://bugzilla.xamarin.com/show_bug.cgi?id=48311 we can get warnings related to the registrar
Func<string, bool> hasLegitWarning = results =>
results.Split (Environment.NewLine.ToCharArray ()).Any (x => x.Contains ("warning") && !x.Contains ("deviceBrowserView:selectionDidChange:"));
results.Split (Environment.NewLine.ToCharArray ()).Any (x => x.Contains ("warning") && !(x.Contains ("deviceBrowserView:selectionDidChange:") || x.Contains ("It is prohibited (rejected) by the Mac App Store")));

// Mobile
string buildResults = TI.TestUnifiedExecutable (test).BuildOutput;
Expand Down
10 changes: 10 additions & 0 deletions tools/common/Frameworks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,16 @@ public static void Gather (Application app, AssemblyDefinition product_assembly,

// Iterate over all the namespaces and check which frameworks we need to link with.
foreach (var nspace in namespaces) {
switch (nspace) {
case "QTKit":
if (Driver.LinkProhibitedFrameworks) {
ErrorHelper.Warning (5219, $"Linking against framework '{nspace}'. It is prohibited (rejected) by the Mac App Store");
} else {
ErrorHelper.Warning (5220, $"Skipping framework '{nspace}'. It is prohibited (rejected) by the Mac App Store");
continue;
}
break;
}
if (Driver.GetFrameworks (app).TryGetValue (nspace, out var framework)) {
if (app.SdkVersion >= framework.Version) {
var add_to = app.DeploymentTarget >= framework.Version ? frameworks : weak_frameworks;
Expand Down
2 changes: 2 additions & 0 deletions tools/mmp/driver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ static void ShowHelp (OptionSet os) {
public static bool IsUnifiedMobile { get; private set; }
public static bool IsUnified { get { return IsUnifiedFullSystemFramework || IsUnifiedMobile || IsUnifiedFullXamMacFramework; } }
public static bool IsClassic { get { return !IsUnified; } }
public static bool LinkProhibitedFrameworks { get; private set; }

public static bool Is64Bit {
get {
Expand Down Expand Up @@ -352,6 +353,7 @@ static void Main2 (string [] args)
aotOptions = new AOTOptions (v);
}
},
{ "link-prohibited-frameworks", "Natively link against prohibited (rejected by AppStore) frameworks", v => { LinkProhibitedFrameworks = true; } },
};

AddSharedOptions (App, os);
Expand Down