From 203d066aa84d5f79ed9a16b855ba120ba02ae1e7 Mon Sep 17 00:00:00 2001 From: Jan-Simon Möller Date: Thu, 27 Jul 2017 23:20:19 +0200 Subject: Initial version of a LOC counter class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Usage: INHERIT += "cloc" cloc --sum-reports `find tmp/work/ -name "*clocreport" | grep -v "\-native"` --out cloc-summary.report cloc needs to be installed on the host. Change-Id: I70c7e707405c718b1685d49f4e84216c5408d2fb Signed-off-by: Jan-Simon Möller Reviewed-on: https://gerrit.automotivelinux.org/gerrit/10437 Tested-by: Jenkins Job builder account Reviewed-by: Matt Ranostay (cherry picked from commit 37c55f85ccf941bbbd8b3eae1eb31c596981304b) Reviewed-on: https://gerrit.automotivelinux.org/gerrit/10643 ci-image-build: Jenkins Job builder account --- meta-agl/classes/cloc.bbclass | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 meta-agl/classes/cloc.bbclass diff --git a/meta-agl/classes/cloc.bbclass b/meta-agl/classes/cloc.bbclass new file mode 100644 index 000000000..53713bfc3 --- /dev/null +++ b/meta-agl/classes/cloc.bbclass @@ -0,0 +1,29 @@ +# (C) 2017 Jan-Simon Möller +# +# License: GPLv2 +# +# summary with +# cloc --sum-reports `find . -name "*clocreport" | grep -v "\-native" ` --out summary.report + +CLOC_DIRECTORY ??= "${DEPLOY_DIR}/cloc/" +CLOCSTATEDIR = "${WORKDIR}/cloc-destdir/" + +python do_cloc() { + + import subprocess + + source_dir = d.getVar('S', True) + pn = d.getVar('PN', True) + + destdir = d.expand('${CLOCSTATEDIR}') + bb.utils.mkdirhier(destdir) + + cloc_cmd = 'cloc %s -q --out=%s/%s.clocreport' % (source_dir, destdir, pn ) + subprocess.call(cloc_cmd, shell=True) + +} + + +addtask cloc before do_configure after do_unpack + +EXPORT_FUNCTIONS do_cloc -- cgit 1.2.3-korg