Return-Path: Mailing-List: contact ant-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list ant-dev@jakarta.apache.org Received: (qmail 58153 invoked from network); 19 Oct 2000 04:21:18 -0000 Received: from postbox.viquity.com (HELO dcsrv0.ecom2ecom.com) (63.198.126.137) by locus.apache.org with SMTP; 19 Oct 2000 04:21:18 -0000 Received: by dcsrv0 with Internet Mail Service (5.5.2650.21) id ; Wed, 18 Oct 2000 21:20:26 -0700 Message-ID: <635802DA64D4D31190D500508B9B04104E0F60@dcsrv0> From: Jose Alberto Fernandez To: "'ant-dev@jakarta.apache.org'" Subject: RE: Get emacs to find the correct build.xml and automatically pas s it to ant. Date: Wed, 18 Oct 2000 21:20:25 -0700 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: multipart/mixed; boundary="----_=_NextPart_000_01C03983.E7ECEF1C" X-Spam-Rating: locus.apache.org 1.6.2 0/1000/N This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_000_01C03983.E7ECEF1C Content-Type: text/plain; charset="iso-8859-1" I GOT IT!!! Thanks for all of you that gave me pointers. The included prj.el will set all the arguments necessary to use JDE with ANT. There are two variables that control whether you want to use ANT: jde-build-use-ant ;; You should set this in your .emacs file ;; This allows some people using ANT and others not ;; If you set it in prj.el, everyone will build with it. jde-ant-project-file ;; the name of the buildfile relative to the prj.el file. ;; defaults to "build.xml" but if different should be set ;; on prj.el file. It works quite well. If you want to allow additional parameters to ANT, then make jde-read-make-args non-nil. Jose Alberto PS: Maybe someone can make an actual ant-mode out of this. That we can give with the distribution. > -----Original Message----- > From: Barrie Treloar [mailto:Barrie.Treloar@camtech.com.au] > Sent: Wednesday, October 18, 2000 5:29 PM > To: 'ant-dev@jakarta.apache.org' > Subject: RE: Get emacs to find the correct build.xml and automatically > pas s it to ant. > > > 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 "/prj.el" and let then specify the > > buildfile > > relative to this location. > > > > Any ideas how to do this? > > [del] > > > > ; The location of the Ant build file. > > > (make-local-variable 'jde-make-args) > > > (setq jde-make-args "-f /build.xml") > > I dont believe it is possible to specify it relative to the location > prj.el file because of the above variable value. > > jde-make-args is simply appended to jde-make-program to form the > command that jde will run to invoke your build. > > Therefore you will get "ant -f /build.xml" and this > will most likely use current working directory of the emacs process as > the place to start evaluating the relative path name. > > I find this resource to be invaluable when hacking emacs. My brain is > not well formed at supporting lisp so I look up all the information I > need when I need it. > http://www.delorie.com/gnu/docs/elisp-manual-20/ > > We have two choices in solving this problem. We can use an > environment variable for storing the location of TOP or we can use an > emacs variable for storing TOP. We can then concatenate the two > strings together in the prj.el file to specify the correct location. > > I would be suggesting the use of emacs variables so they can be > quickly changed and so they dont pollute your shell variable space. > > So for a project name project-x we can create an emacs variable called > project_x_top which defines the developers local location of the > source tree. > > In each developers .emacs file include: > > ;; The per developer location of the source tree for project-x > (setq project_x_top "") > > In the prj.el file change > > (setq jde-make-args "-f /build.xml") > to > ;; The build file for project-x lives at /build.xml > ;; where TOP for project-x is stored in the > project_x_top variable > (setq jde-make-args (concat "-f " project_x_top > "/build.xml") ) > > This will concatenate the strings together to include the value of > project_x_top to correctly point to the per developer location. > > Hope this helps. > 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. --- > ____________________________________________________________________ > > ------_=_NextPart_000_01C03983.E7ECEF1C Content-Type: application/octet-stream; name="prj.el" Content-Disposition: attachment; filename="prj.el" ;;; ;;; 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. ;; ;; Author: Jose Alberto Fernandez ;; Based on an idea from Barrie Treloar [Barrie.Treloar@camtech.com.au] (defcustom jde-build-use-ant nil "*Specify whether to use ANT instead of make to build this project. If this variable is non-nil, the project file will also set jde-build-use-make to non-nil." :group 'jde-project :type 'boolean) (defcustom jde-ant-project-file "build.xml" "*Specify the location of the ANT build file with respect to the project." :group 'jde-project :type 'string) (defun jde-build-set-ant(ant-file) "Set JDE to use ANT for building this project." (setq jde-build-use-make t) (setq jde-make-program (concat "ant -f " (expand-file-name (concat (file-name-directory (jde-find-project-file default-directory)) ant-file))) )) (make-local-variable 'jde-ant-project-file) (make-local-variable 'jde-make-program) (make-local-variable 'jde-build-use-make) ;; Set the name of the file to use if different from default ;(setq jde-ant-project-file "ant.xml") ;; Uncommnet this line if all user will use ANT ;(setq jde-build-use-ant t) (if jde-build-use-ant (jde-build-set-ant jde-ant-project-file) ) ;; 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 ; (if jde-build-use-make (local-set-key "\C-z\C-z" 'jde-build) ) ;;; ;;; END prj.el ;;; ------_=_NextPart_000_01C03983.E7ECEF1C--