Skip to content

Commit 9d908c4

Browse files
erisuvijaysharm
andauthored
feat: add support for runOnlyForDeploymentPostprocessing (#172)
* Add support for runOnlyForDeploymentPostprocessing * Add Test for runOnlyForDeploymentPostprocessing * fix(runOnlyForDeploymentPostprocessing): only allow 0 or 1, defaulting invalid values to 0 * fix(runOnlyForDeploymentPostprocessing): any truthy value, it will be set to 1, including any non-empty strings --------- Co-authored-by: Vijay Sharma <vijay.sharm@gmail.com>
1 parent 2f89486 commit 9d908c4

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

lib/pbxProject.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1615,6 +1615,12 @@ function pbxShellScriptBuildPhaseObj (obj, options, phaseName) {
16151615
obj.shellPath = options.shellPath;
16161616
obj.shellScript = '"' + options.shellScript.replace(/"/g, '\\"') + '"';
16171617

1618+
// By default, runOnlyForDeploymentPostprocessing is set to 0.
1619+
// Any truthy value, it will be set to 1, including any non-empty strings.
1620+
if (options.runOnlyForDeploymentPostprocessing) {
1621+
obj.runOnlyForDeploymentPostprocessing = 1;
1622+
}
1623+
16181624
return obj;
16191625
}
16201626

test/addBuildPhase.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,10 @@ describe('addBuildPhase', () => {
191191
assert.equal(buildPhase.shellPath, '/bin/sh');
192192
assert.equal(buildPhase.shellScript, '"echo \\"hello world!\\""');
193193
});
194+
195+
it('should add runOnlyForDeploymentPostprocessing option to run scripts', () => {
196+
const options = { shellPath: '/bin/sh', shellScript: 'echo "hello world!"', runOnlyForDeploymentPostprocessing: 1 };
197+
const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
198+
assert.equal(buildPhase.runOnlyForDeploymentPostprocessing, 1);
199+
});
194200
});

0 commit comments

Comments
 (0)