You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@buildr.apache.org by Chris Dean <ct...@sokitomi.com> on 2010/07/16 08:20:34 UTC

Packaging with sources

I'm working on adding Clojure support and have a question about
packaging. 

One common way to package up Clojure projects is put both the Clojure
.clj source files and all the .class files in a single jar file.  Can
someone give me some pointers on how to do that?

Cheers,
Chris Dean

Re: Packaging with sources

Posted by Pepijn Van Eeckhoudt <pe...@luciad.com>.
I would handle that by making a new package type. You can do that by implementing a package_as_<type> method. This method can create a preconfigured JarTask that includes both the clj source files and the class files by including both the target and source of the compile task. buildr/java/packaging.rb contains the package_as_jar implementation. That's probably the closest to what you want.

Pepijn
 

On 16 Jul 2010, at 08:20, Chris Dean <ct...@sokitomi.com> wrote:

> I'm working on adding Clojure support and have a question about
> packaging. 
> 
> One common way to package up Clojure projects is put both the Clojure
> .clj source files and all the .class files in a single jar file.  Can
> someone give me some pointers on how to do that?
> 
> Cheers,
> Chris Dean

Re: Packaging with sources

Posted by Chris Dean <ct...@sokitomi.com>.
Alex Boisvert <al...@gmail.com> writes:
> Another approach would be to extend the Project class such that ...

Thanks folks, that's probably enough to get me going.

Cheers,
Chris Dean

Re: Packaging with sources

Posted by Alex Boisvert <al...@gmail.com>.
Another approach would be to extend the Project class such that
package(:jar) includes both .class and .clj source files (only for clojure
projects).   I'm assuming this is the right default for 99% of the projects.

Within the context of the project, you'd do something like:

class << self
  def package_as_jar
    super.tap do |jar|
      jar.with compile.sources unless @dontIncludeSourceOption
    end
  end
end

(This is really just a sketch/handwaving to convey the idea)

alex

On Thu, Jul 15, 2010 at 11:20 PM, Chris Dean <ct...@sokitomi.com> wrote:

> I'm working on adding Clojure support and have a question about
> packaging.
>
> One common way to package up Clojure projects is put both the Clojure
> .clj source files and all the .class files in a single jar file.  Can
> someone give me some pointers on how to do that?
>
> Cheers,
> Chris Dean
>