Coder Social home page Coder Social logo

xcodeproj-format's Introduction

xcodeproj-format

Format Xcode project file (project.pbxproj) exactly the same way Xcode would format it.

Xcode always writes project file in normalized format. External changes to the file may leave it not normalized. If it is still valid, Xcode will read it just fine - but will re-normalize on save. This causes unrelated changes in the file to appear later in commits. Use this tool to keep the file normalized:

Sample Uses

  • Cleanup after merge - especially if conflicts were resolved
  • Cleanup after modifying project file manually or with other tools
  • Detect and reject misformatted or corrupted project files in CI
  • plutil can be used to convert project file to JSON for further processing. This tool can be used to convert it back from JSON to the canonic format.

Install

brew install odnoletkov/tap/xcodeproj-format

Build

git clone https://github.com/odnoletkov/xcodeproj-format
cd xcodeproj-format
xcodebuild
# Produces build/Release/xcodeproj-format

Usage

xcodeproj-format path/to/foo.xcodeproj
xcodeproj-format path/to/foo.xcodeproj/project.pbxproj
xcodeproj-format path1 path2 ...
cd path/to/project
xcodeproj-format

Limitations

  • The tool uses Xcode's internal frameworks so it may break with new version (although this hasn't happened in years)
  • ~1 second overhead to load and initialize Xcode state on each invocation

TODO

  • Daemonize to avoid initialization overhead for back-to-back invocations
  • Add stdin-stdout mode

Credits

xcodeproj-format's People

Contributors

odnoletkov avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

xcodeproj-format's Issues

brew install fails on MacPro M1 machine MacOS 13.4 (22F66)

==> Checking out branch master
Already on 'master'
Your branch is up to date with 'origin/master'.
HEAD is now at c9022b0 Load plugin used by Xcode 11.4
==> Installing xcodeproj-format from odnoletkov/tap
==> xcodebuild install SYMROOT=build DSTROOT=/ INSTALL_PATH=/opt/homebrew/Cellar/xcodeproj-format/0.1/bin
Last 15 lines from /Users/ahmedhassanein/Library/Logs/Homebrew/xcodeproj-format/01.xcodebuild:
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target arm64-apple-macos10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -L/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/EagerLinkingTBDs/Release -L/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/Release -F/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/EagerLinkingTBDs/Release -F/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/Release -filelist /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/arm64/xcodeproj-format.LinkFileList -Xlinker -object_path_lto -Xlinker /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/arm64/xcodeproj-format_lto.o -Xlinker -final_output -Xlinker /opt/homebrew/Cellar/xcodeproj-format/0.1/bin/xcodeproj-format -fobjc-arc -fobjc-link-runtime -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/arm64/xcodeproj-format_dependency_info.dat -o /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/arm64/Binary/xcodeproj-format

Ld /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/x86_64/Binary/xcodeproj-format normal x86_64 (in target 'xcodeproj-format' from project 'xcodeproj-format')
    cd /tmp/xcodeproj-format-20230817-57452-1s0t2b
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -Xlinker -reproducible -target x86_64-apple-macos10.8 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -L/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/EagerLinkingTBDs/Release -L/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/Release -F/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/EagerLinkingTBDs/Release -F/tmp/xcodeproj-format-20230817-57452-1s0t2b/build/Release -filelist /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/x86_64/xcodeproj-format.LinkFileList -Xlinker -object_path_lto -Xlinker /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/x86_64/xcodeproj-format_lto.o -Xlinker -final_output -Xlinker /opt/homebrew/Cellar/xcodeproj-format/0.1/bin/xcodeproj-format -fobjc-arc -fobjc-link-runtime -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/x86_64/xcodeproj-format_dependency_info.dat -o /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/x86_64/Binary/xcodeproj-format
ld: file not found: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/arc/libarclite_macosx.a
clang: error: linker command failed with exit code 1 (use -v to see invocation)

/tmp/xcodeproj-format-20230817-57452-1s0t2b/xcodeproj-format.xcodeproj: warning: The macOS deployment target 'MACOSX_DEPLOYMENT_TARGET' is set to 10.8, but the range of supported deployment target versions is 10.13 to 13.3.99. (in target 'xcodeproj-format' from project 'xcodeproj-format')
** INSTALL FAILED **


The following build commands failed:
        Ld /tmp/xcodeproj-format-20230817-57452-1s0t2b/build/xcodeproj-format.build/Release/xcodeproj-format.build/Objects-normal/x86_64/Binary/xcodeproj-format normal x86_64 (in target 'xcodeproj-format' from project 'xcodeproj-format')
(1 failure)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.