使用DOxygen问题编写Xcode文档脚本

时间:2010-08-09 21:32:47

标签: xcode doxygen

我试图通过duckrowing(http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/)来使用以下脚本来记录现有的 xcode项目。

 #
# 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

但是,我收到了这些错误

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

在脚本输出的早期(在构建之后的xcode窗口中),我看到了这些消息:

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

我认为问题是完整路径实际上是

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

我正在假设空白是罪魁祸首。所以我尝试了两种方法:

$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/

但是所有人都给出了与上面相同的Osascript错误。此外,docset不会构建到请求的目录

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

我已经摸了一会儿,但是无法弄清问题是什么。一个假设是我在一个不是新项目的项目上运行Doxygen。要处理此EXTRACT_ALL设置为YES(应该删除所有警告消息,但我也会收到19个警告)。

非常感谢任何帮助

谢谢

Peyman的

2 个答案:

答案 0 :(得分:1)

我建议您在shell脚本中使用它时双引号"$SOURCE_ROOT"

答案 1 :(得分:0)

Mouviciel ....我想出来......需要将整个变量放在括号中,即$(SOURCE_ROOT)。

谢谢你的帮助