Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d10482e

Browse files
committedAug 15, 2023
Add flag for "use_modular_headers!" Podfile setting
1 parent ebfa213 commit d10482e

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed
 

‎source/IOSResolver/src/IOSResolver.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,9 @@ protected override bool Read(string filename, Logger logger) {
493493
// Whether to add "use_frameworks!" in the Podfile.
494494
private const string PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS =
495495
PREFERENCE_NAMESPACE + "PodfileAddUseFrameworks";
496+
// Whether to add "use_modular_headers!" in the Podfile.
497+
private const string PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS =
498+
PREFERENCE_NAMESPACE + "PodfileAddUseModularHeaders";
496499
// Whether to statically link framework in the Podfile.
497500
private const string PREFERENCE_PODFILE_STATIC_LINK_FRAMEWORKS =
498501
PREFERENCE_NAMESPACE + "PodfileStaticLinkFrameworks";
@@ -521,6 +524,7 @@ protected override bool Read(string filename, Logger logger) {
521524
PREFERENCE_WARN_UPGRADE_WORKSPACE,
522525
PREFERENCE_SKIP_POD_INSTALL_WHEN_USING_WORKSPACE_INTEGRATION,
523526
PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS,
527+
PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS,
524528
PREFERENCE_PODFILE_STATIC_LINK_FRAMEWORKS,
525529
PREFERENCE_SWIFT_FRAMEWORK_SUPPORT_WORKAROUND,
526530
PREFERENCE_SWIFT_LANGUAGE_VERSION,
@@ -1066,6 +1070,20 @@ public static bool PodfileAddUseFrameworks {
10661070
settings.SetBool(PREFERENCE_PODFILE_ADD_USE_FRAMEWORKS, value);
10671071
}
10681072
}
1073+
1074+
/// <summary>
1075+
/// Whether to add "use_modular_headers!" in the Podfile. False by default.
1076+
/// If true, iOS Resolver adds the following line to Podfile.
1077+
///
1078+
/// use_modular_headers!
1079+
/// </summary>
1080+
public static bool PodfileAddUseModularHeaders {
1081+
get { return settings.GetBool(PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS,
1082+
defaultValue: false); }
1083+
set {
1084+
settings.SetBool(PREFERENCE_PODFILE_ADD_USE_MODULAR_HEADERS, value);
1085+
}
1086+
}
10691087

10701088
/// <summary>
10711089
/// Whether to statically link framework in the Podfile. False by default.
@@ -2349,6 +2367,10 @@ public static void GenPodfile(BuildTarget buildTarget,
23492367
"use_frameworks! :linkage => :static" :
23502368
"use_frameworks!");
23512369
}
2370+
2371+
if (PodfileAddUseModularHeaders) {
2372+
file.WriteLine("use_modular_headers!");
2373+
}
23522374
}
23532375

23542376
int versionCount = 0;

‎source/IOSResolver/src/IOSResolverSettingsDialog.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ private class Settings {
3838
internal bool verboseLoggingEnabled;
3939
internal int cocoapodsIntegrationMenuIndex;
4040
internal bool podfileAddUseFrameworks;
41+
internal bool podfileAddUseModularHeaders;
4142
internal bool podfileStaticLinkFrameworks;
4243
internal bool swiftFrameworkSupportWorkaroundEnabled;
4344
internal string swiftLanguageVersion;
@@ -58,6 +59,7 @@ internal Settings() {
5859
cocoapodsIntegrationMenuIndex = FindIndexFromCocoapodsIntegrationMethod(
5960
IOSResolver.CocoapodsIntegrationMethodPref);
6061
podfileAddUseFrameworks = IOSResolver.PodfileAddUseFrameworks;
62+
podfileAddUseModularHeaders = IOSResolver.PodfileAddUseModularHeaders;
6163
podfileStaticLinkFrameworks = IOSResolver.PodfileStaticLinkFrameworks;
6264
swiftFrameworkSupportWorkaroundEnabled =
6365
IOSResolver.SwiftFrameworkSupportWorkaroundEnabled;
@@ -80,6 +82,7 @@ internal void Save() {
8082
IOSResolver.CocoapodsIntegrationMethodPref =
8183
integrationMapping[cocoapodsIntegrationMenuIndex];
8284
IOSResolver.PodfileAddUseFrameworks = podfileAddUseFrameworks;
85+
IOSResolver.PodfileAddUseModularHeaders = podfileAddUseModularHeaders;
8386
IOSResolver.PodfileStaticLinkFrameworks = podfileStaticLinkFrameworks;
8487
IOSResolver.SwiftFrameworkSupportWorkaroundEnabled =
8588
swiftFrameworkSupportWorkaroundEnabled;
@@ -213,7 +216,13 @@ public void OnGUI() {
213216
GUILayout.Box("", GUILayout.ExpandWidth(true), GUILayout.Height(1));
214217
GUILayout.Label("Podfile Configurations", EditorStyles.largeLabel);
215218
EditorGUILayout.Separator();
216-
219+
220+
GUILayout.BeginHorizontal();
221+
GUILayout.Label("Add use_modular_headers! to Podfile", EditorStyles.boldLabel);
222+
settings.podfileAddUseModularHeaders =
223+
EditorGUILayout.Toggle(settings.podfileAddUseModularHeaders);
224+
GUILayout.EndHorizontal();
225+
217226
GUILayout.BeginHorizontal();
218227
GUILayout.Label("Add use_frameworks! to Podfile", EditorStyles.boldLabel);
219228
settings.podfileAddUseFrameworks =
@@ -348,6 +357,9 @@ public void OnGUI() {
348357
new KeyValuePair<string, string>(
349358
"podfileAddUseFrameworks",
350359
IOSResolver.PodfileAddUseFrameworks.ToString()),
360+
new KeyValuePair<string, string>(
361+
"podfileAddUseModularHeaders",
362+
IOSResolver.PodfileAddUseModularHeaders.ToString()),
351363
new KeyValuePair<string, string>(
352364
"podfileStaticLinkFrameworks",
353365
IOSResolver.PodfileStaticLinkFrameworks.ToString()),

0 commit comments

Comments
 (0)
Please sign in to comment.