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

Adds method to remove file references from target - Issue 523 #801

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
16 changes: 16 additions & 0 deletions lib/xcodeproj/project/object/native_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,22 @@ def add_file_references(file_references, compiler_flags = {})
end
end

# Removes source files from the target.
#
# @param [Array<PBXFileReference>] file_references
# the files references of the source files that should be removed
# from the target.
#
def remove_file_references(file_references)
file_references.map do |file|
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why map and not. each? the method doc above does not denote a return type.

extension = File.extname(file.path).downcase
header_extensions = Constants::HEADER_FILES_EXTENSIONS
is_header_phase = header_extensions.include?(extension)
phase = is_header_phase ? headers_build_phase : source_build_phase
phase.remove_file_reference(file)
end
end

# Adds resource files to the resources build phase of the target.
#
# @param [Array<PBXFileReference>] resource_file_references
Expand Down