2010-08-09 68 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