-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathEldev
More file actions
108 lines (93 loc) · 5.21 KB
/
Eldev
File metadata and controls
108 lines (93 loc) · 5.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
; -*- mode: emacs-lisp; lexical-binding: t -*-
(defvar use-old-dependencies nil
"If non-nil, use oldest possible versions of dependencies, to test declared package compatibility.")
(defvar test-results-file "results.xml"
"Where to save the JUnit XML test results")
;; Autodetermined by `eldev init'.
(eldev-use-package-archive 'gnu-elpa)
(eldev-use-package-archive 'melpa)
(eldev-use-plugin 'autoloads)
(setf eldev-test-framework 'buttercup)
(setf (alist-get 'buttercup-junit eldev-known-tool-packages) '(:package buttercup-junit))
(eldev-add-extra-dependencies 'test '(:tool buttercup-junit))
(eldev-add-loading-roots 'test "tests")
(unless (or (fboundp 'lisp-data-mode)
(not enable-local-variables))
;; Work around the fact that transient's autogenerated package header declares mode:
;; lisp-data, which is only present in Emacs 28+, thus breaking the loading of deps
(eldev-trace "Old Emacs version detected, remapping lisp-data-mode")
(defalias 'lisp-data-mode 'emacs-lisp-mode))
(setf eldev-release-post-release-commit-message "Post-release version bump."
eldev-release-post-release-commit (lambda (version)
(let ((eldev-release-min-version-size 3))
(eldev-release-next-snapshot-version-unless-already-snapshot version))))
(defvar straight-base-dir (file-name-as-directory (eldev-cache-dir t)))
;; Ensure a stable location for the lockfile
(defvar straight-profiles `((nil . ,(expand-file-name "tests/packages.lock" eldev-project-dir))))
;; Need straight.el for old versions of dependencies, since `eldev-use-vc-repository' has
;; a showstopper bug: https://github.com/emacs-eldev/eldev/issues/114
(defun bootstrap-straight ()
(unless (require 'straight nil t)
(eldev-trace "Bootstrapping straight.el")
(let ((bootstrap-file
(expand-file-name "straight/repos/straight.el/bootstrap.el" straight-base-dir))
(bootstrap-version 7))
(unless (file-exists-p bootstrap-file)
(with-current-buffer
(url-retrieve-synchronously
"https://raw.githubusercontent.com/radian-software/straight.el/develop/install.el"
'silent 'inhibit-cookies)
(goto-char (point-max))
(eval-print-last-sexp)))
(load bootstrap-file nil 'nomessage))))
(cl-defun use-straight-repository (recipe &optional (loading-mode 'as-is))
(straight--with-plist (straight--convert-recipe recipe)
(package includes)
(eldev-trace "Installing %s via straight" package)
(straight-use-package recipe)
(eldev-use-local-sources (straight--build-dir package) loading-mode)
(cl-loop for include in (if (listp includes)
includes
(list includes))
do (declare-vc-package include (straight--build-dir package) loading-mode))
(eldev-trace "Installed %s into %s" package (straight--build-dir package))))
(cl-defun declare-vc-package (name dir &optional (loading-mode 'as-is))
"Declare package NAME as being present in DIR, using LOADING-MODE.
This function is needed when a package lives in the same
directory as another package, such as `git-commit' being included
as a part of `magit', as it won't be detected by
`eldev-package-descriptor'"
(eldev-trace "Registering included package '%s' at '%s'" name dir)
(straight-use-package name)
(let* ((pkg-desc (cl-loop for (file reader . args) in `((,(format "%s.el" name) package-buffer-info)
(,(format "%s-pkg.el" name) package--read-pkg-desc dir))
for path = (expand-file-name file dir)
when (file-readable-p path)
return (with-temp-buffer
(insert-file-contents path)
(apply reader args))
finally (error "No package file for '%s' found in directory '%s'" name dir))))
(push `(,name ,pkg-desc ,dir ,(expand-file-name dir eldev-project-dir) ,loading-mode)
eldev--local-sources)))
;; Set up dependencies manually for testing compatibility with old versions of Emacs and libraries
(eldev-defoption use-old-dependencies ()
:options (--old-deps)
(eldev-trace "Old dependency mode enabled")
(bootstrap-straight)
;; Need to add git-commit manually for some reason, the built-in recipe doesn't always know about it
(use-straight-repository '(magit :includes git-commit))
(use-straight-repository 'magit-section)
(use-straight-repository 'transient)
(use-straight-repository 'with-editor)
(use-straight-repository 'dash))
;; Set up dependencies manually for testing compatibility with old versions of Emacs and libraries
(eldev-defoption set-test-results-file (file)
:options (--results-file)
:value file
:for-command test
(setf test-results-file file))
;; Use buttercup-junit to generate XML results file
(add-hook 'eldev-test-buttercup-hook (lambda (_)
(require 'buttercup-junit)
(setf buttercup-reporter 'buttercup-junit-reporter)
(setf buttercup-junit-result-file (expand-file-name test-results-file))))