Comments (28)
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.
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.
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.
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.
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.
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.
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.
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.
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.
Any news regarding Xmo'd Xcode 4 compatibility?
from mogenerator.
I too am in the list of those who carefully await for your hard work to be completed! Any news?
from mogenerator.
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.
I'm using the command line tool too, and that's not bad! I think it will suffice, thank you!
from mogenerator.
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.
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.
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.
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.
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.
danieldickison: check out the --includem
and master's --includeh
options
from mogenerator.
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.
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.
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.
thankyou
from mogenerator.
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.
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.
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.
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.
Xmod is RIP.
from mogenerator.
Related Issues (20)
- Add nullability annotation for primitive setters HOT 2
- scalar methods do not respect the signed types that Core Data forces
- Swift generated code creates NSNumber for boolean types HOT 1
- Generated code crashes with Xcode 8.3 HOT 3
- Issue with setPrimitive...: for Transformable attributes HOT 1
- Inherited entities and compundIndex
- RFC: Swift Codable Attribute Support HOT 6
- Changes on swift42 break `attributeValueScalarType` for enumerations HOT 4
- Implement Codable support for NSManagedObject subclasses HOT 13
- Use scalar properties for primitive data types HOT 3
- generate NSFetchRequest without executing it HOT 3
- There is mo mogenerator's folder in /Library/Application Support after successful installation. HOT 2
- Trying to find swift template files outside of template-group HOT 8
- Attribute's userInfo dictionary HOT 1
- Feature Request: MacPorts support HOT 1
- Swift module name breaks things HOT 1
- Wiki for Template Variables - abstract should read isAbstract
- Is this project maintained? HOT 1
- Transformable property for [NSString] get error.
- mogenerator --configuration does nothing now HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mogenerator.