blob: 61719a857075fb0ab1719559b3b2aed9746c9117 [file] [log] [blame]
Joey Armstrong449ce7a2023-07-18 18:32:24 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16# -----------------------------------------------------------------------
17# https://gerrit.opencord.org/plugins/gitiles/onf-make
18# ONF.makefiles.lint.groovy.version = 1.1.1 (+local edits)
19# -----------------------------------------------------------------------
20
21##-------------------##
22##---] GLOBALS [---##
23##-------------------##
24
25groovy-check := npm-groovy-lint
26
27groovy-check-args := $(null)
28# groovy-check-args += --loglevel info
29# groovy-check-args += --ignorepattern
30# groovy-check-args += --verbose
31
32##-------------------##
33##---] TARGETS [---##
34##-------------------##
35
36## -----------------------------------------------------------------------
37## Intent: Enabled by repository_sandbox_root/config.mk
38## -----------------------------------------------------------------------
39ifndef NO-LINT-GROOVY
40 lint : lint-groovy
41endif
42
43## -----------------------------------------------------------------------
44## Target type: lint all or individual files:
45## o make lint-groovy GROOVY_SRC="a/b/c.groovy d/e/f.groovy"
46## -----------------------------------------------------------------------
47lint-groovy : lint-groovy-$(if $(GROOVY_SRC),src,all)
48
49## -----------------------------------------------------------------------
50## Intent: Perform a lint check on command line script sources
51## -----------------------------------------------------------------------
52lint-groovy-all :
53 $(groovy-check) --version
54 @echo
55 $(HIDE)$(env-clean) find . -iname '*.groovy' -print0 \
56 | $(xargs-n1) $(groovy-check) $(groovy-check-args)
57
58## -----------------------------------------------------------------------
59## Intent: On-demand lint checking
60## -----------------------------------------------------------------------
61lint-groovy-src :
62 ifndef GROOVY_SRC
63 @echo "ERROR: Usage: $(MAKE) $@ GROOVY_SRC="
64 @exit 1
65 endif
66 $(groovy-check) --version
67 @echo
68 $(HIDE) $(groovy-check) $(groovy-check-args) $(GROOVY_SRC)
69
70## -----------------------------------------------------------------------
71## Intent: Display command help
72## -----------------------------------------------------------------------
73help-summary ::
74 @echo ' lint-groovy Syntax check groovy sources'
75 ifdef VERBOSE
76 @echo ' lint-groovy-all Lint all sources'
77 @echo ' lint-groovy-src Lint only files listed in GROOVY_SRC='
78 endif
79
80# [EOF]