On Jun 20, 2008, at 1:45 PM, Rush Manbert wrote:
Hi Andrew,
I was hoping you were still around and would reply!
We want Cocoa client-side operations. Our server will be C++, so I
don't expect to get into too much unexplored territory.
phew!
I went ahead and made a Xcode project that builds a framework and a
Cocoa static library, but I haven't tried to use it yet. Once we
have tested our code against it, I will submit a patch.
cool.
What I did was this:
In lib/cocoa, I added a ThriftCocoa subdirectory that contains the
ThriftCocoa Xcode project. (The .xcodeproj bundle, info.plist, etc.)
The project has two targets. One called ThriftCocoa generates a
Cocoa framework. The other, called thriftcocoa_mt_s generates a
Cocoa static library that is called libthriftcocoa_dbg_mt_s.a in
Debug and libthriftcocoa_rel_mt_s.a in Release. (The "mt" stands for
"multi-threaded", and the "s" stands for "static".) This is our
internal naming convention, which allows static and dynamic
libraries, as well as both debug and release variants to be
installed in the same directory on OS X. Otherwise you get into
problems with the default linker behavior if you have static and
dynamic libs in the same directory. Both targets contain all of the
source files in the tree under lib/cocoa. So far, I have left the
build settings with their default values, so the build products get
put in a build subdirectory tree of lib/cocoa/ThriftCocoa. I'm going
to need some way to install the libaries and header files. I'll
probably write a shell script for now to get me through my testing.
I don't know what's required for a real patch submission.
sounds good. i haven't put any unit tests or other testing stuff in
place but it's on my "Thrift ToDo" list.
One other thing on a slightly different subject. A colleague was
looking at the gen-cocoa code and made this comment:
"Because things like this:
- (NSArray *) queryActivation: (LsActivation *) proto : (NSString *)
queryStr;
Should actually be:
- (NSArray *) queryActivationWithPrototype: (LsActivation *) proto
andQuery: (NSString *) queryStr;
That is, each parameter gets a name in Cocoa."
agreed.
How would you feel about a patch that changes the code generation in
this way? I think the real thing could generate something like this:
- (NSArray *) queryActivationWithProto: (LsActivation *) proto
andQueryStr: (NSString *) queryStr;
which would conform more to Cocoa conventions, but would change the
Thrift-generated classes for everyone. Maybe we could add a switch
that would turn on this style to the compiler command line args?
Sounds good. I'm not sure how many people are using the Cocoa
bindings right now. It pretty much just a syntax change so i
certainly don't have any objections to just forcing people to change
their code. But probably better to defer to higher authorities on
this one...anybody?
- a