Re: How to use buildtool?

Ivan Vučica <[email protected]> Sat, 23 Jan 2016 19:12:10 +0000
Newsgroups gmane.comp.lib.gnustep.user
Message-ID <CAGPLYoS5m1DWQpv0q7pbEc5RZL7LOUwucekZa-po0E94x7DMVg__6730.42175262726$1453586728$gmane$org@mail.gmail.com>
--===============2592506189937129993==
Content-Type: multipart/alternative; boundary=001a11410bda6d3289052a051d45

--001a11410bda6d3289052a051d45
Content-Type: text/plain; charset=UTF-8

[help-gnustep to bcc, +to discuss-gnustep]

On Fri, Jan 22, 2016 at 2:58 PM Richard Kennaway <[email protected]>
wrote:

> (Is this list dead? No postings for two years. Where else should I take
> this enquiry?)
>

http://www.gnustep.org/information/gethelp.html
Consider discuss-gnustep :-)


> I have a command-line tool written in C++ and built with XCode on a Mac,
> which I'm trying to port to a Linux machine.  I came across buildtool,
> which promises to interpret the Xcode project file and carry out the build
> using the gnustep tools.  I've installed gnustep, xcode, and buildtool, but
> it is not clear to me how to use buildtool. No documentation comes with it
> and I've found none on the web.


Your choice to read the source code was the right one because, luckily,
this is a very short and simple tool, with easy to follow code. (What
follows is merely an interpretation while coming up with this email; I've
never really used buildtool before. I could be wrong!)


> From reading the source code, it takes two arguments, the name of the
> Xcode project and a command to buildtool to tell it what to do with it.  I
> see nothing in the source to reveal what commands are available, except
> that the default is "build".  When I try that, buildtool begins by
> attempting to build a target that I don't want to build for this platform
> and wouldn't make any sense there (it's an iOS app).
>
> How can I tell buildtool which target I want to build?  I have tried
> guessing its commands, but so far it has responded to everything with
> "Unknown build operation".
>

My interpretation is that 'build' is passed as a string, turned into a
selector, and then invoked on PBXContainer (which gets unpacked using
PBXCoder).

Which means you're really interested in this:
https://github.com/gnustep/xcode/blob/master/PBXContainer.m
(Note: I'm linking to Github, because it's more convenient for me, but note
that the canonical version control system is still Subversion, at
http://svn.gna.org/svn/gnustep).

Based on PBXContainer's implemented methods, you could seemingly call the
following methods and have it work: 'build', 'clean', 'install'. Somewhat
uselessly, you could (but probably want) also call 'archiveVersion',
'classes', 'objectVersion', 'objects' and 'collectHeaderFileReferences'.
Amusingly, you could call 'dealloc', too, but I doubt that would help.

PBXContainer's implementation of 'build' seems to forward this to the 'root
object'. Reading an arbitrary .pbxproj grabbed from the Internet, a
'rootObject' will probably be an object of type PBXProject.

Reading -[PBXProject build] method, you can see that the answer to your
question is 'no, you cannot filter out which target will be built'.

But because this is a tool (and accompanying framework) that's very easy to
follow around, this seems like something that'd be very easy to hack
together. I would look into how you can store the 'desired target' in
GSXCBuildContext. Then, if this desired target is non-nil, you'd skip every
other target when executing -[PBXProject build].

If you choose to do this, and decide to contribute the patch upstream
(which means you'd follow existing code style etc), I think we can accept
it even without formal copyright assignment (I think the patch might be
short enough). That's probably up to Gregory, who authored the tool.

Greg?

--001a11410bda6d3289052a051d45
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div><div>[help-gnustep to bcc,=C2=A0+to discuss-gnustep]<=
/div></div><div><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Fri, Jan=
 22, 2016 at 2:58 PM Richard Kennaway &lt;<a href=3D"mailto:richard@kennawa=
y.org.uk">[email protected]</a>&gt; wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex">(Is this list dead? No postings for two years. Where else sho=
uld I take this enquiry?)<br></blockquote><div><br></div><div><span style=
=3D"color:rgb(51,103,214);text-decoration:underline"><a href=3D"http://www.=
gnustep.org/information/gethelp.html">http://www.gnustep.org/information/ge=
thelp.html</a></span><br></div><div>Consider discuss-gnustep :-)</div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex">I have a command-line tool writt=
en in C++ and built with XCode on a Mac, which I&#39;m trying to port to a =
Linux machine.=C2=A0 I came across buildtool, which promises to interpret t=
he Xcode project file and carry out the build using the gnustep tools.=C2=
=A0 I&#39;ve installed gnustep, xcode, and buildtool, but it is not clear t=
o me how to use buildtool. No documentation comes with it and I&#39;ve foun=
d none on the web.=C2=A0</blockquote><div><br></div><div>Your choice to rea=
d the source code was the right one because, luckily, this is a very short =
and simple tool, with easy to follow code. (What follows is merely an inter=
pretation while coming up with this email; I&#39;ve never really used build=
tool before. I could be wrong!)</div><div><br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">
<br>
From reading the source code, it takes two arguments, the name of the Xcode=
 project and a command to buildtool to tell it what to do with it.=C2=A0 I =
see nothing in the source to reveal what commands are available, except tha=
t the default is &quot;build&quot;.=C2=A0 When I try that, buildtool begins=
 by attempting to build a target that I don&#39;t want to build for this pl=
atform and wouldn&#39;t make any sense there (it&#39;s an iOS app).<br>
<br>
How can I tell buildtool which target I want to build?=C2=A0 I have tried g=
uessing its commands, but so far it has responded to everything with &quot;=
Unknown build operation&quot;.<br></blockquote><div><br></div><div>My inter=
pretation is that &#39;build&#39; is passed as a string, turned into a sele=
ctor, and then invoked on PBXContainer (which gets unpacked using PBXCoder)=
.</div><div><br></div><div>Which means you&#39;re really interested in this=
:</div><div><a href=3D"https://github.com/gnustep/xcode/blob/master/PBXCont=
ainer.m">https://github.com/gnustep/xcode/blob/master/PBXContainer.m</a><br=
></div><div>(Note: I&#39;m linking to Github, because it&#39;s more conveni=
ent for me, but note that the canonical version control system is still Sub=
version, at <a href=3D"http://svn.gna.org/svn/gnustep">http://svn.gna.org/s=
vn/gnustep</a>).</div><div><br></div><div>Based on PBXContainer&#39;s imple=
mented methods, you could seemingly call the following methods and have it =
work: &#39;build&#39;, &#39;clean&#39;, &#39;install&#39;. Somewhat useless=
ly, you could (but probably want) also call &#39;archiveVersion&#39;, &#39;=
classes&#39;, &#39;objectVersion&#39;, &#39;objects&#39; and &#39;collectHe=
aderFileReferences&#39;. Amusingly, you could call &#39;dealloc&#39;, too, =
but I doubt that would help.</div><div><br></div><div>PBXContainer&#39;s im=
plementation of &#39;build&#39; seems to forward this to the &#39;root obje=
ct&#39;. Reading an arbitrary .pbxproj grabbed from the Internet, a &#39;ro=
otObject&#39; will probably be an object of type PBXProject.</div><div><br>=
</div><div>Reading -[PBXProject build] method, you can see that the answer =
to your question is &#39;no, you cannot filter out which target will be bui=
lt&#39;.</div><div><br></div><div>But because this is a tool (and accompany=
ing framework) that&#39;s very easy to follow around, this seems like somet=
hing that&#39;d be very easy to hack together. I would look into how you ca=
n store the &#39;desired target&#39; in GSXCBuildContext. Then, if this des=
ired target is non-nil, you&#39;d skip every other target when executing -[=
PBXProject build].</div><div><br></div><div>If you choose to do this, and d=
ecide to contribute the patch upstream (which means you&#39;d follow existi=
ng code style etc), I think we can accept it even without formal copyright =
assignment (I think the patch might be short enough). That&#39;s probably u=
p to Gregory, who authored the tool.</div><div><br></div><div>Greg?</div></=
div></div></div>

--001a11410bda6d3289052a051d45--


--===============2592506189937129993==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Help-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-gnustep

--===============2592506189937129993==--