From 4218a1630f8025ccc3061547678b1694f57243e7 Mon Sep 17 00:00:00 2001 From: "Andre A. Gomes" Date: Thu, 30 Nov 2023 10:59:03 +0200 Subject: [PATCH] Delete logic related to NASDF. --- .github/report-unbound-exports.lisp | 41 ----------------------- .github/report-warnings.lisp | 52 ----------------------------- 2 files changed, 93 deletions(-) delete mode 100644 .github/report-unbound-exports.lisp delete mode 100644 .github/report-warnings.lisp diff --git a/.github/report-unbound-exports.lisp b/.github/report-unbound-exports.lisp deleted file mode 100644 index e8e4cb2..0000000 --- a/.github/report-unbound-exports.lisp +++ /dev/null @@ -1,41 +0,0 @@ -;;;; SPDX-FileCopyrightText: Atlas Engineer LLC -;;;; SPDX-License-Identifier: BSD-3-Clause - -(defun list-unbound-exports (package) - (let ((result '())) - (do-external-symbols (s (find-package package) result) - (when (and (not (fboundp s)) - (not (boundp s)) - (not (find-class s nil)) - ;; TODO: How can we portably check if symbol refers to a type? - #+sbcl - (not (sb-ext:defined-type-name-p s))) - (push s result ))))) - -(defun subpackage-p (subpackage package) - "Return non-nil if SUBPACKAGE is a sub-package of PACKAGE. -A sub-package has a name that starts with that of PACKAGE followed by a '/' separator." - (not (null - (uiop:string-prefix-p (uiop:strcat (package-name package) "/") - (package-name subpackage))))) - -(defun list-subpackages (package) - (remove-if (lambda (pkg) (not (subpackage-p pkg package))) (list-all-packages))) - -(defun unbound-exports (package) - "Report unbound exported symbols for PACKAGE and all its subpackages." - ;; TODO: Only SBCL is supported for now. - #-sbcl - nil - #+sbcl - (let* ((package (find-package package)) - (report (delete nil - (mapcar (lambda (package) - (let ((exports (list-unbound-exports package))) - (when exports - (list package exports)))) - (cons (find-package package) (list-subpackages package)))))) - (when report - (format t "~a~&Found unbound exported symbols in ~a packages." - report (length report)) - (uiop:quit 20)))) diff --git a/.github/report-warnings.lisp b/.github/report-warnings.lisp deleted file mode 100644 index 1add4db..0000000 --- a/.github/report-warnings.lisp +++ /dev/null @@ -1,52 +0,0 @@ -;;;; SPDX-FileCopyrightText: Atlas Engineer LLC -;;;; SPDX-License-Identifier: BSD-3-Clause - -(defun list-dependencies (system) - "Return SYSTEM dependencies. -If a dependency is part of the subsystem (i.e. they have the same .asd file), -they are not included but their dependencies are." - (let ((root-location (asdf:system-source-file (asdf:find-system system)))) - (labels ((list-deps-recursively (deps) - (when deps - (let* ((dep (first deps)) - (location (asdf:system-source-file (asdf:find-system dep)))) - (if (and location - (uiop:pathname-equal location root-location)) - (append (list-deps-recursively - (asdf:system-depends-on (asdf:find-system dep))) - (list-deps-recursively (rest deps))) - (cons dep (list-deps-recursively (rest deps)))))))) - (let ((all-deps (asdf:system-depends-on (asdf:find-system system)))) - (delete-duplicates (list-deps-recursively all-deps) :test #'string=))))) - -(defun redefinition-p (condition) ; From Slynk. - (and (typep condition 'style-warning) - (every #'char-equal "redefin" (princ-to-string condition)))) - -#+ccl -(defun osicat-warning-p (condition) - ;; Osicat triggers a warning on CCL because of some unimplemented chunk. - ;; See https://github.com/osicat/osicat/issues/37. - (and (typep condition 'style-warning) - (search "Undefined function OSICAT::MAKE-FD-STREAM" (princ-to-string condition)))) - -(defun load-system-silently (system) - (uiop:with-null-output (null-output) - (let ((*standard-output* null-output)) - (asdf:load-system system)))) - -(defun compilation-conditions (system) - (mapc #'load-system-silently (list-dependencies system)) - (let ((conditions '())) - (handler-bind ((warning (lambda (c) - (unless (or (redefinition-p c) - #+ccl - (osicat-warning-p c)) - (push c conditions))))) - (asdf:load-system system :force t)) - (let ((report (mapcar (lambda (c) (format nil "~t~a~%" c)) - (nreverse conditions)))) - (when report - (format t "~&Found ~a warnings when loading ~s:~%~a" - (length report) system report) - (uiop:quit 19)))))