Permalink
Browse files

Changes to support ivy / multiple dejour versions

  • Loading branch information...
1 parent ff629b1 commit 533807dc193108ad30aa73917c5ce632972473ca Russ Olsen committed Sep 30, 2011
Showing with 70 additions and 138 deletions.
  1. +0 −2 README.textile
  2. +3 −15 bin/clj
  3. +53 −65 build.xml
  4. +0 −12 c_src/args.c
  5. +0 −2 c_src/args.h
  6. +0 −4 c_src/main.c
  7. +2 −25 c_src/paths.c
  8. +0 −1 c_src/paths.h
  9. +12 −12 ivy.xml
View
@@ -69,8 +69,6 @@ The clj script and executable are designed to be very simple for beginners to us
* @-no-jline@ Don't use jline
- * @-no-contrib@ Don't use clojure-contrib
-
* @-cp <jar or directory>@ Add the next argument to the classpath
* @-classpath <jar or directory>@ Add the next argument to the classpath
View
@@ -7,7 +7,6 @@
# Options:
# -debug Just print out the java cmd and exit.
# -no-jline Don't use jline
-# -no-contrib Don't use clojure-contrib
# -cp <jar or directory> Add the next argument to the classpath
# -classpath <jar or directory> Add the next argument to the classpath
# -Dname=value Define the given Java system property, passed directly to java.
@@ -93,12 +92,10 @@ fi
# Figure out where all the key jar files are
-CLOJURE_CORE_LIB=$CLOJURE_HOME/cljlib
CLOJURE_LIB=$CLOJURE_HOME/lib
-CLOJURE_JAR=$CLOJURE_CORE_LIB/clojure.jar
-CLOJURE_CONTRIB_JAR=$CLOJURE_CORE_LIB/clojure-contrib.jar
-JLINE_JAR=$CLOJURE_CORE_LIB/jline.jar
+CLOJURE_JAR=$CLOJURE_LIB/clojure.jar
+JLINE_JAR=$CLOJURE_LIB/jline.jar
CP_DELIMITER=":"
@@ -119,7 +116,6 @@ declare -a JAVA_ARGS
USE_JLINE=true
-USE_CONTRIB=true
CLOJURE_MAIN_CLASS=clojure.main
CLOJURE_JLINE_CLASS=jline.ConsoleRunner
@@ -169,10 +165,6 @@ do
USE_JLINE=false
;;
- -no-contrib)
- USE_CONTRIB=false
- ;;
-
-repl-class)
arg_check "$1" $#
shift
@@ -205,11 +197,7 @@ if [ -z "$USER_CP" ]; then
USER_CP="$CLASSPATH"
fi
-# Do we want to use clojure contrib?
-
-if $USE_CONTRIB; then
- CORE_CP=`add_to_path "$CORE_CP" "$CLOJURE_CONTRIB_JAR" $CP_DELIMITER`
-fi
+# Do we want to use clojure jline?
if $USE_JLINE; then
CORE_CP=`add_to_path "$CORE_CP" "$JLINE_JAR" $CP_DELIMITER`
View
@@ -1,96 +1,83 @@
-<project name="dejour" basedir="." default="all">
+<project name="dejour" basedir="." default="all"
+ xmlns:ivy="antlib:org.apache.ivy.ant">
<property environment="env"/>
<property name="clojure-version" value="1.1.0" />
<property name="clojure-contrib-version" value="1.1.0" />
<property name="jline-version" value="0.9.94" />
- <property name="dejour-version" value="${clojure-version}b" />
- <property name="staging-dir" value="${basedir}/build/dejour-${dejour-version}"/>
- <property name="test-dir" value="${basedir}/test"/>
+ <target name="install-ivy" description="install ivy">
+ <path id="ivy.lib.path">
+ <pathelement location="ivy.jar"/>
+ </path>
+ <taskdef resource="org/apache/ivy/ant/antlib.xml"
+ uri="antlib:org.apache.ivy.ant"
+ classpathref="ivy.lib.path" />
+ </target>
- <target name="init">
- <mkdir dir="${staging-dir}"/>
- <mkdir dir="${staging-dir}/lib"/>
- <mkdir dir="${staging-dir}/cljlib"/>
+ <target name="downloads" depends="install-ivy">
+ <ivy:retrieve pattern="${basedir}/downloads/[conf]/[artifact].[ext]"/>
</target>
+ <target name="init" depends="downloads"/>
+
<target name="clj.exe" depends="init">
<exec dir="c_src" executable="make"/>
</target>
- <target name="clojure.zip" depends="init" unless="skip.download">
- <get src="http://clojure.googlecode.com/files/clojure-${clojure-version}.zip"
- dest="build/clojure.zip" />
- </target>
+ <macrodef name="create-dejour-release">
+ <attribute name="release-name"/>
+ <attribute name="ivy-conf-name"/>
+ <attribute name="name" default="@{release-name}-@{ivy-conf-name}"/>
+
+ <sequential>
+ <mkdir dir="build/@{name}/lib"/>
+ <copy todir="build/@{name}">
+ <fileset dir="${basedir}">
+ <include name="bin/**/*"/>
+ <include name="examples/**/*"/>
+ </fileset>
+ </copy>
- <target name="clojure.jar" depends="clojure.zip">
- <unzip src="build/clojure.zip" dest="${staging-dir}/cljlib">
- <patternset>
- <include name="**/clojure.jar"/>
- </patternset>
- <flattenmapper/>
- </unzip>
- </target>
+ <copy todir="build/@{name}/lib" flatten="true">
+ <fileset dir="${basedir}">
+ <include name="downloads/@{ivy-conf-name}/**/*"/>
+ </fileset>
+ </copy>
- <target name="clojure-contrib.zip" depends="init" unless="skip.download">
- <get src="http://clojure-contrib.googlecode.com/files/clojure-contrib-${clojure-contrib-version}.zip"
- dest="build/clojure-contrib.zip" />
- </target>
+ <chmod perm="ugo+x">
+ <fileset dir="build/@{name}"/>
+ </chmod>
+
- <target name="clojure-contrib.jar" depends="clojure-contrib.zip">
- <unzip src="build/clojure-contrib.zip" dest="${staging-dir}/cljlib">
- <patternset>
- <include name="**/clojure-contrib.jar"/>
- </patternset>
- <flattenmapper/>
- </unzip>
- </target>
+ <zip destfile="build/@{name}.zip"
+ basedir="build/@{name}"
+ includes="**/*"/>
+ </sequential>
- <target name="jline.jar" depends="init" unless="skip.download">
- <get src="http://mirrors.ibiblio.org/pub/mirrors/maven2/jline/jline/${jline-version}/jline-${jline-version}.jar"
- dest="${staging-dir}/cljlib/jline.jar" />
- </target>
+ </macrodef>
- <target name="downloaded-jars"
- depends="clojure.jar,clojure-contrib.jar,jline.jar" />
-
- <target name="build.dejour" depends="downloaded-jars,clj.exe">
- <copy todir="${staging-dir}" >
- <fileset dir="${basedir}" includes="bin/**/*"/>
- <fileset dir="${basedir}" includes="examples/**/*"/>
- </copy>
- <copy file="c_src/clj.exe" todir="${staging-dir}/bin"/>
- <copy file="c_src/cljw.exe" todir="${staging-dir}/bin"/>
- <chmod file="${staging-dir}/bin/clj" perm="ugo+x"/>
- </target>
+ <target name="all" depends="init" >
+ <create-dejour-release release-name="dejour"
+ ivy-conf-name="minimal-1.2.1c"/>
- <target name="all" depends="dejour.tar,dejour.zip"/>
+ <create-dejour-release release-name="dejour"
+ ivy-conf-name="complete-1.2.1c"/>
- <target name="dejour.zip" depends="build.dejour">
- <zip destfile="build/dejour-${dejour-version}.zip" basedir="build"
- includes="dejour-${dejour-version}/**/*"/>
- </target>
+ <create-dejour-release release-name="dejour"
+ ivy-conf-name="minimal-1.3.0c"/>
- <target name="dejour.tar" depends="build.dejour">
- <tar destfile="build/dejour-${dejour-version}.tar">
- <tarfileset dir="build" filemode="755">
- <include name="dejour-${dejour-version}/bin/**/*"/>
- </tarfileset>
- <tarfileset dir="build">
- <include name="dejour-${dejour-version}/**/*"/>
- <exclude name="dejour-${dejour-version}/bin/**/*"/>
- </tarfileset>
- </tar>
+ <create-dejour-release release-name="dejour"
+ ivy-conf-name="complete-1.3.0c"/>
</target>
<target name="test">
<java fork="true" failonerror="true" classname="clojure.main">
- <env key="PATH" value="${staging-dir}/bin${path.separator}${env.PATH}"/>
+ <env key="PATH" value="${build-dir}/bin${path.separator}${env.PATH}"/>
<classpath>
- <fileset dir="${staging-dir}/cljlib">
+ <fileset dir="${build-dir}/cljlib">
<include name="*.jar"/>
</fileset>
</classpath>
@@ -100,6 +87,7 @@
<target name="clean">
<delete dir="build" />
+ <delete dir="downloads" />
<exec dir="c_src" executable="make">
<arg value="clean"/>
</exec>
View
@@ -8,7 +8,6 @@ static char clojureMain[1000];
static char jlineMain[1000];
static int debug = FALSE;
-static int use_contrib = TRUE;
static int use_jline = TRUE;
static void add_vm_arg(char* arg) {
@@ -37,13 +36,6 @@ int get_debug() {
}
/**
- * Return true if we should use the contrib jar.
- */
-int get_use_contrib() {
- return use_contrib;
-}
-
-/**
* Return true if we should use jline.
*/
int get_use_jline() {
@@ -119,10 +111,6 @@ void process_args(int argc, char** argv) {
add_user_classpath(argv[i]);
}
- else if (strcmp(arg, "-no-contrib") == 0) {
- use_contrib = FALSE;
- }
-
else if (strcmp(arg, "-no-jline") == 0) {
use_jline = FALSE;
strcpy(jlineMain, "");
View
@@ -28,8 +28,6 @@ extern char *get_jline_main();
extern int get_use_jline();
-extern int get_use_contrib();
-
extern char *get_vmargs();
extern void process_args( int argc, char** argv );
View
@@ -45,10 +45,6 @@ int main(int argc, char **argv) {
char classpath[MAX_CMD_LINE_LEN];
strcpy( classpath, get_clojure_jar() );
- if ( get_use_contrib() ) {
- add_to_path( classpath, get_clojure_contrib_jar() );
- }
-
if ( get_use_jline() ) {
add_to_path( classpath, get_jline_jar() );
}
View
@@ -7,17 +7,14 @@
static char *base_dir;
static char *lib_dir;
-static char *clj_lib_dir;
static char *jline_jar;
static char *clojure_jar;
-static char *clojure_contrib_jar;
static char *java_cmd;
char *get_base_dir() { return base_dir; }
char *get_lib_dir() { return lib_dir; }
char *get_jline_jar() { return jline_jar; }
char *get_clojure_jar() { return clojure_jar; }
-char *get_clojure_contrib_jar() { return clojure_contrib_jar; }
char *get_java_cmd() { return java_cmd; }
/**
@@ -60,37 +57,19 @@ static char *compute_lib_dir() {
}
/**
- * Return the path to the cljlib directory.
- */
-static char *compute_clj_lib_dir() {
- char* path = compute_base_dir();
- strcat( path, "\\cljlib");
- return path;
-}
-
-/**
* Get the path to the clojure.jar file.
*/
static char *compute_clojure_jar( ) {
- char* path = compute_clj_lib_dir();
+ char* path = compute_lib_dir();
strcat( path, "\\clojure.jar");
return path;
}
/**
- * Get the path to the clojure-contrib.jar file.
- */
-static char *compute_clojure_contrib_jar( ) {
- char* path = compute_clj_lib_dir();
- strcat( path, "\\clojure-contrib.jar");
- return path;
-}
-
-/**
* Get the path to the jline.jar file.
*/
static char *compute_jline_jar( ) {
- char* path = compute_clj_lib_dir();
+ char* path = compute_lib_dir();
strcat( path, "\\jline.jar");
return path;
}
@@ -121,10 +100,8 @@ static char *compute_java_cmd( ) {
void initPaths() {
base_dir = compute_base_dir();
lib_dir = compute_lib_dir();
- clj_lib_dir = compute_clj_lib_dir();
jline_jar = compute_jline_jar();
clojure_jar = compute_clojure_jar();
- clojure_contrib_jar = compute_clojure_contrib_jar();
java_cmd = compute_java_cmd();
}
View
@@ -16,7 +16,6 @@ extern char *get_base_dir();
extern char *get_lib_dir();
extern char *get_jline_jar();
extern char *get_clojure_jar();
-extern char *get_clojure_contrib_jar();
extern char *get_java_cmd();
Oops, something went wrong.

0 comments on commit 533807d

Please sign in to comment.