Can't build XCode 4 Project from Textmate

2020-06-04 16:49发布

I've opened a newly created XCode 4 project in TextMate (by dropping the project folder on the TextMate icon like the manual suggests) and have attempted to build it using the Command-B shortcut and selecting 2 for an XCode build. I get the following error

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

Any idea where I can modify the command being run that is specifying the '-activebuildstyle' option?

the command seems to be in TextMate.app/Contents/SharedSupport/Bundles/Xcode.tmbundle/Support/run_xcodebuild.sh

line 57/60 has "-activebuildstyle" (the STYLEARGNAME variable being set on line 36).

of course, this may just be one error in a series of xcode 4/textmate compatibility issues.

1条回答
家丑人穷心不美
2楼-- · 2020-06-04 17:46

you want to modify /Applications/TextMate.app/Contents/SharedSupport/Bundles/Xcode.tmbundle/Support/bin/xcode_version.rb to detect xcode 4, replace this line

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

with this:

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

you also want to modify /Applications/TextMate.app/Contents/SharedSupport/Bundles/Xcode.tmbundle/Support/bin/run_xcodebuild.sh ( the lines that I commented-out are the originals )

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 
查看更多
登录 后发表回答