DyCI / dyci-main

Dynamic Code Injection Tool for Objective-C
MIT License
1.11k stars 166 forks source link

AppCode plugin and Xcode version #44

Open grav opened 9 years ago

grav commented 9 years ago

AppCode 3 does not rely on xcode-select, instead you choose the desired Xcode version in the Preferences.

But I believe the dyci plugin still relies on xcode-select. Is it possible to make the AppCode version of the plugin aware of the AppCode setting instead of using code-select?

PaulTaykalo commented 9 years ago

Hm. Need to see what's going one there, but when I saw it last time, there's was not a lot API we can use related to AppCode settings.

grav commented 9 years ago

Parsing ~/Library/Preferences/appcode30/options/other.xml works:

$ xpath ~/Library/Preferences/appCode30/options/other.xml "/application/component[@name='XcodeSettings']/option[@name='selectedXcode']/@value"

Found 1 nodes:
-- NODE --
 value="/Applications/Xcode511.app/Contents/Developer"

I might be able to do a patch though I'm not sure how to integrate with the plugin and all that

PaulTaykalo commented 9 years ago

@grav Nice one. :+1: Don't think that I'll be able to get to it till Saturday. So I'll write my thoughts about this:

grav commented 9 years ago

Just got my Java on and recreated the simple bash one-liner above in Java for the plugin:

https://gist.github.com/grav/d8f44d1a2ad527e764dc

(XPathFactory, sheesh ...)

grav commented 9 years ago

Alright, I did a pull request with your suggestions, with the big disclaimer that I didn't test it, since I haven't tried compiling the plugin for AppCode yet!

https://github.com/DyCI/dyci-main/pull/45

grav commented 9 years ago

Okay, now I found out how to link to the correct jars to get the script to compile. I'm still not sure how to build the plugin jar so that I can test it in AppCode. Can you help me out there?

Edit: just for my own reference, this is how I compile:

javac -cp /Applications/AppCode.app/Contents/lib/*:. Support/AppCode/Dyci/src/com/stanfy/dyci/DyciRecompileAndInjectAction.java 
PaulTaykalo commented 9 years ago

Well. The plugin was made long time ago
It was created by InteliJ IDEA http://confluence.jetbrains.com/display/IDEADEV/PluginDevelopment
Read docs there. The plugin version can be outdated
I think you'll be able to do it :)
I'll look to this one on Saturday - a bit busy here.

Also - just to mention - use fallback, to old logic of searching xcode-select, in case if something will be different in AppCode configuration

PaulTaykalo commented 9 years ago

It's may be even faster by using this example:
http://bjorn.tipling.com/how-to-make-an-intellij-idea-plugin-in-30-minutes

grav commented 9 years ago

Thanks for the pointers, I'll look into it!

PaulTaykalo commented 9 years ago

@grav How it's going? need a help? Will have some time to check this out :) Should I wait for you to finish?

grav commented 9 years ago

@PaulTaykalo Didn't get down to looking at the tutorials yet. I did do a pull request with code that now actually compiles, but it is still untested.

It would be great if you could test out the PR. I won't have the time before next week.

grav commented 9 years ago

Okay, I managed to set everything up and build the plugin in IntelliJ 13. I had to download and build with JDK 1.6 from https://developer.apple.com/downloads/index.action in order to get AppCode to accept the plugin (since it's running on JRE 1.6).

However, I get a weird exception in AppCode when it starts up (or maybe it's when I do Ctrl+x the first time only, in any case, the reaction comes quite late):

Null child action in group Run () of class class com.intellij.openapi.actionSystem.DefaultActionGroup, id=com.stanfy.dyci.DyciRecompileAndInjectAction
java.lang.Throwable
    at com.intellij.openapi.diagnostic.Logger.error(Logger.java:113)
    at com.intellij.openapi.actionSystem.DefaultActionGroup.unStub(DefaultActionGroup.java:347)
    at com.intellij.openapi.actionSystem.DefaultActionGroup.getChildren(DefaultActionGroup.java:303)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1261)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$5.compute(ActionManagerImpl.java:1254)
    at com.intellij.openapi.application.impl.ApplicationImpl.runReadAction(ApplicationImpl.java:932)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1254)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1269)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.preloadActionGroup(ActionManagerImpl.java:1248)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.doPreloadActions(ActionManagerImpl.java:1239)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl.access$200(ActionManagerImpl.java:73)
    at com.intellij.openapi.actionSystem.impl.ActionManagerImpl$4.run(ActionManagerImpl.java:1220)
    at com.intellij.openapi.application.impl.ApplicationImpl$8.run(ApplicationImpl.java:419)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
    at java.lang.Thread.run(Thread.java:695)
    at com.intellij.openapi.application.impl.ApplicationImpl$1$1.run(ApplicationImpl.java:149)

I've updated the pull request with the updated .iml and changelog: https://github.com/DyCI/dyci-main/pull/63

Maybe I'll look into it again later this week, but ping me if you have any clues :-)

Edit: when I build the plugin, I get a 100 MB big plugin with all the AppCode libs for some reason, so I haven't pushed the updated plugin.

PaulTaykalo commented 9 years ago

Well, 100 MB plugin is quite a lot :)
I'll look into your pull request later today thank you for your effort :)

PaulTaykalo commented 9 years ago

Thank you @grav Closed with #63 / #64 Wasn't sure how to do it correctly, but it seems, that it worked )

PaulTaykalo commented 9 years ago

Well, we also need to handle 3.1 and later installations