ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Les Hughes <>
Subject RE: Ant perforce task wit '-G'
Date Mon, 26 Nov 2001 09:55:27 GMT

Well, there are two things about linking to p4 through JNI, 1) it's a
platform dep and 2) it's platform dep :-) The p4 tasks already need the p4
client to run so they already have a native depend there. Since the p4 C++
interface doesn't really buy us much I can't se the point in reworking

I think perforce did explore a "pure" Java interface but the word on the
street is that they had some problems, weren't that impressed by Java and
shelved the work.

So, at the moment, it aint broke so I aint fixing it :-) - of course, if
anyone else wants to rework the code then cool. But for Ant 2 the P4 tasks
will probably have a bit of a clean up and rework so perhaps we could
revisit these suggestions then?


P.S. And -G only came in with P4 2001.1, we're still on 99.2 release....

> -----Original Message-----
> From: Kirk Wylie []
> Sent: 25 November 2001 19:04
> To: Rosinus, Michael
> Cc: ''
> Subject: Re: Ant perforce task wit '-G'
> Well, the '-G' option only works in marshalling mode with 
> Python. While my 
> company internally uses the -G option for some of our python-based 
> scripting, it doesn't seem appropriate for use in an Ant 
> task. It would 
> require another dependency on another system (such as 
> Python), or rewriting 
> the entire Python marshalling system in Java, which doesn't 
> seem like such 
> a good idea for this.
> There are two "real" alternatives to parsing the normal command-line 
> options that I can see:
> 1) Use JNI and the P4 integration library. This is definitely 
> doable, and 
> would give you most of what you want, except that it would 
> involve having 
> to ship a platform-specific binary with Ant, which is 
> probably not what you 
> want to do for a project like Ant. Furthermore, it wouldn't 
> really work at 
> all, because the P4 integration library actually doesn't 
> return you any 
> structured output: it returns things in the same form as the 
> command-line 
> system, as text, which you would then have to parse anyway.
> 2) Get Perforce to either open up their protocol or produce a 
> native java 
> implementation. This would also solve the platform 
> compatibility issues, 
> but if their protocol works the way I think it does, which is 
> to have ALL 
> processing (including command-line formatting) happen on the 
> server, it 
> doesn't really help us much at all.
> 3) Get Perforce to un-break their protocol, and document it, to allow 
> structured access to the underlying data to happen on the 
> client. I doubt 
> very much this is going to happen.
> So while the -G option is great for some tasks, I don't think 
> that it's 
> such a good option for Ant integration. I prefer a combination of 
> alternatives 2 and 3, but I very much doubt that they're 
> going to happen 
> any time soon.
> cheers,
> Kirk
> Rosinus, Michael wrote:
> > Hello Leslie, hello Kirk,
> > 
> >  
> > 
> > did you ever try the '-G' option of Perforce to implement the Java 
> > connection? This should make parsing much more safer, shouldn't it?
> > 
> >  
> > 
> > * Python developers will find the -G option extremely useful for 
> > scripting. For instance, to get a dictionary of all fields of a job 
> > whose ID is known, use the following:
> > 
> > job_dict = marshal.load(os.popen('p4 -G job -o ' + job_id, 'r'))
> > 
> > from:
> Cheers, Michael

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message