Initial Commit
[packages] / xemacs-packages / jde / lisp / jde-compile.el
1 ;;; jde-compile.el -- Integrated Development Environment for Java.
2 ;; $Revision: 1.65 $ $Date: 2005/04/06 03:03:07 $ 
3
4 ;; Author: Paul Kinnucan <paulk@mathworks.com>
5 ;; Maintainer: Paul Kinnucan
6 ;; Keywords: java, tools
7
8 ;; Copyright (C) 1997, 1998, 2001, 2002, 2003, 2004, 2005 Paul Kinnucan.
9
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
13 ;; any later version.
14
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 ;; GNU General Public License for more details.
19
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
24
25 ;;; Commentary:
26
27 ;; This is one of a set of packages that make up the 
28 ;; Java Development Environment (JDE) for Emacs. See the
29 ;; JDE User's Guide for more information.
30
31 ;; The latest version of the JDE is available at
32 ;; <URL:http://sunsite.auc.dk/jde/>.
33
34 ;; Please send any comments, bugs, or upgrade requests to
35 ;; Paul Kinnucan at paulk@mathworks.com.
36
37 ;;; Code:
38
39 (require 'eieio)
40 (require 'cl)
41 (require 'compile)
42
43 (defgroup jde-compile-options nil
44   "JDE Compiler Options"
45   :group 'jde
46   :prefix "jde-compile-option-")
47
48 ;; (makunbound 'jde-compiler)
49 (defcustom jde-compiler '("javac server" "")
50   "Specify the type, and if necessary, the location of the compiler to
51 be used to compile source files for the current project. The JDE
52 supports three compilers: javac server, javac executable, and
53 jikes. The javac server runs the com.sun.tools.javac package included
54 with the JDK in the Beanshell. The javac executable shipped with the
55 JDK also uses this package. The advantage of the javac server is that
56 it avoids the vm startup time that accounts for most of the
57 compilation time consumed by the javac executable. The javac server
58 uses the version of com.sun.tools.javac included in the JDK for the
59 current project. See `jde-jdk' for more information. If you want to
60 use the javac executable to compile your project's source files,
61 select \"javac\" as the compiler type and, optionally, specify
62 the path to the executable in the \"Path\" field. If you do
63 not specify a path, the JDE uses the javac executable included in the
64 JDK for the current project. Similarly, to use jikes, select \"jikes\"
65 and, if jikes is not on the command path of the Emacs
66 environment, specify the path of the jikes executable."
67   :group 'jde-project
68   :type '(list
69           (radio-button-choice
70            :format "%t \n%v"
71            :tag "Compiler type"
72            (item "javac server")
73            (item "javac")
74            (item "jikes"))
75           (file 
76            :tag "Path")))
77            
78            
79 (defcustom jde-read-compile-args nil
80 "*Specify whether to prompt for additional compiler arguments.
81 If this variable is non-nil, the jde-compile command prompts
82 you to enter additional compiler arguments in the minibuffer.
83 These arguments are appended to those specified by customization
84 variables. The JDE maintains a history list of arguments 
85 entered in the minibuffer."
86   :group 'jde-project
87   :type 'boolean)
88
89 (defvar jde-interactive-compile-args ""
90 "String of compiler arguments entered in the minibuffer.")
91
92 (defvar jde-interactive-compile-arg-history nil
93 "History of compiler arguments entered in the minibuffer.")
94
95 ;; (makunbound 'jde-compile-finish-hook)
96 (defcustom jde-compile-finish-hook 
97   '(jde-compile-finish-kill-buffer 
98     jde-compile-finish-refresh-speedbar
99     jde-compile-finish-update-class-info)
100   "List of functions to be invoked when compilation of a 
101 Java source file terminates. Each function should accept
102 two arguments: the compilation buffer and a string 
103 describing how the compilation finished."
104   :group 'jde
105   :type 'hook)
106
107 (defcustom jde-compile-option-hide-classpath nil 
108   "Substitute the classpath in the compilation window for
109 ..."
110   :group 'jde-compile-options
111   :type 'boolean)
112
113 (defun jde-compile-update-class-list () 
114   (let ((class-dir
115          (if (string= jde-compile-option-directory "")
116              (expand-file-name ".")
117            (jde-normalize-path 
118             jde-compile-option-directory 
119             'jde-compile-option-directory))))
120     (message (concat "Updating class list for " class-dir))
121     (jde-jeval (concat
122                 "jde.util.JdeUtilities.updateClassList(\"" 
123                 class-dir
124                "\");"))
125     (message "Updating class list...done.")))
126
127 (defun jde-compile-finish-update-class-info (buf msg) 
128   "Flush the classinfo cache and update the class list used by
129 JDEE wizards at the end of compilation.  Flush the entire cache as we
130 don't know which classes were recompiled."
131   ;;Setting the last java buffer as the current buffer
132   (condition-case nil
133       (progn
134         (if jde-xemacsp
135             (set-buffer (cadr (buffer-list)))
136           (set-buffer (car (buffer-list))))
137         (if (eq major-mode 'jde-mode)
138             (progn
139               (setq jde-complete-last-compiled-class (jde-parse-get-buffer-class))
140               (jde-complete-flush-classes-in-cache (list jde-complete-last-compiled-class))
141               (message "Flushed completion cache.")
142               (setq jde-complete-last-compiled-class nil)
143               (jde-compile-update-class-list))))
144     (error nil)))
145
146 (defun jde-compile-finish-refresh-speedbar (buf msg) 
147   "Refresh speedbar at the end of a compilation."
148   (if (and (frame-live-p speedbar-frame)
149             (frame-visible-p speedbar-frame))
150        (speedbar-refresh)))
151
152
153 (defcustom jde-compile-jump-to-first-error t
154   "*Automatically jump to the first error when a compilation process completes."
155   :group 'jde-compile-options
156   :type 'boolean)
157
158 (defun jde-compile-kill-buffer (buf) 
159   (if jde-compile-enable-kill-buffer
160       (progn
161         (delete-windows-on buf)
162         (kill-buffer buf))))
163
164
165 ;; Thanks to Jack Donohue <donohuej@synovation.com>.
166 (defun jde-compile-finish-kill-buffer (buf msg)
167   "Removes the jde-compile window after a few seconds if no errors."
168   (save-excursion
169     (set-buffer buf)
170     (if (null (or (string-match ".*exited abnormally.*" msg) 
171                   (string-match ".*BUILD FAILED.*" (buffer-string))))
172         ;;no errors, make the compilation window go away in a few seconds
173         (lexical-let ((compile-buffer buf))
174           (run-at-time
175            "2 sec" nil 'jde-compile-kill-buffer
176            compile-buffer)
177           (message "No compilation errors"))
178       ;;there were errors, so jump to the first error
179       (if jde-compile-jump-to-first-error (next-error 1)))))
180   
181
182 (defcustom jde-compile-option-command-line-args nil
183   "*Specify options as a string of command-line arguments.
184 The value of this variable should be a list of switches understood
185 by the compiler, for example, -depend -g. This variable is intended to
186 be used to set compile options not otherwise defined by the JDE, in
187 particular, options not defined by javac but used by another compiler
188 that you might want to use with the JDE."
189   :group 'jde-compile-options
190   :type '(repeat (string :tag "Argument:")))
191
192 (defcustom jde-compile-option-classpath nil
193 "*Specify paths of classes required to compile this project.
194 The JDE uses the specified paths to construct a -classpath
195 argument to pass to the compiler. This option overrides the
196 `jde-global-classpath' option."
197   :group 'jde-compile-options
198   :type '(repeat (file :tag "Path")))
199
200 (defcustom jde-compile-option-sourcepath nil
201 "*Specify the source code path to search for class or interface definitions.
202
203 As with the user class path, source path entries  can be directories, JAR 
204 archives, or ZIP archives. If packages are used, the local path name within 
205 the directory or archive must reflect the package name. 
206
207 Note that classes found through the classpath are subject to automatic 
208 recompilation if their sources are found."
209   :group 'jde-compile-options
210   :type '(repeat (file :tag "Path")))
211
212 (defcustom jde-compile-option-directory ""
213   "*Specifies the root directory of the class file hierarchy.
214 The compiler places compiled classes in the specified
215 directory. For example, specifying the class
216 directory as: 
217   
218   C:\\users\\dac\\classes
219
220 causes the class files for the classes in the MyProgram.java source
221 file to be saved in the directory C:\\users\\dac\\classes. If your class 
222 is in the package demos\\awt, the class files would be placed in directory
223 C:\\users\\dac\\classes\\demos\\awt."
224   :group 'jde-compile-options
225   :type 'directory)
226
227 (defcustom jde-compile-option-deprecation nil
228   "*Warn use or override of a deprecated member or class. 
229 A member or class is deprecated if its documentation comment contains
230 the @deprecated tag. The compiler will emit a warning at the end of
231 compilation whether or not the deprecation option is on; this option
232 causes the location of each individual use or override to be noted.
233
234 Deprecated members or classes are deliberately not mentioned if the
235 source file containing the deprecation is being recompiled.  This can
236 happen because the file is on the command line or because the depend
237 option is on and the source file is out of date.
238 "
239   :group 'jde-compile-options
240   :type 'boolean)
241
242
243 (defcustom jde-compile-option-debug 
244   (list "selected" (list t nil nil))
245   "*Include debug information in classes.
246 The compiler includes line number information by default.
247
248 Before JDK 1.2, the the debug and optimize options were
249 mutually exclusive. In JDK 1.2, it is possible to combine debug and
250 optimize, but the shortcuts taken by optimized code may occasionally
251 produce surprising debugging results. For example, declared variables
252 may not exist and code may appear to move or not be executed at all.
253
254 The JDK 1.1.x versions of javac do not support inclusion of selected
255 debug information."
256   :group 'jde-compile-options
257   :type '(list 
258           (radio-button-choice 
259            :format "%t \n%v"
260            :tag "Debug info to include in class:"
261            (const "all")
262            (const "none")
263            (const "selected"))
264           (list
265            :tag "    info"
266            :indent 4
267            (checkbox :format "%[%v%] %t \n"
268                      :tag "Line Numbers")
269            (checkbox :format "%[%v%] %t \n"
270                      :tag "Variables")
271            (checkbox :format "%[%v%] %t \n"
272                      :tag "Source")))
273            
274 )
275
276
277 (defcustom jde-compile-option-optimize nil
278 "*Directs the compiler to try to generate faster code. 
279 This may slow down compilation, make larger class files, and/or make
280 it difficult to debug.
281
282 Prior to 1.2, the optimize option tried to inline methods across
283 classes. This created compatibility problems and sometimes generated
284 illegal bytecode. The optimize option also implicitly turned on the
285 depend option and implicitly turned off the debug option.
286
287 In JDK 1.2, the optimize option no longer inlines across classes and
288 so may safely be used for any java compilation. Optimize no longer
289 implicitly turns on depend or implicitly turns off debug."
290   :group 'jde-compile-options
291   :type 'boolean)
292
293
294 (defcustom jde-compile-option-depend nil
295 "*Analyze dependencies.
296 Causes recompilation of class files on which the source files given as
297 command line arguments recursively depend. Without this option, only
298 files that are directly depended on and missing or out-of-date will be
299 recompiled. Recompilation does not extend to missing or out-of-date
300 files only depended on by already up-to-date class files.
301
302 Note: if you are using a compiler other than post JDK 1.1.6 versions
303 of javac, you may need to specify the command-line switch used by
304 the compiler to specify dependency checking. See 
305 `jde-compile-option-depend-switch' for more information."
306   :group 'jde-compile-options
307   :type 'boolean)
308
309 (defcustom jde-compile-option-depend-switch (list "-Xdepend")
310 "*Specify command line switch for depend option.
311 This option is necessary because the command-line switch for
312 dependency checking differs among Java compilers. Choose
313 from the following options:
314
315   -Xdepend  Full dependency checking (post JDK 1.1.6)
316   -depend   Full dependency checking (jikes and pre-JDK 1.1.6)
317   +F        Check everything except jar and zip files (jikes only)
318   +U        Check everything including jar and zip files (jikes only)"
319   :group 'jde-compile-options
320   :type '(list 
321           (radio-button-choice 
322            :format "%t \n%v"
323            :tag "Select -Xdepend (javac) or -depend (jikes):"
324            (const "-Xdepend")
325            (const "-depend")
326            (const "+F")
327            (const "+U"))))
328
329 (defcustom jde-compile-option-vm-args nil
330 "*Specify command-line arguments for Java interpreter.
331 Passes the specified arguments to the Java interpreter that runs the
332 compiler. The argument should not contain spaces. This is useful for
333 adjusting the compiler's execution environment or memory usage."
334   :group 'jde-compile-options
335   :type '(repeat (string :tag "Option")))
336
337 (defcustom jde-compile-option-verbose nil
338 "*Print verbose messages.
339 Causes the compiler and linker to print out messages about what source
340 files are being compiled and what class files are being loaded."
341   :group 'jde-compile-options
342   :type 'boolean)
343
344 (defcustom jde-compile-option-nowarn nil
345 "*Turn off warnings.
346 If this option is specified, the compiler does not print out any
347 warnings."
348   :group 'jde-compile-options
349   :type 'boolean)
350
351 (defcustom jde-compile-option-encoding ""
352 "*Specify the source file encoding name, such as EUCJIS\\SJIS.
353 If this option is not specified, then the platform default converter
354 is used."
355   :group 'jde-compile-options
356   :type 'string)
357
358 ;;(makunbound 'jde-compile-option-source)
359 (defcustom jde-compile-option-source (list "default")
360 "*Enables JDK version-specific features to be used in
361 source files.
362
363   1.3     The compiler does not support assertions
364   
365   1.4     The compiler accepts code containing assertions. 
366
367   1.5     Enables 1.5-specific features.
368
369   Select \"default\" to use the source features that
370   the compiler supports by default, i.e., to not include the -source
371   switch on the compiler command line. For example, the javac compiler
372   defaults to 1.3 source features if the -source flag is not
373   used.
374
375    ***NOTE***
376
377    This option is supported only by versions of javac shipped
378    starting with J2SDK 1.4."
379   :group 'jde-compile-options
380   :type '(list
381           (radio-button-choice 
382            :format "%t \n%v"
383            :tag "Source release:"
384            (const "default")
385            (const "1.3")
386            (const "1.4")
387            (const "1.5"))))
388
389 ;;(makunbound 'jde-compile-option-target)
390 (defcustom jde-compile-option-target (list "1.1")
391 "*Generate class files that will work on VMs with the specified version.
392  
393 The default is to generate class files to be compatible with both
394 1.1 and 1.2 VMs. The versions supported by javac in JDK1.2 are: 
395
396   1.1     Ensure that generated class files will be compatible 
397           with 1.1 and 1.2 VMs. This is the default.
398   
399   1.2     Generate class files that will run on 1.2 VMs, but 
400           not on 1.1 VMs.
401
402   1.3     Generate class files that will run on VMs in the 
403           Java 2 SDK, v 1.3 and later, but will not run 
404           on 1.1 or 1.2 VMs
405
406   1.4     Generate class files that are compatible only with
407           1.4 VMs.
408
409 By default, classes are compiled against the bootstrap and extension classes
410 of the JDK that javac shipped with. But javac also supports cross-compiling, 
411 where classes are compiled against a bootstrap and extension classes of a 
412 different Java platform implementation. It is important to use 
413 `jde-compile-option-bootclasspath' and `jde-compile-option-extdirs' when 
414 cross-compiling."
415   :group 'jde-compile-options
416   :type '(list
417           (radio-button-choice 
418            :format "%t \n%v"
419            :tag "Target VM:"
420            (const "1.1")
421            (const "1.2")
422            (const "1.3")
423            (const "1.4"))))
424
425 (defcustom jde-compile-option-bootclasspath nil
426 "*Cross-compile against the specified set of boot classes.
427 As with the user class path, boot class path entries can be 
428 directories, JAR archives, or ZIP archives."
429   :group 'jde-compile-options
430   :type '(repeat (file :tag "Path")))
431
432 (defcustom jde-compile-option-extdirs nil
433 "*Cross-compile against the specified extension directories. 
434 Each JAR archive in the specified directories is searched for class files."
435   :group 'jde-compile-options
436   :type '(repeat (file :tag "Path")))
437
438 ;;(makunbound 'jde-compile-option-verbose-path)
439 (defcustom jde-compile-option-verbose-path nil
440 "*Describe how paths and standard extensions were searched to find
441 source and class files.
442
443    ***NOTE***
444
445    This option is supported only by the versions of javac shipped
446    with JDK 1.1.x and 1.2.x and oldjavac in JDK 1.3."
447
448   :group 'jde-compile-options
449   :type 'boolean)
450
451 (defcustom jde-compile-enable-kill-buffer nil
452   "* If true the 'jde-compile-finish-kill-buffer will kill the compilation
453 buffer."
454   :group 'jde-compile-options
455   :type 'boolean)
456
457 (defun jde-compile-show-options-buffer ()
458   "Show the JDE Compile Options panel."
459   (interactive)
460   (customize-apropos "jde-compile-options" 'groups))
461
462 (defclass jde-compile-server-buffer (bsh-compilation-buffer) ()
463   "Compiler server buffer.")
464
465 (defmethod bsh-compilation-buffer-create-native-buffer ((this jde-compile-server-buffer))
466   "Creates the native Emacs buffer for the JDEE compile server."
467   (oset this buffer-name "*JDEE Compile Server*")
468   (oset this buffer (get-buffer-create (oref this buffer-name))))
469
470 (defclass jde-compile-exec-buffer (bsh-compilation-buffer) ()
471   "Compiler exec buffer.")
472
473 (defmethod initialize-instance ((this jde-compile-exec-buffer) &rest fields)
474   "Constructor for exec compilation buffer instance."
475
476   (bsh-compilation-buffer-create-native-buffer this)
477
478   (oset 
479    this 
480    filter
481    (lexical-let ((this-buf this))
482      (lambda (process output)
483        (bsh-compilation-buffer-filter this-buf process output))))
484     
485   (oset this process (get-buffer-process (oref this buffer)))
486
487   ;; Make sure this buffer is not associated with a compiler process that is
488   ;; already running.
489   (if (oref this process)
490       (if (or (not (eq (process-status (oref this process)) 'run))
491               (yes-or-no-p
492                "A compilation process is running; kill it?"))
493           (condition-case ()
494               (progn
495                 (interrupt-process (oref this process))
496                 (sit-for 1)
497                 (delete-process (oref this process)))
498             (error nil))
499         (error "Cannot have two processes in `%s' at once"
500                (oref this buffer-name))))
501
502   (bsh-compilation-buffer-set-mode this))
503
504 (defmethod bsh-compilation-buffer-create-native-buffer ((this jde-compile-exec-buffer))
505   "Creates the native Emacs buffer for the JDEE compile server."
506   (oset this buffer-name "*compilation*")
507   (oset this buffer (get-buffer-create (oref this buffer-name))))
508
509
510 (defclass jde-compile-compiler ()
511   ((name             :initarg :name
512                      :type string
513                      :documentation
514                      "Name of compiler")
515    (version          :initarg :version
516                      :type string
517                      :documentation
518                      "Compiler version.")
519    (path             :initarg :path
520                      :type string
521                      :documentation
522                      "Path of the compiler executable.")
523    (buffer           :initarg :buffer
524                      :type bsh-compilation-buffer
525                      :documentation
526                      "Compilation buffer")
527    (window           :initarg :window
528                      :type window
529                      :documentation
530                      "Window that displays the compilation buffer.")
531    (interactive-args :initarg :interactive-args
532                      :type list
533                      :documentation
534                      "Arguments entered in the minibuffer.")
535    (use-server-p     :initarg :use-server-p
536                      :type boolean
537                      :documentation
538                      "Run as a compile server in the Beanshell."))
539   "Class of Java compilers.")
540
541 (defmethod jde-compile-classpath-arg ((this jde-compile-compiler))
542   "Returns the classpath argument for this compiler."
543   (let ((classpath
544          (if jde-compile-option-classpath
545              jde-compile-option-classpath
546            (jde-get-global-classpath)))
547         (symbol
548          (if jde-compile-option-classpath
549              'jde-compile-option-classpath
550            'jde-global-classpath)))
551     (if classpath
552         (list
553          "-classpath"
554          (jde-build-classpath
555           classpath 
556           symbol)
557          ))))
558
559 (defmethod jde-compile-sourcepath-arg ((this jde-compile-compiler))
560   "Get the source path argument for this compiler."
561     (if jde-compile-option-sourcepath
562         (list
563          "-sourcepath"
564          (jde-build-classpath
565           jde-compile-option-sourcepath
566           'jde-compile-option-sourcepath))))
567
568 (defmethod jde-compile-bootclasspath-arg ((this jde-compile-compiler))
569   "Get the boot classpath argument for this compiler."
570   (if jde-compile-option-bootclasspath
571       (list
572        "-bootclasspath"
573        (jde-build-classpath jde-compile-option-bootclasspath 
574                             'jde-compile-option-bootclasspath))))
575
576 (defmethod jde-compile-extdirs-arg ((this jde-compile-compiler))
577   "Get the extdirs argument for this compiler."
578   (if jde-compile-option-extdirs
579       (list
580        "-extdirs"
581        (jde-build-classpath 
582         jde-compile-option-extdirs
583         'jde-compile-option-extdirs))))
584
585
586 (defmethod jde-compile-encoding-arg ((this jde-compile-compiler))
587   (if (not (string= jde-compile-option-encoding ""))
588       (list 
589        "-encoding"
590        jde-compile-option-encoding)))
591
592 (defmethod jde-compile-debug-arg ((this jde-compile-compiler))
593   "Get the debug arg for this compiler."
594   (let* ((include-option (nth 0 jde-compile-option-debug))
595          (selected (nth 1 jde-compile-option-debug))
596          (lines (nth 0 selected))
597          (vars (nth 1 selected))
598          (src (nth 2 selected)))
599     (cond
600      ((and
601        (string= include-option "selected")
602        lines
603        (not vars)
604        (not src))
605       nil)
606      ((string= include-option "all")
607       (list "-g"))
608      ((string= include-option "none")
609       (list "-g:none"))
610      ((and
611        (string= include-option "selected")
612        (or lines vars src))
613       (list 
614        (concat 
615         "-g:"
616         (if lines
617             (if (or vars src) "lines,"
618               "lines"))
619         (if vars
620             (if vars
621                 (if src "vars," "vars")))
622         (if src "source")))))))
623
624 (defmethod jde-compile-output-dir-arg ((this jde-compile-compiler))
625   "Get the ouput directory arg for this compiler."
626     (if (not (string= jde-compile-option-directory ""))
627         (list
628          "-d"
629          (jde-normalize-path 'jde-compile-option-directory))))
630
631 (defmethod jde-compile-deprecation-arg ((this jde-compile-compiler))
632   "Get deprecation argument for this compiler."
633     (if jde-compile-option-deprecation
634         (list "-deprecation")))
635
636 (defmethod jde-compile-optimize-arg ((this jde-compile-compiler))
637   "Get optimization argument for this compiler."
638     (if jde-compile-option-optimize
639         (list "-O")))
640
641 (defmethod jde-compile-depend-arg ((this jde-compile-compiler))
642   "Get dependency-checking argument for this compiler."
643   (if jde-compile-option-depend
644     (list (car jde-compile-option-depend-switch))))
645
646 (defmethod jde-compile-vm-args ((this jde-compile-compiler))
647   "Get arguments to pass to the vm used to run this compiler."
648     (if jde-compile-option-vm-args
649         (mapcan
650          (lambda (arg)
651            (list (concat "-J" arg)))
652          jde-compile-option-vm-args)))
653
654 (defmethod jde-compile-verbose-arg ((this jde-compile-compiler))
655   "Get verbosity level argument for this compiler."
656     (if jde-compile-option-verbose
657         (list "-verbose")))
658
659 (defmethod jde-compile-verbose-path-arg ((this jde-compile-compiler))
660   "Get verbose path argument for this compiler."
661     (if jde-compile-option-verbose-path
662         (list "-Xverbosepath")))
663
664 (defmethod jde-compile-nowarn-arg ((this jde-compile-compiler))
665   "Get no warning argument for this compiler."
666     (if jde-compile-option-nowarn
667         (list "-nowarn")))
668
669 (defmethod jde-compile-command-line-args ((this jde-compile-compiler))
670   "Get additional command line arguments for this compiler."
671         jde-compile-option-command-line-args)
672
673 (defmethod jde-compile-target-arg ((this jde-compile-compiler))
674   "Get compiler target argument for this compiler."
675     (let ((target (car jde-compile-option-target)))
676       (if (not (string= target "1.1"))
677           (list "-target" target))))
678
679 (defmethod jde-compile-source-arg ((this jde-compile-compiler))
680   "Get compiler source argument for this compiler."
681   (let ((source (car jde-compile-option-source)))
682     (if (not (string= source "default"))
683         (list "-source" source))))
684
685 (defmethod jde-compile-get-args ((this jde-compile-compiler))
686   (append
687    (jde-compile-classpath-arg this)
688    (jde-compile-sourcepath-arg this)
689    (jde-compile-bootclasspath-arg this)
690    (jde-compile-extdirs-arg this)
691    (jde-compile-encoding-arg this)
692    (jde-compile-debug-arg this)
693    (jde-compile-output-dir-arg this)
694    (jde-compile-deprecation-arg this)
695    (jde-compile-optimize-arg this)
696    (jde-compile-depend-arg this)
697    (jde-compile-vm-args this)
698    (jde-compile-verbose-arg this)
699    (jde-compile-verbose-path-arg this)
700    (jde-compile-nowarn-arg this)
701    (jde-compile-target-arg this)
702    (jde-compile-source-arg this)
703    (jde-compile-command-line-args this)))
704
705
706 (defmethod jde-compile-run-exec ((this jde-compile-compiler))
707   (let* ((outbuf (oref (oref this buffer) buffer))
708          (compiler-path (oref this :path))
709          (source-file (file-name-nondirectory buffer-file-name))
710          (flag nil)
711          (args (append
712                 (jde-compile-get-args this)
713                 (oref this :interactive-args)
714                 (list source-file))))
715
716     (save-excursion
717       (set-buffer outbuf)
718
719       (let ((inhibit-read-only t)) ; make compilation buffer temporarily writable
720         (insert (format "cd %s\n" default-directory))
721         (insert (concat
722                compiler-path
723                " "
724                (mapconcat (lambda (x) 
725                             (if (and flag
726                                      jde-compile-option-hide-classpath)
727                                 (progn
728                                   (setq flag nil)
729                                   "...")
730                               (if (not (string= x "-classpath"))
731                                   x
732                                 (progn
733                                   (setq flag t)
734                                   x)))) args " ")
735                "\n\n")))
736
737       (let* ((process-environment (cons "EMACS=t" process-environment))
738              (w32-quote-process-args ?\")
739              (win32-quote-process-args ?\") ;; XEmacs
740              (proc (apply 'start-process 
741                           (downcase mode-name)
742                           outbuf
743                           compiler-path
744                           args)))
745         (set-process-sentinel proc 'compilation-sentinel)
746         (set-process-filter proc 'compilation-filter)
747         (set-marker (process-mark proc) (point) outbuf)
748         (setq compilation-in-progress
749               (cons proc compilation-in-progress))))))
750
751 (defmethod jde-compile-run-server ((this jde-compile-compiler))
752   (let* ((directory-sep-char ?/)
753            (args
754             (append
755             (jde-compile-get-args this)))
756            (source-path 
757             (jde-normalize-path buffer-file-name))
758            (arg-array (concat "new String[] {\"" source-path "\"")))
759     
760     (if args
761         (setq arg-array
762               (concat
763                arg-array
764                ","
765                (mapconcat
766                 (lambda (arg)
767                   (concat "\"" arg "\""))
768                 args
769                 ","))))
770
771       (setq arg-array (concat arg-array "}"))
772      
773       (save-excursion
774         (set-buffer (oref (oref this buffer) buffer))
775
776         (let* ((inhibit-read-only t)
777                flag
778                (arg-string
779                 (mapconcat 
780                  (lambda (x) 
781                    (if (and flag
782                             jde-compile-option-hide-classpath)
783                        (progn
784                          (setq flag nil)
785                          "...")
786                      (if (not (string= x "-classpath"))
787                          x
788                        (progn
789                          (setq flag t)
790                          x))))
791                  args " ")))
792
793           (insert "CompileServer output:\n\n")
794           (insert arg-string " " source-path "\n")))
795
796       (if (not (jde-bsh-running-p))
797           (progn
798             (bsh-launch (oref 'jde-bsh the-bsh))
799             (bsh-eval (oref 'jde-bsh the-bsh) (jde-create-prj-values-str))))
800
801       (bsh-buffer-eval 
802        (oref 'jde-bsh the-bsh)
803        (concat
804         (format
805          "jde.util.CompileServer.compile(%s);"
806          arg-array) 
807         "\n")
808        (oref this buffer))))
809
810
811 (defmethod jde-compile-launch ((this jde-compile-compiler))
812
813   (if (oref this :use-server-p)
814       (jde-compile-run-server this)
815     (jde-compile-run-exec this))
816
817   (set-buffer-modified-p nil))
818
819 (defmethod jde-compile-compile ((this jde-compile-compiler))
820
821   (if (oref this :use-server-p)
822       (oset this buffer (jde-compile-server-buffer "compilation buffer"))
823     (oset this buffer (jde-compile-exec-buffer "compilation buffer")))
824   
825
826   ;; Pop to compilation buffer.
827   (let* ((outbuf (oref (oref this buffer) buffer))
828           (outwin (display-buffer outbuf)))
829     (compilation-set-window-height outwin)
830     (oset this :window outwin)
831
832     (if (not jde-xemacsp)
833         (if compilation-process-setup-function
834           (funcall compilation-process-setup-function)))     
835     
836     (jde-compile-launch this)
837
838     (setq compilation-last-buffer outbuf)))
839
840
841 (defclass jde-compile-javac (jde-compile-compiler)
842   ()
843   "Class of javac compilers.")
844
845 (defmethod initialize-instance ((this jde-compile-javac) &rest fields)
846  ;; Call parent initializer.
847
848   (call-next-method)
849
850   ;; Set compiler name.
851   (oset this name "javac")  
852
853 )
854
855 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
856 ;;                                                                            ;;
857 ;; JDK 1.1 Compiler                                                           ;;
858 ;;                                                                            ;;
859 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
860 (defclass jde-compile-javac-11 (jde-compile-compiler)
861   ()
862   "Class of JDK 1.1 javac compilers.")
863
864 (defmethod initialize-instance ((this jde-compile-javac-11) &rest fields)
865  ;; Call parent initializer.
866
867   (call-next-method)
868
869   ;; Set compiler version.
870   (oset this version "1.1"))
871
872 (defmethod jde-compile-debug-arg ((this jde-compile-javac-11))
873   "Get the debug arg for this compiler."
874    (let ((include-option (nth 0 jde-compile-option-debug)))
875      (cond
876       ((string= include-option "all")
877        (list "-g"))
878       ((string= include-option "selected")
879        (error "JDK 1.1 version of javac does not support selected debug info.")))))
880
881 (defmethod jde-compile-depend-arg ((this jde-compile-javac-11))
882   "Get dependency-checking argument for this compiler."
883   (if jde-compile-option-depend
884     (list "-depend")))
885
886 (defmethod jde-compile-get-args ((this jde-compile-javac-11))
887   (append
888    (jde-compile-classpath-arg this)
889    (jde-compile-encoding-arg this)
890    (jde-compile-debug-arg this)
891    (jde-compile-output-dir-arg this)
892    (jde-compile-deprecation-arg this)
893    (jde-compile-optimize-arg this)
894    (jde-compile-depend-arg this)
895    (jde-compile-vm-args this)
896    (jde-compile-verbose-arg this)
897    (jde-compile-nowarn-arg this)
898    (jde-compile-command-line-args this)))
899
900
901 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
902 ;;                                                                            ;;
903 ;; JDK 1.2 Compiler                                                           ;;
904 ;;                                                                            ;;
905 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
906 (defclass jde-compile-javac-12 (jde-compile-compiler)
907   ()
908   "Class of JDK 1.2 javac compilers.")
909
910 (defmethod initialize-instance ((this jde-compile-javac-12) &rest fields)
911  ;; Call parent initializer.
912
913   (call-next-method)
914
915   ;; Set compiler version.
916   (oset this version "1.2"))
917
918 (defmethod jde-compile-depend-arg ((this jde-compile-javac-12))
919   "Get dependency-checking argument for this compiler."
920   (if jde-compile-option-depend
921     (list "-Xdepend")))
922
923
924 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
925 ;;                                                                            ;;
926 ;; JDK 1.3 Compiler                                                           ;;
927 ;;                                                                            ;;
928 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
929 (defclass jde-compile-javac-13 (jde-compile-javac-12)
930   ()
931   "Class of JDK 1.3 javac compilers.")
932
933 (defmethod initialize-instance ((this jde-compile-javac-13) &rest fields)
934  ;; Call parent initializer.
935
936   (call-next-method)
937
938   ;; Set compiler version.
939   (oset this version "1.3"))
940
941
942 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
943 ;;                                                                            ;;
944 ;; JDK 1.4 Compiler                                                           ;;
945 ;;                                                                            ;;
946 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
947 (defclass jde-compile-javac-14 (jde-compile-javac-13)
948   ()
949   "Class of JDK 1.4 javac compilers.")
950
951 (defmethod initialize-instance ((this jde-compile-javac-14) &rest fields)
952  ;; Call parent initializer.
953
954   (call-next-method)
955
956   ;; Set compiler version.
957   (oset this version "1.4"))
958
959
960 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
961 ;;                                                                            ;;
962 ;; J2SDK 1.5 Compiler                                                         ;;
963 ;;                                                                            ;;
964 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
965 (defclass jde-compile-javac-15 (jde-compile-javac-14)
966   ()
967   "Class of J2SDK 1.5 javac compilers.")
968
969 (defmethod initialize-instance ((this jde-compile-javac-15) &rest fields)
970  ;; Call parent initializer.
971
972   (call-next-method)
973
974   ;; Set compiler version.
975   (oset this version "1.5"))
976
977
978
979 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
980 ;;                                                                            ;;
981 ;; Jikes Compiler                                                             ;;
982 ;;                                                                            ;;
983 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
984 (defclass jde-compile-jikes (jde-compile-compiler)
985   ()
986   "Class of jikes compilers.")
987
988 (defmethod initialize-instance ((this jde-compile-jikes) &rest fields)
989  ;; Call parent initializer.
990
991   (call-next-method)
992
993   ;; Set compiler name.
994   (oset this :name "jikes")
995
996   ;; Set compiler version.
997   (oset this version "1.14"))
998
999 (defmethod jde-compile-debug-arg ((this jde-compile-jikes))
1000   "Get the debug arg for this compiler."
1001   (let ((include-option (nth 0 jde-compile-option-debug)))
1002     (cond
1003      ((string= include-option "all")
1004       (list "-g"))
1005      ((string= include-option "selected")
1006       (error "Jikes does not support jde-compile-option-debug's selected debug info option.")))))
1007
1008 (defmethod jde-compile-depend-arg ((this jde-compile-jikes))
1009   "Get dependency-checking argument for this compiler."
1010   (if jde-compile-option-depend
1011     (list "-depend")))
1012
1013 (defmethod jde-compile-command-line-args ((this jde-compile-jikes))
1014   "Get additional command line arguments for this compiler."
1015         (append
1016          (list "+E")
1017          jde-compile-option-command-line-args))
1018
1019 (defmethod jde-compile-classpath-arg ((this jde-compile-jikes))
1020   "Returns the classpath argument for this compiler."
1021   (let ((classpath (call-next-method))
1022         (rt        (expand-file-name "jre/lib/rt.jar" (jde-get-jdk-dir))))
1023     (if (file-exists-p rt)
1024         (if classpath
1025             (or (string-match "jre/lib/rt\.jar" (cadr classpath))
1026                 (setcar (cdr classpath)
1027                         (concat (cadr classpath)
1028                                 jde-classpath-separator
1029                                 rt)))
1030           (setq classpath (list "-classpath" rt))))
1031     classpath))
1032
1033 (defmethod jde-compile-get-args ((this jde-compile-jikes))
1034   (append
1035    (jde-compile-classpath-arg this)
1036    (jde-compile-sourcepath-arg this)
1037    (jde-compile-bootclasspath-arg this)
1038    (jde-compile-extdirs-arg this)
1039    (jde-compile-encoding-arg this)
1040    (jde-compile-debug-arg this)
1041    (jde-compile-output-dir-arg this)
1042    (jde-compile-deprecation-arg this)
1043    (jde-compile-source-arg this)
1044    (jde-compile-optimize-arg this)
1045    (jde-compile-depend-arg this)
1046    (jde-compile-verbose-arg this)
1047    (jde-compile-verbose-path-arg this)
1048    (jde-compile-nowarn-arg this)
1049    (jde-compile-target-arg this)
1050    (jde-compile-command-line-args this)))
1051
1052
1053 (defvar jde-compile-javac-compilers
1054   (list
1055    (jde-compile-javac-11 "javac 1.1.x")
1056    (jde-compile-javac-12 "javac 1.2.x")
1057    (jde-compile-javac-13 "javac 1.3.x")
1058    (jde-compile-javac-14 "javac 1.4.x")
1059    (jde-compile-javac-15 "javac 1.5.x"))
1060   "List of supported javac compilers.")
1061
1062 (defun jde-compile-get-javac ()
1063   (let* ((jdk-version (jde-java-version))
1064          (jdk-split-version (split-string jdk-version "[.]"))
1065          (jdk-major-version (nth 0 jdk-split-version))
1066          (jdk-minor-version (nth 1 jdk-split-version))
1067          (compiler
1068           (find-if 
1069            (lambda (compiler-x)
1070              (let* ((compiler-split-version (split-string (oref compiler-x :version) "[.]"))
1071                     (compiler-major-version (nth 0 compiler-split-version))
1072                     (compiler-minor-version (nth 1 compiler-split-version)))
1073                (and 
1074                 (string= jdk-major-version compiler-major-version)
1075                 (string= jdk-minor-version compiler-minor-version))))
1076            jde-compile-javac-compilers)))
1077     (unless compiler
1078       (let ((latest-javac (car (last jde-compile-javac-compilers))))
1079         (if
1080             (yes-or-no-p 
1081              (format "The JDE does not recognize JDK %s javac. Assume JDK %s javac?"
1082                      jdk-version (oref latest-javac :version)))
1083             (setq compiler latest-javac))))
1084     (if compiler 
1085         (if (string= (car jde-compiler) "javac server")
1086             (oset compiler :use-server-p t)
1087           (progn
1088             (oset compiler :use-server-p nil)
1089             (oset compiler 
1090                   :path 
1091                   (let ((compiler-path 
1092                          (substitute-in-file-name (nth 1 jde-compiler))))
1093                     (if (string= compiler-path "")
1094                         (setq compiler-path (jde-get-jdk-prog 'javac))
1095                       (if (file-exists-p compiler-path)
1096                           compiler-path
1097                         (error (format "Invalid compiler path %s"
1098                                        compiler-path)))))))))
1099     compiler))
1100            
1101              
1102 (defun jde-compile-get-jikes ()
1103   (let ((compiler-path 
1104                 (substitute-in-file-name (nth 1 jde-compiler))))
1105
1106     (if (string= compiler-path "")
1107         (if (executable-find "jikes")
1108             (setq compiler-path "jikes")
1109           (error "Cannot find jikes."))
1110       (unless
1111           (or
1112            (file-exists-p
1113             (if (and
1114                  (eq system-type 'windows-nt)
1115                  (not (string-match "[.]exe$" compiler-path)))
1116                 (concat compiler-path ".exe")
1117               compiler-path))
1118            (executable-find compiler-path))
1119         (error "Invalid compiler path: %s" compiler-path)))
1120
1121   (jde-compile-jikes
1122      "Jikes"
1123      :use-server-p nil
1124      :path compiler-path)))
1125
1126 (defun jde-compile-get-the-compiler ()
1127   "Get a compiler object that represents the compiler specified
1128 by `jde-compiler'."
1129   (let ((compiler-name (car jde-compiler)))
1130     (cond 
1131      ((string-match "javac" compiler-name)
1132        (jde-compile-get-javac))
1133      ((string-match "jikes" compiler-name)
1134       (jde-compile-get-jikes))
1135      (t
1136       (error "The JDEE does not support a compiler named %s" compiler-name)))))
1137      
1138
1139 ;;;###autoload
1140 (defun jde-set-compile-options (options)
1141   "Sets the compile options.
1142 Enter the options as you would on the command line, e.g.,
1143 -depend -verbose."
1144   (interactive
1145    "sEnter options: ")
1146   (setq jde-compile-option-command-line-args (split-string options " ")))
1147
1148 ;;;###autoload
1149 (defun jde-compile ()
1150   "Compile the Java program in the current buffer.
1151 This command invokes the compiler specified by `jde-compiler'
1152 with the options specified by the JDE customization variables
1153 that begin with `jde-compile'. If the variable
1154 `jde-read-compile-args' is non-nil, this command reads
1155 additional compilation options from the minibuffer, with
1156 history enabled. If `jde-compiler' specifies the JDE compile
1157 server, this command uses the compile server. Otherwise, it
1158 uses the compiler executable specified by
1159 `jde-compiler' to compile."
1160   (interactive)
1161
1162   (if jde-read-compile-args
1163       (setq jde-interactive-compile-args
1164               (read-from-minibuffer 
1165                "Compile args: "
1166                jde-interactive-compile-args
1167                nil nil
1168                '(jde-interactive-compile-arg-history . 1))))
1169
1170     ;; Force save-some-buffers to use the minibuffer
1171     ;; to query user about whether to save modified buffers.
1172     ;; Otherwise, when user invokes jde-compile from
1173     ;; menu, save-some-buffers tries to popup a menu
1174     ;; which seems not to be supported--at least on
1175     ;; the PC.
1176     (if (and (eq system-type 'windows-nt)
1177              (not jde-xemacsp)) 
1178         (let ((temp last-nonmenu-event))
1179           ;; The next line makes emacs think that jde-compile
1180           ;; was invoked from the minibuffer, even when it
1181           ;; is actually invoked from the menu-bar.
1182           (setq last-nonmenu-event t)
1183           (save-some-buffers (not compilation-ask-about-save) nil)
1184           (setq last-nonmenu-event temp))
1185       (save-some-buffers (not compilation-ask-about-save) nil))
1186
1187     (setq compilation-finish-function 
1188       (lambda (buf msg) 
1189         (run-hook-with-args 'jde-compile-finish-hook buf msg)
1190         (setq compilation-finish-function nil)))
1191
1192     (let ((compiler (jde-compile-get-the-compiler)))
1193       (if compiler
1194           (progn
1195             (oset compiler 
1196                   :interactive-args 
1197                   (if (and jde-interactive-compile-args
1198                            (not (string= jde-interactive-compile-args "")))
1199                       (split-string jde-interactive-compile-args " ")))
1200             (jde-compile-compile compiler))
1201         (error "Unknown compiler. Aborting compilation."))))
1202     
1203
1204
1205 (provide 'jde-compile)
1206
1207 ;; Change History
1208 ;; $Log: jde-compile.el,v $
1209 ;; Revision 1.65  2005/04/06 03:03:07  paulk
1210 ;; Fix jde-compile-kill-buffer to honor jde-compile-enable-kill-buffer.
1211 ;;
1212 ;; Revision 1.64  2005/02/02 03:49:31  paulk
1213 ;; Updated to be compatible with new Emacs policy of making compilation buffers read-only.
1214 ;;
1215 ;; Revision 1.63  2004/10/20 06:17:06  paulk
1216 ;; Update to support reloading classes from a single classpath entry. Thanks to Martin Schwamberger.
1217 ;;
1218 ;; Revision 1.62  2004/08/21 04:29:20  paulk
1219 ;; Update the wizard class list after compiling a class.
1220 ;;
1221 ;; Revision 1.61  2004/08/03 03:55:00  paulk
1222 ;; Emacs 21.3.5 compatibility fix: Updated jde-compile-finish-kill-buffer to include prefix argument which is not optional in Emacs 21.3.5.
1223 ;;
1224 ;; Revision 1.60  2004/05/26 05:15:33  paulk
1225 ;; Fix version-matching bug in jde-compile-get-javac.
1226 ;;
1227 ;; Revision 1.59  2004/04/15 03:58:59  paulk
1228 ;; Add "default" option to jde-compile-option-source.
1229 ;;
1230 ;; Revision 1.58  2004/02/22 08:02:29  paulk
1231 ;; Update to support J2SDK1.5.0.
1232 ;;
1233 ;; Revision 1.57  2003/07/15 11:56:23  paulk
1234 ;; Update jde-compile-option-target.
1235 ;;
1236 ;; Revision 1.56  2003/04/08 03:16:28  paulk
1237 ;; Fixes regression that causes compilation buffer's default directory to be set incorrectly. Also rename compile server buffer from *compilation* to *JDEE Compile Server*
1238 ;;
1239 ;; Revision 1.55  2003/04/05 06:26:19  paulk
1240 ;; Added jde-compile-jump-to-first-error option. Thanks to Sean Wellington.
1241 ;;
1242 ;; Revision 1.54  2003/04/04 13:35:00  jslopez
1243 ;; Adds the source argument to the jikes compiler.
1244 ;;
1245 ;; Revision 1.53  2003/03/04 10:12:50  paulk
1246 ;; Updated the compile server to use the new compilation-mode buffer support
1247 ;; provided by bsh class.
1248 ;;
1249 ;; Revision 1.52  2003/02/28 04:13:33  jslopez
1250 ;; Adds customization variable jde-compile-enable-kill-buffer. If true the
1251 ;; jde-compile-finish-kill-buffer hook will kill the compilation buffer.
1252 ;;
1253 ;; Revision 1.51  2003/02/17 08:13:05  paulk
1254 ;; Changes required to support new package-independent version of beanshell.el
1255 ;;
1256 ;; Revision 1.50  2003/02/07 00:31:57  jslopez
1257 ;; Adds jde-compile-option-source to be compile 1.4 code with
1258 ;; the assert key word on it.
1259 ;;
1260 ;; Revision 1.49  2002/12/12 05:24:46  paulk
1261 ;; Fixed bug  that caused the compile command to fail when jikes
1262 ;; is the compiler and jde-compiler does not specify the path of the
1263 ;; jikes executable.
1264 ;;
1265 ;; Revision 1.48  2002/11/22 09:32:13  paulk
1266 ;; Improve error reporting when a user attempts to use an unsupported compiler.
1267 ;;
1268 ;; Revision 1.47  2002/11/05 07:47:25  paulk
1269 ;; Mac OS (darwin) compatibility fix: find path of javac compiler. Thanks to Andrew Hyatt.
1270 ;;
1271 ;; Revision 1.46  2002/09/18 15:20:19  jslopez
1272 ;; Fixes bug in jde-compile-finish-kill-buffer.
1273 ;; The regexp BUILD FAILED was being match agains the wrong string.
1274 ;; Now it is being match against the contents of the compilation buffer.
1275 ;;
1276 ;; Revision 1.45  2002/09/16 04:23:50  paulk
1277 ;; Added missing -encoding switch for compiler encoding command line argument.
1278 ;; Thanks to Toru Takahashi.
1279 ;;
1280 ;; Revision 1.44  2002/08/07 06:36:20  paulk
1281 ;; Removed code intended to eliminate spurious warnings when byte-compiling the JDEE. The
1282 ;; removed code now resides in a separate package, jde-compat.el. Thanks to Andy Piper
1283 ;; for suggesting this restructuring. Also fixed a number of compiler warnings caused
1284 ;; by genuine bugs.
1285 ;;
1286 ;; Revision 1.43  2002/08/03 05:01:45  paulk
1287 ;; Added a jde-compile-finish-hook function that kills the compilation
1288 ;; buffer if no compilation errors occured. Thanks to Jack Donohue <donohuej@synovation.com>.
1289 ;;
1290 ;; Revision 1.42  2002/06/12 07:04:30  paulk
1291 ;; XEmacs compatibility fix: set win32-quote-process-args wherever
1292 ;; the JDEE sets w32-quote-process-args. This allows use of spaces in
1293 ;; paths passed as arguments to processes (e.g., javac)  started by
1294 ;; the JDEE.
1295 ;;
1296 ;; Revision 1.41  2002/06/11 06:24:27  paulk
1297 ;; Provides support for paths containing spaces as compiler arguments via the following changes;
1298 ;; - Locally set the w32-quote-process-args variable to a quotation mark.
1299 ;; - The compile server Lisp code now passes the compiler arguments to the
1300 ;;   compile server Java code as an array of strings instead of as a single space-delimited
1301 ;;   string of arguments.
1302 ;;
1303 ;; Revision 1.40  2002/05/12 06:23:20  paulk
1304 ;; Replaced call to jde-complete-get-name-of-this-class with call to
1305 ;; jde-parse-buffer-class.
1306 ;;
1307 ;; Revision 1.39  2002/03/17 14:20:40  jslopez
1308 ;; Fixes bug using jde-compile-option-vm-args.
1309 ;;
1310 ;; Revision 1.38  2002/03/03 14:42:26  jslopez
1311 ;; Fixes bug getting compilation status in
1312 ;; linux.
1313 ;;
1314 ;; Revision 1.37  2002/03/03 13:51:03  jslopez
1315 ;; Fixes bug getting compilation status code.
1316 ;; Makes the code more robust.
1317 ;;
1318 ;; Revision 1.36  2002/02/25 20:10:41  jslopez
1319 ;; The Compile Server now uses its own filter.
1320 ;;
1321 ;; Revision 1.35  2002/02/15 02:52:42  jslopez
1322 ;; Updates the compile server to be interactive.
1323 ;;
1324 ;; Revision 1.34  2001/12/12 05:40:53  paulk
1325 ;; Removed an extraneous print form from jde-compile-run-exec that was dumping
1326 ;; the compiler arguments into the minibuffer.
1327 ;;
1328 ;; Revision 1.33  2001/12/09 17:09:26  jslopez
1329 ;; Adding the -classpath flag when the classpath is nil.
1330 ;;
1331 ;; Revision 1.32  2001/12/09 17:01:04  jslopez
1332 ;; Fixes bug in the method jde-compile-classpath-arg (jikes)
1333 ;; that will cause an error when appending the path for rt.jar
1334 ;; to a nil classpath.
1335 ;;
1336 ;; Revision 1.31  2001/12/08 05:49:20  paulk
1337 ;; Fixed jde-compile-get-javac to handle unknown version of the JDK.
1338 ;;
1339 ;; Revision 1.30  2001/11/29 10:00:33  paulk
1340 ;; Fixed bug where the JDE was inserting a null string in the javac
1341 ;; argument list when the user did not specify arguments interactively, which is normally the case. This bug caused compiling with the javac executable to fail on XEmacs.
1342 ;;
1343 ;; Revision 1.29  2001/11/28 08:32:10  paulk
1344 ;; Compile server now runs jde-normalize-path on the path of the path of the source file.
1345 ;; This ensures that the path will be converted to a Windows path on the Cygwin version
1346 ;; of XEmacs.
1347 ;;
1348 ;; Revision 1.28  2001/11/23 14:21:47  paulk
1349 ;; Fixed cut-and-paste error in the debug options error messages for Jikes.
1350 ;;
1351 ;; Revision 1.27  2001/10/24 04:13:33  jslopez
1352 ;; Adds the customization variable jde-compile-option-hide-classpath.
1353 ;; A non-nil variable causes the classpath value in the compilation
1354 ;; output to be shown as ... . i.e java -classpath ... -g Test.
1355 ;;
1356 ;; Revision 1.26  2001/10/19 10:10:59  paulk
1357 ;; Removed space in front of -g option that made it unrecognizable to compiler.
1358 ;; Thanks to bert van vreckem.
1359 ;;
1360 ;; Revision 1.25  2001/10/19 04:14:20  paulk
1361 ;; Bug fix: compile command once again supports the jde-read-compile-args option.
1362 ;; Thanks to Luis Novais for reporting this bug.
1363 ;;
1364 ;; Revision 1.24  2001/10/16 05:10:50  paulk
1365 ;; - Fixed Lisp error that occurred when the default setting
1366 ;;   for jde-compile-option-debug is in effect.
1367 ;;
1368 ;; - XEmacs compatibility fix. Fixed undefined variable and
1369 ;;   function Lisp errors that occur when trying to compile
1370 ;;   a Java source file.
1371 ;;
1372 ;; - XEmacs compatibility fix. Fixed bug that produced a Beanshell
1373 ;;   error when trying to run the compile server in XEmacs.
1374 ;;
1375 ;; Revision 1.23  2001/10/08 13:06:11  paulk
1376 ;; Minor restructuring of compile server code.
1377 ;;
1378 ;; Revision 1.22  2001/10/05 11:02:27  paulk
1379 ;; Reordered the compile server output message so that the file name follows the other arguments.
1380 ;;
1381 ;; Revision 1.21  2001/10/05 04:08:01  paulk
1382 ;; - Fixed compile error that occurs when jde-compile-option-debug is set.
1383 ;;   This was due to the -g option being wrapped in an extra list.
1384 ;; - Now includes rt.jar in the classpath when jikes is the compiler.
1385 ;;   Thanks to David Ponce.
1386 ;;
1387 ;; Revision 1.20  2001/10/01 20:48:58  jslopez
1388 ;; Added support for jdk1.4.
1389 ;;
1390 ;; Revision 1.19  2001/10/01 12:02:34  paulk
1391 ;; - Now uses the version of javac shipped with the JDK specified by jde-jdk.
1392 ;; - Now generates the correct options for the various versions of javac.
1393 ;; - Now includes the +E options if jikes is the selected compiler.
1394 ;;
1395 ;; Revision 1.18  2001/10/01 02:24:49  paulk
1396 ;; - Created jde-compile-javac, jde-compile-jikes, jde-compile-javac-11x classes.
1397 ;;
1398 ;; - Fixed missing slot names in jde-compile-compiler class. Thanks to Eric Friedman.
1399 ;;
1400 ;; Revision 1.17  2001/09/28 05:10:10  paulk
1401 ;; - Redefined jde-compiler to allow selection of the
1402 ;;   following options: javac executable, javac server,
1403 ;;   and jikes executable.
1404 ;;
1405 ;; - Redefinded jde-compile-option-command-line-args to
1406 ;;   accept a list of strings, each corresponding to one
1407 ;;   argument.
1408 ;;
1409 ;; - Created a new class jde-compile-compiler to serve
1410 ;;   as the root class for all compilers supported by
1411 ;;   the JDE. This should promote sharing code among
1412 ;;   the compilers.
1413 ;;
1414 ;; Revision 1.16  2001/08/30 13:21:57  jslopez
1415 ;; Fixed bug in jde-compile-internal that did not scroll the compilation output
1416 ;; when the compile server and compilation-scroll-output were enable.
1417 ;;
1418 ;; Revision 1.15  2001/08/30 01:31:54  paulk
1419 ;; Adds support for compile server. Thanks to Javier Lopez.
1420 ;;
1421 ;; Revision 1.14  2001/04/16 05:47:33  paulk
1422 ;; Normalized paths. Thanks to Nick Sieger.
1423 ;;
1424 ;; Revision 1.13  2001/04/11 03:23:18  paulk
1425 ;; Updated to resolve relative paths relative to the project file that defines them. Thanks to Nick Sieger.
1426 ;;
1427 ;; Revision 1.12  2001/04/02 02:42:58  paulk
1428 ;; Remove extraneous definition of jde-build-classpath-arg.
1429 ;;
1430 ;; Revision 1.11  2001/03/13 04:03:47  paulk
1431 ;; Changed the type of jde-compile-option-directory from string to directory to permit path completion.
1432 ;;
1433 ;; Revision 1.10  2001/02/20 05:15:10  paulk
1434 ;; You can now use environment variables, tilde notation, and cygwin syntax in jde-compile-option-directory path.
1435 ;;
1436 ;; Revision 1.9  2001/02/17 17:43:34  paulk
1437 ;; Added support for JDK 1.3 targets.
1438 ;;
1439 ;; Revision 1.8  2001/02/03 08:18:44  paulk
1440 ;; Changed declarations of customized variables so that you can now use completion (M tab) to complete path names.
1441 ;;
1442 ;; Revision 1.7  2000/09/21 02:05:11  paulk
1443 ;; Fixes bug in formatting jde-compile-option-vm-args for the command line.
1444 ;;
1445 ;; Revision 1.6  2000/08/19 07:04:28  paulk
1446 ;; Adds compile finish hook.
1447 ;;
1448 ;; Revision 1.5  2000/08/11 05:04:45  paulk
1449 ;; Added jde-compile-finish-hook variable.
1450 ;;
1451 ;; Revision 1.4  2000/04/10 05:27:30  paulk
1452 ;; Compile command now supports Cygwin-style class paths.
1453 ;;
1454 ;; Revision 1.3  1999/01/15 22:04:15  paulk
1455 ;; Added Andy Piper's NT/XEmacs compatibility changes.
1456 ;;
1457 ;; Revision 1.2  1998/12/07 01:35:28  paulk
1458 ;; Updated compile options to reflect changes in command-line options
1459 ;; accepted by javac.
1460 ;;
1461 ;; Revision 1.1  1998/12/06 02:37:54  paulk
1462 ;; Initial revision
1463 ;;
1464
1465 ;; End of jde-compile.el