travisjeffery/ClangFormat-Xcode

The Info.plist should specify a principal class (TRVSClangFormat).

masonmark opened this issue · 0 comments

The ClangFormat-Info.plist file should specify the principal class as TRVSClangFormat. This would help people who fork it to hack on it to avoid the case that Xcode seemingly-randomly silently fails to load the plug-in.

If the principal class is not specified, then the plug-in bundle load process will just use whatever class it first encounters as the principal class. But if somebody working on a fork adds a new class to the project in the usual way within Xcode, it has a high chance of being added to the Compile Sources build phase before the TRVSClangFormat class.

If that happens, then the plugin will build fine, but Xcode will just silently fail to load it (because whatever class was selected as the principal class does not implement the required plug-in interface).

In the Xcode build settings editor for the target "ClangFormat", in the Info tab, the plist contents are shown in human-readable form. Using this editor, you can add a value to the list for "Principal class" and set it to "TRVSClangFormat".

This will have the effect of adding the following to the ClangFormat-Info.plist file (and hence the built bundle's Info.plist file):

<key>NSPrincipalClass</key>
<string>TRVSClangFormat</string>

Once that is done, forkers can add classes to the project willy-nilly, without affecting the Xcode plugin load process.