Class: XcodeArchiveCache::Injection::FrameworkEmbedder
- Inherits:
-
Object
- Object
- XcodeArchiveCache::Injection::FrameworkEmbedder
- Includes:
- Logs
- Defined in:
- lib/injection/framework_embedder.rb
Instance Method Summary collapse
- #embed(framework_file_paths, target) ⇒ Object
-
#initialize ⇒ FrameworkEmbedder
constructor
A new instance of FrameworkEmbedder.
Methods included from Logs
#debug, #error, #info, #set_log_level
Constructor Details
#initialize ⇒ FrameworkEmbedder
Returns a new instance of FrameworkEmbedder.
7 8 9 |
# File 'lib/injection/framework_embedder.rb', line 7 def initialize @shell_executor = XcodeArchiveCache::Shell::Executor.new end |
Instance Method Details
#embed(framework_file_paths, target) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/injection/framework_embedder.rb', line 14 def (framework_file_paths, target) return unless target.product_type == Xcodeproj::Constants::PRODUCT_TYPE_UTI[:application] dynamic_framework_file_paths = framework_file_paths.select do |path| binary_name = File.basename(path, ".framework") binary_path = File.join(path, binary_name) shell_executor.execute("file #{binary_path} | grep dynamic") end return if dynamic_framework_file_paths.length == 0 debug("Embedding frameworks:\n\t#{dynamic_framework_file_paths.join("\n\t")}") frameworks_group = target.project.main_group.new_group("XcodeArchiveCache Frameworks") file_references = dynamic_framework_file_paths.map {|file_path| frameworks_group.new_reference(file_path)} = target.new_copy_files_build_phase("Embed XcodeArchiveCache Frameworks") .symbol_dst_subfolder_spec = :frameworks .run_only_for_deployment_postprocessing = false file_references.each do |file_reference| build_file = target.project.new(Xcodeproj::Project::Object::PBXBuildFile) build_file.file_ref = file_reference build_file.settings = {"ATTRIBUTES" => %w(CodeSignOnCopy RemoveHeadersOnCopy)} build_file.add_referrer(frameworks_group) .files.push(build_file) end end |