From 4b9bfb81cba1398cd31e0bf36ca309d43c475bd1 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 28 Apr 2023 16:31:59 -0300 Subject: [PATCH] feat(ios): always override xcconfig with user values --- lib/services/xcconfig-service.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/services/xcconfig-service.ts b/lib/services/xcconfig-service.ts index 693f31619e..1b99ffa962 100644 --- a/lib/services/xcconfig-service.ts +++ b/lib/services/xcconfig-service.ts @@ -43,12 +43,12 @@ export class XcconfigService implements IXcconfigService { const escapedSourceFile = sourceFile.replace(/'/g, "\\'"); const mergeScript = `require 'xcodeproj'; - sourceConfig = Xcodeproj::Config.new('${escapedDestinationFile}') - targetConfig = Xcodeproj::Config.new('${escapedSourceFile}') - if(sourceConfig.attributes.key?('IPHONEOS_DEPLOYMENT_TARGET') && targetConfig.attributes.key?('IPHONEOS_DEPLOYMENT_TARGET')) - sourceConfig.attributes.delete('IPHONEOS_DEPLOYMENT_TARGET') + userConfig = Xcodeproj::Config.new('${escapedDestinationFile}') + existingConfig = Xcodeproj::Config.new('${escapedSourceFile}') + userConfig.attributes.each do |key,| + existingConfig.attributes.delete(key) if (userConfig.attributes.key?(key) && existingConfig.attributes.key?(key)) end - sourceConfig.merge(targetConfig).save_as(Pathname.new('${escapedDestinationFile}'))`; + userConfig.merge(existingConfig).save_as(Pathname.new('${escapedDestinationFile}'))`; await this.$childProcess.exec(`ruby -e "${mergeScript}"`); }