Skip to content

Commit

Permalink
broke out emacs lisp compilation build source into separate file
Browse files Browse the repository at this point in the history
git-svn-id: http://jdee.svn.sourceforge.net/svnroot/jdee/branches/paul_landes/jde@62 381a1f10-3442-0410-997e-ef331cd04102
  • Loading branch information
paullandes committed Nov 25, 2008
1 parent 378a561 commit 71d368c
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 44 deletions.
72 changes: 28 additions & 44 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

<!-- configuration directory -->
<property name="config.dir" location="./config"/>
<property name="config.build.file" location="${config.dir}/config.properties"/>

<!-- source code -->
<property name="src.lisp.dir" location="./lisp"/>
Expand All @@ -17,8 +16,14 @@

<!-- create objects -->
<property name="build.dir" location="./build"/>

<property name="build.config.dir" location="${build.dir}/config"/>
<property name="config.build.file"
location="${build.config.dir}/config.properties"/>

<property name="build.lisp.dir" location="${build.dir}/lisp"/>
<property name="build.lisp.file" location="${build.lisp.dir}/build.el"/>
<property name="build.lisp.src.file" location="${config.dir}/build.el"/>
<property name="build.lisp.dst.file" location="${build.config.dir}/build.el"/>

<property name="build.java.dir" location="${build.dir}/classes"/>

Expand All @@ -31,7 +36,7 @@
<fileset dir="${lib.java.dir}"/>
</path>

<!-- ** properties start ** -->
<!-- ** properties end ** -->



Expand All @@ -42,27 +47,33 @@
<mkdir dir="${build.dir}"/>
</target>


<target name="init-compile" depends="init">
<property file="${config.build.file}"/>
</target>


<target name="configure" depends="init" unless="config.uptodate">

<mkdir dir="${build.config.dir}"/>

<!-- developers will usually have the following config file (i.e. source
installed libs) -->
<property file="${user.home}/.jdee-config.properties"/>

<!-- project specific defaults (not user or instance specific) -->
<property file="${config.dir}/default.properties"/>

<propertyfile file="${config.build.file}" comment="user editable build configuration parameters">
<propertyfile file="${config.build.file}"
comment="user editable build configuration parameters">
<entry key="config.time" type="date" value="now"/>
<entry key="cedet.dir" value="${cedet.dir}"/>
<entry key="elib.dir" value="${elib.dir}"/>
<entry key="prefix.dir" value="${prefix.dir}"/>
</propertyfile>
</target>


<!-- configure (create/build) the emacs lisp build configuration files -->
<target name="configure-ebuild" depends="configure,init-compile">
<mkdir dir="${build.lisp.dir}"/>
Expand All @@ -72,60 +83,32 @@
<mapper type="glob" from="*.el" to="*.elc"/>
</uptodate>


<!-- copy the lisp into place and create an emacs lisp build file -->
<copy todir="${build.lisp.dir}">
<fileset dir="${src.lisp.dir}" includes="*.el"/>
</copy>

<echo file="${build.lisp.file}">
(defun gen-autoloads (dir)
(let* ((libname "jde-autoload")
(filename (format "%s.el" libname))
(filename-long (expand-file-name filename dir))
(buf (find-file-noselect filename-long))
files)
(save-excursion
(set-buffer buf)
(erase-buffer)
(dolist (file (remove nil
(mapcar #'(lambda (file)
(unless
(or (string= filename file)
(string-match "^\\.#" file))
file))
(directory-files dir nil
"\\.el$"))))
(generate-file-autoloads file))
(insert (format "\n(provide '%s)\n" libname))
(save-buffer buf)
(eval-buffer buf)
buf)))
(require 'autoload)
(setq autoload-buf (gen-autoloads "${build.lisp.dir}"))

(dolist (path '("common"
"eieio"
"semantic"
"semantic/bovine"
"speedbar"
))
(add-to-list 'load-path (expand-file-name path "${cedet.dir}") t))
(add-to-list 'load-path "${src.lisp.dir}" t)
(eval-buffer autoload-buf)
(message "LOAD PATH: %s" (mapconcat #'identity load-path ":"))
(byte-recompile-directory (expand-file-name "${build.lisp.dir}") 0)
</echo>
<!-- create the file used to compile the emacs lisp code -->
<copy file="${build.lisp.src.file}" tofile="${build.lisp.dst.file}"/>
<replace file="${build.lisp.dst.file}">
<replacefilter token="@{cedet.dir}" value="${cedet.dir}"/>
<replacefilter token="@{src.lisp.dir}" value="${src.lisp.dir}"/>
<replacefilter token="@{build.lisp.dir}" value="${build.lisp.dir}"/>
</replace>
</target>


<target name="build-lisp" depends="configure-ebuild" if="lisp-is-uptodate"
description="compile the JDEE Emacs lisp code">
<!-- invoke Emacs in batch mode to creat autoloads and compile emacs
lisp -->
<exec dir="${build.lisp.dir}" executable="${build.bin.emacs}">
<arg value="--script"/>
<arg value="build.el"/>
<arg value="${build.lisp.dst.file}"/>
</exec>
</target>


<target name="build-java" depends="init-compile"
description="compile the JDEE Java source code">
<mkdir dir="${build.java.dir}"/>
Expand All @@ -134,6 +117,7 @@
classpathref="compile.classpath"/>
</target>


<target name="build" depends="build-lisp, build-java"
description="compile all JDEE source code"/>

Expand Down
56 changes: 56 additions & 0 deletions config/build.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
;; Create autoloads and build the lisp source code. The paths are substituted
;; by the ant build.

(defun jde-make-autoloads (dir)
"Generate the jde-autoloads.el for all elisp source files in DIR."
(let* ((libname "jde-autoload")
(filename (format "%s.el" libname))
(filename-long (expand-file-name filename dir))
(buf (find-file-noselect filename-long))
files)
(save-excursion
(set-buffer buf)
(erase-buffer)
(dolist (file (remove nil
(mapcar #'(lambda (file)
(unless
(or (string= filename file)
(string-match "^\\.#" file))
file))
(directory-files dir nil
"\\.el$"))))
(generate-file-autoloads file))
;; users can now use (require 'jde); which in turn, loads the autoloads
(insert (format "\n(provide '%s)\n" libname))
(save-buffer buf)
(eval-buffer buf)
buf)))

(defun jde-make-autoloads-and-compile (dir lisp-src-dir cedet-dir paths)
"Create autoloads and compile lisp code in DIR.
LISP-SRC-DIR is the base directory for all third party lisp code use to
compile.
CEDET-DIR is the cedet lisp code base directory (see PATHS).
PATHS are sub directories under CEDET-DIR we use to compile."
(let ((autoload-buf (jde-make-autoloads dir)))
(dolist (path paths)
(add-to-list 'load-path (expand-file-name path cedet-dir) t))
(add-to-list 'load-path lisp-src-dir t)
(eval-buffer autoload-buf)
(message "load path: %s" (mapconcat #'identity load-path ":"))
(byte-recompile-directory dir 0)))



(require 'autoload)
(jde-make-autoloads-and-compile (expand-file-name "@{build.lisp.dir}")
"@{src.lisp.dir}"
"@{cedet.dir}"
'("common"
"eieio"
"semantic"
"semantic/bovine"
"speedbar"
))

0 comments on commit 71d368c

Please sign in to comment.