Giter VIP home page Giter VIP logo

Comments (28)

rentzsch avatar rentzsch commented on August 19, 2024

Yup, Xmo'd doesn't work with Xcode 4 since v4 doesn't load .pbplugins any more. This looks interesting as a way to migrate Xmo'd to an .xcplugin.

Once loaded, the next obstacle is to discover whether swizzling -[XDPersistenceDocumentController saveModelToFile:] is still the best way to get notifications of model file changes.

Finally, how much you wanna bet Apple changed/broke Xcode's AppleScript interface, so chances are there's work to be done there as well.

If Xcode seriously breaks the AppleScript interface again, I'm of the opinion that a pure Obj-C implementation would be preferable. We'd have to use a lot more internal APIs, but Xcode's internal APIs are more stable and make more sense than their AppleScript interface,

from mogenerator.

vguerci avatar vguerci commented on August 19, 2024

I tried to port AppleScript for Xcode 4. It can be done, but that's awful... I guess Applescript coding is not completed yet. Imho, that GM of Xcode 4 is anyway more a RC / Beta than a gold. But I still prefer it and use it.
For now, I use mogenerator from command line... (and if really needed use Xmod from v3)

That Xcode plugin template is quite empty and pretty useless... :( but i agree native plugin is THE way. AppleScript, you know, bleh. Xcode internal APIs are not documented, isn't?

from mogenerator.

MonsieurDart avatar MonsieurDart commented on August 19, 2024

Thanks for your quick help guys! I'll do as you do: use the command line, or maybe add it to the target if I need it to be automatized...

from mogenerator.

vguerci avatar vguerci commented on August 19, 2024

Side note, GTM provides a xcplugin source code, with class-dump-ed Xcode headers...
A good base to start a mogenerator plugin imho :)
http://code.google.com/p/google-toolbox-for-mac/source/browse/#svn/trunk/XcodePlugin

from mogenerator.

prime31 avatar prime31 commented on August 19, 2024

Has anyone come up with a solution to the AppleScript breaking? The only outstanding issue I see is that a file reference can no longer be added to a build phase (add modelSrcFileRef to targetItr). I have tried everything under the sun to get this to work but have not successfully added a single file to any phase...

from mogenerator.

vguerci avatar vguerci commented on August 19, 2024

Could you gist your changes? I would help with pleasure.
Last attempt I did on Beta was horrible, Applescript API wasn't done, from what I've just seen, it looks now more complete...

from mogenerator.

prime31 avatar prime31 commented on August 19, 2024

vguerci, I don't have any changes to gist. Everything I tried failed. I tried manually creating the build files which didnt work, creating the file references while in the context of the build phase and anything else I could think of all failed.

from mogenerator.

vguerci avatar vguerci commented on August 19, 2024

I've just gave a look into Xcode 4 Applescript... Thought it was better than beta, it is not. Still a terrible mess I think... But maybe I'm missing something.
Where you could simply get xmod data model by using:
set modelList to every file reference of _project whose file kind is "wrapper.xcdatamodel" and comments contains "xmod", you now have (like in Xcode beta) to recursive browse groups / items hierarchy to get it. (please tell me I'm wrong)

There is a (new?) appealing Xcode application > data model property, which just brings... nothing.
And those To be removed suite and Xcode 3 xxxx types are just... scary.
I don't think I'll look further in this for a while... maybe at next Xcode version or maybe directly in a native coded obj-c .xcplugin...

from mogenerator.

rentzsch avatar rentzsch commented on August 19, 2024

vguerci and prime31:

I really appreciate you guys digging into this. The first time I'll have to look at this is late next week. Godspeed on your efforts :-)

from mogenerator.

noirs avatar noirs commented on August 19, 2024

Any news regarding Xmo'd Xcode 4 compatibility?

from mogenerator.

marzapower avatar marzapower commented on August 19, 2024

I too am in the list of those who carefully await for your hard work to be completed! Any news?

from mogenerator.

vguerci avatar vguerci commented on August 19, 2024

I'm afraid doing an Xcode 4 plugin with that no so documented API is not that easy.
And that could easily break with Xcode versions upgrades...

That's really a weak point of Xcode, Visual Studio in comparison has tons of wonderful add-ons thanks to its (probably documented) API.

I'm still using command-line, with manually adding files to Xcode project... still a good productivity boost. :)

from mogenerator.

marzapower avatar marzapower commented on August 19, 2024

I'm using the command line tool too, and that's not bad! I think it will suffice, thank you!

from mogenerator.

mknippen avatar mknippen commented on August 19, 2024

have we found any solution to this? If not, is there a good place for documentation on the command line tool version?
With Xcode 3 pretty much gone, this will soon be our only option.

from mogenerator.

marzapower avatar marzapower commented on August 19, 2024

The best guide I've found to the command line tool is at this page:
http://stackoverflow.com/questions/3589247/how-do-the-mogenerator-parameters-work-which-can-i-send-via-xcode

I do not think anyone has ported this project to Xcode 4 yet. The command
line tool works just great, by the way!

2011/6/14 mknippen <
[email protected]>

have we found any solution to this? If not, is there a good place for
documentation on the command line tool version?
With Xcode 3 pretty much gone, this will soon be our only option.

Reply to this email directly or view it on GitHub:
#48 (comment)

from mogenerator.

Burnsoft avatar Burnsoft commented on August 19, 2024

for those that have mogenerator working via command line in xcode 4, can you put together a very simplistic dummies guide? would be very much appreciated.

from mogenerator.

rentzsch avatar rentzsch commented on August 19, 2024

burnsoft: mogenerator --help gives pretty-good list of mogenerator's arguments. Personally, before Xmo'd, I used to keep a mogenerate.command double-clickable shell script that I would manually run after modifying a model. Here's an example mogenerate.command file.

from mogenerator.

danieldickison avatar danieldickison commented on August 19, 2024

I've been creating a separate Xcode build target that contains just a shell script build phase to run the command line tool. It's pretty quick to switch to that target after making any model changes.

But adding and removing new and deleted .h and .m files from the project is still a manual process. Is there any way to automate those short of an Xcode plugin?

from mogenerator.

rentzsch avatar rentzsch commented on August 19, 2024

danieldickison: check out the --includem and master's --includeh options

from mogenerator.

Burnsoft avatar Burnsoft commented on August 19, 2024

ok, so I'm in the folder where my model is:
mogenerator --model myModel.xcdatamodeld --base-class People
but I get this:
Assertion failed: (model), function -[MOGeneratorApp setModel:], file /Users/wolf/code/github/mogenerator/mogenerator.m, line 432.
Abort trap

any ideas?

from mogenerator.

Burnsoft avatar Burnsoft commented on August 19, 2024

and am I correct in assuming that mogenerator will create both the Model and _Model files if I just use
mogenerator --model myModel.xcdatamodeld

?
thanks for all the help so far.

from mogenerator.

marzapower avatar marzapower commented on August 19, 2024

You have to point to the correct model, not the parent directory. I.e.
something like this:

mogenerator --model myModel.xcdatamodeld/myModel.xcdatamodel

2011/6/15 Burnsoft <
[email protected]>

and am I correct in assuming that mogenerator will create both the Model
and _Model files if I just use
mogenerator --model myModel.xcdatamodeld

?
thanks for all the help so far.

Reply to this email directly or view it on GitHub:
#48 (comment)

from mogenerator.

Burnsoft avatar Burnsoft commented on August 19, 2024

thankyou

from mogenerator.

vguerci avatar vguerci commented on August 19, 2024

Here is a small script I use that auto pick current version of a versioned model, that could help :

modeld=MyApp.xcdatamodeld
modelversion=$(/usr/libexec/PlistBuddy -c 'print _XCCurrentVersionName' $modeld/.xccurrentversion)
model=$modeld/$modelversion
echo "Mo'Generating code for $model..."
mogenerator -m "$model"\
 --base-class MyBaseManagedObject\
 --template-path templates\
 --machine-dir Generated\
 --includeh MyModelEntities.h

from mogenerator.

larsxschneider avatar larsxschneider commented on August 19, 2024

I wrote an Xcode plugin that might help with the situation: https://github.com/larsxschneider/Xcode-Scripting-Interface
What project modifications do you want to perform? I can add them!

from mogenerator.

adib avatar adib commented on August 19, 2024

Here is a script that I use to update the generated files. Put this in a subfolder of your project (like BuildScripts for example)

#!/bin/sh

#  update_mo.sh
#  Updates Core Data generated classes - requires mogenerator
#
#  Created by Sasmito Adibowo on 28-11-11.

baseClass=NSManagedObject

function update_model()
{

    fileDir=`dirname "${1}"`
    curVer=`/usr/libexec/PlistBuddy "${1}/.xccurrentversion" -c 'print _XCCurrentVersionName'`

    echo mogenerator  --model "${1}/$curVer" --output-dir "${fileDir}/" --base-class $baseClass  --template-var arc=true
    mogenerator  --model "${1}/$curVer" --output-dir "${fileDir}/" --base-class $baseClass  --template-var arc=true
}

find .. -iname \*.xcdatamodeld -print0 | while read -d $'\0' i; do update_model "$i"; done

from mogenerator.

rentzsch avatar rentzsch commented on August 19, 2024

larsxschneider: thanks for the offer, but if it comes down to bypassing AppleScript and using Xcode internals to update group files, I'd prefer if Xmo'd did that directly. But I'll probably be able to poach from your code, thanks!

from mogenerator.

justin avatar justin commented on August 19, 2024

Xmod is RIP.

from mogenerator.

Related Issues (20)

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.