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

Add flag for "use_modular_headers!" Podfile setting #633

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
22 changes: 22 additions & 0 deletions source/IOSResolver/src/IOSResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,9 @@ protected override bool Read(string filename, Logger logger) {
// Whether to add "use_frameworks!" in the Podfile.
private const string PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS =
PREFERENCE_NAMESPACE + "PodfileAddUseFrameworks";
// Whether to add "use_modular_headers!" in the Podfile.
private const string PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS =
PREFERENCE_NAMESPACE + "PodfileAddUseModularHeaders";
// Whether to statically link framework in the Podfile.
private const string PREFERENCE_PODFILE_STATIC_LINK_FRAMEWORKS =
PREFERENCE_NAMESPACE + "PodfileStaticLinkFrameworks";
Expand Down Expand Up @@ -521,6 +524,7 @@ protected override bool Read(string filename, Logger logger) {
PREFERENCE_WARN_UPGRADE_WORKSPACE,
PREFERENCE_SKIP_POD_INSTALL_WHEN_USING_WORKSPACE_INTEGRATION,
PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS,
PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS,
PREFERENCE_PODFILE_STATIC_LINK_FRAMEWORKS,
PREFERENCE_SWIFT_FRAMEWORK_SUPPORT_WORKAROUND,
PREFERENCE_SWIFT_LANGUAGE_VERSION,
Expand Down Expand Up @@ -1066,6 +1070,20 @@ public static bool PodfileAddUseFrameworks {
settings.SetBool(PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS, value);
}
}

/// <summary>
/// Whether to add "use_modular_headers!" in the Podfile. False by default.
/// If true, iOS Resolver adds the following line to Podfile.
///
/// use_modular_headers!
/// </summary>
public static bool PodfileAddUseModularHeaders {
get { return settings.GetBool(PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS,
defaultValue: false); }
set {
settings.SetBool(PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS, value);
}
}

/// <summary>
/// Whether to statically link framework in the Podfile. False by default.
Expand Down Expand Up @@ -2349,6 +2367,10 @@ public static void GenPodfile(BuildTarget buildTarget,
"use_frameworks! :linkage => :static" :
"use_frameworks!");
}

if (PodfileAddUseModularHeaders) {
file.WriteLine("use_modular_headers!");
}
}

int versionCount = 0;
Expand Down
14 changes: 13 additions & 1 deletion source/IOSResolver/src/IOSResolverSettingsDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private class Settings {
internal bool verboseLoggingEnabled;
internal int cocoapodsIntegrationMenuIndex;
internal bool podfileAddUseFrameworks;
internal bool podfileAddUseModularHeaders;
internal bool podfileStaticLinkFrameworks;
internal bool swiftFrameworkSupportWorkaroundEnabled;
internal string swiftLanguageVersion;
Expand All @@ -58,6 +59,7 @@ internal Settings() {
cocoapodsIntegrationMenuIndex = FindIndexFromCocoapodsIntegrationMethod(
IOSResolver.CocoapodsIntegrationMethodPref);
podfileAddUseFrameworks = IOSResolver.PodfileAddUseFrameworks;
podfileAddUseModularHeaders = IOSResolver.PodfileAddUseModularHeaders;
podfileStaticLinkFrameworks = IOSResolver.PodfileStaticLinkFrameworks;
swiftFrameworkSupportWorkaroundEnabled =
IOSResolver.SwiftFrameworkSupportWorkaroundEnabled;
Expand All @@ -80,6 +82,7 @@ internal void Save() {
IOSResolver.CocoapodsIntegrationMethodPref =
integrationMapping[cocoapodsIntegrationMenuIndex];
IOSResolver.PodfileAddUseFrameworks = podfileAddUseFrameworks;
IOSResolver.PodfileAddUseModularHeaders = podfileAddUseModularHeaders;
IOSResolver.PodfileStaticLinkFrameworks = podfileStaticLinkFrameworks;
IOSResolver.SwiftFrameworkSupportWorkaroundEnabled =
swiftFrameworkSupportWorkaroundEnabled;
Expand Down Expand Up @@ -213,7 +216,13 @@ public void OnGUI() {
GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
GUILayout.Label("Podfile Configurations", EditorStyles.largeLabel);
EditorGUILayout.Separator();


GUILayout.BeginHorizontal();
GUILayout.Label("Add use_modular_headers! to Podfile", EditorStyles.boldLabel);
settings.podfileAddUseModularHeaders =
EditorGUILayout.Toggle(settings.podfileAddUseModularHeaders);
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label("Add use_frameworks! to Podfile", EditorStyles.boldLabel);
settings.podfileAddUseFrameworks =
Expand Down Expand Up @@ -348,6 +357,9 @@ public void OnGUI() {
new KeyValuePair<string, string>(
"podfileAddUseFrameworks",
IOSResolver.PodfileAddUseFrameworks.ToString()),
new KeyValuePair<string, string>(
"podfileAddUseModularHeaders",
IOSResolver.PodfileAddUseModularHeaders.ToString()),
new KeyValuePair<string, string>(
"podfileStaticLinkFrameworks",
IOSResolver.PodfileStaticLinkFrameworks.ToString()),
Expand Down