2010-08-09 69 views
1

我正在尝试使用下面的脚本(使用缩小(http://www.duckrowing.com/2010/03/18/documenting-objective-c-with-doxygen-part-ii/))来记录现有的 xcode项目。使用DOxygen问题编写Xcode文档的脚本

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

我想的问题是:

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

不过,我(建成后在Xcode窗口)我看到这些封邮件收到这些错误

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

脚本输出早些时候全路径实际上是

'/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错误。此外,该文档集未建成请求的目录

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

我抓伤我的头在这一段时间,但无法弄清楚是什么问题。一个假设是我在一个不是新项目的项目上运行Doxygen。为了处理这个EXTRACT_ALL被设置为YES(它应该删除所有的警告消息,但是我也得到了19个警告)。

任何帮助,将不胜感激

谢谢

Peyman的

回答

1

我建议你双引号"$SOURCE_ROOT"无论你在你的shell脚本中使用它。

+0

谢谢mouviciel。差不多了。我不得不把$ TMP_DIR放在引号中。但是现在我得到了3个警告:标记输入:输入源/用户/ [USR]/SVN/trunk/Examples'不存在(与其他2个类似的信息一起用于目录名'using'和'SDK')。和1个错误消息:标签OUTPUT_DIRECTORY:Otput目录'/ users/[usr]/SVN/trunk/ExamplesUsingSDK/...'不存在(即删除所有空格)。输出目录正在被写为echo“OUTPUT_DIRECTORY = $ DOCSET_PATH”>>“$ TEMP_DIR”/ Doxyfile,其中DOCSET_PATH =“$ SOURCE_ROOT”/build/$PRODUCT_NAME.docset。 – Peyman 2010-08-10 13:33:17

+0

DoxyFile中的输出目录是正确的,虽然OUTPUT_DIRECTORY =/Users/[USR]/SVN/trunk /使用SDK的示例/..../ StrandsRecs.docset – Peyman 2010-08-10 13:34:34

0

Mouviciel ....我想通了......需要把整个变量放在括号里,例如$(SOURCE_ROOT)。

感谢您的帮助

+0

实际上...这是另一个问题...我不得不跳过这样的名字:echo“INPUT = \”$ Source_ROOT \“ – Peyman 2010-08-10 17:35:38

+0

你能发布更新后的脚本吗?我并不完全跟踪你所做的每一项变更。 – JoePasq 2010-10-25 01:08:46