Clojuresque 1.2.0 released
A new version of Clojuresque is released! Changes to v1.1.0:
warnOnReflectionnow configurableaotCompilenow configurable and off by default, see discussion on the google group- easy integration of Clojars and Hudson repositories
- easy deployment to Clojars
Caveats
Please 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
nsform 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}/libwith jsch-0.1.29.jar. Otherwise the transfer might hang. See this ant bug for more information.
Clojars Deployment
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!
Example
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:
- The
buildscriptpart defines a dependency and automatically fetches clojuresque from Clojars. - The
groupandversionproperties 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! usePluginbasically loads the clojure plugin.warnOnReflectionturns on the reflection warnings of the clojure compileraotCompilespecifies 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.clojureSnapshotsRepotells gradle where to find the clojure and contrib snapshots, ie. where it can find the Hudson server.clojarsRepoadds the Clojars Repository in a similar way.gradleHomeRepois used to add${GRADLE_HOME}/libas a local repository. This is useful to minimise the download of the scp ant task dependencies. Note thatGRADLE_HOMEmust be set for this to work! Note, that this must come before a possiblemavenCentral()!- In the
dependenciessection we add a dependency on the current master SNAPSHOT. - Last but not least:
configureClojarsDeployconfigures the givenUploadtask to deploy to the Clojars Repository
This 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.
Issues
This is alpha software! Expect problems! Please report issues in the bugtracker at bitbucket in the 'Issues' tab.