Re: flymake integration for the eclipse java compiler

"Suraj Acharya" <[email protected]> Tue, 1 May 2007 08:43:33 -0700
Newsgroups gmane.emacs.jdee
Message-ID <[email protected]>
Jason, James,

Do you guys have any more debugging info for me to look at?

Suraj

On 4/27/07, Suraj Acharya <[email protected]> wrote:
> The following functions add some more logging. And send me your
> flymake.el, just to make sure that the problem is not due to differing
> versions of flymake.
>
> (defun jde-ecj-server-flymake-init ()
>   "Run the Eclipse Java compiler to collect flymake errors.
> To use this funtion set the java line in `flymake-allowed-file-name-masks' to
>   (\"\\.java\\'\" jde-ecj-server-flymake-init jde-ecj-flymake-cleanup)"
>
>   (unless jde-ecj-server-setup-called
>     (jde-ecj-server-setup))
>
>   (if (not (object-of-class-p (jde-compile-get-the-compiler)
> 'jde-compile-ejc-server))
>       (error "The ecj option for flymake can only be set when the
> jde-compiler is also set to ecj")
>     ;; else
>     (let* ((temp-file (flymake-init-create-temp-buffer-copy
> 'jde-ecj-create-temp-file))
>            (directory-sep-char ?/)
>            (args (append (jde-compile-classpath-arg
> (jde-compile-get-the-compiler))
>                          (list "-Xemacs" "-noExit")
>                          jde-ecj-command-line-args))
>            (arg-array (concat "new String[] {"))
>            (bsh-process (oref (oref  (oref 'jde-bsh the-bsh) buffer) process)))
>
>       (flymake-log 3 "jde-ecj-server-flymake-init temp-file=%s" temp-file)
>       (flymake-log 3 "jde-ecj-server-flymake-init
> flymake-temp-source-file-name=%s" flymake-temp-source-file-name)
>
>       (unless (jde-bsh-running-p)
>         (bsh-launch (oref 'jde-bsh the-bsh))
>         (bsh-eval (oref 'jde-bsh the-bsh) (jde-create-prj-values-str)))
>
>       (if args (setq arg-array (concat arg-array
>                                        (mapconcat
>                                         (lambda (arg)
>                                           (concat "\"" arg "\"")) args ",")
>                                        ",")))
>
>       (setq arg-array (concat arg-array "\"" temp-file "\"}"))
>
>
>       (list (cons bsh-process ;; server process
>                   "bsh %")  ;; output end marker
>             ;; compile command
>             (concat (format
>                      "(new
> org.eclipse.jdt.internal.compiler.batch.Main(new
> java.io.PrintWriter(System.out),
>
> new java.io.PrintWriter(System.err), true)).compile(%s);"
>                      arg-array))))))
>
>
>
> (defun flymake-get-full-patched-file-name (file-name-from-err-msg
> base-dirs files)
>   (let* ((base-dirs-count  (length base-dirs))
>          (file-count       (length files))
>          (real-name        nil))
>
>     (while (and (not real-name) (> base-dirs-count 0))
>       (setq file-count (length files))
>       (while (and (not real-name) (> file-count 0))
>         (let* ((this-dir        (nth (1- base-dirs-count) base-dirs))
>                (this-file       (nth 0 (nth (1- file-count) files)))
>                (this-real-name  (nth 1 (nth (1- file-count) files))))
>           (flymake-log 0 "this-dir=%s this-file=%s this-real=%s msg-file=%s"
> this-dir this-file this-real-name file-name-from-err-msg)
>           (when (and this-dir this-file (flymake-same-files
>                                          (expand-file-name file-name-from-err-msg this-dir)
>                                          this-file))
>             (setq real-name this-real-name)))
>         (setq file-count (1- file-count)))
>       (setq base-dirs-count (1- base-dirs-count)))
>     real-name))
>
> Suraj
>
> On 4/27/07, Jason Coffin <[email protected]> wrote:
> > On 4/27/07, Suraj Acharya <[email protected]> wrote:
> > > Jason,
> > >
> > > The problem is because flymake thinks the temp file is called
> > > "c:/DOCUME~1/jcoffin/LOCALS~1/Temp/..." while ecj is returning error
> > > messages with filenames like "c:\Documents and Settings\jcoffin\Local
> > > Settings\Temp\...".
> > >
> > > I thought I fixed this in the new function definition I sent in my
> > > previous mail, by not calling file-truename. Are you sure you're using
> > > this function definition and not the one from your saved .el file?
> > > Basically the variable temp-file in that function should have the
> > > directory names with ~1 in them, and not spaces.
> > >
> > > What does the line that starts with "sent command=.." in your
> > > *Messages* buffer look like?
> > >
> >
> > sent command=(new org.eclipse.jdt.internal.compiler.batch.Main(new
> > java.io.PrintWriter(System.out),
> >
> > new java.io.PrintWriter(System.err), true)).compile(new String[]
> > {"-classpath","[**very long clas path
> > definition**]","-Xemacs","-noExit","-d","none","-1.5","c:/Documents
> > and Settings/jcoffin/Local
> > Settings/Temp/-45009877/ISPSpamComplaintHandler.java"});, to
> > process=#<process bsh>
> >
> >
> > And yes, I'm using your new function definition.
> >
>