iosxcodebashshellappledoc

Appledoc can't run in Xcode


So I'm following this tutorial for the appledoc generation (http://objcsharp.wordpress.com/2013/09/24/how-to-generate-beautiful-apple-style-documentation-in-xcode-5/). Nothing happens after the build. Here's the script:

#if [ ${CONFIGURATION} == "Release" ]; then
APPLEDOC_PATH=`which appledoc`
if [ $APPLEDOC_PATH ]; then
$APPLEDOC_PATH \
--project-name ${PRODUCT_NAME} \
--project-company "Your Name" \
--company-id "com.yourcompany" \
--output ${PRODUCT_NAME}Docs \
--keep-undocumented-objects \
--keep-undocumented-members \
--keep-intermediate-files \
--no-repeat-first-par \
--no-warn-invalid-crossref \
--exit-threshold 2 \
${PROJECT_DIR}/${PRODUCT_NAME}
fi;
#fi; 

To make sure I install the appledoc correctly, I did the following from the terminal and the doc shows up fine.

appledoc --project-name BabelCPP --project-company "My Name" --company-id com.mycompany --no-create-docset --output ./doc/ ./CaterpillarCount/CaterpillarCount

Am I missing any critical step or setup in Xcode? It seems like the following part didn't execute correctly and it's what terminate this run script:

APPLEDOC_PATH=`which appledoc`
if [ $APPLEDOC_PATH ]; then
$APPLEDOC_PATH \

Solution

  • The default path on OSX is /usr/bin:/bin:/usr/sbin:/sbin, and if you followed the instructions, you would have copied it to /usr/local/bin.

    XCode won't consider changes that you've put into your .bash_profile files, etc, so anything that's launched from it will not have a path (this includes the run script you've posted).

    You can add PATH=$PATH:/usr/local/bin on the line prior to the APPLEDOC_PATH=... line, which should allow it to be found.

    Secondly, you need to have a proper test:

    if [ -n "$APPLEDOC_PATH" -a -x "$APPLEDOC_PATH" ]; then
    

    i.e. test that the variable is set, and that the file is executable that it determines.

    so, altogether:

    PATH=$PATH:/usr/local/bin
    APPLEDOC_PATH=`which appledoc`
    if [ -n "$APPLEDOC_PATH" -a -x "$APPLEDOC_PATH" ]; then