From f31a489d246e01250536b7187225fb7ca6398ba5 Mon Sep 17 00:00:00 2001 From: Petr Spacek Date: Tue, 8 Nov 2016 09:24:51 +0100 Subject: [PATCH] Build: add JS lint target https://fedorahosted.org/freeipa/ticket/6418 Reviewed-By: Martin Basti Reviewed-By: Christian Heimes --- Makefile.am | 26 +++++++++++++++++++++++++- configure.ac | 15 +++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index 90b1c1ee9..803b0a92a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -49,7 +49,10 @@ rpms: dist-gzip rpmroot rpmdistdir if WITH_PYLINT PYLINT_TARGET = pylint endif WITH_PYLINT -lint: $(PYLINT_TARGET) +if WITH_JSLINT +JSLINT_TARGET = jslint +endif WITH_JSLINT +lint: $(PYLINT_TARGET) $(JSLINT_TARGET) .PHONY: pylint pylint: @@ -66,3 +69,24 @@ pylint: echo "Pylint is running, please wait ..."; \ PYTHONPATH=$(top_srcdir) $(PYLINT) \ --rcfile=$(top_srcdir)/pylintrc $${FILES} + +.PHONY: jslint jslint-ui jslint-ui-test jslint-html +jslint: jslint-ui jslint-ui-test jslint-html + +# create temporary symlinks to allow jslint to find libs/loader.js +jslint-ui: + cd $(top_srcdir)/install/ui; \ + $(MKDIR_P) js; \ + rm -f js/libs; \ + $(LN_S) ../src/libs js/libs; \ + jsl -nologo -nosummary -nofilelisting -conf jsl.conf; \ + rm js/libs; \ + rmdir js + +jslint-ui-test: + cd $(top_srcdir)/install/ui/test; \ + jsl -nologo -nosummary -nofilelisting -conf jsl.conf + +jslint-html: + cd $(top_srcdir)/install/html; \ + jsl -nologo -nosummary -nofilelisting -conf jsl.conf diff --git a/configure.ac b/configure.ac index 7c7c31ed1..23c96c0cb 100644 --- a/configure.ac +++ b/configure.ac @@ -427,6 +427,21 @@ fi AC_SUBST([PYLINT]) AM_CONDITIONAL([WITH_PYLINT], [test "x${PYLINT}" != "xno"]) + +AC_ARG_WITH([jslint], + AS_HELP_STRING([--with-jslint=path to jsl], + [path to JavaScript lint]), +dnl --without-jslint will set JSLINT=no + [JSLINT=$with_jslint], + [AC_PATH_PROG([JSLINT], [jsl])] +) +if test "x${JSLINT}" == "x"; then + AC_MSG_ERROR([cannot find JS lint]) +fi +AC_SUBST([JSLINT]) +AM_CONDITIONAL([WITH_JSLINT], [test "x${JSLINT}" != "xno"]) + + # Flags AC_SUBST(CFLAGS)