On Wed, 18 Oct 2000, Jose Alberto Fernandez wrote:
> Barry hi,
>
> I am trying to use your prj.el file for our builds, but since we use CVS
> and every developer may have checkout the source in a different directory,
> I wonder if it is possible to specify the location of the build file
> relative
> to prj.el itself.
>
> My idea is to checkin on CVS "<TOP>/prj.el" and let then specify the
> buildfile
> relative to this location.
>
> Any ideas how to do this?
from memory it is something like this
(setq myBase (expand-file-name (substitute-in-file-name ".")))
(setq myLocalFile "mybuild.xml")
(setq full-path (message "%s/%s" myBase myLocalFile) )
this will thus specify myBuild.xml relative to
rpj.el. Alternatively you could just use
(setq full-path (expand-file-name (substitute-in-file-name "myBuild.xml")))
thou then you loose base details which can come in handy for
other stuff (like executing project)
> TIA,
>
> Jose Alberto
>
> > -----Original Message-----
> > From: Barrie Treloar [mailto:Barrie.Treloar@camtech.com.au]
> > Sent: Wednesday, September 20, 2000 12:53 AM
> > To: ant-dev@jakarta.apache.org
> > Subject: Get emacs to find the correct build.xml and
> > automatically pass
> > it to ant.
> >
> >
> > On 20 Sep 2000, Stefan Bodewig wrote:
> >
> > > It is useful for a lot of people I know - those using
> > (X)Emacs/JDE can
> > > now simply say "build using make" and set the make command
> > to ant and
> > > it will always pick up build.xml without the need to explicitly
> > > specify the -buildfile switch, for example.
> >
> > To do this with Emacs/JDE do the following:
> >
> > (I'll add this to FAQ when its working :)
> >
> > Customize jde-build-use-make and set it to true.
> > [This makes jde use make instead of its own internal builder]
> >
> > Customize jde-read-make-args and set it to true.
> > [This makes jde prompt you for the arguments to give to make.
> > You can just hit return if you dont want to pass any arguments
> > (the common case), otherwise you can include the target you
> > want invoked. Dont specify the build file to use, we will do
> > this another way]
> >
> > Customize jde-make-program and set it to "ant".
> > [This makes jde use "ant" instead of "make" as the
> > build program]
> >
> > To your .emacs files add the following, this causes jde to try
> > and load a prj.el file whenever you open a .java file. This
> > allows us to do some black magic a bit later.
> > ;;
> > ;; JDE mode
> > ;;
> > (require 'jde)
> > (add-hook 'jde-mode-hook
> > '(lambda ()
> > (jde-load-project-file)
> > ))
> >
> > For each project hierarchy create a prj.el file at the top
> > level. JDE will search the directory hierarchy to find the
> > prj.el file and use the first one it finds. For example, if
> > you are in <TOP>/src/org/apache/tools/ant/ and you load
> > Main.java and the file <TOP>/prj.el exists it will load it.
> > The prj.el file will customize the jde-make-args to include
> > the correct build file based on the java file that was
> > loaded.
> >
> > The prj.el file should contain the following lisp code:
> >
> > ;;;
> > ;;; BEGIN prj.el
> > ;;;
> >
> > ;;
> > ;; This file is loaded by JDE-mode via JDE->Project->Project
> > File->Load.
> > ;; The only value that requires changing is the jde-make-args variable
> > ;;
> > ;; Notes: It is important to use make-local-variable as this allows
> > ;; each buffer to have its own version of the build.xml file.
> > ;; Therefore two source files from two different projects will
> > ;; correctly use the write build.xml file.
> > ;;
> >
> > ; The location of the Ant build file.
> > (make-local-variable 'jde-make-args)
> > (setq jde-make-args "-f <TOP>/build.xml")
> >
> > ;; You may want to add the following (this allows C-z C-z or
> > ;; "compile" to use ant instead of "make") This is more natural to
> > ;; old emacs hackers than C-c C-v C-b.
> > ;
> > ; Set C-z C-z to be the same as C-c C-v C-b inside jde major modes
> > ;
> > (local-set-key "\C-z\C-z" 'jde-build)
> >
> > ;;;
> > ;;; END prj.el
> > ;;;
> >
> > Happy hacking,
> > Barrie
> > --
> > Barrie Treloar
> > ____________________________________________________________________
> >
> > Barrie Treloar Phone: +61 8 8303 3300
> > Senior Analyst/Programmer Fax: +61 8 8303 4403
> > Electronic Commerce Division Email: barrie@camtech.com.au
> > Camtech (SA) Pty Ltd http://www.camtech.com.au
> > --- Level 8, 10 Pulteney Street, Adelaide SA 5000, Australia. ---
> > ____________________________________________________________________
> >
> >
>
--
Cheers,
Pete
*--------------------------------------------------*
| Latrobe University, | Does the name 'Pavlov' |
| Bundoora, Australia | ring a bell ? |
*--------------------------------------------------*
|