Skip to content

Commit

Permalink
Merge pull request #5 from bielikb/release/1.1.1
Browse files Browse the repository at this point in the history
Fine-grained control
  • Loading branch information
bielikb authored Nov 4, 2020
2 parents 2552b2f + 7eb6617 commit f214b49
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def self.run(params)

params[:destinations].each_with_index do |destination, framework_index|
params[:destination] = destination
params[:archive_path] = @xchelper.xcarchive_path(framework_index)
params[:archive_path] = @xchelper.xcarchive_path_for_destination(framework_index)
XcarchiveAction.run(params)
end

Expand All @@ -31,7 +31,7 @@ def self.run(params)

copy_BCSymbolMaps(params)

clean
clean(params)

provide_shared_values
else
Expand All @@ -48,8 +48,8 @@ def self.provide_shared_values
ENV[SharedValues::XCFRAMEWORK_BCSYMBOLMAPS_OUTPUT_PATH.to_s] = File.expand_path(@xchelper.xcframework_BCSymbolMaps_path)
end

def self.clean
@xchelper.xcarchive_frameworks_path.each { |framework| FileUtils.rm_rf(framework.split('/').first) }
def self.clean(params)
FileUtils.rm_rf(@xchelper.xcarchive_path) if params[:remove_xcarchives]
end

def self.create_xcframework(params)
Expand All @@ -67,7 +67,7 @@ def self.create_xcframework(params)
end

def self.debug_symbols(index:, params:)
return "" unless Helper.xcode_at_least?('12.0.0')
return "" unless Helper.xcode_at_least?('12.0.0') && params[:include_debug_symbols] == true

debug_symbols = []

Expand All @@ -77,7 +77,7 @@ def self.debug_symbols(index:, params:)
end

# Include BCSymbols in xcframework
if params[:include_BCSymbolMaps] != false && params[:include_bitcode] != false
if params[:include_BCSymbolMaps] != false && params[:enable_bitcode] != false
bc_symbols_dir = @xchelper.xcarchive_BCSymbolMaps_path(index)
if Dir.exist?(bc_symbols_dir)
arguments = Dir.children(bc_symbols_dir).map { |path| "-debug-symbols #{File.expand_path("#{bc_symbols_dir}/#{path}")}" }
Expand All @@ -89,6 +89,8 @@ def self.debug_symbols(index:, params:)
end

def self.copy_dSYMs(params)
return if params[:include_dSYMs] == false

dSYMs_output_dir = @xchelper.xcframework_dSYMs_path
FileUtils.mkdir_p(dSYMs_output_dir)

Expand All @@ -104,7 +106,7 @@ def self.copy_dSYMs(params)
end

def self.copy_BCSymbolMaps(params)
return if params[:include_bitcode] == false
return if params[:enable_bitcode] == false || params[:include_BCSymbolMaps] == false

symbols_output_dir = @xchelper.xcframework_BCSymbolMaps_path
FileUtils.mkdir_p(symbols_output_dir)
Expand Down Expand Up @@ -134,7 +136,7 @@ def self.update_xcargs(params)
end
xcargs = ['SKIP_INSTALL=NO', 'BUILD_LIBRARY_FOR_DISTRIBUTION=YES']

if params[:include_bitcode] != false
if params[:enable_bitcode] != false
params[:xcargs].gsub!(/ENABLE_BITCODE(=|\s+)(YES|NO)/, '') if params[:xcargs]
xcargs << ['OTHER_CFLAGS="-fembed-bitcode"', 'BITCODE_GENERATION_MODE="bitcode"', 'ENABLE_BITCODE=YES']
end
Expand Down Expand Up @@ -198,7 +200,7 @@ def self.authors

def self.details
'Create xcframework plugin generates xcframework for specified destinations. ' \
'The output of this action consists of the xcframework itself, which contains dSYM and BCSymbolMaps, if bitcode is enabled.'
'The output of this action consists of the xcframework itself, which contains dSYM and BCSymbolMaps, if bitcode is enabled.'
end

def self.available_options
Expand All @@ -209,7 +211,7 @@ def self.available_options
optional: false
),
FastlaneCore::ConfigItem.new(
key: :include_bitcode,
key: :enable_bitcode,
description: "Should the project be built with bitcode enabled?",
optional: true,
is_string: false,
Expand Down Expand Up @@ -239,10 +241,24 @@ def self.available_options
optional: true,
default_value: true
),
FastlaneCore::ConfigItem.new(
key: :include_debug_symbols,
description: 'This feature was added in Xcode 12.0.' \
'If this is set to false, the dSYMs and BCSymbolMaps wont be added to XCFramework itself',
optional: true,
default_value: true
),
FastlaneCore::ConfigItem.new(
key: :product_name,
description: "The name of your module. Optional if equals to :scheme. Equivalent to CFBundleName",
optional: true
),
FastlaneCore::ConfigItem.new(
key: :remove_xcarchives,
description: 'This option will auto-remove the xcarchive files once the plugin finishes.' \
'Set this to false to preserve the xcarchives',
optional: true,
default_value: true
)
]
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ def framework
"#{product_name}.framework"
end

def xcarchive_path(framework_index)
"#{framework_index}_#{product_name}.xcarchive"
def xcarchive_path
"#{output_directory}/archives"
end

def xcarchive_path_for_destination(framework_index)
"#{xcarchive_path}/#{framework_index}_#{product_name}.xcarchive"
end

def xcarchive_framework_path(framework_index)
framework_path = "#{xcarchive_path(framework_index)}/Products/Library/Frameworks/#{framework}"
framework_path = "#{xcarchive_path_for_destination(framework_index)}/Products/Library/Frameworks/#{framework}"
return framework_path if File.exist?(framework_path)

FastlaneCore::UI.user_error!("▸ PRODUCT_NAME was misdefined: `#{product_name}`. Please, provide :product_name option")
Expand All @@ -33,15 +37,15 @@ def xcarchive_frameworks_path
end

def xcarchive_dSYMs_path(framework_index)
File.expand_path("#{xcarchive_path(framework_index)}/dSYMS")
File.expand_path("#{xcarchive_path_for_destination(framework_index)}/dSYMS")
end

def xcframework_dSYMs_path
File.expand_path("#{output_directory}/#{product_name}.dSYMs")
end

def xcarchive_BCSymbolMaps_path(framework_index)
File.expand_path("#{xcarchive_path(framework_index)}/BCSymbolMaps")
File.expand_path("#{xcarchive_path_for_destination(framework_index)}/BCSymbolMaps")
end

def xcframework_BCSymbolMaps_path
Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/create_xcframework/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module CreateXcframework
VERSION = "1.1.0"
VERSION = "1.1.1"
end
end

0 comments on commit f214b49

Please sign in to comment.