无法从Textmate构建XCode 4项目

时间:2011-06-11 02:12:27

标签: xcode xcode4 textmate xcodebuild textmatebundles

我在TextMate中打开了一个新创建的XCode 4项目(通过在TextMate图标上删除项目文件夹,如手册所示),并尝试使用Command-B快捷方式构建它,并为XCode构建选择2。我收到以下错误

xcodebuild: error: invalid option '-activebuildstyle'
Usage: xcodebuild [-project <projectname>] [[-target <targetname>]...|-alltargets] [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild -workspace <workspacename> -scheme <schemeName> [-configuration <configurationname>] [-arch <architecture>]... [-sdk [<sdkname>|<sdkpath>]] [<buildsetting>=<value>]... [<buildaction>]...
       xcodebuild -version [-sdk [<sdkfullpath>|<sdkname>] [<infoitem>] ]
       xcodebuild -list [[-project <projectname>]|[-workspace <workspacename>]]
       xcodebuild -showsdks
Options:
    -usage                print full usage
    -verbose              provide additional status output
    -project NAME         build the project NAME
.
.
.
.

我知道在哪里可以修改正在运行的指定'-activebuildstyle'选项的命令?

命令似乎在TextMate.app/Contents/SharedSupport/Bundles/Xcode.tmbundle/Support/run_xcodebuild.sh

第57/60行有“-activebuildstyle”(第36行设置了STYLEARGNAME变量)。

当然,这可能只是一系列xcode 4 / textmate兼容性问题中的一个错误。

1 个答案:

答案 0 :(得分:3)

你想修改/Applications/TextMate.app/Contents/SharedSupport/Bundles/Xcode.tmbundle/Support/bin/xcode_version.rb来检测xcode 4,替换这一行

@@xcode2dot1_or_later = (version_match != nil && ...

用这个:

xcode4 = /Xcode 4\./.match(version_str)
@@xcode2dot1_or_later = xcode4 || (version_match != nil && ...

您还想修改/Applications/TextMate.app/Contents/SharedSupport/Bundles/Xcode.tmbundle/Support/bin/run_xcodebuild.sh (我注释掉的行是原件)

if [[ -n $TM_BUILDSTYLE ]]; then    
    # If we have an Xcode project, and it doesn't contain the build style we're looking for,
    # accept the active build style in the project.
    if [[ -d $PROJECT_FILE ]] && xcodebuild -project "$PROJECT_FILE" -list | awk 'display == "yes" { sub(/^[ \t]+/, ""); print }; /Build (styles|Configurations)/ { display = "yes" }' |    grep -F "${BUILD_STYLE}" &>/dev/null; then
        BUILD_STYLE="-$STYLEARGNAME $BUILD_STYLE";
    else
        # BUILD_STYLE="-active$STYLEARGNAME"
        BUILD_STYLE=""
    fi
else
    # BUILD_STYLE="-active$STYLEARGNAME"
    BUILD_STYLE=""
fi