Hi,

Am Montag, 4. Juli 2011 09:14:01 UTC+2 schrieb konrad...@laposte.net:

> Thanks for everyone's suggestions and comments!
> 
> Some remarks:
> 
> Gradle/clojuresque: I never tried them, but it looks like I should!
> 
> AOT compilation: My case is probably a bit complex in this respect. I
> need AOT compilation only because I want to produce an executable jar,
> so there is at least one namespace that must be AOT compiled. For
> building that executable jar, it doesn't matter if everything else is
> AOT compiled as well. But I want to be able to build a standard
> library jar with just the Clojure code to make sure it works with
> future Clojure releases. One solution would be to have two completely
> different builds, one for the executable jar and one for the library
> version, but using the same set of source code files.

I would do it like this:

Split the source in two parts: the library part and the application
part. This would help to maintain a clean library API, because you
could use your application as “real” customer. You could build both
parts independently if desired and so on.

On the other hand this is not a requirement. You could just as well
have everything in one tree and create two jars from it. But my
gradle-fu is too limited to suggest a quick solution for that way.

First the former way the source layout would be something like this:

root directory of the project
 │
 ├─ build.gradle (see below)
 │
 ├─ lib
 │   │
 │   ├─ build (clojuresque, other stuff needed for buildscript)
 │   │
 │   └─ runtime (your dependencies go here)
 │
 ├─ library (library subproject)
 │
 └─ app (application subproject)

You need only the following central build.gradle. It will build a
normal library jar for the library subproject and a AOT-compiled
jar for the application.

buildscript {
    repositories { flatDir dirs: project.file('lib/build') }
    dependencies { classpath "clojuresque:clojuresque:1.4.1" }
}

subprojects {
    apply plugin: "java"
    apply plugin: "clojure"

    group = "yourGroupGoesHere"
    version = "some.version.number"

    repositories {
        flatDir dirs: project(':').file('lib/runtime').absoluteFile
    }

    dependencies {
        compile "org.clojure:clojure:1.2.1"
    }
}

project(':library') {
    dependencies {
        compile "some.other:library:1.2.3"
        compile "and.another:one:3.2.1"
    }
}

project(':app') {
    aotCompile = true

    // If you want a fat jar with all dependencies included...
    uberjar.enabled = true
    configurations.compile.transitive = true

    dependencies {
        compile project(':library')
    }

    // more stuff here for main class definition etc.
}

Although not completely working out of the box this should give
you a feeling of how things would look like with gradle. So you
can hopefully quickly evaluate whether it is worth a look at all.

I'm open for any support request to get you going with clojuresque.
Mail me or put the discussions on the newly created google
group: http://groups.google.com/group/clojuresque.

Sincerely
Meikel

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to