Skip to content

Commit 4687604

Browse files
committed
Add support for PBXShellScriptBuildPhase
1 parent b441568 commit 4687604

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

lib/pbxProject.js

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ pbxProject.prototype.addTargetDependency = function(target, dependencyTargets) {
811811
return { uuid: target, target: nativeTargets[target] };
812812
}
813813

814-
pbxProject.prototype.addBuildPhase = function(filePathsArray, buildPhaseType, comment, target, folderType, subfolderPath) {
814+
pbxProject.prototype.addBuildPhase = function(filePathsArray, buildPhaseType, comment, target, optionsOrFolderType, subfolderPath) {
815815
var buildPhaseSection,
816816
fileReferenceSection = this.pbxFileReferenceSection(),
817817
buildFileSection = this.pbxBuildFileSection(),
@@ -827,7 +827,9 @@ pbxProject.prototype.addBuildPhase = function(filePathsArray, buildPhaseType, co
827827
filePathToBuildFile = {};
828828

829829
if (buildPhaseType === 'PBXCopyFilesBuildPhase') {
830-
buildPhase = pbxCopyFilesBuildPhaseObj(buildPhase, folderType, subfolderPath, comment);
830+
buildPhase = pbxCopyFilesBuildPhaseObj(buildPhase, optionsOrFolderType, subfolderPath, comment);
831+
} else if (buildPhaseType === 'PBXShellScriptBuildPhase') {
832+
buildPhase = pbxShellScriptBuildPhaseObj(buildPhase, optionsOrFolderType, comment)
831833
}
832834

833835
if (!this.hash.project.objects[buildPhaseType]) {
@@ -1490,7 +1492,7 @@ function pbxBuildPhaseObj(file) {
14901492
return obj;
14911493
}
14921494

1493-
function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName){
1495+
function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName) {
14941496

14951497
// Add additional properties for 'CopyFiles' build phase
14961498
var DESTINATION_BY_TARGETTYPE = {
@@ -1523,6 +1525,18 @@ function pbxCopyFilesBuildPhaseObj(obj, folderType, subfolderPath, phaseName){
15231525
obj.name = '"' + phaseName + '"';
15241526
obj.dstPath = subfolderPath || '""';
15251527
obj.dstSubfolderSpec = SUBFOLDERSPEC_BY_DESTINATION[DESTINATION_BY_TARGETTYPE[folderType]];
1528+
console.log("pbxCopyFilesBuildPhase");
1529+
console.log(obj);
1530+
1531+
return obj;
1532+
}
1533+
1534+
function pbxShellScriptBuildPhaseObj(obj, options, phaseName) {
1535+
obj.name = '"' + phaseName + '"';
1536+
obj.inputPaths = options.inputPaths || [];
1537+
obj.outputPaths = options.outputPaths || [];
1538+
obj.shellPath = options.shellPath;
1539+
obj.shellScript = '"' + options.shellScript.replace(/"/g, '\\"') + '"';
15261540

15271541
return obj;
15281542
}

0 commit comments

Comments
 (0)