A new version of Clojuresque is released! Changes to v1.1.0:
warnOnReflection now configurableaotCompile now configurable and off by default, see [discussion on
the google group]aotPlease be sure to read and understand these issues:
Sitting between the chairs of Clojure's namespace based and the other languages file based compilation, you have to include or exclude namespaces based on filenames for now.
Automatic recognition of namespaces only works if the ns form is the
first in the file. Comments may precede the form. The symbol is allowed
to be fully qualified: clojure.core/ns.
In order for the scp deployment of Clojars to work, you have to
replace the jsch jar in ${GRADLE_HOME}/lib with jsch-0.1.29.jar.
Otherwise the transfer might hang. See this ant bug for more
information.
Additional to configuration of the Upload tasks with configureClojarsDeploy
you also have to specify the location of the keyfile and the passphrase you
use to access Clojars. This can be done independent of the projects
in a file called ${HOME}/.gradle/gradle.properties.
clojarsKeyfile = /Users/mb/.ssh/id_dsa
clojarsPassphrase = My super secret passphrase
Be sure to correctly secure this file! Or your key might be compromised!
Here a non-trivial with AOT compilation, reflection warning and Clojars deployment:
buildscript {
repositories {
mavenRepo name: 'clojars', urls: 'http://clojars.org/repo'
}
dependencies {
classpath 'clojuresque:clojuresque:1.2.0'
}
}
group = 'example.group'
version = '1.0.0'
usePlugin(cojuresque.ClojurePlugin)
warnOnReflection = true
aotCompile = true
clojureSnapshotsRepo(repositories)
clojarsRepo(repositories)
gradleHomeRepo(repositories)
dependencies {
compile 'org.clojure:clojure:1.1.0-master-SNAPSHOT'
}
configureClojarsDeploy(uploadArchives)
A small walkthrough:
buildscript part defines a dependency and automatically fetches
clojuresque from Clojars.group and version properties define the respective attributes of
your project. They are required for the POM generation. *Note that gradle
derives the project name from the name of this directory!*usePlugin basically loads the clojure plugin.warnOnReflection turns on the reflection warnings of the clojure compileraotCompile specifies whether to produce a source jar or an AOT compiled
jar. The default is produce a source jar, because they also tend to be
smaller. This issue was discussed on the Google group.clojureSnapshotsRepo tells gradle where to find the clojure and contrib
snapshots, ie. where it can find the Hudson server.clojarsRepo adds the Clojars Repository in a similar way.gradleHomeRepo is used to add ${GRADLE_HOME}/lib as a local repository.
This is useful to minimise the download of the scp ant task dependencies.
Note that GRADLE_HOME must be set for this to work! *Note, that this
must come before a possible mavenCentral()!*dependencies section we add a dependency on the current master
SNAPSHOT.configureClojarsDeploy configures the given Upload
task to deploy to the Clojars RepositoryThis can be even more simplified by registering clojuresque with your local
Gradle installation. Put the clojuresque jar in ${GRADLE_HOME}/lib and add
the following line to ${GRADLE_HOME}/plugin.properties:
clojure=clojuresque.ClojurePlugin
From now on you can skip the whole buildscript stuff and just use
usePlugin('clojure') to load the plugin.
This is alpha software! Expect problems! Please report issues in the bugtracker at bitbucket in the 'Issues' tab.
Published by Meikel Brandmeyer on .
I'm a long-time Clojure user and the developer of several open source projects mostly involving Clojure. I try to actively contribute to the Clojure community.
My most active projects are at the moment VimClojure, Clojuresque and ClojureCheck.
Copyright © 2009-2014 All Right Reserved. Meikel Brandmeyer