in lib/plugman/pluginHandlers.js [83:130]
install: function (obj, plugin, project, options) {
const src = obj.src;
const custom = !!(obj.custom); // convert to boolean (if truthy/falsy)
const embed = !!(obj.embed); // convert to boolean (if truthy/falsy)
let link;
// If obj.link is not explicitly set, default to pre-link attribute behaviour
if (obj.link === null || obj.link === undefined) {
link = !embed;
} else {
link = String(obj.link).toLowerCase() === 'true';
}
if (!custom) {
const keepFrameworks = keep_these_frameworks;
if (keepFrameworks.indexOf(src) < 0) {
if (obj.type === 'podspec') {
events.emit('error', '"framework" tag with type "podspec" is no longer supported. Please use the "podspec" tag.');
} else {
project.frameworks[src] = project.frameworks[src] || 0;
project.frameworks[src]++;
const opt = { customFramework: false, embed: false, link: true, weak: obj.weak };
events.emit('verbose', util.format('Adding non-custom framework to project... %s -> %s', src, JSON.stringify(opt)));
project.xcode.addFramework(src, opt);
events.emit('verbose', util.format('Non-custom framework added to project. %s -> %s', src, JSON.stringify(opt)));
}
}
return;
}
const srcFile = path.resolve(plugin.dir, src);
const targetDir = path.resolve(project.plugins_dir, plugin.id, path.basename(src));
if (!fs.existsSync(srcFile)) throw new CordovaError(`Cannot find framework "${srcFile}" for plugin ${plugin.id} in iOS platform`);
if (fs.existsSync(targetDir)) throw new CordovaError(`Framework "${targetDir}" for plugin ${plugin.id} already exists in iOS platform`);
const symlink = !!(options && options.link);
copyFile(plugin.dir, src, project.projectDir, targetDir, symlink); // frameworks are directories
// CB-10773 translate back slashes to forward on win32
const project_relative = fixPathSep(path.relative(project.projectDir, targetDir));
// CB-11233 create Embed Frameworks Build Phase if does not exist
const existsEmbedFrameworks = project.xcode.buildPhaseObject('PBXCopyFilesBuildPhase', 'Embed Frameworks');
if (!existsEmbedFrameworks && embed) {
events.emit('verbose', '"Embed Frameworks" Build Phase (Embedded Binaries) does not exist, creating it.');
project.xcode.addBuildPhase([], 'PBXCopyFilesBuildPhase', 'Embed Frameworks', null, 'frameworks');
}
const opt = { customFramework: true, embed, link, sign: true };
events.emit('verbose', util.format('Adding custom framework to project... %s -> %s', src, JSON.stringify(opt)));
project.xcode.addFramework(project_relative, opt);
events.emit('verbose', util.format('Custom framework added to project. %s -> %s', src, JSON.stringify(opt)));
},