Socket
Socket
Sign inDemoInstall

xcode

Package Overview
Dependencies
Maintainers
1
Versions
1212
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xcode - npm Package Compare versions

Comparing version 0.5.1 to 0.5.2

test/addStaticLibrary.js

6

lib/pbxFile.js

@@ -8,2 +8,3 @@ var path = require('path'),

FRAMEWORK_EXTENSION = /[.]framework/, FRAMEWORK = 'wrapper.framework',
ARCHIVE_EXTENSION = /[.]a$/, ARCHIVE = 'archive.ar',
DEFAULT_SOURCE_TREE = '"<group>"',

@@ -31,2 +32,5 @@ DEFAULT_FILE_ENCODING = 4;

if (ARCHIVE_EXTENSION.test(path))
return ARCHIVE;
// dunno

@@ -63,3 +67,3 @@ return 'unknown';

return 'Sources';
} else if (file.lastType == DYLIB) {
} else if (file.lastType == DYLIB || file.lastType == ARCHIVE) {
return 'Frameworks';

@@ -66,0 +70,0 @@ } else {

@@ -200,2 +200,16 @@ var util = require('util'),

pbxProject.prototype.addStaticLibrary = function (path, opt) {
var file = new pbxFile(path, opt);
file.uuid = this.generateUuid();
file.fileRef = this.generateUuid();
this.addToPbxBuildFileSection(file); // PBXBuildFile
this.addToPbxFileReferenceSection(file); // PBXFileReference
this.addToPbxFrameworksBuildPhase(file); // PBXFrameworksBuildPhase
this.ensureCorrectSearchPaths(file); // make sure it gets built!
return file;
}
// helper addition functions

@@ -407,4 +421,37 @@ pbxProject.prototype.addToPbxBuildFileSection = function (file) {

propReplace(config, 'PRODUCT_NAME', '"' + name + '"');
};
}
pbxProject.prototype.ensureCorrectSearchPaths = function (file) {
var configurations = nonComments(this.pbxXCBuildConfigurationSection()),
INHERITED = '"$(inherited)"',
config, buildSettings, searchPaths;
for (config in configurations) {
buildSettings = configurations[config].buildSettings;
if (unquote(buildSettings['PRODUCT_NAME']) != this.productName)
continue;
if (!buildSettings['LIBRARY_SEARCH_PATHS']) {
buildSettings['LIBRARY_SEARCH_PATHS'] = [INHERITED];
}
buildSettings['LIBRARY_SEARCH_PATHS'].push(searchPathForFile(file, this));
}
}
// a JS getter. hmmm
pbxProject.prototype.__defineGetter__("productName", function () {
var configurations = nonComments(this.pbxXCBuildConfigurationSection()),
config, productName;
for (config in configurations) {
productName = configurations[config].buildSettings['PRODUCT_NAME'];
if (productName) {
return unquote(productName);
}
}
});
// helper recursive prop search+replace

@@ -498,2 +545,23 @@ function propReplace(obj, prop, value) {

function searchPathForFile(file, project) {
return '"\\"$(SRCROOT)/' + project.productName + '\\""';
}
function nonComments(obj) {
var keys = Object.keys(obj),
newObj = {}, i = 0;
for (i; i < keys.length; i++) {
if (!COMMENT_KEY.test(keys[i])) {
newObj[keys[i]] = obj[keys[i]];
}
}
return newObj;
}
function unquote(str) {
if (str) return str.replace(/^"(.*)"$/, "$1");
}
module.exports = pbxProject;

2

package.json

@@ -5,3 +5,3 @@ {

"description": "parser for xcodeproj/project.pbxproj files",
"version": "0.5.1",
"version": "0.5.2",
"main":"index.js",

@@ -8,0 +8,0 @@ "repository": {

@@ -49,3 +49,3 @@ var fullProject = require('./fixtures/full-project')

'should add the PBXFileReference object correctly': function (test) {
var newFile = proj.addHeaderFile('libsqlite3.dylib'),
var newFile = proj.addFramework('libsqlite3.dylib'),
fileRefSection = proj.pbxFileReferenceSection(),

@@ -52,0 +52,0 @@ fileRefEntry = fileRefSection[newFile.fileRef];

@@ -46,2 +46,9 @@ var pbxFile = require('../lib/pbxFile');

'should detect that a .a path means archive.ar': function (test) {
var sourceFile = new pbxFile('libGoogleAnalytics.a');
test.equal('archive.ar', sourceFile.lastType);
test.done();
},
'should allow lastType to be overridden': function (test) {

@@ -83,2 +90,8 @@ var sourceFile = new pbxFile('Plugins/ChildBrowser.m',

test.done();
},
'should be Frameworks for archives': function (test) {
var archive = new pbxFile('libGoogleAnalytics.a');
test.equal('Frameworks', archive.group);
test.done();
}

@@ -124,2 +137,9 @@ }

test.done();
},
'should be "<group>" for archives': function (test) {
var archive = new pbxFile('libGoogleAnalytics.a');
test.equal('"<group>"', archive.sourceTree);
test.done();
}

@@ -126,0 +146,0 @@ }

var pbx = require('../lib/pbxProject'),
buildConfig = require('./fixtures/buildFiles'),
jsonProject = require('./fixtures/full-project'),
fs = require('fs'),

@@ -156,1 +157,11 @@ project;

}
exports['productName field'] = {
'should return the product name': function (test) {
var newProj = new pbx('.');
newProj.hash = jsonProject;
test.equal(newProj.productName, 'KitchenSinktablet');
test.done();
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc