Skip to content
Merged
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
58 changes: 2 additions & 56 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,36 +83,6 @@ rescue SystemCallError => error
UI.user_error!("Could not read app configuration file at #{expanded_path}: #{error.message}")
end

def expected_firebase_configuration_from_xcconfig(configuration)
expanded_path = File.expand_path(APP_CONFIG_XCCONFIG_PATH)
UI.user_error!("Missing app configuration file: #{expanded_path}") if !File.file?(expanded_path)

escaped_configuration = Regexp.escape(configuration)
expected_settings = {
firebase_project_id: "EXPECTED_FIREBASE_PROJECT_ID",
google_app_id: "EXPECTED_GOOGLE_APP_ID"
}

expected_settings.to_h do |key, setting|
assignments = File.foreach(expanded_path).filter_map do |line|
assignment = line.match(
/^\s*#{setting}\s*\[\s*config\s*=\s*#{escaped_configuration}\s*\]\s*=\s*(.*)$/
)
next if assignment.nil?

assignment[1].strip
end

if assignments.empty? || assignments.last.empty?
UI.user_error!("Missing #{setting} for #{configuration} in #{expanded_path}")
end

[key, assignments.last]
end
rescue SystemCallError => error
UI.user_error!("Could not read app configuration file at #{expanded_path}: #{error.message}")
end

def expected_google_sign_in_configuration_from_xcconfig(configuration)
expanded_path = File.expand_path(APP_CONFIG_XCCONFIG_PATH)
UI.user_error!("Missing app configuration file: #{expanded_path}") if !File.file?(expanded_path)
Expand Down Expand Up @@ -268,13 +238,6 @@ platform :ios do
end
end

expected_firebase_project_id = expected_configuration[:firebase_project_id].to_s.strip
expected_google_app_id = expected_configuration[:google_app_id].to_s.strip

if expected_firebase_project_id.empty? != expected_google_app_id.empty?
UI.user_error!("Expected Firebase PROJECT_ID and GOOGLE_APP_ID must be provided together")
end

Dir.mktmpdir("devlog-ipa") do |tmpdir|
sh("unzip -q #{Shellwords.escape(ipa_path)} -d #{Shellwords.escape(tmpdir)}")

Expand Down Expand Up @@ -348,13 +311,13 @@ platform :ios do
expected: "true"
)

actual_firebase_project_id = required_plist_value(
required_plist_value(
path: google_service_info_plist_path,
source: "GoogleService-Info.plist",
key: "PROJECT_ID"
)

actual_google_app_id = required_plist_value(
required_plist_value(
path: google_service_info_plist_path,
source: "GoogleService-Info.plist",
key: "GOOGLE_APP_ID"
Expand Down Expand Up @@ -383,14 +346,6 @@ platform :ios do
redact_values: true
)

if !expected_firebase_project_id.empty? && actual_firebase_project_id != expected_firebase_project_id
UI.user_error!("Unexpected PROJECT_ID in GoogleService-Info.plist")
end

if !expected_google_app_id.empty? && actual_google_app_id != expected_google_app_id
UI.user_error!("Unexpected GOOGLE_APP_ID in GoogleService-Info.plist")
end

UI.message("Verified PROJECT_ID in GoogleService-Info.plist")
UI.message("Verified GOOGLE_APP_ID in GoogleService-Info.plist")
end
Expand Down Expand Up @@ -493,7 +448,6 @@ platform :ios do
function_api_base_url: expected_function_api_base_url
)

firebase_configuration = expected_firebase_configuration_from_xcconfig(configuration)
google_sign_in_configuration = expected_google_sign_in_configuration_from_xcconfig(configuration)

if ENV["FASTLANE_XCODEBUILD_SETTINGS_TIMEOUT"].to_s.strip.empty?
Expand Down Expand Up @@ -587,8 +541,6 @@ platform :ios do
bundle_id: APP_IDENTIFIER,
database_id: expected_database_id,
function_api_base_url: expected_function_api_base_url,
firebase_project_id: firebase_configuration[:firebase_project_id],
google_app_id: firebase_configuration[:google_app_id],
client_id: google_sign_in_configuration[:client_id],
reversed_client_id: google_sign_in_configuration[:reversed_client_id],
server_client_id: google_sign_in_configuration[:server_client_id]
Expand Down Expand Up @@ -656,7 +608,6 @@ platform :ios do

lane :upload_testflight_build do
api_key = asc_api_key
firebase_configuration = expected_firebase_configuration_from_xcconfig(TESTFLIGHT_CONFIGURATION)
google_sign_in_configuration = expected_google_sign_in_configuration_from_xcconfig(TESTFLIGHT_CONFIGURATION)
# lane_context는 같은 fastlane 실행 내에서만 유지되므로, 별도 CI step에서는 고정 ipa 경로를 사용한다.
ipa_output_path = lane_context[SharedValues::IPA_OUTPUT_PATH].to_s
Expand All @@ -671,8 +622,6 @@ platform :ios do
bundle_id: APP_IDENTIFIER,
database_id: TESTFLIGHT_DATABASE_ID,
function_api_base_url: function_api_base_url_from_xcconfig(TESTFLIGHT_CONFIGURATION),
firebase_project_id: firebase_configuration[:firebase_project_id],
google_app_id: firebase_configuration[:google_app_id],
client_id: google_sign_in_configuration[:client_id],
reversed_client_id: google_sign_in_configuration[:reversed_client_id],
server_client_id: google_sign_in_configuration[:server_client_id]
Expand All @@ -688,7 +637,6 @@ platform :ios do

lane :upload_appstore_build do
api_key = asc_api_key
firebase_configuration = expected_firebase_configuration_from_xcconfig(APPSTORE_CONFIGURATION)
google_sign_in_configuration = expected_google_sign_in_configuration_from_xcconfig(APPSTORE_CONFIGURATION)
# lane_context는 같은 fastlane 실행 내에서만 유지되므로, 별도 CI step에서는 고정 ipa 경로를 사용한다.
ipa_output_path = lane_context[SharedValues::IPA_OUTPUT_PATH].to_s
Expand All @@ -703,8 +651,6 @@ platform :ios do
bundle_id: APP_IDENTIFIER,
database_id: APPSTORE_DATABASE_ID,
function_api_base_url: function_api_base_url_from_xcconfig(APPSTORE_CONFIGURATION),
firebase_project_id: firebase_configuration[:firebase_project_id],
google_app_id: firebase_configuration[:google_app_id],
client_id: google_sign_in_configuration[:client_id],
reversed_client_id: google_sign_in_configuration[:reversed_client_id],
server_client_id: google_sign_in_configuration[:server_client_id]
Expand Down
Loading