librelist archives

« back to archive

Re: [leiningen] javac enhancement :java-source-exclude

Re: [leiningen] javac enhancement :java-source-exclude

From:
Phil Hagelberg
Date:
2013-09-23 @ 16:47
Gregg Reynolds writes:

> I needed to exclude some files from javac so I implemented simple support
> for a new project map key:
>
>   ;; javac exclusions - vector of file and dir names to exclude from compile
>   :java-source-exclude
>   ["org/example/foo.java" ; don't javac src/main/java/org/example/foo.java
>     "org/example/bar"]  ;; don't javac anything below
> src/main/java/org/example/bar

I'd rather not use the term "exclusions" for this because that's already
used to specify what should be left out of the jar file. Can you explain
the motivation here? If you have Java source that you don't want to
compile, why not place it in resources/ or something?

-Phil

Re: [leiningen] javac enhancement :java-source-exclude

From:
Phil Hagelberg
Date:
2013-09-24 @ 14:55
Gregg Reynolds writes:

> I'm playing exterminator - exploring the use leiningen instead of ant to
> control a legacy java application (DITA-OT).  The ant javac task uses the
> "excludes" attribute:
>
>     <javac srcdir="${java.dir}" destdir="${bin.dir}"
>            debug="on"
>            source="1.6" target="1.6">
>       <exclude name="org/dita/dost/invoker/JavaInvoker.java"/>
>       <exclude name="org/dita/dost/invoker/CommandLineInvoker"/>
>       ...
>
> I have no idea why, but if we want to use leiningen in this sort of
> situation we need some form of support for the exclude attribute.

I'd really rather not add a new setting to Leiningen without a really
solid use case; more than just because Ant does it this way. However,
you could do this with a hook.

(add-hook #'leiningen.javac
          (fn [orig & args] (for [f (apply orig args)
                                  :when (keep-java-source? f)] f)))

-Phil

Re: [leiningen] javac enhancement :java-source-exclude

From:
Gregg Reynolds
Date:
2013-09-24 @ 04:12
On Mon, Sep 23, 2013 at 11:47 AM, Phil Hagelberg <phil@hagelb.org> wrote:

>
> Gregg Reynolds writes:
>
> > I needed to exclude some files from javac so I implemented simple support
> > for a new project map key:
> >
> >   ;; javac exclusions - vector of file and dir names to exclude from
> compile
> >   :java-source-exclude
> >   ["org/example/foo.java" ; don't javac
> src/main/java/org/example/foo.java
> >     "org/example/bar"]  ;; don't javac anything below
> > src/main/java/org/example/bar
>
> I'd rather not use the term "exclusions" for this because that's already
> used to specify what should be left out of the jar file.


Doesn't the prefix disambiguate sufficiently?  :jar-exclusions v.
:java-source-exclude seems clear enough to me, but I'm not religious about
it.  Maybe javac-source-exclude.  Anyway I can't see a better term.


> Can you explain
> the motivation here? If you have Java source that you don't want to
> compile, why not place it in resources/ or something?
>

I'm playing exterminator - exploring the use leiningen instead of ant to
control a legacy java application (DITA-OT).  The ant javac task uses the
"excludes" attribute:

    <javac srcdir="${java.dir}" destdir="${bin.dir}"
           debug="on"
           source="1.6" target="1.6">
      <exclude name="org/dita/dost/invoker/JavaInvoker.java"/>
      <exclude name="org/dita/dost/invoker/CommandLineInvoker"/>
      ...

I have no idea why, but if we want to use leiningen in this sort of
situation we need some form of support for the exclude attribute.

-Gregg