Merge pull request #232 from TouchInstinct/feature/support_custom_lane_name_and_scheme

add support for custom scheme and lane name via options
This commit is contained in:
Ivan Smolin 2020-10-20 14:53:12 +03:00 committed by GitHub
commit 50499df38e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 12 deletions

View File

@ -19,10 +19,6 @@ private_lane :installDependencies do |options|
sh("rm -rf #{podsReposPath}")
end
if File.exists? "../Gemfile"
bundle_install(path: "../.gem")
end
cocoapods(
repo_update: true
)
@ -95,7 +91,7 @@ end
private_lane :addShield do |options|
buildNumber = options[:buildNumber]
buildDescription = options[:xcconfig_name] # EnterpriseCustomerDev1WithoutSSLPinningRelease
buildDescription = options[:lane_name] # EnterpriseCustomerDev1WithoutSSLPinningRelease
.split(/(?=[A-Z])/) # -> ["Enterprise", "Customer", "Dev1", "Without", "S", "S", "L", "Pinning", "Release"]
.map { |v| v.gsub(/[[:lower:]]+/, "") }[1..2] # -> ["E", "C", "D1", "W", "S", "S", "L", "P", "R"] -> ["C", "D1"]
.join # -> "CD1"
@ -113,10 +109,10 @@ end
private_lane :buildConfiguration do |options|
appName = options[:appName] || $appName
lane_name = lane_context[SharedValues::LANE_NAME]
lane_name = options[:lane_name] || lane_context[SharedValues::LANE_NAME]
options[:scheme] = appName
options[:xcconfig_name] = lane_name
options[:scheme] = options[:scheme] || appName
options[:lane_name] = lane_name
configuration_type = Touchlane::ConfigurationType.from_lane_name(lane_name)
options = fill_up_options_using_configuration_type(options, configuration_type)
@ -172,12 +168,12 @@ private_lane :buildArchive do |options|
exportOptions = icloudEnvironment.to_s.empty? ? {} : {iCloudContainerEnvironment: icloudEnvironment}
exportOptions[:compileBitcode] = options[:compileBitcode] || false
xcconfig_name = options[:xcconfig_name]
lane_name = options[:lane_name]
configuration = options[:configuration]
xcodeproj_path = options[:xcodeproj_path]
if configuration != "AppStore" # AppStore uses xcconfig choosen in Xcode
set_xcconfig_for_configuration_of_project(xcconfig_name, configuration, xcodeproj_path)
set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
end
gym(
@ -401,7 +397,7 @@ 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"
end
def set_xcconfig_for_configuration_of_project(xcconfig_name, configuration, xcodeproj_path)
def set_xcconfig_for_configuration_of_project(lane_name, configuration, xcodeproj_path)
require 'xcodeproj'
project = Xcodeproj::Project.open(xcodeproj_path)
@ -418,7 +414,7 @@ def set_xcconfig_for_configuration_of_project(xcconfig_name, configuration, xcod
application_targets.each do |target|
build_configuration = target.build_configuration_list[configuration]
config_name = target.name + xcconfig_name
config_name = target.name + lane_name
build_configuration_reference = project.files.select { |f| f.path.start_with?(config_name) }.first
build_configuration.base_configuration_reference = build_configuration_reference
end