tags:

views:

85

answers:

2

Hi

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

A: 

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

mouviciel
thanks mouviciel. Almost there. I had to put $TMP_DIR in quotes too. But now I get 3 warnings: Tag INPUT: input source /users/[USR]/SVN/trunk/Examples' does not exist (together with 2 other similar msgs for the rest of the directory name 'using' and 'SDK') and 1 error msg: Tag OUTPUT_DIRECTORY: Otput directory '/users/[usr]/SVN/trunk/ExamplesUsingSDK/...' does not exist (i.e all the spaces are removed). output dir is being written as echo "OUTPUT_DIRECTORY = $DOCSET_PATH" >> "$TEMP_DIR"/Doxyfile, where DOCSET_PATH="$SOURCE_ROOT"/build/$PRODUCT_NAME.docset.
Peyman
the output directory in the DoxyFile is correct though OUTPUT_DIRECTORY = /Users/[USR]/SVN/trunk/Examples using SDK/..../StrandsRecs.docset
Peyman
A: 

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

thank you for your help

Peyman
actually...it was another problem...i had to escape the name as such: echo "INPUT = \"$Source_ROOT\"
Peyman
Can you post the updated script? I'm not entirely tracking every change you made.
JoePasq