Skip to content

Commit

Permalink
[FAB-11137] Include dependencies of test imports
Browse files Browse the repository at this point in the history
This change includes TestImports when calculating dependencies.

Change-Id: Ifd86a913cb9d0ee8a055a39ef9d332b7bc6b7efa
Signed-off-by: Troy Ronda <troy@troyronda.com>
  • Loading branch information
troyronda committed Jul 12, 2018
1 parent a5e3ef8 commit 93590f0
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions test/scripts/lib/find_packages.sh
Expand Up @@ -151,13 +151,24 @@ function writePkgDeps {
declare pkg=${1}
declare key="PKGDEPS__${pkg//[-\.\/]/_}"

declare -a depsAndImports=($(${GO_CMD} list -f '{{.TestImports}} {{.Deps}}' ${pkg} | tr -d '[]' | xargs | tr ' ' '\n' | \
declare -a testImports=($(${GO_CMD} list -f '{{.TestImports}}' ${pkg} | tr -d '[]' | xargs | tr ' ' '\n' | \
grep "^${REPO}" | \
grep -v "^${REPO}/vendor/" | \
sort -u | \
tr '\n' ' '))

echo "${depsAndImports[@]}" > ${PKG_DEPS_DIR}/${key}.txt
declare -a depsAndImports=($(${GO_CMD} list -f '{{.Deps}}' ${pkg} ${testImports[@]} | tr -d '[]' | xargs | tr ' ' '\n' | \
grep "^${REPO}" | \
grep -v "^${REPO}/vendor/" | \
sort -u | \
tr '\n' ' ') ${testImports[@]})

declare val=""
if [ ${#depsAndImports[@]} -gt 0 ]; then
val=$(echo ${depsAndImports[@]} | tr ' ' '\n' | sort -u | tr '\n' ' ')
fi

echo "${val}" > ${PKG_DEPS_DIR}/${key}.txt
}

function evalPkgDeps {
Expand Down

0 comments on commit 93590f0

Please sign in to comment.