I have a “Run Script” phase on my target that renders a PDF manual. I want to include this manual in my Xcode archive of the product.
How do I tell Xcode from a script what files to add to its archive during the Archive phase?
Currently, the script places the PDF in BUILT_PRODUCTS_DIR, but this appears not to suffice.
xsltproc -o >(fop -fo - -pdf "$BUILT_PRODUCTS_DIR/doc/$TARGET_NAME.pdf") \
--stringparam use.extensions 0 \
--stringparam fop1.extensions 1 \
--stringparam draft.mode no \
--stringparam admon.graphics 1 \
--stringparam admon.graphics.extension .svg \
/opt/local/share/xsl/docbook-xsl/fo/docbook.xsl \
"$TARGET_NAME/manual.xml"
You can add a post build script to the Archive action, using the ARCHIVE_PRODUCTS_PATH environment variable.
Add a post action run script:
Your file will be included in the archive, you can see it by showing the package contents of the archive, or sharing the built products of the archive.
You can see all the environment variables available by adding a run script that runs
printenvthen checking the output in the Console application in system.log.