2012-03-30 55 views
1

是否可以使用xcode 4中的構建階段刪除文件,基於它是發佈還是開發?使用構建階段刪除文件?

如果有的話有人得到了一個例子嗎?

我曾嘗試:

 if [ "${CONFIGURATION}" = "Debug" ]; then 
     find "$TARGET_BUILD_DIR" -name '*-live.*' -print0 | xargs -0 rm 
     fi 

這將打印CopyStringsFile

"build/Debug-iphonesimulator/Blue Sky.app/PortalText-live.strings" CDL/PortalText-live.strings 
cd "/Users/internet/Desktop/iPhone Template/iPhonePortalTemplate/CDL.Labs" 
setenv PATH "/Developer/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" 
builtin-copyStrings --validate --inputencoding utf-8 --outputencoding binary --outdir "/Users/internet/Desktop/iPhone Template/iPhonePortalTemplate/CDL.Labs/build/Debug-iphonesimulator/Blue Sky.app" -- CDL/PortalText-live.strings 

但是否真正從包中刪除文件。

回答

3

我有過不同文件的唯一方法是擁有一個單獨的目標,並且只包含特定目標中的某些文件。

編輯舉例

好的,我在另一個項目中完全一樣。我們有一個DefaultProperties.plist文件,它包含在目標文件中。

然後,我們有3個副本,不包括在目標ProdProperties.plist,TestProperties.plist,UatProperties.plist中。

我們使用xcodebuild爲命令行環境構建,因爲它是使用自動構建服務器(Bamboo)構建的。

此前執行xcodebuild聯編,我們會運行以下命令:

cp -vf "./Properties/Environments/${environment}Properties.plist" ./Properties/shared/DefaultProperties.plist 
touch Properties/shared/DefaultProperties.plist 

與$(環境)被傳遞到腳本。

你可以用Xcode中的RunScript階段做這樣的事情。

+0

我有兩個不同的文件的原因是我打電話給一個Web服務,並有一個開發版本和一個實時版本,所以我有我所稱的backoffice-dev/live.xml文件,處理所有的url和其他配置要求不同的版本我有我的代碼在appdelegate.m中選擇正確的文件,但沒有意義的是在那裏有額外的文件,所以想在構建階段刪除,它不是那麼重要,如果它可以'那麼就做吧。我只是想我會問。 – Popeye 2012-03-30 17:08:10