Changeset 11678


Ignore:
Timestamp:
02/22/09 15:13:44 (12 years ago)
Author:
ehuelsmann
Message:

Lisp builds store build-artifacts outside of the source tree (build/classes/) just like Ant.

build-abcl.lisp:

SUBSTITUTE-IN-STRING: replace multiple occurrences in 1 string.
MAKE-CLASSES: Create output directories before using them; pass '-d' argument to javac for

out-of-tree class file storage.

MAKE-JAR: Create output directories before using them.
DO-COMPILE-SYSTEM: Move platform specific bits into argument value calculation,

one main code path remaining. Pass OUTPUT-PATH argument for out-of-tree *.cls/*.abcl storage.
Create output directories before using them.

MAKE-LAUNCH-SCRIPT: Don't point to source directory in the classpath; there are no *.class files

anyway. Adjust for the fact that 'abcl.jar' is in dist/ now.

CLEAN: Use a list of directories and file patterns.

make-jar.bat.in, make-jar.in:

Adapt for the fact that build artifacts are now in build/classes/.

Location:
trunk/abcl
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/abcl/build-abcl.lisp

    r11674 r11678  
    218218(defun substitute-in-string (string substitutions-alist)
    219219  (dolist (entry substitutions-alist)
    220     (let ((index (search (car entry) string :test #'string=)))
    221       (when index
    222         (setf string (concatenate 'string
    223                                   (subseq string 0 index)
    224                                   (cdr entry)
    225                                   (subseq string (+ index (length (car entry)))))))))
     220    (loop named replace
     221         for index = (search (car entry) string :test #'string=)
     222         do
     223         (unless index
     224           (return-from replace))
     225         (setf string (concatenate 'string
     226                                   (subseq string 0 index)
     227                                   (cdr entry)
     228                                   (subseq string (+ index (length (car entry))))))))
    226229  string)
    227230
     
    269272          (t
    270273           (cond (batch
     274                  (ensure-directories-exist (merge-pathnames "build/classes/" *build-root*))
    271275                  (let* ((dir (pathname-directory *abcl-dir*))
    272276                         (cmdline (with-output-to-string (s)
    273277                                    (princ *java-compiler-command-line-prefix* s)
     278                                    (princ " -d " s)
     279                                    (princ (merge-pathnames "build/classes/"
     280                                                            *build-root*) s)
     281                                    (princ #\Space s)
    274282                                    (dolist (source-file source-files)
    275283                                      (princ
     
    282290                    (zerop status)))
    283291                 (t
     292                  (ensure-directories-exist (merge-pathnames "build/classes/" *build-root*))
    284293                  (dolist (source-file source-files t)
    285294                    (unless (java-compile-file source-file)
     
    297306          (command     (if (eq *platform* :windows) "make-jar.bat"    "sh make-jar")))
    298307      (copy-with-substitutions source-file target-file substitutions-alist)
     308      (ensure-directories-exist (merge-pathnames "dist/" *build-root*))
    299309      (let ((status (run-shell-command command :directory *build-root*)))
    300310        (unless (zerop status)
     
    306316  (finish-output)
    307317  (let* ((java-namestring (safe-namestring *java*))
    308          status)
    309     (cond ((eq *platform* :windows)
    310            (with-open-file (stream
    311                             (merge-pathnames "compile-system.bat" *build-root*)
    312                             :direction :output
    313                             :if-exists :supersede)
    314              (princ java-namestring stream)
    315              (write-string " -cp " stream)
    316              (princ "src" stream)
    317              (write-char #\space stream)
    318              (write-string
    319               (if zip
    320                  "org.armedbear.lisp.Main --eval \"(compile-system :zip t :quit t)\""
    321                  "org.armedbear.lisp.Main --eval \"(compile-system :zip nil :quit t)\"")
    322               stream)
    323              (terpri stream))
    324            (setf status
    325                  (run-shell-command "compile-system.bat"
    326                                     :directory *build-root*)))
    327           (t ; Linux
    328            (let ((cmdline
    329                   (with-output-to-string (s)
    330                     (princ java-namestring s)
    331                     (write-string " -cp " s)
    332                     (princ "src" s)
    333                     (write-char #\space s)
    334                     (write-string
    335                      (if zip
    336                          "org.armedbear.lisp.Main --eval \"(compile-system :zip t :quit t)\""
    337                          "org.armedbear.lisp.Main --eval \"(compile-system :zip nil :quit t)\"")
    338                      s))))
    339              (setf status
    340                    (run-shell-command cmdline
    341                                       :directory *build-root*)))))
     318         status
     319         (abcl-home (substitute-in-string
     320                     (namestring *abcl-dir*)
     321                     (when (eq *platform* :windows)
     322                       '(("\\" . "/")
     323                         ("/" . "\\\\")))))
     324         (output-path (substitute-in-string
     325                       (namestring
     326                        (merge-pathnames "build/classes/org/armedbear/lisp/"
     327                                         *build-root*))
     328                       (when (eq *platform* :windows)
     329                         '(("\\" . "/")))))
     330         (cmdline (format nil
     331                          "~A -cp build\\classes -Dabcl.home=\"~A\" ~
     332org.armedbear.lisp.Main --noinit ~
     333--eval \"(compile-system :zip ~A :quit t :output-path \\\"~A\\\")\"~%"
     334                          java-namestring
     335                          abcl-home
     336                          (not (not zip)) ;; because that ensures T or NIL
     337                          output-path)))
     338    (ensure-directories-exist output-path)
     339    (setf status
     340          (run-shell-command cmdline
     341                             :directory *build-root*))
    342342    status))
    343343
     
    377377                          :direction :output
    378378                          :if-exists :supersede)
    379            (format s "~A -Xss4M -Xmx256M -cp \"~A;~A\" org.armedbear.lisp.Main %1 %2 %3 %4 %5 %6 %7 %8 %9~%"
     379           (format s "~A -Xss4M -Xmx256M -cp \"~A\" org.armedbear.lisp.Main %1 %2 %3 %4 %5 %6 %7 %8 %9~%"
    380380                   (safe-namestring *java*)
    381                    (namestring (merge-pathnames "src" *build-root*))
    382                    (namestring (merge-pathnames "abcl.jar" *build-root*)))))
     381                   (namestring (merge-pathnames "dist\\abcl.jar" *build-root*)))))
    383382        (t
    384383         (let ((pathname (merge-pathnames "abcl" *build-root*)))
     
    426425
    427426(defun clean ()
    428   (dolist (f (list (list *build-root* "abcl.jar")
     427  (dolist (f (list (list *build-root* "abcl.jar" "abcl.bat" "make-jar.bat"
     428                                      "compile-system.bat")
    429429                   (list *abcl-dir* "*.class" "*.abcl" "*.cls"
    430430                                    "native.h" "libabcl.so" "build")
    431                    (list (merge-pathnames "java/awt/" *abcl-dir*)
     431                   (list (merge-pathnames "build/classes/org/armedbear/lisp/"
     432                                          *build-root*)
     433                                    "*.class" "*.abcl" "*.cls"
     434                                    "native.h" "libabcl.so" "build")
     435                   (list (merge-pathnames
     436                          "build/classes/org/armedbear/lisp/util/"
     437                          *build-root*)
     438                                    "*.class" "*.abcl" "*.cls")
     439                   (list (merge-pathnames "dist/" *build-root*)
     440                                    "*.jar" "*.class" "*.abcl" "*.cls")
     441                  (list (merge-pathnames "java/awt/" *abcl-dir*)
    432442                         "*.class")))
    433443    (let ((default (car f)))
    434       (delete-files (mapcan #'(lambda (name)
    435                                 (directory (merge-pathnames name default)))
    436                             (cdr f))))))
     444      (when (probe-directory default)
     445        (delete-files (mapcan #'(lambda (name)
     446                                  (directory (merge-pathnames name default)))
     447                              (cdr f)))))))
    437448
    438449(defun build-abcl (&key force
  • trunk/abcl/make-jar.bat.in

    r11556 r11678  
    1 cd src
    2 @JAR@ cmf manifest-abcl ..\abcl.jar org\armedbear\lisp\*.class
    3 @JAR@ uf ..\abcl.jar org\armedbear\lisp\util\*.class
    4 @JAR@ uf ..\abcl.jar org\armedbear\lisp\LICENSE
    5 @JAR@ uf ..\abcl.jar org\armedbear\lisp\*.lisp
    6 @JAR@ uf ..\abcl.jar org\armedbear\lisp\*.abcl
    7 @JAR@ uf ..\abcl.jar org\armedbear\lisp\*.cls
     1@JAR@ cfm dist\abcl.jar src\manifest-abcl -C src org\armedbear\lisp\LICENSE -C src org\armedbear\lisp\boot.lisp
     2@JAR@ uf dist\abcl.jar -C build\classes .
     3
  • trunk/abcl/make-jar.in

    r11556 r11678  
    11#!/bin/sh
    2 cd src
    3 @JAR@ cmf manifest-abcl ../abcl.jar org/armedbear/lisp/*.class
    4 @JAR@ uf ../abcl.jar org/armedbear/lisp/LICENSE
    5 @JAR@ uf ../abcl.jar org/armedbear/lisp/*.lisp
    6 @JAR@ uf ../abcl.jar org/armedbear/lisp/*.abcl
    7 @JAR@ uf ../abcl.jar org/armedbear/lisp/util/*.class
    8 find . -name '*.cls' | xargs @JAR@ uf ../abcl.jar
     2
     3@JAR@ cfm dist/abcl.jar src/manifest-abcl -C src org/armedbear/lisp/LICENSE -C src org/armedbear/lisp/boot.lisp
     4@JAR@ uf dist/abcl.jar -C build/classes .
     5
Note: See TracChangeset for help on using the changeset viewer.