|
Boost-Build : |
From: Phillip Seaver (phil_at_[hidden])
Date: 2006-09-25 14:57:08
Vladimir Prus wrote, on 9/25/2006 1:56 PM:
> On Monday 25 September 2006 20:45, Phillip Seaver wrote:
>
>> Vladimir Prus wrote, on 9/22/2006 1:50 AM:
>>
>>> On Friday 22 September 2006 01:05, Phillip Seaver wrote:
>>>
>>>> Has anyone used boost-build to create jar files? One of my co-workers
>>>> is compiling .java files into .class files and then making a .jar file
>>>> out of the .class files. The problem is the paths in the class files.
>>>> He basically needs to strip off everything but the original relative
>>>> path. E.g., for apago/foo.java, he gets
>>>> ....../link-static/threading-multi/apago/foo.class and he needs to pass
>>>> just apago/foo.class to the jar creation program.
>>>>
>>> Isn't this the matter for passing right -C options to jar? Of course,
>>> computing the right options might not be straight-forward. Or maybe not
>>> -- would
>>>
>>> jar
>>> -C ..../link-static/threading-multi
>>> <all .class file>
>>>
>>> work?
>>>
>>> - Volodya
>>>
>> Not quite. javac creates filenames relative to the source directory, so
>> for ./apago/foo.java, "javac -d {build-dir}" creates
>> {build-dir}/apago/foo.class.
>>
>
> Ah, I read your original email as saying you've some problem with jar, like
> having extra directories in path.
>
With the way things are currently being done, the jar action gets passed
.class names without the directory structure that javac creates, so
that's a problem too.
>> So, I think I need my own javac generator
>> that "knows" where the output files end up.
>>
>
> So, you want to give javac a directory full of java files, have it
> create .class files in builddir.
>
Actually, we pass javac a single .java at a time.
>> Am I on the right track? Or do I need to go somewhere else and start
>> again? :-)
>>
>
> I'm afraid so. A single .java file can result in multiple .class files being
> produced. One language feature that I know does this is 'anonymous classes'.
> I think the if you have several classes in one .java file you'll get
> several .class files too, but this case might be handled by regexp, while
> detecting anonymous classes is harder.
>
True. You can have multiple classes in a .java file, including inner
classes, each of which results in a .java file. I didn't know that
before you brought it up. (I'm not a java programmer :-) ).
> SCons is supposed to have a parser that works, which I attach. It seems to be
> standlone, so you probably can call it when using Python-enabled bjam.
>
You seem to have forgotten to attach it. :-> How do I get a
python-enabled bjam?
> Even then, I think the right interface would be to specify a source directory,
> not a single .java file. I think that compiling a single .java file might not
> work, since other classes the compiled file depends on might not be compiled
> yet. I'm not sure about this though.
>
> - Volodya
I think it would need to do dependency scanning, too. On the other
hand, if all I'm ever doing with the .class files is putting them in a
.jar file, the javac command could be part of the jar actions...
Thanks,
Phillip
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk