[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Cons patches: AtEnd and AddTarget
From: |
Gary Oberbrunner |
Subject: |
Cons patches: AtEnd and AddTarget |
Date: |
Wed, 25 Jul 2001 10:22:18 -0400 |
Hi cons folks. I have a couple of cons patches which I've found to be
useful. AddTarget is one I've submitted before (but a long time ago); it
dynamically adds a target to be built. It's useful when you have a list of
targets to be shipped which is not known in advance, but auto-generated.
Like AfterBuild, it is not compatible with cons's -r mode. (As part of this
patch, I also added a note in the doc that AfterBuild is not compatible
with -r.)
The other patch is something that's been discussed but never implemented, at
least to my knowledge. AtEnd takes a perl code ref or a string, and
executes it just before cons exits; but only if something was built. To
detect this, I added a little code to the main build method which remembers
each file which gets a status of 'built'. It seems right, but there might
be some cases I've overlooked.
I also arranged AtEnd to run in the script package of the Conscript in which
it's defined, so you have access to the environments and methods of that
Conscript. The new package save/restore stuff seems very nicely
implemented, by the way! It was quite easy for me to figure out how to use
it. Good job folks!
There are a couple of things which could be added to AtEnd. It would
perhaps be useful to be able to run different commands depending on the exit
status (nothing done, something done, error). It might also be useful to
know which files were built; I started that by remembering those files in
@built_files, but that would need to be exported nicely so the AtEnd method
could use it. I didn't need that and didn't want to overcomplicate things.
I think even as it is it is pretty useful. You could use it to run tests,
or any kind of post-build step you like. I use it to do a "local install"
for testing my stuff. Can't do this easily with regular cons, because the
files have to be installed all over, so it would be complex to specify all
the proper target dirs, and also cons would create .consign files in those
dirs, and we want to keep the install as close to a real customer install as
possible. Of course there are other ways to do it -- after all, this is
perl!, but AtEnd makes it quite simple.
Of course, there's pod documentation for both of the new methods.
I also made the error message about importing a variable which is not
exported mention which Conscript is trying to import the unexported var.
Simplifies debugging.
This is a patch against the released Cons 2.3.0. Hope you like it!
. . . . . . . . . . . . . . . . . . . . . . . . .
Gary Oberbrunner address@hidden
GenArts, Inc. Tel: 617-492-2888
8 Clinton Street Fax: 617-492-2852
Cambridge, MA 02139 USA http://web.genarts.com
cons.patch
Description: Binary data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Cons patches: AtEnd and AddTarget,
Gary Oberbrunner <=