From 6eee9cefca162bfdd33f08eb70c068a1010854f1 Mon Sep 17 00:00:00 2001 From: christopherlam Date: Wed, 16 Aug 2017 23:33:03 +0800 Subject: [PATCH 1/6] Account fullname filter for transaction.scm This small change will introduce an account full-name filter. Only accounts whose fullname containing substring will be selected e.g. ":Travel" will match Expenses:Travel:Holiday and Expenses:Business:Travel. This can be left blank, which will mimic previous behavior. This will ease accounts selection tremendously. --- src/report/standard-reports/transaction.scm | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 85bb53711f..7ea7993378 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -33,6 +33,7 @@ (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (srfi srfi-1)) +(use-modules (srfi srfi-13)) (use-modules (gnucash gnc-module)) (use-modules (gnucash gettext)) @@ -660,6 +661,14 @@ '()) #f #t)) + (gnc:register-trep-option + (gnc:make-string-option + gnc:pagename-accounts (N_ "Account Substring") + "a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel:' will \ +match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \ +disable the substring filter.") + "")) + (gnc:register-trep-option (gnc:make-account-list-option gnc:pagename-accounts (N_ "Filter By...") @@ -1422,6 +1431,7 @@ Credit Card, and Income accounts."))))) (gnc:report-starting reportname) (let ((document (gnc:make-html-document)) (c_account_1 (opt-val gnc:pagename-accounts "Accounts")) + (c_account_substring (opt-val gnc:pagename-accounts "Account Substring")) (c_account_2 (opt-val gnc:pagename-accounts "Filter By...")) (filter-mode (opt-val gnc:pagename-accounts "Filter Type")) (begindate (gnc:timepair-start-day-time @@ -1444,6 +1454,11 @@ Credit Card, and Income accounts."))))) ;;(gnc:warn "accts in trep-renderer:" c_account_1) ;;(gnc:warn "Report Account names:" (get-other-account-names c_account_1)) + (set! c_account_1 + (filter (lambda (acc) + (string-contains (gnc-account-get-full-name acc) c_account_substring)) + c_account_1)) + (if (not (or (null? c_account_1) (and-map not c_account_1))) (begin (qof-query-set-book query (gnc-get-current-book)) From 11a1ff61c5e15ebc9fa46473ebbb51aac713084e Mon Sep 17 00:00:00 2001 From: christopherlam Date: Wed, 16 Aug 2017 23:46:25 +0800 Subject: [PATCH 2/6] added case sensitive filter please squash commits for me! --- src/report/standard-reports/transaction.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 7ea7993378..151ab47cf6 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -664,9 +664,9 @@ (gnc:register-trep-option (gnc:make-string-option gnc:pagename-accounts (N_ "Account Substring") - "a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel:' will \ + "a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel' will \ match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \ -disable the substring filter.") +disable the substring filter. This filter is case-sensitive.") "")) (gnc:register-trep-option From 19fe7d8a560467d2c6fe2b53277fa453f0677c16 Mon Sep 17 00:00:00 2001 From: christopherlam Date: Fri, 25 Aug 2017 17:13:54 +0800 Subject: [PATCH 3/6] Reduce to compatibility shim Reduce option to retain compatibility layer for earlier 2.8 --- src/report/standard-reports/transaction.scm | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 151ab47cf6..87c3945171 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -33,7 +33,6 @@ (use-modules (gnucash main)) ;; FIXME: delete after we finish modularizing. (use-modules (srfi srfi-1)) -(use-modules (srfi srfi-13)) (use-modules (gnucash gnc-module)) (use-modules (gnucash gettext)) @@ -666,7 +665,7 @@ gnc:pagename-accounts (N_ "Account Substring") "a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel' will \ match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \ -disable the substring filter. This filter is case-sensitive.") +disable the substring filter. This filter is case-sensitive. Gnucash 2.8 or later.") "")) (gnc:register-trep-option @@ -1431,7 +1430,6 @@ Credit Card, and Income accounts."))))) (gnc:report-starting reportname) (let ((document (gnc:make-html-document)) (c_account_1 (opt-val gnc:pagename-accounts "Accounts")) - (c_account_substring (opt-val gnc:pagename-accounts "Account Substring")) (c_account_2 (opt-val gnc:pagename-accounts "Filter By...")) (filter-mode (opt-val gnc:pagename-accounts "Filter Type")) (begindate (gnc:timepair-start-day-time @@ -1454,11 +1452,6 @@ Credit Card, and Income accounts."))))) ;;(gnc:warn "accts in trep-renderer:" c_account_1) ;;(gnc:warn "Report Account names:" (get-other-account-names c_account_1)) - (set! c_account_1 - (filter (lambda (acc) - (string-contains (gnc-account-get-full-name acc) c_account_substring)) - c_account_1)) - (if (not (or (null? c_account_1) (and-map not c_account_1))) (begin (qof-query-set-book query (gnc-get-current-book)) From 197faeab3f5e24fbebfb78290b6599a549bccd35 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Fri, 25 Aug 2017 11:40:54 +0200 Subject: [PATCH 4/6] Hide Account Substring option It is only there for compatibility with gnucash 2.8. It should not be visible on 2.6.x, only exist. --- src/report/standard-reports/transaction.scm | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/report/standard-reports/transaction.scm b/src/report/standard-reports/transaction.scm index 87c3945171..d737a74362 100644 --- a/src/report/standard-reports/transaction.scm +++ b/src/report/standard-reports/transaction.scm @@ -661,11 +661,8 @@ #f #t)) (gnc:register-trep-option - (gnc:make-string-option + (gnc:make-internal-option gnc:pagename-accounts (N_ "Account Substring") - "a5" (N_ "Match only above accounts whose fullname contains substring e.g. ':Travel' will \ -match Expenses:Travel:Holiday and Expenses:Business:Travel. Can be left blank, which will \ -disable the substring filter. This filter is case-sensitive. Gnucash 2.8 or later.") "")) (gnc:register-trep-option From 14b72ea11d948999968616f5b8c14a46ab70753d Mon Sep 17 00:00:00 2001 From: Rob Gowin Date: Fri, 1 Sep 2017 17:48:25 -0500 Subject: [PATCH 5/6] Enable CMake build in Travis CI --- .travis.yml | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 1660d5cf22..9b903b0049 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,29 @@ compiler: before_install: - sudo apt-get update -qq - sudo apt-get build-dep -qq gnucash - - sudo apt-get install -qq swig xsltproc libdbd-sqlite3 + - sudo apt-get install -qq swig xsltproc libdbd-sqlite3 cmake3 texinfo ninja-build - sudo apt-get --reinstall install -qq language-pack-en language-pack-fr -script: ./autogen.sh && ./configure && make && make check +script: | + # The -e here says that if any line below fails, the whole script fails + set -ev + + # First, do the cmake build using the default Makefile generator + mkdir /tmp/gnucash-build-cmake-make + cd /tmp/gnucash-build-cmake-make + cmake $TRAVIS_BUILD_DIR + make -j 4 + make check + + # Next, do cmake again, using the Ninja generator this time + mkdir /tmp/gnucash-build-cmake-ninja + cd /tmp/gnucash-build-cmake-ninja + cmake -G Ninja $TRAVIS_BUILD_DIR + ninja + ninja check + + # Finally, do the autotools build + cd $TRAVIS_BUILD_DIR + ./autogen.sh + ./configure + make + make check From 0e0e4d294e493911004f2e5c53eeedc798fa92a4 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sat, 2 Sep 2017 11:05:30 +0200 Subject: [PATCH 6/6] Set up a build matrix on Travis CI This will run the different builds in parallel (depending on resource availability on Travis). The advantages are - faster test results - easier to spot which build type has failed - shorter test log per build type to parse --- .travis.yml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/.travis.yml b/.travis.yml index 9b903b0049..cd1626a02f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,10 @@ language: c compiler: - gcc # - clang +env: + - BUILDTYPE=cmake-make + - BUILDTYPE=cmake-ninja + - BUILDTYPE=autotools before_install: - sudo apt-get update -qq - sudo apt-get build-dep -qq gnucash @@ -13,22 +17,26 @@ script: | set -ev # First, do the cmake build using the default Makefile generator - mkdir /tmp/gnucash-build-cmake-make - cd /tmp/gnucash-build-cmake-make - cmake $TRAVIS_BUILD_DIR - make -j 4 - make check + if [[ "$BUILDTYPE" == "cmake-make" ]]; then + mkdir /tmp/gnucash-build-cmake-make + cd /tmp/gnucash-build-cmake-make + cmake $TRAVIS_BUILD_DIR + make -j 4 + make check # Next, do cmake again, using the Ninja generator this time - mkdir /tmp/gnucash-build-cmake-ninja - cd /tmp/gnucash-build-cmake-ninja - cmake -G Ninja $TRAVIS_BUILD_DIR - ninja - ninja check + elif [[ "$BUILDTYPE" == "cmake-ninja" ]]; then + mkdir /tmp/gnucash-build-cmake-ninja + cd /tmp/gnucash-build-cmake-ninja + cmake -G Ninja $TRAVIS_BUILD_DIR + ninja + ninja check # Finally, do the autotools build - cd $TRAVIS_BUILD_DIR - ./autogen.sh - ./configure - make - make check + elif [[ "$BUILDTYPE" == "autotools" ]]; then + cd $TRAVIS_BUILD_DIR + ./autogen.sh + ./configure + make + make check + fi