Skip to content

Commit 04fc2dd

Browse files
feat: support for 'alwaysOutOfDate' PBX Shell Script property (#173)
* Added support for 'alwaysOutOfDate' PBX Shell Script property * feat(alwaysOutOfDate): any truthy value to hard set to 1 --------- Co-authored-by: Marco Saia <marco.saia@datadoghq.com>
1 parent 9d908c4 commit 04fc2dd

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

lib/pbxProject.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1621,6 +1621,12 @@ function pbxShellScriptBuildPhaseObj (obj, options, phaseName) {
16211621
obj.runOnlyForDeploymentPostprocessing = 1;
16221622
}
16231623

1624+
// By default, alwaysOutOfDate is not set and treated as false.
1625+
// Any truthy value, it will be set to 1, including any non-empty strings.
1626+
if (options.alwaysOutOfDate) {
1627+
obj.alwaysOutOfDate = 1;
1628+
}
1629+
16241630
return obj;
16251631
}
16261632

test/addBuildPhase.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,4 +197,26 @@ describe('addBuildPhase', () => {
197197
const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
198198
assert.equal(buildPhase.runOnlyForDeploymentPostprocessing, 1);
199199
});
200+
201+
it('should add the PBXBuildPhase with alwaysOutOfDate property', () => {
202+
const options = {
203+
shellPath: '/bin/sh',
204+
shellScript: 'test',
205+
alwaysOutOfDate: true
206+
};
207+
208+
const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
209+
assert.equal(buildPhase.shellPath, '/bin/sh');
210+
assert.equal(buildPhase.shellScript, '"test"');
211+
assert.strictEqual(buildPhase.alwaysOutOfDate, 1);
212+
});
213+
214+
it('should add the PBXBuildPhase without alwaysOutOfDate property', () => {
215+
const options = { shellPath: '/bin/sh', shellScript: 'test' };
216+
217+
const buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase;
218+
assert.equal(buildPhase.shellPath, '/bin/sh');
219+
assert.equal(buildPhase.shellScript, '"test"');
220+
assert.strictEqual(buildPhase.alwaysOutOfDate, undefined);
221+
});
200222
});

0 commit comments

Comments
 (0)