From da81dc9e9f6930cce8bcbbdacba12ec16b7753f3 Mon Sep 17 00:00:00 2001 From: Francois-Rene Rideau <fare@tunes.org> Date: Sat, 19 Jun 2010 17:52:33 -0400 Subject: [PATCH] 2.100: add compile-file* that outputs to a temporary file and only overwrites the output-file on success (also, it calls an updated compile-file-pathname* that heads &key output-file). Also, merge with 2.002 from release branch. --- asdf.lisp | 41 +++++++++++++++++++++++++++++++------ doc/index.html | 4 +++- test/try-recompiling-1.lisp | 2 ++ 3 files changed, 40 insertions(+), 7 deletions(-) diff --git a/asdf.lisp b/asdf.lisp index e647caaa..4d14b720 100644 --- a/asdf.lisp +++ b/asdf.lisp @@ -290,6 +290,7 @@ #:clear-output-translations #:ensure-output-translations #:apply-output-translations + #:compile-file* #:compile-file-pathname* #:enable-asdf-binary-locations-compatibility @@ -1761,7 +1762,7 @@ recursive calls to traverse.") (let ((source-file (component-pathname c)) (output-file (car (output-files operation c)))) (multiple-value-bind (output warnings-p failure-p) - (apply #'compile-file source-file :output-file output-file + (apply #'compile-file* source-file :output-file output-file (compile-op-flags operation)) (when warnings-p (case (operation-on-warnings operation) @@ -2928,11 +2929,39 @@ effectively disabling the output translation facility." (mapcar #'apply-output-translations files))) t)) -(defun compile-file-pathname* (input-file &rest keys) - (apply-output-translations - (apply #'compile-file-pathname - (truenamize (lispize-pathname input-file)) - keys))) +(defun compile-file-pathname* (input-file &rest keys &key output-file &allow-other-keys) + (or output-file + (apply-output-translations + (apply 'compile-file-pathname + (truenamize (lispize-pathname input-file)) + keys)))) + +(defun tmpize-pathname (x) + (make-pathname + :name (format nil "ASDF-TMP-~A" (pathname-name x)) + :defaults x)) + +(defun delete-file-if-exists (x) + (when (probe-file x) + (delete-file x))) + +(defun compile-file* (input-file &rest keys) + (let* ((output-file (apply 'compile-file-pathname* input-file keys)) + (tmp-file (tmpize-pathname output-file)) + (successp nil)) + (unwind-protect + (multiple-value-bind (output-truename warnings-p failure-p) + (apply 'compile-file input-file :output-file tmp-file keys) + (if failure-p + (setf output-truename nil) + (setf successp t)) + (values output-truename warnings-p failure-p)) + (cond + (successp + (delete-file-if-exists output-file) + (rename-file tmp-file output-file)) + (t + (delete-file-if-exists tmp-file)))))) #+abcl (defun translate-jar-pathname (source wildcard) diff --git a/doc/index.html b/doc/index.html index 11391f36..5377f906 100644 --- a/doc/index.html +++ b/doc/index.html @@ -71,6 +71,8 @@ <li>pull the latest from our git repository (<a href="http://common-lisp.net/gitweb?p=projects/asdf/asdf.git">browse</a>) <pre>git clone git://common-lisp.net/projects/asdf/asdf.git</pre> + (Note that our "master" branch is for current development; + get our "release" branch for the latest stable release.) </li></ul> <a id="bugs"> @@ -100,7 +102,7 @@ <dd>François-René Rideau is de facto maintainer, with notable contributions from Robert P. Goldman, Juanjo Garcia-Ripoll and James Anderson. - Push towards an ASDF 2 release + ASDF 2 released with many clean-ups, better configurability and updated documentation. </dd> diff --git a/test/try-recompiling-1.lisp b/test/try-recompiling-1.lisp index 8f754c02..395c719d 100644 --- a/test/try-recompiling-1.lisp +++ b/test/try-recompiling-1.lisp @@ -1,5 +1,7 @@ (in-package #:common-lisp-user) +#+clisp (eval-when (:compile-toplevel) (fmakunbound 'try-recompiling-1)) + (defun try-recompiling-1 () (assert *caught-error*)) -- GitLab