I’ve a multi goal challenge the place each goal depends on a constructed “net bundle” which is mainly a set of html, optimized photographs, and optimized javascript.
Proper now that net bundle is in-built a pre construct step by working a script. The script takes awhile to run and outputs to a folder that’s referenced into the challenge by way of a PBXFileReference which is then referenced within the Copy Bundle Sources step.
96516AC22BF928DD00576562 /* construct */ = {isa = PBXFileReference; lastKnownFileType = folder; identify = construct; path = "../web-ui/construct"; sourceTree = ""; }
....
96516AC32BF928DD00576562 /* construct in Sources */ = {isa = PBXBuildFile; fileRef = 96516AC22BF928DD00576562 /* construct */; };
As a step, I wrote an combination goal that may additionally run this script. I specified its enter and output recordsdata and turned off sandboxing. It does precisely what I would like it to. Critically it’s ran primarily based on dependency evaluation. If I modify any file in web-ui it rebuilds, if I dont I can repeatedly construct the combination goal and it’ll not re-run the script. That is good.
A97590172E419CBA00741928 /* Construct Internet Bundle */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 12;
recordsdata = (
);
inputFileListPaths = (
);
inputPaths = (
"$(SRCROOT)/xcodescripts/build-web-bundle.bash",
"$(SRCROOT)/web-ui/index.html",
"$(SRCROOT)/web-ui/vite-env.d.ts",
"$(SRCROOT)/web-ui/vite.config.ts",
"$(SRCROOT)/web-ui/tsconfig.json",
"$(SRCROOT)/web-ui/stats.html",
"$(SRCROOT)/web-ui/postcss.config.js",
"$(SRCROOT)/web-ui/bundle.json",
"$(SRCROOT)/web-ui/justfile",
"$(SRCROOT)/web-ui/src/",
);
identify = "Construct Internet Bundle";
outputFileListPaths = (
);
outputPaths = (
"$(SRCROOT)/web-ui/construct/",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "exec "${SCRIPT_INPUT_FILE_0}"n";
};
You might discover I reference a src file. That is made attainable by way of a flag USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES
which permits Xcode to test folder dependencies recursively.
The issue is that my different targets don’t routinely acknowledge that they should run the “WebBundle” combination goal to be able to replace a useful resource they copy of their “Copy bundle sources” part.
So I attempted including it as a Goal Dependency.
A9DE685B2E41C9A8005EF4E0 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
goal = A97590132E419C1200741928 /* WebBundle */;
targetProxy = A9DE685A2E41C9A8005EF4E0 /* PBXContainerItemProxy */;
};
Sadly this breaks no matter magic was permitting the script to be run solely when there are net bundle modifications. Each construct it runs the “Construct Internet Bundle” script.
I feel what I’m lacking is a strategy to specify in these different targets {that a} useful resource they’re used to copying from the Xcode PBXFileReference is produced by the combination goal. This fashion they will begin to motive concerning the dependencies.
Different potentialities are that I must be constructing the net bundle to a separate location. Or that these references are by some means damaged in one other manner. To be clear the folder format is as thus
challenge/
iOS/
shopper.xcodeproj
web-ui/
construct/ (net bundle construct is output right here and referenced comparatively)
src/
index.html (and different issues)