Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make qlot exec allow to take sbcl #180

Merged
merged 2 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,12 @@ Here are few useful commands:
* `qlot exec ros build some-app.ros` - another command, useful, to build a binary
from systems, fixed in `qlfile` and `qlfile.lock`. This way you can be sure that your builds are stable.

**NOTE**: `qlot exec` only affects `ros` or Roswell scripts.
**NOTE**: `qlot exec` only affects `ros`, `sbcl` or Roswell scripts.

If you're using Qlot without Roswell, load `.qlot/setup.lisp` instead, like:
Since it's the same as loading `.qlot/setup.lisp`, you can still use the project-local Quicklisp by loading it, like:

```
$ sbcl --noinform --no-userinit --no-sysinit --load .qlot/setup.lisp
$ ccl --load .qlot/setup.lisp
```

## `qlfile` syntax
Expand Down
39 changes: 33 additions & 6 deletions cli.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,26 @@ OPTIONS:
(return (list (or project-root *default-pathname-defaults*)
:exclude exclude))))

(defun append-load-setup-to-argv (argv)
(flet ((runtime-option-p (option)
(and (member option
'("--help" "--version" "--core" "--dynamic-space-size" "--control-stack-size" "--tls-limit")
:test 'equal)
t))
(option-string-p (option)
(starts-with "--" option)))
(let ((start-pos
(position-if (lambda (option)
(and (option-string-p option)
(not (runtime-option-p option))))
argv)))
(append (subseq argv 0 (and start-pos
(1+ start-pos)))
(list "--load" ".qlot/setup.lisp")
(if start-pos
(subseq argv (1+ start-pos))
nil)))))

(defun use-local-quicklisp ()
;; Set QUICKLISP_HOME ./.qlot/
(unless (uiop:getenv "QUICKLISP_HOME")
Expand Down Expand Up @@ -397,12 +417,19 @@ OPTIONS:

(let ((command (or (which (first argv))
(first argv))))
(unless (or (member (file-namestring command)
'("ros")
:test 'equal)
(ros-script-p command))
(qlot/errors:ros-command-error "exec must be followed by 'ros' or a Roswell script"))
(exec (cons command (rest argv)))))
(exec
(cons
command
(case-equal (file-namestring command)
("ros"
(rest argv))
("sbcl"
#+ros.init (setf (uiop:getenv "SBCL_HOME") "")
(append-load-setup-to-argv (rest argv)))
(otherwise
(if (ros-script-p command)
(rest argv)
(qlot/errors:ros-command-error "exec must be followed by 'ros' or a Roswell script"))))))))
((equal "add" $1)
(unless argv
(qlot/errors:ros-command-error "requires a new library information."))
Expand Down
Loading