RobertGummesson / BuildTimeAnalyzer-for-Xcode

Build Time Analyzer for Swift
MIT License
4.3k stars 260 forks source link

Cannot get the plugin to install correctly #20

Closed plivesey closed 8 years ago

plivesey commented 8 years ago

I installed via alcatraz:

$ ls ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins
Alcatraz.xcplugin       BuildTimeAnalyzer.xcplugin

I've restarted Xcode several times, but I do not see anything under the view menu and Ctrl+Shift+B does nothing. Do you have any recommendations on how to debug?

Btw, I'm using Xcode 7.2.1. Is that supported?

RobertGummesson commented 8 years ago

I have not added support for older Xcode versions. You could however download the project and add the support yourself if you want.

Do defaults read /Applications/Xcode.app/Contents/Info DVTPlugInCompatibilityUUID in the terminal. Then add the UUID you get back to Info.plist under DVTPlugInCompatibilityUUIDs.

plivesey commented 8 years ago

Thanks for the quick response. So currently, 7.3.1 (and above in the future) is supported?

plivesey commented 8 years ago

Adding 7.2.1 support now btw.

RobertGummesson commented 8 years ago

The annoying bit with Xcode plugins is that the UUIDs has to be added manually every time Apple updates Xcode. Xcode 7.3 and 7.3.1 uses the same plugin compatibility UUID so those are the two versions supported as of right now. I'll try to be quick to add more UUIDs when new Xcode versions pop up.

plivesey commented 8 years ago

I created a pull request: https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode/pull/21

plivesey commented 8 years ago

Do 7.2.1 and 7.2 have the same version? I can update the docs.

RobertGummesson commented 8 years ago

Yep, so with your PR, it will support Xcode 7.2 - 7.3.1.

plivesey commented 8 years ago

Here's the new pull request: https://github.com/RobertGummesson/BuildTimeAnalyzer-for-Xcode/pull/22 Screwed up the first one.

plivesey commented 8 years ago

Updating to 7.2 - 7.3.1

plivesey commented 8 years ago

Updated

RobertGummesson commented 8 years ago

Thanks!

plivesey commented 8 years ago

How does this get updated in Alcatraz?

plivesey commented 8 years ago

Asking to see if I can avoid downloading 7.3 😛 Our project only builds on 7.2.1 right now.

RobertGummesson commented 8 years ago

Alcatraz updates right away and should be working for 7.2.1 already.

...alternatively you can build the plugin yourself.

plivesey commented 8 years ago

I can't build because the code isn't compatible with 7.2.1. I could convert the code, or download 7.3.1, but I'm lazy. :)

plivesey commented 8 years ago

Hmmm. Doesn't seem to be working installing from alcatraz. I tried reinstalling and rebooting Xcode. Ideas on how to debug?

plivesey commented 8 years ago

It looks like everything in the plugin is empty:

plivesey-mn3:BuildTimeAnalyzer.xcplugin plivesey$ ls Contents/MacOS/
plivesey-mn3:BuildTimeAnalyzer.xcplugin plivesey$ ls Contents/Resources/
plivesey commented 8 years ago

I'm not sure how plugins work. Does it run the code locally? If so, it may not work because the code can't compile on 7.2.1?

plivesey commented 8 years ago

Yep. Fixed the code to work on 7.2.1 and it works locally now. I'm guessing that was the problem. How do you feel about downgrading the code to be 7.2.1 friendly?

Changes:

selector doesn't exist (need to use "selector:" instead)

need to add a NSObject.Type cast here: guard let windowController = NSClassFromString("IDEWorkspaceWindowController") as? NSObject.Type else { return nil }

RobertGummesson commented 8 years ago

Not too keen on downgrading since I am on Xcode 7.3.1 myself. I'm not sure if Xcode is to blame though. I think this is Swift 2.2 which came with Xcode 7.3. Wonder if there is a way to check at compile time similar to checking iOS version if #available(iOS 9.0, *).

plivesey commented 8 years ago

I would have thought the "" selector syntax also works on 7.3.1? (Yeah totally agree that we shouldn't break 7.3.1. I was hoping to support both).

plivesey commented 8 years ago

AFAIK, there is no way to detect swift compiler version...in the past for this, we've created precompile macros and changed them manually. This won't work here though.

plivesey commented 8 years ago

Here's the pull request. Can you try it with 7.3 and see if it works?

RobertGummesson commented 8 years ago

I compiles but with warnings so I'd prefer to keep the more future proof Swift 2.2 selectors.

plivesey commented 8 years ago

Got it. In that case, I'd revert my commits. There is a #if swift(>=2.2) command, but that only works on Xcode 7.3 :(

So don't see anyway of getting this working. I can run locally though, so I'm unblocked :)

RobertGummesson commented 8 years ago

Ah, almost. :)

plivesey commented 8 years ago

Thanks for your help. I wrote a really dumb script to do this, but this is way better :). We're trying to upgrade to 7.3 soon, but the build machinery is way flakier than 7.2.1 (simulator is way less stable on CI machines).