Peyman
Peyman

Reputation: 1068

Scripting Xcode documentation with DOxygen problems

I am trying to use the following script by duckrowing (http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/), to document an existing xcode project.

 #
# Build the doxygen documentation for the project and load the docset into Xcode 
#
# Created by Fred McCann on 03/16/2010.
# http://www.duckrowing.com
#
# Based on the build script provided by Apple:
# http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
#
# Set the variable $COMPANY_RDOMAIN_PREFIX equal to the reverse domain name of your comany
# Example: com.duckrowing
#

DOXYGEN_PATH=/Applications/Doxygen.app/Contents/Resources/doxygen
DOCSET_PATH=$SOURCE_ROOT/build/$PRODUCT_NAME.docset

if ! [ -f $SOURCE_ROOT/Doxyfile] 
then 
  echo doxygen config file does not exist
  $DOXYGEN_PATH -g $SOURCE_ROOT/Doxyfile
fi

#  Append the proper input/output directories and docset info to the config file.
#  This works even though values are assigned higher up in the file. Easier than sed.

cp $SOURCE_ROOT/Doxyfile $TEMP_DIR/Doxyfile

echo "INPUT = $SOURCE_ROOT" >> $TEMP_DIR/Doxyfile
echo "OUTPUT_DIRECTORY = $DOCSET_PATH" >> $TEMP_DIR/Doxyfile
echo "RECURSIVE = YES" >> $TEMP_DIR/Doxyfile
echo "EXTRACT_ALL        = YES" >> $TEMP_DIR/Doxyfile
echo "JAVADOC_AUTOBRIEF        = YES" >> $TEMP_DIR/Doxyfile
echo "GENERATE_LATEX        = NO" >> $TEMP_DIR/Doxyfile
echo "GENERATE_DOCSET        = YES" >> $TEMP_DIR/Doxyfile
echo "DOCSET_FEEDNAME = $PRODUCT_NAME Documentation" >> $TEMP_DIR/Doxyfile
echo "DOCSET_BUNDLE_ID       = $COMPANY_RDOMAIN_PREFIX.$PRODUCT_NAME" >> $TEMP_DIR/Doxyfile

#  Run doxygen on the updated config file.
#  Note: doxygen creates a Makefile that does most of the heavy lifting.

$DOXYGEN_PATH $TEMP_DIR/Doxyfile

#  make will invoke docsetutil. Take a look at the Makefile to see how this is done.

make -C $DOCSET_PATH/html install

#  Construct a temporary applescript file to tell Xcode to load a docset.

rm -f $TEMP_DIR/loadDocSet.scpt

echo "tell application \"Xcode\"" >> $TEMP_DIR/loadDocSet.scpt
echo "load documentation set with path \"/Users/$USER/Library/Developer/Shared/Documentation/DocSets/$COMPANY_RDOMAIN_PREFIX.$PRODUCT_NAME.docset\"" >> $TEMP_DIR/loadDocSet.scpt
echo "end tell" >> $TEMP_DIR/loadDocSet.scpt

#  Run the load-docset applescript command.
osascript $TEMP_DIR/loadDocSet.scpt

exit 0

However, I am getting these errors

Osascript:/Users/[username]/SVN/trunk/Examples: No such file or directory

Earlier in the script output (in xcode window after building) I see these msgs:

Configuration file '/Users/[username]/SVN/trunk/Examples' created

the problem I think is that the full path is actually

'/Users/[username]/SVN/trunk/Examples using SDK'

I was working on the assumption that the whitespaces were the culprit. So I tried two approaches:

$SOURCE_ROOT = "/Users/[username]/SVN/trunk/Examples using SDK"
$SOURCE_ROOT = /Users/[username]/SVN/trunk/Examples\ using\ SDK
set $SOURCE_ROOT to quoted form of POSIX path of /Users/$USER/SVN/trunk/Examples\ using\ SDK/

but all give the same Osascript error as above. Also, the docset is not build into the requested directory

/Users/$USER/Library/Developer/Shared/Documentation/DocSets/$COMPANY_RDOMAIN_PREFIX.$PRODUCT_NAME.docset\

I've scratched my head over this for a while but can't figure out what is the problem. One hypothesis is that I am running Doxygen on a project that is not a new project. To handle this EXTRACT_ALL is set to YES (which should remove all warning messages, but I get 19 warnings too).

Any help would be much appreciated

thank you

Peyman

Upvotes: 1

Views: 2567

Answers (2)

Peyman
Peyman

Reputation: 1068

Mouviciel....i figured it out....needed to put the whole variable in parenthesis i.e. $(SOURCE_ROOT).

thank you for your help

Upvotes: 0

mouviciel
mouviciel

Reputation: 67839

I suggest that you double quote "$SOURCE_ROOT" wherever you use it in your shell script.

Upvotes: 1

Related Questions