Meta: Update makem.sh, etc.

This commit is contained in:
Adam Porter 2020-11-24 12:17:39 -06:00
parent 8fb6efecc1
commit 5fab48e2cd
3 changed files with 62 additions and 13 deletions

View file

@ -1,7 +1,7 @@
# * test.yml --- Test Emacs packages using makem.sh on GitHub Actions # * test.yml --- Test Emacs packages using makem.sh on GitHub Actions
# URL: https://github.com/alphapapa/makem.sh # URL: https://github.com/alphapapa/makem.sh
# Version: 0.2.1 # Version: 0.3
# * Commentary: # * Commentary:
@ -31,8 +31,8 @@ on:
pull_request: pull_request:
push: push:
# Comment out this section to enable testing of all branches. # Comment out this section to enable testing of all branches.
# branches: branches:
# - master - master
jobs: jobs:
build: build:
@ -63,7 +63,7 @@ jobs:
- name: Lint - name: Lint
# NOTE: Uncomment this line to treat lint failures as passing # NOTE: Uncomment this line to treat lint failures as passing
# so the job doesn't show failure. # so the job doesn't show failure.
continue-on-error: true # continue-on-error: true
run: ./makem.sh -vv --sandbox=$SANDBOX_DIR lint run: ./makem.sh -vv --sandbox=$SANDBOX_DIR lint
- name: Test - name: Test

View file

@ -1,7 +1,7 @@
# * makem.sh/Makefile --- Script to aid building and testing Emacs Lisp packages # * makem.sh/Makefile --- Script to aid building and testing Emacs Lisp packages
# URL: https://github.com/alphapapa/makem.sh # URL: https://github.com/alphapapa/makem.sh
# Version: 0.2.1 # Version: 0.3
# * Arguments # * Arguments

View file

@ -3,7 +3,7 @@
# * makem.sh --- Script to aid building and testing Emacs Lisp packages # * makem.sh --- Script to aid building and testing Emacs Lisp packages
# URL: https://github.com/alphapapa/makem.sh # URL: https://github.com/alphapapa/makem.sh
# Version: 0.2.1 # Version: 0.3
# * Commentary: # * Commentary:
@ -80,6 +80,7 @@ Options:
-d, --debug Print debug info. -d, --debug Print debug info.
-h, --help I need somebody! -h, --help I need somebody!
-v, --verbose Increase verbosity, up to -vv. -v, --verbose Increase verbosity, up to -vv.
--no-color Disable color output.
--debug-load-path Print load-path from inside Emacs. --debug-load-path Print load-path from inside Emacs.
@ -88,7 +89,8 @@ Options:
-e, --exclude FILE Exclude FILE from linting and testing. -e, --exclude FILE Exclude FILE from linting and testing.
-f, --file FILE Check FILE in addition to discovered files. -f, --file FILE Check FILE in addition to discovered files.
--no-color Disable color output. -c, --compile-batch Batch-compile files (instead of separately; quicker, but
may hide problems).
-C, --no-compile Don't compile files automatically. -C, --no-compile Don't compile files automatically.
Sandbox options: Sandbox options:
@ -289,6 +291,18 @@ function batch-byte-compile {
"$@" "$@"
} }
function byte-compile-file {
debug "byte-compile: ERROR-ON-WARN:$compile_error_on_warn"
local file="$1"
[[ $compile_error_on_warn ]] && local error_on_warn=(--eval "(setq byte-compile-error-on-warn t)")
run_emacs \
"${error_on_warn[@]}" \
--eval "(byte-compile-file \"$file\")" \
|| error "Compiling file failed: $file"
}
# ** Files # ** Files
function dirs-project { function dirs-project {
@ -684,18 +698,48 @@ function all {
tests tests
} }
function compile { function compile-batch {
[[ $compile ]] || return 0
unset compile # Only compile once.
verbose 1 "Compiling..."
verbose 2 "Batch-compiling files..."
debug "Byte-compile files: ${files_project_byte_compile[@]}"
batch-byte-compile "${files_project_byte_compile[@]}" \
&& success "Compiling finished without errors." \
|| error "Compilation failed."
}
function compile-each {
[[ $compile ]] || return 0 [[ $compile ]] || return 0
unset compile # Only compile once. unset compile # Only compile once.
verbose 1 "Compiling..." verbose 1 "Compiling..."
debug "Byte-compile files: ${files_project_byte_compile[@]}" debug "Byte-compile files: ${files_project_byte_compile[@]}"
batch-byte-compile "${files_project_byte_compile[@]}" \ local compile_errors
for file in "${files_project_byte_compile[@]}"
do
verbose 2 "Compiling file: $file..."
byte-compile-file "$file" \
|| compile_errors=t
done
! [[ $compile_errors ]] \
&& success "Compiling finished without errors." \ && success "Compiling finished without errors." \
|| error "Compilation failed." || error "Compilation failed."
} }
function compile {
if [[ $compile = batch ]]
then
compile-batch "$@"
else
compile-each "$@"
fi
}
function batch { function batch {
# Run Emacs in batch mode with ${args_batch_interactive[@]} and # Run Emacs in batch mode with ${args_batch_interactive[@]} and
# with project source and test files loaded. # with project source and test files loaded.
@ -747,7 +791,7 @@ function lint-compile {
verbose 1 "Linting compilation..." verbose 1 "Linting compilation..."
compile_error_on_warn=true compile_error_on_warn=true
batch-byte-compile "${files_project_byte_compile[@]}" \ compile "${files_project_byte_compile[@]}" \
&& success "Linting compilation finished without errors." \ && success "Linting compilation finished without errors." \
|| error "Linting compilation failed." || error "Linting compilation failed."
unset compile_error_on_warn unset compile_error_on_warn
@ -880,6 +924,7 @@ errors=0
verbose=0 verbose=0
compile=true compile=true
arg_batch="--batch" arg_batch="--batch"
compile=each
# MAYBE: Disable color if not outputting to a terminal. (OTOH, the # MAYBE: Disable color if not outputting to a terminal. (OTOH, the
# colorized output is helpful in CI logs, and I don't know if, # colorized output is helpful in CI logs, and I don't know if,
@ -938,8 +983,8 @@ elisp_org_package_archive="(add-to-list 'package-archives '(\"org\" . \"https://
# * Args # * Args
args=$(getopt -n "$0" \ args=$(getopt -n "$0" \
-o dhe:E:i:s::vf:CO \ -o dhce:E:i:s::vf:CO \
-l exclude:,emacs:,install-deps,install-linters,debug,debug-load-path,help,install:,verbose,file:,no-color,no-compile,no-org-repo,sandbox:: \ -l compile-batch,exclude:,emacs:,install-deps,install-linters,debug,debug-load-path,help,install:,verbose,file:,no-color,no-compile,no-org-repo,sandbox:: \
-- "$@") \ -- "$@") \
|| { usage; exit 1; } || { usage; exit 1; }
eval set -- "$args" eval set -- "$args"
@ -966,6 +1011,10 @@ do
usage usage
exit exit
;; ;;
-c|--compile-batch)
debug "Compiling files in batch mode"
compile=batch
;;
-E|--emacs) -E|--emacs)
shift shift
emacs_command=($1) emacs_command=($1)