Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/pbxProject.js
Original file line number Diff line number Diff line change
Expand Up @@ -1621,6 +1621,12 @@ function pbxShellScriptBuildPhaseObj (obj, options, phaseName) {
obj.runOnlyForDeploymentPostprocessing = 1;
}

// By default, alwaysOutOfDate is not set and treated as false.
// Any truthy value, it will be set to 1, including any non-empty strings.
if (options.alwaysOutOfDate) {
obj.alwaysOutOfDate = 1;
}

return obj;
}

Expand Down
22 changes: 22 additions & 0 deletions test/addBuildPhase.js
Original file line number Diff line number Diff line change
Expand Up @@ -197,4 +197,26 @@ describe('addBuildPhase', () => {
const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
assert.equal(buildPhase.runOnlyForDeploymentPostprocessing, 1);
});

it('should add the PBXBuildPhase with alwaysOutOfDate property', () => {
const options = {
shellPath: '/bin/sh',
shellScript: 'test',
alwaysOutOfDate: true
};

const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
assert.equal(buildPhase.shellPath, '/bin/sh');
assert.equal(buildPhase.shellScript, '"test"');
assert.strictEqual(buildPhase.alwaysOutOfDate, 1);
});

it('should add the PBXBuildPhase without alwaysOutOfDate property', () => {
const options = { shellPath: '/bin/sh', shellScript: 'test' };

const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
assert.equal(buildPhase.shellPath, '/bin/sh');
assert.equal(buildPhase.shellScript, '"test"');
assert.strictEqual(buildPhase.alwaysOutOfDate, undefined);
});
});
Loading