From ddde70a9a72b9564e2476cba687dfdb1167a5852 Mon Sep 17 00:00:00 2001 From: Marco Saia Date: Fri, 31 May 2024 12:40:40 +0200 Subject: [PATCH] Added support for 'alwaysOutOfDate' PBX Shell Script property --- lib/pbxProject.js | 4 ++++ test/addBuildPhase.js | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/lib/pbxProject.js b/lib/pbxProject.js index 1133940f..79ff2cc5 100644 --- a/lib/pbxProject.js +++ b/lib/pbxProject.js @@ -1644,6 +1644,10 @@ function pbxShellScriptBuildPhaseObj(obj, options, phaseName) { obj.shellPath = options.shellPath; obj.shellScript = '"' + options.shellScript.replace(/"/g, '\\"') + '"'; + if (options.alwaysOutOfDate !== null) { + obj.alwaysOutOfDate = options.alwaysOutOfDate; + } + return obj; } diff --git a/test/addBuildPhase.js b/test/addBuildPhase.js index eb105f80..c1ace69f 100644 --- a/test/addBuildPhase.js +++ b/test/addBuildPhase.js @@ -194,4 +194,26 @@ exports.addBuildPhase = { test.equal(buildPhase.shellScript, '"echo \\"hello world!\\""'); test.done(); }, + 'should add the PBXBuildPhase with alwaysOutOfDate property': function (test) { + var options = { + shellPath: '/bin/sh', + shellScript: 'test', + alwaysOutOfDate: true + }; + + var buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase; + test.equal(buildPhase.shellPath, '/bin/sh'); + test.equal(buildPhase.shellScript, '"test"'); + test.equal(buildPhase.alwaysOutOfDate, 1); + test.done(); + }, + 'should add the PBXBuildPhase without alwaysOutOfDate property': function (test) { + var options = {shellPath: '/bin/sh', shellScript: 'test'}; + + var buildPhase = proj.addBuildPhase([], 'PBXShellScriptBuildPhase', 'Run a script', proj.getFirstTarget().uuid, options).buildPhase; + test.equal(buildPhase.shellPath, '/bin/sh'); + test.equal(buildPhase.shellScript, '"test"'); + test.equal(buildPhase.alwaysOutOfDate, null); + test.done(); + }, }