-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not overwrite all targets with same id #545
Changes from 1 commit
f3a137c
160542d
0c24c4b
342396b
86ef135
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -275,12 +275,59 @@ function handleOrientationSettings (platformConfig, infoPlist) { | |
} | ||
} | ||
|
||
// Make sure only update properties from our target project | ||
function updateBuildPropertyLocal(proj, displayName, prop, value, build) { | ||
try { | ||
// Check if we have a valid target - during prepare we do not have it | ||
var target = proj.pbxTargetByName(displayName); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this definitely use the display name, and not the full name? In Cordova apps those are usually the same, but it's not guaranteed (and we provide a way to change the display name). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you give me an example how to change the name - I will test that case. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In config.xml: <name short="MyApp">My Full Application Name</name> In that example, There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes you were right - I have fixed the pbx target retrieval (tried both variants) |
||
|
||
if (target == null || target.buildConfigurationList == null) { | ||
proj.updateBuildProperty(prop, value, build); | ||
} else { | ||
var targetProjectBuildReference = target.buildConfigurationList; | ||
|
||
// Collect the uuid's from the configuration of our target | ||
var COMMENT_KEY = /_comment$/; | ||
var validConfigs = []; | ||
var configList = proj.pbxXCConfigurationList(); | ||
for (var configName in configList) { | ||
if (!COMMENT_KEY.test(configName) && targetProjectBuildReference === configName) { | ||
var buildVariants = configList[configName].buildConfigurations; | ||
for (var i = 0; i < buildVariants.length; i++) { | ||
validConfigs.push(buildVariants[i].value); | ||
} | ||
break; | ||
} | ||
} | ||
|
||
// Only update target props | ||
var configs = proj.pbxXCBuildConfigurationSection(); | ||
for (var configName in configs) { | ||
if (!COMMENT_KEY.test(configName)) { | ||
if (validConfigs.indexOf(configName) == -1) { | ||
continue; | ||
} | ||
|
||
var config = configs[configName]; | ||
if ((build && config.name === build) || (!build)) { | ||
config.buildSettings[prop] = value; | ||
} | ||
} | ||
} | ||
} | ||
} catch (e) { // fallback to default behavior on error | ||
proj.updateBuildProperty(prop, value, build); | ||
} | ||
} | ||
|
||
|
||
function handleBuildSettings (platformConfig, locations, infoPlist) { | ||
var pkg = platformConfig.getAttribute('ios-CFBundleIdentifier') || platformConfig.packageName(); | ||
var targetDevice = parseTargetDevicePreference(platformConfig.getPreference('target-device', 'ios')); | ||
var deploymentTarget = platformConfig.getPreference('deployment-target', 'ios'); | ||
var needUpdatedBuildSettingsForLaunchStoryboard = checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, infoPlist); | ||
var swiftVersion = platformConfig.getPreference('SwiftVersion', 'ios'); | ||
var displayName = platformConfig.shortName && platformConfig.shortName(); | ||
|
||
var proj = new xcode.project(locations.pbxproj); /* eslint new-cap : 0 */ | ||
|
||
|
@@ -300,22 +347,22 @@ function handleBuildSettings (platformConfig, locations, infoPlist) { | |
|
||
if (origPkg !== pkg) { | ||
events.emit('verbose', 'Set PRODUCT_BUNDLE_IDENTIFIER to ' + pkg + '.'); | ||
proj.updateBuildProperty('PRODUCT_BUNDLE_IDENTIFIER', pkg); | ||
updateBuildPropertyLocal(proj, displayName, 'PRODUCT_BUNDLE_IDENTIFIER', pkg); | ||
} | ||
|
||
if (targetDevice) { | ||
events.emit('verbose', 'Set TARGETED_DEVICE_FAMILY to ' + targetDevice + '.'); | ||
proj.updateBuildProperty('TARGETED_DEVICE_FAMILY', targetDevice); | ||
updateBuildPropertyLocal(proj, displayName, 'TARGETED_DEVICE_FAMILY', targetDevice); | ||
} | ||
|
||
if (deploymentTarget) { | ||
events.emit('verbose', 'Set IPHONEOS_DEPLOYMENT_TARGET to "' + deploymentTarget + '".'); | ||
proj.updateBuildProperty('IPHONEOS_DEPLOYMENT_TARGET', deploymentTarget); | ||
updateBuildPropertyLocal(proj, displayName, 'IPHONEOS_DEPLOYMENT_TARGET', deploymentTarget); | ||
} | ||
|
||
if (swiftVersion) { | ||
events.emit('verbose', 'Set SwiftVersion to "' + swiftVersion + '".'); | ||
proj.updateBuildProperty('SWIFT_VERSION', swiftVersion); | ||
updateBuildPropertyLocal(proj, displayName, 'SWIFT_VERSION', swiftVersion); | ||
} | ||
|
||
updateBuildSettingsForLaunchStoryboard(proj, platformConfig, infoPlist); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should add a new property here for
multipleProvisioningProfiles
vs changing the existingprovisioningProfile
property to accept either a single string or an array.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess thats a better approach - i will change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to revert the idea - merging the two options do not work and require more refactoring. So I suggest to add this additional parameter which is only used for the export plist.