From b5aadf1a5817860b8d9d23a836ab9d0fbcfe5291 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 1133940..056baea 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 eb105f8..1913660 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, true); + 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(); + }, }