Skip to content

Commit 3019af1

Browse files
committed
🔨 Make / pins-format patches
1 parent 8916e6f commit 3019af1

File tree

3 files changed

+16
-18
lines changed

3 files changed

+16
-18
lines changed

Makefile

+13-17
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@ CONTAINER_IMAGE := marlin-dev
55

66
help:
77
@echo "Tasks for local development:"
8-
@echo "* format-pins: Reformat all pins files"
9-
@echo "* tests-single-ci: Run a single test from inside the CI"
10-
@echo "* tests-single-local: Run a single test locally"
11-
@echo "* tests-single-local-docker: Run a single test locally, using docker"
12-
@echo "* tests-all-local: Run all tests locally"
13-
@echo "* tests-all-local-docker: Run all tests locally, using docker"
14-
@echo "* setup-local-docker: Build the local docker image"
8+
@echo "make marlin : Build marlin for the configured board"
9+
@echo "make format-pins : Reformat all pins files"
10+
@echo "make tests-single-ci : Run a single test from inside the CI"
11+
@echo "make tests-single-local : Run a single test locally"
12+
@echo "make tests-single-local-docker : Run a single test locally, using docker"
13+
@echo "make tests-all-local : Run all tests locally"
14+
@echo "make tests-all-local-docker : Run all tests locally, using docker"
15+
@echo "make setup-local-docker : Build the local docker image"
1516
@echo ""
1617
@echo "Options for testing:"
1718
@echo " TEST_TARGET Set when running tests-single-*, to select the"
@@ -24,46 +25,41 @@ help:
2425
@echo " VERBOSE_PLATFORMIO If you want the full PIO output, set any value"
2526
@echo " GIT_RESET_HARD Used by CI: reset all local changes. WARNING:"
2627
@echo " THIS WILL UNDO ANY CHANGES YOU'VE MADE!"
27-
.PHONY: help
28+
29+
marlin:
30+
./buildroot/bin/mftest -a
31+
.PHONY: marlin
2832

2933
tests-single-ci:
3034
export GIT_RESET_HARD=true
3135
$(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) PLATFORMIO_BUILD_FLAGS=-DGITHUB_ACTION
32-
.PHONY: tests-single-ci
3336

3437
tests-single-local:
3538
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local" ; return 1; fi
3639
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
3740
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
3841
&& run_tests . $(TEST_TARGET) "$(ONLY_TEST)"
39-
.PHONY: tests-single-local
4042

4143
tests-single-local-docker:
4244
@if ! test -n "$(TEST_TARGET)" ; then echo "***ERROR*** Set TEST_TARGET=<your-module> or use make tests-all-local-docker" ; return 1; fi
4345
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
4446
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-single-local TEST_TARGET=$(TEST_TARGET) VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD) ONLY_TEST="$(ONLY_TEST)"
45-
.PHONY: tests-single-local-docker
4647

4748
tests-all-local:
4849
export PATH="./buildroot/bin/:./buildroot/tests/:${PATH}" \
4950
&& export VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) \
5051
&& for TEST_TARGET in $$($(SCRIPTS_DIR)/get_test_targets.py) ; do echo "Running tests for $$TEST_TARGET" ; run_tests . $$TEST_TARGET ; done
51-
.PHONY: tests-all-local
5252

5353
tests-all-local-docker:
5454
@if ! $(CONTAINER_RT_BIN) images -q $(CONTAINER_IMAGE) > /dev/null ; then $(MAKE) setup-local-docker ; fi
5555
$(CONTAINER_RT_BIN) run $(CONTAINER_RT_OPTS) $(CONTAINER_IMAGE) $(MAKE) tests-all-local VERBOSE_PLATFORMIO=$(VERBOSE_PLATFORMIO) GIT_RESET_HARD=$(GIT_RESET_HARD)
56-
.PHONY: tests-all-local-docker
5756

5857
setup-local-docker:
5958
$(CONTAINER_RT_BIN) build -t $(CONTAINER_IMAGE) -f docker/Dockerfile .
60-
.PHONY: setup-local-docker
6159

6260
PINS := $(shell find Marlin/src/pins -mindepth 2 -name '*.h')
6361

64-
.PHONY: $(PINS)
65-
6662
$(PINS): %:
67-
@echo "Formatting $@" && node buildroot/share/scripts/pinsformat.js $@
63+
@echo "Formatting $@" && node $(SCRIPTS_DIR)/pinsformat.js $@
6864

6965
format-pins: $(PINS)

buildroot/bin/mftest

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
[[ -d Marlin/src ]] || { echo "Please 'cd' to the Marlin repo root." ; exit 1 ; }
1010

11+
which pio || { echo "Make sure 'pio' is in your execution PATH." ; exit 1 ; }
12+
1113
perror() { echo -e "$0: \033[0;31m$1 -- $2\033[0m" ; }
1214
errout() { echo -e "\033[0;31m$1\033[0m" ; }
1315
bugout() { ((DEBUG)) && echo -e "\033[0;32m$1\033[0m" ; }

buildroot/share/scripts/pinsformat.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ String.prototype.concat_with_space = function(str) {
4242
};
4343

4444
const mpatt = [ '-?\\d{1,3}', 'P[A-I]\\d+', 'P\\d_\\d+', 'Pin[A-Z]\\d\\b' ],
45-
definePatt = new RegExp(`^\\s*(//)?#define\\s+[A-Z_][A-Z0-9_]+\\s+(${'|'.join(mpatt)})\\s*(//.*)?$`, 'gm'),
45+
definePatt = new RegExp(`^\\s*(//)?#define\\s+[A-Z_][A-Z0-9_]+\\s+(${mpatt.join('|')})\\s*(//.*)?$`, 'gm'),
4646
ppad = [ 3, 4, 5, 5 ],
4747
col_comment = 50,
4848
col_value_rj = col_comment - 3;

0 commit comments

Comments
 (0)