ios – How can an SPM library entry pictures generated by a prebuildCommand plugin? Can SPM plugins expose non-source information, like pictures, to a library goal?

0
36
ios – How can an SPM library entry pictures generated by a prebuildCommand plugin? Can SPM plugins expose non-source information, like pictures, to a library goal?


Let’s think about I’ve an app that has a ton of picture sources concerned in it. My designer is at all times sending me the information in a lossless format. They’re additionally a bit too vibrant. New pictures are coming in from them steadily.

I want to be sure that after I ship the app I’ve already transformed them into a pleasant compressed format. I additionally like to use a coloration grade to make them a bit extra muted.

In a standard Xcode construct I do know I might get one thing going with a run script or construct plugin to routinely preprocess these pictures at any time when I construct the app. Is it a bit lazy of me to make use of Xcode construct for… maybe. However it positive is sweet to know which you could simply put these massive information within the challenge, write a script, configure your construct and at construct time have Xcode run the required scripts to get them right into a good condition.

Within the swift packages world I can not determine find out how to do one thing related. On its floor a plugin would appear to be what I would like. There’s even an thought of a prebuildPlugin with a outputFilesDirectory. In idea it looks like I ought to have the ability to write a plugin that does the identical factor I was doing in Xcode to ensure these pictures received processed as they got here in.

Nonetheless, this seems to not be the case. I get the purpose that modifying the sources of a package deal whilst you construct the package deal is fraught. So maybe we aren’t eager on giving builders a path to take action. However I actually really feel like I’m lacking one thing as a result of the one means I can actually discover to leverage the outputFilesDirectory is to write down a swift supply there that one way or the other embrace what I want. The swift compiler picks these swift sources up and packages every part properly for me. This appears to be what SwiftGen and the OpenAPI generator do. If I have been to write down different information they aren’t compiled into the package deal and I appear to be out of luck.

Does this imply {that a} prebuildPlugin and that outputFilesDirectory are actually solely helpful if youre outputting swift supply information? Is there actually no secure and dependable means for a library that makes use of that plugin to entry different information output?

Positive I can search through the .construct path however this hardly feels strong sufficient for manufacturing. Maybe I might determine find out how to embrace a path to the sources I write and embrace that in a swift supply file however that feels dicey too. Or is that effective?

Is there any means for a library that makes use of a plugin to generate non-swift sources to get to them safely?

LEAVE A REPLY

Please enter your comment!
Please enter your name here