8000 Add option to app host installer whether or not ot add a main by dostrander · Pull Request #8235 · CocoaPods/CocoaPods · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add option to app host installer whether or not ot add a main #8235

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

Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ To install release candidates run `[sudo] gem install cocoapods --pre`

##### Enhancements

* Don't add main for app specs.
[Derek Ostrander](https://github.com/dostrander)
[#8235](https://github.com/CocoaPods/CocoaPods/pull/8235)st

* Multiple Swift versions support
[Dimitris Koutsogiorgas](https://github.com/dnkoutso)
[#8191](https://github.com/CocoaPods/CocoaPods/issues/8191)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class AppHostInstaller
#
attr_reader :app_target_label

# @return [Boolean] whether the app host installer should add main.m
#
attr_reader :add_main

# Initialize a new instance
#
# @param [Sandbox] sandbox @see #sandbox
Expand All @@ -41,14 +45,16 @@ class AppHostInstaller
# @param [String] subgroup_name @see #subgroup_name
# @param [String] group_name @see #group_name
# @param [String] app_target_label see #app_target_label
# @param [Boolean] add_main see #add_main
#
def initialize(sandbox, project, platform, subgroup_name, group_name, app_target_label)
def initialize(sandbox, project, platform, subgroup_name, group_name, app_target_label, add_main: true)
@sandbox = sandbox
@project = project
@platform = platform
@subgroup_name = subgroup_name
@group_name = group_name
@app_target_label = app_target_label
@add_main = add_main
target_group = project.pod_group(group_name)
@group = target_group[subgroup_name] || target_group.new_group(subgroup_name)
end
Expand All @@ -66,7 +72,7 @@ def install!
configuration.build_settings['CURRENT_PROJECT_VERSION'] = '1'
end

Pod::Generator::AppTargetHelper.add_app_host_main_file(project, app_host_target, platform_name, @group, app_target_label)
Pod::Generator::AppTargetHelper.add_app_host_main_file(project, app_host_target, platform_name, @group, app_target_label) if add_main
Pod::Generator::AppTargetHelper.add_launchscreen_storyboard(project, app_host_target, @group, app_target_label) if platform == :ios
additional_entries = platform == :ios ? ADDITIONAL_IOS_INFO_PLIST_ENTRIES : {}
create_info_plist_file_with_sandbox(sandbox, app_host_info_plist_path, app_host_target, '1.0.0', platform,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,13 @@ def add_app_targets
subspec_name = target.subspec_label(app_spec)
app_target_label = target.app_target_label(app_spec)
platform = target.platform
app_native_target = AppHostInstaller.new(sandbox, project, platform, subspec_name, spec_name, app_target_label).install!
app_native_target = AppHostInstaller.new(sandbox,
project,
platform,
subspec_name,
spec_name,
app_target_label,
:add_main => false).install!

target.user_build_configurations.each do |bc_name, type|
app_native_target.add_build_configuration(bc_name, type)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ class PodsProjectGenerator
]
end

it 'does not add main to the group' do
name = 'AppHost-PodName-iOS-Unit-Tests'
installer = AppHostInstaller.new(config.sandbox, @project, Platform.ios,
name,
'Subgroup',
name,
:add_main => false)
installer.install!
@project.pod_group('Subgroup')[name].files.map(&:name).sort.should == [
'AppHost-PodName-iOS-Unit-Tests-Info.plist',
'LaunchScreen.storyboard',
]
end

it 'sets the correct bu 4617 ild settings for an iOS app host target' do
installer = AppHostInstaller.new(config.sandbox, @project, Platform.ios,
'AppHost-PodName-iOS-Unit-Tests',
Expand Down
0