Changeset 14278
- Timestamp:
- 12/03/12 00:17:58 (8 years ago)
- Location:
- branches/1.1.x
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.1.x/doc/asdf/asdf.texinfo
r14150 r14278 318 318 Any ASDF extension becomes invalid, and will need to be reloaded. 319 319 This applies to e.g. CFFI-Grovel, or to hacks used by ironclad, etc. 320 Starting with ASDF 2.014.8 , ASDF will actually invalidate321 all previously loaded systems when it is loaded on top of 322 a different ASDF version.320 Starting with ASDF 2.014.8 (as far as releases go, 2.015), 321 ASDF will actually invalidate all previously loaded systems 322 when it is loaded on top of a different ASDF version. 323 323 @item 324 324 Until all implementations provide ASDF 2.015 or later, … … 342 342 (error "FOO requires ASDF ~A or later." *required-asdf-version*)) 343 343 @end example 344 @item 345 Until all implementations provide ASDF 2.27 or later, 346 it is unsafe for a system to transitively depend on ASDF 347 and not directly depend on ASDF; 348 if any of the system you use either depends-on asdf, 349 system-depends-on asdf, or transitively does, 350 you should also do as well. 344 351 @end itemize 345 352 … … 638 645 639 646 On some implementations (namely recent versions of 640 ABCL, Allegro CL, Clozure CL, CMUCL, ECL, GNU CLISP, LispWorks, MKCL, SBCL and XCL), 647 ABCL, Allegro CL, Clozure CL, CMUCL, ECL, GNU CLISP, 648 LispWorks, MKCL, SBCL and XCL), 641 649 ASDF hooks into the @code{CL:REQUIRE} facility 642 650 and you can just use: … … 689 697 @xref{Configuring ASDF,,Configuring ASDF to find your systems}. 690 698 699 For the advanced users, note that 700 @code{require-system} calls @code{load-system} 701 with keyword arguments @code{:force-not (loaded-systems)}. 702 @code{loaded-systems} returns a list of the names of loaded systems. 703 @code{load-system} applies @code{operate} with the operation from 704 @code{*load-system-operation*}, which by default is @code{load-op}, 705 the system, and any provided keyword arguments. 691 706 692 707 @section Summary … … 1310 1325 Operations are invoked on systems via @code{operate}. 1311 1326 @anchor{operate} 1312 @deffn {Generic function} @code{operate} @var{operation} @var{system} @&rest @var{initargs} 1313 @deffnx {Generic function} @code{oos} @var{operation} @var{system} @&rest @var{initargs} 1327 @deffn {Generic function} @code{operate} @var{operation} @var{system} @&rest @var{initargs} @&key @code{force} @code{force-not} @code{verbose} @&allow-other-keys 1328 @deffnx {Generic function} @code{oos} @var{operation} @var{system} @&rest @var{initargs} @&key @&allow-other-keys 1314 1329 @code{operate} invokes @var{operation} on @var{system}. 1315 1330 @code{oos} is a synonym for @code{operate}. … … 1326 1341 with the same @var{initargs} as the original one. 1327 1342 1343 If @var{force} is @code{t}, then all systems 1344 are forced to be recompiled even if not modified since last compilation. 1345 If @var{force} is a list, then it specifies a list of systems that 1346 are forced to be recompiled even if not modified since last compilation. 1347 If @var{force-not} is @code{t}, then all systems 1348 are forced not to be recompiled even if modified since last compilation. 1349 If @var{force-not} is a list, then it specifies a list of systems that 1350 are forced not to be recompiled even if modified since last compilation. 1351 @var{force} takes precedences over @var{force-not}; 1352 both of them apply to systems that are dependencies and were already compiled. 1328 1353 @end deffn 1329 1354 … … 2887 2912 A non-nil value designates a function of one argument 2888 2913 that will be called with a function that 2889 calls the @code{*compile-op-compile-file-function*} (usually @code{compile-file*}) 2914 calls the @code{*compile-op-compile-file-function*} 2915 (usually @code{compile-file*}) 2890 2916 with proper arguments; 2891 2917 the around-compile hook may supply additional arguments 2892 2918 to pass to that @code{*compile-op-compile-file-function*}. 2919 2893 2920 One notable argument that is heeded by @code{compile-file*} is 2894 @code{:compile-check}, a function called when the compilation was otherwise a success, 2895 with the same arguments as @code{compile-file}, 2896 to determine whether 2897 (NB: The ability to pass such extra flags is only available starting with asdf 2.22.1.) 2898 2899 Note that by using a string, you may reference 2921 @code{:compile-check}, 2922 a function called when the compilation was otherwise a success, 2923 with the same arguments as @code{compile-file}; 2924 the function shall return true if the compilation 2925 and its resulting compiled file respected all system-specific invariants, 2926 and false (NIL) if it broke any of those invariants; 2927 it may issue warnings or errors before it returns NIL. 2928 (NB: The ability to pass such extra flags 2929 is only available starting with ASDF 2.22.3.) 2930 This feature is notably exercised by asdf-finalizers. 2931 2932 By using a string, you may reference 2900 2933 a function, symbol and/or package 2901 2934 that will only be created later during the build, but … … 3242 3275 @emph{All} versions of ASDF should have the @code{:asdf} feature. 3243 3276 3244 Additionally, all versions of asdf23277 Additionally, all versions of ASDF 2 3245 3278 define a function @code{(asdf:asdf-version)} you may use to query the version; 3246 and the source code of recent versions of asdf2 features the version number3279 and the source code of recent versions of ASDF 2 features the version number 3247 3280 prominently on the second line of its source code. 3248 3281 … … 3463 3496 3464 3497 @item 3465 Some systems in the large have been known not to play well with output translations. 3498 Some systems in the large have been known 3499 not to play well with output translations. 3466 3500 They were relatively easy to fix. 3467 3501 Once again, it is also easy to disable output translations, … … 3483 3517 3484 3518 @item 3485 ASDF pathname designators are now specified in places where they were unspecified, 3519 ASDF pathname designators are now specified 3520 in places where they were unspecified, 3486 3521 and a few small adjustments have to be made to some non-portable defsystems. 3487 Notably, in the @code{:pathname} argument to a @code{defsystem} and its components, 3522 Notably, in the @code{:pathname} argument 3523 to a @code{defsystem} and its components, 3488 3524 a logical pathname (or implementation-dependent hierarchical pathname) 3489 3525 must now be specified with @code{#p} syntax … … 3513 3549 based on the Windows registry. 3514 3550 Other implementations make do with environment variables, 3515 that you may have to define yourself if you're using an older version of Windows. 3551 that you may have to define yourself 3552 if you're using an older version of Windows. 3516 3553 Windows support is somewhat less tested than Unix support. 3517 3554 Please help report and fix bugs. 3555 @emph{Update}: As of ASDF 2.21, all implementations 3556 should now use the same proper default configuration pathnames 3557 and they should actually work, though they haven't all been tested. 3518 3558 3519 3559 @item 3520 3560 The mechanism by which one customizes a system so that Lisp files 3521 3561 may use a different extension from the default @file{.lisp} has changed. 3522 Previously, the pathname for a component was lazily computed when operating on a system, 3562 Previously, the pathname for a component 3563 was lazily computed when operating on a system, 3523 3564 and you would 3524 3565 @code{(defmethod source-file-type ((component cl-source-file) (system (eql (find-system 'foo)))) … … 3526 3567 Now, the pathname for a component is eagerly computed when defining the system, 3527 3568 and instead you will @code{(defclass cl-source-file.lis (cl-source-file) ((type :initform "lis")))} 3528 and use @code{:default-component-class cl-source-file.lis} as argument to @code{defsystem}, 3569 and use @code{:default-component-class cl-source-file.lis} 3570 as argument to @code{defsystem}, 3529 3571 as detailed in a @pxref{FAQ,How do I create a system definition where all the source files have a .cl extension?} below. 3530 3572 … … 3554 3596 You may consult with the maintainer for which specific version they recommend, 3555 3597 but the latest @code{release} should be correct. 3556 We trust you to thoroughly test it with your implementation before you release it. 3598 We trust you to thoroughly test it with your implementation 3599 before you release it. 3557 3600 If there are any issues with the current release, 3558 3601 it's a bug that you should report upstream and that we will fix ASAP. … … 3572 3615 then it would be nice to add ASDF to this hook the same way that 3573 3616 ABCL, CCL, CLISP, CMUCL, ECL, SBCL and SCL do it. 3617 Please send us appropriate code to this end. 3574 3618 3575 3619 @item … … 3907 3951 3908 3952 3909 ** document all the error classes3910 3911 ** what to do with compile-file failure3912 3913 Should check the primary return value from compile-file and see if3914 that gets us any closer to a sensible error handling strategy3915 3916 ** foreign files3917 3918 lift unix-dso stuff from db-sockets3919 3920 3953 ** Diagnostics 3921 3954 … … 3923 3956 3924 3957 @lisp 3925 (traverse (make-instance '<operation-name>) 3926 (find-system <system-name>) 3927 'explain) 3958 (let ((asdf::*verbose-out* *standard-output*)) 3959 (loop :for (op . comp) :in 3960 (asdf::traverse (make-instance '<operation-name> :force t) 3961 (asdf:find-system <system-name>)) 3962 :do (asdf:explain op comp))) 3928 3963 @end lisp 3929 3964 … … 3935 3970 ** reuse the same scratch package whenever a system is reloaded from disk 3936 3971 3972 Have a package ASDF-USER instead of all these temporary packages? 3973 3937 3974 ** proclamations probably aren't 3938 3975 3939 ** when a system is reloaded with fewer components than it previously had, odd things happen3940 3941 We should do something inventive when processing a @code{defsystem} form,3942 like take the list of kids and @code{setf} the slot to @code{nil},3943 then transfer children from old to new list as they're found.3944 3945 3976 ** (stuff that might happen later) 3946 3977 … … 3951 3982 @code{(asdf:compile-system :araneida :force t)} 3952 3983 3953 also forces compilation of every other system the @code{:araneida} system depends on. 3984 also forces compilation of every other system 3985 the @code{:araneida} system depends on. 3954 3986 This is rarely useful to me; 3955 usually, when I want to force recompilation of something more than a single source file, 3987 usually, when I want to force recompilation 3988 of something more than a single source file, 3956 3989 I want to recompile only one system. 3957 3990 So it would be more useful to have @code{make-sub-operation} -
branches/1.1.x/src/org/armedbear/lisp/asdf.lisp
r14230 r14278 1 1 ;;; -*- mode: Common-Lisp; Base: 10 ; Syntax: ANSI-Common-Lisp ; coding: utf-8 -*- 2 ;;; This is ASDF 2.26 : Another System Definition Facility.2 ;;; This is ASDF 2.26.6: Another System Definition Facility. 3 3 ;;; 4 4 ;;; Feedback, bug reports, and patches are all welcome: … … 119 119 ;; "2.345.0.7" would be your seventh local modification of official release 2.345 120 120 ;; "2.345.6.7" would be your seventh local modification of development version 2.345.6 121 (asdf-version "2.26 ")121 (asdf-version "2.26.6") 122 122 (existing-asdf (find-class 'component nil)) 123 123 (existing-version *asdf-version*) … … 216 216 shadow export redefined-functions) 217 217 (let* ((p (ensure-exists name nicknames use))) 218 (ensure-unintern p (append unintern #+cmu redefined-functions))218 (ensure-unintern p unintern) 219 219 (ensure-shadow p shadow) 220 220 (ensure-export p export) 221 #-cmu(ensure-fmakunbound p redefined-functions)221 (ensure-fmakunbound p redefined-functions) 222 222 p))) 223 223 (macrolet … … 412 412 413 413 (defvar *compile-file-failure-behaviour* 414 (or #+ sbcl:error #+clisp :ignore :warn)414 (or #+(or mkcl sbcl) :error #+clisp :ignore :warn) 415 415 "How should ASDF react if it encounters a failure (per the ANSI spec of COMPILE-FILE) 416 416 when compiling a file? Valid values are :error, :warn, and :ignore. … … 1213 1213 (operation :reader error-operation :initarg :operation)) 1214 1214 (:report (lambda (c s) 1215 (format s (compatfmt "~@< Errorwhile invoking ~A on ~A~@:>")1216 ( error-operation c) (error-component c)))))1215 (format s (compatfmt "~@<~A while invoking ~A on ~A~@:>") 1216 (type-of c) (error-operation c) (error-component c))))) 1217 1217 (define-condition compile-error (operation-error) ()) 1218 1218 (define-condition compile-failed (compile-error) ()) … … 1462 1462 (licence :accessor system-licence :initarg :licence 1463 1463 :accessor system-license :initarg :license) 1464 (source-file :reader %system-source-file :initarg :source-file ; for CLISP upgrade 1465 :writer %set-system-source-file) 1464 (source-file :initarg :source-file :writer %set-system-source-file) ; upgrade issues on CLISP, CMUCL 1466 1465 (defsystem-depends-on :reader system-defsystem-depends-on :initarg :defsystem-depends-on))) 1467 1466 … … 1637 1636 FN should be a function of one argument. It will be 1638 1637 called with an object of type asdf:system." 1639 (maphash #'(lambda (_ datum) 1640 (declare (ignore _)) 1641 (destructuring-bind (_ . def) datum 1642 (declare (ignore _)) 1643 (funcall fn def))) 1644 *defined-systems*)) 1638 (loop :for (nil . system) :being :the hash-values :of *defined-systems* 1639 :do (funcall fn system))) 1645 1640 1646 1641 ;;; for the sake of keeping things reasonably neat, we adopt a … … 1796 1791 (defvar *systems-being-defined* nil 1797 1792 "A hash-table of systems currently being defined keyed by name, or NIL") 1793 (defvar *systems-being-operated* nil 1794 "A boolean indicating that some systems are being operated on") 1798 1795 1799 1796 (defun* find-system-if-being-defined (name) … … 2005 2002 (declare (ignorable operation slot-names force force-not)) 2006 2003 (macrolet ((frob (x) ;; normalize forced and forced-not slots 2007 `(when (consp ( ,x operation))2008 (setf ( ,x operation)2009 (mapcar #'coerce-name ( ,x operation))))))2010 (frob operation-forced) (frob operation-forced-not))2004 `(when (consp (slot-value operation ',x)) 2005 (setf (slot-value operation ',x) 2006 (mapcar #'coerce-name (slot-value operation ',x)))))) 2007 (frob forced) (frob forced-not)) 2011 2008 (values)) 2012 2009 … … 2358 2355 (c x))) 2359 2356 (r* (l) 2360 ( dolist (x l) (r x))))2357 (map () #'r l))) 2361 2358 (r* l)))) 2362 2359 … … 2459 2456 (read-from-string fun)))))))) 2460 2457 2461 (def method call-with-around-compile-hook ((c component) thunk)2462 ( let ((hook (around-compile-hook c)))2463 (if hook 2464 (funcall (ensure-function hook) thunk)2465 (funcall thunk))))2458 (defun call-around-hook (hook function) 2459 (funcall (or (ensure-function hook) 'funcall) function)) 2460 2461 (defmethod call-with-around-compile-hook ((c component) function) 2462 (call-around-hook (around-compile-hook c) function)) 2466 2463 2467 2464 ;;; perform is required to check output-files to find out where to put … … 2619 2616 (defmethod operation-done-p ((o load-source-op) (c source-file)) 2620 2617 (declare (ignorable o)) 2621 (if (or (not (component-property c 'last-loaded-as-source)) 2622 (> (safe-file-write-date (component-pathname c)) 2623 (component-property c 'last-loaded-as-source))) 2624 nil t)) 2618 (and (component-property c 'last-loaded-as-source) 2619 (<= (safe-file-write-date (component-pathname c)) 2620 (component-property c 'last-loaded-as-source)))) 2625 2621 2626 2622 (defmethod operation-description ((operation load-source-op) component) … … 2658 2654 (defgeneric* operate (operation-class system &key &allow-other-keys)) 2659 2655 (defgeneric* perform-plan (plan &key)) 2656 (defgeneric* plan-operates-on-p (plan component)) 2660 2657 2661 2658 ;;;; Separating this into a different function makes it more forward-compatible … … 2692 2689 (cleanup-upgraded-asdf version))) 2693 2690 2691 (defmethod plan-operates-on-p ((plan list) (component-path list)) 2692 (find component-path (mapcar 'cdr plan) 2693 :test 'equal :key 'component-find-path)) 2694 2694 2695 (defmethod perform-plan ((steps list) &key) 2695 2696 (let ((*package* *package*) … … 2700 2701 2701 2702 (defmethod operate (operation-class system &rest args 2702 &key ((:verbose *asdf-verbose*) *asdf-verbose*) version force 2703 &allow-other-keys) 2704 (declare (ignore force)) 2703 &key force force-not verbose version &allow-other-keys) 2704 (declare (ignore force force-not)) 2705 2705 (with-system-definitions () 2706 (let* (( op (apply 'make-instance operation-class2707 :original-initargs args2708 args))2709 (*verbose-out* (if *asdf-verbose* *standard-output* (make-broadcast-stream)))2706 (let* ((*asdf-verbose* verbose) 2707 (*verbose-out* (if verbose *standard-output* (make-broadcast-stream))) 2708 (op (apply 'make-instance operation-class 2709 :original-initargs args args)) 2710 2710 (system (etypecase system 2711 2711 (system system) 2712 ((or string symbol) (find-system system))))) 2713 (unless (version-satisfies system version) 2714 (error 'missing-component-of-version :requires system :version version)) 2715 (let ((steps (traverse op system))) 2716 (when (and (not (equal '("asdf") (component-find-path system))) 2717 (find '("asdf") (mapcar 'cdr steps) 2718 :test 'equal :key 'component-find-path) 2719 (upgrade-asdf)) 2720 ;; If we needed to upgrade ASDF to achieve our goal, 2721 ;; then do it specially as the first thing, then 2722 ;; invalidate all existing system 2723 ;; retry the whole thing with the new OPERATE function, 2724 ;; which on some implementations 2725 ;; has a new symbol shadowing the current one. 2726 (return-from operate 2727 (apply (find-symbol* 'operate :asdf) operation-class system args))) 2728 (perform-plan steps) 2729 (values op steps))))) 2730 2731 (defun* oos (operation-class system &rest args &key force verbose version 2732 &allow-other-keys) 2733 (declare (ignore force verbose version)) 2712 ((or string symbol) (find-system system)))) 2713 (systems-being-operated *systems-being-operated*) 2714 (*systems-being-operated* (or systems-being-operated (make-hash-table :test 'equal)))) 2715 (check-type system system) 2716 (setf (gethash (coerce-name system) *systems-being-operated*) system) 2717 (flet ((upgrade () 2718 ;; If we needed to upgrade ASDF to achieve our goal, 2719 ;; then do it specially as the first thing, 2720 ;; which will invalidate all existing systems; 2721 ;; afterwards, retry the whole thing with the new OPERATE function, 2722 ;; which on some implementations 2723 ;; has a new symbol shadowing the current one. 2724 (unless (gethash "asdf" *systems-being-operated*) 2725 (upgrade-asdf) 2726 (return-from operate 2727 (apply (find-symbol* 'operate :asdf) operation-class system args))))) 2728 (when systems-being-operated ;; Upgrade if loading a system from another one. 2729 (upgrade)) 2730 (unless (version-satisfies system version) 2731 (error 'missing-component-of-version :requires system :version version)) 2732 (let ((plan (traverse op system))) 2733 (when (plan-operates-on-p plan '("asdf")) 2734 (upgrade)) ;; Upgrade early if the plan involves upgrading asdf at any time. 2735 (perform-plan plan) 2736 (values op plan)))))) 2737 2738 (defun* oos (operation-class system &rest args 2739 &key force force-not verbose version &allow-other-keys) 2740 (declare (ignore force force-not verbose version)) 2734 2741 (apply 'operate operation-class system args)) 2735 2742 … … 3184 3191 (%set-system-source-file 3185 3192 (probe-asd (component-name system) (component-pathname system)) system)) 3186 ( %system-source-file system))3193 (slot-value system 'source-file)) 3187 3194 (defmethod system-source-file ((system-name string)) 3188 ( %system-source-file (find-system system-name)))3195 (system-source-file (find-system system-name))) 3189 3196 (defmethod system-source-file ((system-name symbol)) 3190 ( %system-source-file (find-system system-name)))3197 (system-source-file (find-system system-name))) 3191 3198 3192 3199 (defun* system-source-directory (system-designator) … … 3919 3926 3920 3927 (defun* tmpize-pathname (x) 3921 (make-pathname 3922 :name (strcat "ASDF-TMP-" (pathname-name x)) 3923 :defaults x)) 3928 (make-pathname :name (strcat "ASDF-TMP-" (pathname-name x)) :defaults x)) 3924 3929 3925 3930 (defun* delete-file-if-exists (x) … … 3956 3961 (values output-truename warnings-p failure-p)))) 3957 3962 3958 #+abcl 3963 #+abcl 3959 3964 (defun* translate-jar-pathname (source wildcard) 3960 3965 (declare (ignore wildcard)) 3961 (let* ((jar 3962 (pathname (first (pathname-device source)))) 3963 (target-root-directory-namestring 3964 (format nil "/___jar___file___root___/~@[~A/~]" 3965 (and (find :windows *features*) 3966 (pathname-device jar)))) 3967 (relative-source 3968 (relativize-pathname-directory source)) 3969 (relative-jar 3970 (relativize-pathname-directory (ensure-directory-pathname jar))) 3971 (target-root-directory 3972 (if (find :windows *features*) 3973 (make-pathname :name nil 3974 :type nil 3975 :version nil 3976 :defaults (parse-namestring target-root-directory-namestring)) 3977 (make-pathname :device :unspecific 3978 :name nil 3979 :type nil 3980 :version nil 3981 :defaults (parse-namestring target-root-directory-namestring)))) 3982 (target-root 3983 (merge-pathnames* relative-jar target-root-directory)) 3984 (target 3985 (merge-pathnames* relative-source target-root))) 3986 (if (find :windows *features*) 3987 (apply-output-translations target) 3988 (make-pathname :defaults (apply-output-translations target) 3989 :device :unspecific)))) 3966 (flet ((normalize-device (pathname) 3967 (if (find :windows *features*) 3968 pathname 3969 (make-pathname :defaults pathname :device :unspecific)))) 3970 (let* ((jar 3971 (pathname (first (pathname-device source)))) 3972 (target-root-directory-namestring 3973 (format nil "/___jar___file___root___/~@[~A/~]" 3974 (and (find :windows *features*) 3975 (pathname-device jar)))) 3976 (relative-source 3977 (relativize-pathname-directory source)) 3978 (relative-jar 3979 (relativize-pathname-directory (ensure-directory-pathname jar))) 3980 (target-root-directory 3981 (normalize-device 3982 (pathname-directory-pathname 3983 (parse-namestring target-root-directory-namestring)))) 3984 (target-root 3985 (merge-pathnames* relative-jar target-root-directory)) 3986 (target 3987 (merge-pathnames* relative-source target-root))) 3988 (normalize-device (apply-output-translations target))))) 3990 3989 3991 3990 ;;;; ----------------------------------------------------------------- … … 4155 4154 4156 4155 (defun* collect-sub*directories-asd-files 4157 (directory &key 4158 (exclude *default-source-registry-exclusions*) 4159 collect) 4156 (directory &key (exclude *default-source-registry-exclusions*) collect) 4160 4157 (collect-sub*directories 4161 4158 directory … … 4509 4506 4510 4507 #+mkcl 4511 (progn 4512 (defvar *loading-asdf-bundle* nil) 4513 (unless *loading-asdf-bundle* 4514 (let ((*central-registry* 4515 (cons (translate-logical-pathname #P"CONTRIB:asdf-bundle;") *central-registry*)) 4516 (*loading-asdf-bundle* t)) 4517 (clear-system :asdf-bundle) ;; we hope to force a reload. 4518 (multiple-value-bind (result bundling-error) 4519 (ignore-errors (asdf:oos 'asdf:load-op :asdf-bundle)) 4520 (unless result 4521 (format *error-output* 4522 "~&;;; ASDF: Failed to load package 'asdf-bundle'!~%;;; ASDF: Reason is: ~A.~%" 4523 bundling-error)))))) 4508 (handler-case 4509 (progn 4510 (load-sysdef "asdf-bundle" 4511 (subpathname (translate-logical-pathname #P"CONTRIB:") 4512 "asdf-bundle/asdf-bundle.asd")) 4513 (load-system "asdf-bundle")) 4514 (error (e) 4515 (format *error-output* 4516 "~&;;; ASDF: Failed to load package 'asdf-bundle'!~%;;; ~A~%" 4517 e))) 4524 4518 4525 4519 #+allegro
Note: See TracChangeset
for help on using the changeset viewer.