Fix script logic
This commit is contained in:
parent
2af414680f
commit
a042e43450
|
|
@ -137,9 +137,7 @@ private_lane :buildConfiguration do |options|
|
||||||
|
|
||||||
installDependencies(options)
|
installDependencies(options)
|
||||||
|
|
||||||
unless options[:features].nil?
|
generate_enabled_features_extension_if_needed(options)
|
||||||
generate_enabled_features_extension(options)
|
|
||||||
end
|
|
||||||
|
|
||||||
if !(options[:uploadToFabric] || options[:uploadToAppStore])
|
if !(options[:uploadToFabric] || options[:uploadToAppStore])
|
||||||
options[:skip_package_ipa] = true
|
options[:skip_package_ipa] = true
|
||||||
|
|
@ -402,20 +400,32 @@ def get_google_services_plist_path(app_target_folder_name, configuration_type)
|
||||||
File.expand_path "../#{app_target_folder_name}/Resources/#{configuration_type.prefix}-GoogleService-Info.plist"
|
File.expand_path "../#{app_target_folder_name}/Resources/#{configuration_type.prefix}-GoogleService-Info.plist"
|
||||||
end
|
end
|
||||||
|
|
||||||
def generate_enabled_features_extension(options)
|
def generate_enabled_features_extension_if_needed(options)
|
||||||
app_target_folder_name = options[:appName] || $appName
|
app_target_folder_name = options[:appName] || $appName
|
||||||
|
|
||||||
project_features_file_path = File.expand_path "../#{app_target_folder_name}/Resources/Features/Enabled.swift"
|
project_enabled_features_file_path = File.expand_path "../#{app_target_folder_name}/Resources/Features/Enabled.swift"
|
||||||
build_settings_file_path = File.expand_path "../common/build_settings.yaml"
|
build_settings_file_path = File.expand_path "../common/build_settings.yaml"
|
||||||
|
|
||||||
builder_features_list = options[:features]
|
unless is_feature_extension_needed?(options, project_enabled_features_file_path)
|
||||||
.split(",").map { |feature_name| feature_name.strip } # [ "Feature1", "Feature2", "Feature3" ]
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if options[:features].nil?
|
||||||
|
builder_features_list = [] # If Enabled.swift exists and features option is nil we need to create empty extension to avoid unexpected features
|
||||||
|
else
|
||||||
|
builder_features_list = (options[:features] || [])
|
||||||
|
.split(",").map { |feature_name| feature_name.strip } # [ "Feature1", "Feature2", "Feature3" ]
|
||||||
|
end
|
||||||
|
|
||||||
build_settings_features_list = Managers::FileManager.load_from_file_YAML(build_settings_file_path)["features"]
|
build_settings_features_list = Managers::FileManager.load_from_file_YAML(build_settings_file_path)["features"]
|
||||||
|
|
||||||
enabled_features_hash = Touchlane::Features.generate_enabled_features_hash(builder_features_list, build_settings_features_list)
|
enabled_features_extension = Touchlane::Features.generate_enabled_features_extension(builder_features_list, build_settings_features_list)
|
||||||
|
|
||||||
Managers::FileManager.save_data_to_file_in_json(project_features_file_path, features_hash)
|
Managers::FileManager.save_data_to_file(project_enabled_features_file_path, enabled_features_extension)
|
||||||
|
end
|
||||||
|
|
||||||
|
def is_feature_extension_needed?(options, project_enabled_features_file_path)
|
||||||
|
!options[:features].nil? || File.exists?(project_enabled_features_file_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
|
def set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,12 @@ require_relative '../../../../templates/templates'
|
||||||
module Touchlane
|
module Touchlane
|
||||||
class Features
|
class Features
|
||||||
|
|
||||||
def self.generate_enabled_features_hash(builder_features_list, build_settings_features_list)
|
def self.generate_enabled_features_extension(builder_features_list, build_settings_features_list)
|
||||||
|
|
||||||
# Check is entered features contains in configuration file
|
# Check is entered features contains in configuration file
|
||||||
features_diff = builder_features_list - build_settings_features_list
|
features_diff = builder_features_list - build_settings_features_list
|
||||||
|
|
||||||
if !features_diff.empty?
|
unless features_diff.empty?
|
||||||
raise "Unexpected features: " + features_diff.join(', ')
|
raise "Unexpected features: " + features_diff.join(', ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -17,7 +17,7 @@ module Touchlane
|
||||||
enabled_features_extension_template = Templates::FeatureTemplates.enabled_features_extension
|
enabled_features_extension_template = Templates::FeatureTemplates.enabled_features_extension
|
||||||
utils = Managers::TemplateManager.new(builder_features_list)
|
utils = Managers::TemplateManager.new(builder_features_list)
|
||||||
|
|
||||||
utils.render(enabled_features_extension_template).strip.to_hash()
|
utils.render(enabled_features_extension_template).strip
|
||||||
end
|
end
|
||||||
|
|
||||||
private_class_method :new
|
private_class_method :new
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ public extension Feature {
|
||||||
static var enabled: [Feature] {
|
static var enabled: [Feature] {
|
||||||
[
|
[
|
||||||
<% for @item in @items %>
|
<% for @item in @items %>
|
||||||
.<%= @item %>,
|
\.<%= @item %>,
|
||||||
<% end %>
|
<% end %>
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue