Hi,
My approach for building java projects with tup is to work in terms of jar
files bundling collections of classes. It's not perfect, since it somewhat
reduces the granularity of the dependency resolution, but it avoids a lot of
fussing about. The scripts I use are uploaded at
https://github.com/nshepperd/tup-java-tools - hopefully they haven't bitrot
yet... There's some android scripts as well, which you can ignore. But
basically instead of calling javac directly from tup, I have a python script
which calls javac then wraps all compilation products into a jar file. This way
you get a single known output file for each command.
For example, given a set of three java sources {A,B,C}.java, where A and B are
independent but C could import A and B, I would do:
(with !javac = |> $(TOOLS_HOME)/javac.py -o %o %f |>)
: src/A.java |> !javac |> src/A.jar
: src/B.java |> !javac |> src/B.jar
: src/C.java src/A.jar src/B.jar |> !javac |> src/C.jar
This results in three jar files, containing the classes output from A.java,
B.java, C.java respectively. You could then combine the products into one file
(analogous to a static library) with mashjar.py:
(!mashjar = |> $(TOOLS_HOME)/mashjar.py -o %o %f |>)
: src/*.jar |> !mashjar |> everything.jar
Alternatively, you could compile everything at once:
: src/*.java |> !javac |> everything.jar
This is the less granular but easier approach.
These scripts all support a "-e entry.Point" option for defining the entry
point to an executable jarfile, but other than that they're qute dumb and could
do with extension -- for example, currently there's no way to supply compiler
flags like "-debug". Also if you try to compile without having javac and
fastjar both available in your PATH I think these scripts will just fail
mysteriously. But this at least gives you the idea of how you can handle this.
Hope this helps-
Regards,
Neil
--
--
tup-users mailing list
email: [email protected]
unsubscribe: [email protected]
options: http://groups.google.com/group/tup-users?hl=en
---
You received this message because you are subscribed to the Google Groups
"tup-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.