Regenerating a common managed-object model
Regenerating a common managed-object model
- Subject: Regenerating a common managed-object model
- From: Fritz Anderson <email@hidden>
- Date: Fri, 20 Jul 2012 15:00:33 -0500
I'd like to be able to force the regeneration of a .momd package in the build of a command-line tool target.
I have a work project (a RL task, not an Xcode project window/file) that will produce applications for the command line, Mac GUI, and iOS. The command-line tool builds a Core Data store, which the Mac and iOS apps access read-only (not concurrent with the build).
It's therefore vital that I keep the managed-object models (MOMs) that they use in sync. (The apps embed the .momd in their packages, the tool takes a path in its arguments.)
This is going to be tricky in many ways, and I'd like to address the first. Here's what happened:
I changed the data model file for my projects (an integer attribute became string). The data model is among the files in the compile-sources build phase for the command-line tool. I built and ran the tool. It crashed because I attempted to fill an integer attribute with a string value; the revised model hadn't made it into the .mom file. Examining the modification date on the .mom file confirms this.
Examining the build logs, and experimentation, confirm that so long as a .momd directory already exists, the data-model compiler won't be run. Deleting the .momd gets the build system to generate an up-to-date MOM.
I'd rather not manually delete the MOM every time I change the data model. It's error-prone. The .app products can't readily be built until the command-line tool is mostly finished, so that's not a solution now, and again I'd have to remember to do it. (Getting all three to share a .momd is a question for later.)
One might suggest a run-script build phase, before the compilation phase, that deletes the .momd, but as far as I know (this had been true in the past), once a build has commenced, the build dependencies are fixed: Deleting an intermediate product before the compilation phase does not trigger a rebuild of the product.
Does anyone know how I can force an automatic rebuild of the .momd?
— F
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden