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

Adopt makem.sh for build support (linting, running tests) #432

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ jobs:
- name: Byte compilation
run: emacs --eval "(setq byte-compile-error-on-warn (>= emacs-major-version 26))" -L . --batch -f batch-byte-compile ./*.el
- name: Tests
run: nix shell ${{ matrix.ledger_version || 'nixpkgs#ledger' }} --print-build-logs -c make -C test
run: nix shell 'nixpkgs#getopt' ${{ matrix.ledger_version || 'nixpkgs#ledger' }} --print-build-logs -c ./makem.sh test -vv
# This is currently for information only, since a lot of docstrings need fixing up
- name: Checkdoc
run: make -C test checkdoc || true
run: make lint-checkdoc || true
# TODO: Run other makem.sh lints
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
*.elc
*~
CMakeCache.txt
CMakeFiles/
/Makefile
cmake_install.cmake
59 changes: 0 additions & 59 deletions CMakeLists.txt

This file was deleted.

6 changes: 5 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Tips for contributors
---------------------

* In your local repository, ensure that everything compiles by **running
`cmake . && make`** (this will launch byte compilation of lisp files and regression
`make`** (this will launch byte compilation of lisp files and regression
tests).
* You are then ready to make a **pull request**. Please make pull requests
**against `master`**.
Expand Down Expand Up @@ -30,6 +30,9 @@ description on GitHub.

**./LICENSE.md**: the [GPLv2] license.

**./makem.sh** and **./Makefile**: build scripts for linting and testing this
project, copied from [makem].

**./*.el**: the [Emacs] ledger-mode lisp code.

**./doc/**: documentation, and tools for generating documents such as the *pdf*
Expand All @@ -47,3 +50,4 @@ manual.
[Emacs]: http://www.gnu.org/software/emacs/
[GPLv2]: http://www.gnu.org/licenses/gpl-2.0.html
[github]: https://github.com/ledger/ledger-mode/
[makem]: https://github.com/alphapapa/makem.sh/
59 changes: 59 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# * makem.sh/Makefile --- Script to aid building and testing Emacs Lisp packages

# URL: https://github.com/alphapapa/makem.sh
# Version: 0.5

# * Arguments

# For consistency, we use only var=val options, not hyphen-prefixed options.

# NOTE: I don't like duplicating the arguments here and in makem.sh,
# but I haven't been able to find a way to pass arguments which
# conflict with Make's own arguments through Make to the script.
# Using -- doesn't seem to do it.

ifdef install-deps
INSTALL_DEPS = "--install-deps"
endif
ifdef install-linters
INSTALL_LINTERS = "--install-linters"
endif

ifdef sandbox
ifeq ($(sandbox), t)
SANDBOX = --sandbox
else
SANDBOX = --sandbox=$(sandbox)
endif
endif

ifdef debug
DEBUG = "--debug"
endif

# ** Verbosity

# Since the "-v" in "make -v" gets intercepted by Make itself, we have
# to use a variable.

verbose = $(v)

ifneq (,$(findstring vvv,$(verbose)))
VERBOSE = "-vvv"
else ifneq (,$(findstring vv,$(verbose)))
VERBOSE = "-vv"
else ifneq (,$(findstring v,$(verbose)))
VERBOSE = "-v"
endif

# * Rules

# TODO: Handle cases in which "test" or "tests" are called and a
# directory by that name exists, which can confuse Make.

%:
@./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(INSTALL_DEPS) $(INSTALL_LINTERS) $(@)

.DEFAULT: init
init:
@./makem.sh $(DEBUG) $(VERBOSE) $(SANDBOX) $(INSTALL_DEPS) $(INSTALL_LINTERS)
3 changes: 1 addition & 2 deletions ledger-complete.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
;; Functions providing payee and account auto complete.

(require 'cl-lib)
(eval-when-compile
(require 'subr-x))
(eval-when-compile (require 'subr-x))

;; In-place completion support

Expand Down
1 change: 1 addition & 0 deletions ledger-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

;;; Code:

(eval-when-compile (require 'subr-x))
(require 'ledger-regex)
(require 'org)
(require 'ledger-commodities)
Expand Down
1 change: 1 addition & 0 deletions ledger-occur.el
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
;;; Code:

(require 'cl-lib)
(eval-when-compile (require 'subr-x))
(require 'ledger-navigate)

(defconst ledger-occur-overlay-property-name 'ledger-occur-custom-buffer-grep)
Expand Down
1 change: 1 addition & 0 deletions ledger-post.el
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
;;; Commentary:
;; Utility functions for dealing with postings.

(eval-when-compile (require 'subr-x))
(require 'ledger-regex)
(require 'ledger-navigate)

Expand Down
1 change: 1 addition & 0 deletions ledger-reconcile.el
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

;;; Code:

(eval-when-compile (require 'subr-x))
(require 'easymenu)
(require 'ledger-init)

Expand Down
1 change: 1 addition & 0 deletions ledger-xact.el
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

;;; Code:

(eval-when-compile (require 'subr-x))
(require 'eshell)
(require 'ledger-regex)
(require 'ledger-navigate)
Expand Down
Loading