Class: Pod::Command::Binary::Package
Constant Summary
collapse
- DEFAULT_SWIFT_VERSION =
'5.0'.freeze
- DEFAULT_DEPLOY_TARGET =
'11.0'.freeze
Class Method Summary
collapse
Instance Method Summary
collapse
#verify_binaryfile_exists!
Constructor Details
#initialize(argv) ⇒ Package
Returns a new instance of Package.
20
21
22
23
24
25
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 20
def initialize(argv)
@spec_path = argv.shift_argument
source_urls = argv.option('sources', Pod::TrunkSource::TRUNK_REPO_URL).split(',')
@source_urls = source_urls.map { |url| config.sources_manager.source_with_name_or_url(url) }.map(&:url)
super
end
|
Class Method Details
.options ⇒ Object
13
14
15
16
17
18
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 13
def self.options
[
["--sources=#{Pod::TrunkSource::TRUNK_REPO_URL}", 'The sources from which to pull dependent pods ' \
"(defaults to #{Pod::TrunkSource::TRUNK_REPO_URL}). Multiple sources must be comma-delimited"],
].concat(super)
end
|
Instance Method Details
#build_dir ⇒ Object
42
43
44
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 42
def build_dir
@build_dir ||= Pathname.getwd + Pathname('aries_binary_build')
end
|
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 123
def configure_pod_targets(target_installation_results)
target_installation_results.first.values.each do |pod_target_installation_result|
pod_target = pod_target_installation_result.target
native_target = pod_target_installation_result.native_target
native_target.build_configuration_list.build_configurations.each do |build_configuration|
(build_configuration.build_settings['OTHER_CFLAGS'] ||= '$(inherited)') << ' -Wincomplete-umbrella'
if pod_target.uses_swift?
build_configuration.build_settings['SWIFT_VERSION'] = DEFAULT_SWIFT_VERSION
end
end
end
end
|
#create_app_project ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 63
def create_app_project
app_project = Xcodeproj::Project.new(build_dir + 'App.xcodeproj')
app_target = Pod::Generator::AppTargetHelper.add_app_target(app_project, :ios, DEFAULT_DEPLOY_TARGET)
sandbox = Sandbox.new(config.sandbox_root)
info_plist_path = app_project.path.dirname.+('App/App-Info.plist')
Pod::Installer::Xcode::PodsProjectGenerator::TargetInstallerHelper.create_info_plist_file_with_sandbox(sandbox,
info_plist_path,
app_target,
'1.0.0',
Platform.new(:ios),
:appl,
:build_setting_value => '$(SRCROOT)/App/App-Info.plist')
Pod::Generator::AppTargetHelper.add_swift_version(app_target, DEFAULT_SWIFT_VERSION)
app_target.build_configurations.each do |config|
config.build_settings.delete('ASSETCATALOG_COMPILER_APPICON_NAME')
config.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = 'org.cocoapods.${PRODUCT_NAME:rfc1034identifier}'
end
app_project.save
app_project.recreate_user_schemes
end
|
#download_pod ⇒ Object
84
85
86
87
88
89
90
91
92
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 84
def download_pod
podfile = podfile_from_spec(true)
sandbox = Sandbox.new(config.sandbox_root)
@installer = Installer.new(sandbox, podfile)
@installer.use_default_plugins = false
@installer.has_dependencies = !spec.dependencies.empty?
%i(prepare resolve_dependencies download_dependencies write_lockfiles).each { |m| @installer.send(m) }
@file_accessor = @installer.pod_targets.flat_map(&:file_accessors).find { |fa| fa.spec.name == spec.name }
end
|
#file ⇒ Object
50
51
52
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 50
def file
@linter.file
end
|
#install_pod ⇒ Object
115
116
117
118
119
120
121
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 115
def install_pod
%i(validate_targets generate_pods_project integrate_user_project
perform_post_install_actions).each { |m| @installer.send(m) }
configure_pod_targets(@installer.target_installation_results)
@installer.pods_project.save
end
|
#podfile_from_spec(use_modular_headers = false) ⇒ Object
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 94
def podfile_from_spec( = false)
name = spec.name
podspec = file.realpath
urls = @source_urls
project_path = 'App.xcodeproj'
Pod::Podfile.new do
install! 'cocoapods', :deterministic_uuids => false, :warn_for_unused_master_specs_repo => false
inhibit_all_warnings!
urls.each { |u| source(u) }
project project_path
target 'App' do
use_frameworks!(:linkage => :static)
if
platform(:ios, DEFAULT_DEPLOY_TARGET)
pod name, :podspec => podspec.to_s, :inhibit_warnings => false
end
end
end
|
#run ⇒ Object
35
36
37
38
39
40
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 35
def run
setup_build_environment
create_app_project
download_pod
install_pod
end
|
#setup_build_environment ⇒ Object
57
58
59
60
61
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 57
def setup_build_environment
build_dir.rmtree if build_dir.exist?
build_dir.mkpath
config.installation_root = build_dir
end
|
#spec ⇒ Object
46
47
48
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 46
def spec
@linter.spec
end
|
#validate! ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/cocoapods-aries-binary/command/package.rb', line 27
def validate!
super
help! 'Packaging needs a podspec.' unless @spec_path
pathname = Pathname.new(@spec_path)
help! 'Podspec not exist.' unless pathname.exist? && @spec_path.include?('.podspec')
@linter = Specification::Linter.new(pathname)
end
|