Skip to content

Commit 26007a4

Browse files
committed
[FAB-2211] Use discretion in building shim filelist
This patch modifies our scripts/goListFiles to work more closely to its advertised function. That is, it will only report files actually related to golang/cgo sources rather than any files it encounters in the filesystem. Change-Id: I5b9532ce963c5d020e7cefe80e0aafcdd7177da6 Signed-off-by: Gregory Haskins <[email protected]>
1 parent 4e051ed commit 26007a4

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ EXECUTABLES = go docker git curl
5959
K := $(foreach exec,$(EXECUTABLES),\
6060
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH: Check dependencies")))
6161

62-
GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim | sort | uniq)
62+
GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim)
6363
JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
6464
PROTOS = $(shell git ls-files *.proto | grep -v vendor)
6565
MSP_SAMPLECONFIG = $(shell git ls-files msp/sampleconfig/*.pem)

scripts/goListFiles.sh

+19-11
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,24 @@
11
#!/bin/bash
22

3-
target=$1
3+
find_golang_src() {
4+
find $1 -name "*.go" -or -name "*.h" -or -name "*.c"
5+
}
46

5-
deps=`go list -f '{{ join .Deps "\n" }}' $target`
7+
list_deps() {
8+
target=$1
69

7-
find $GOPATH/src/$target -type f
10+
deps=`go list -f '{{ join .Deps "\n" }}' $target`
811

9-
for dep in $deps;
10-
do
11-
importpath=$GOPATH/src/$dep
12-
if [ -d $importpath ];
13-
then
14-
find $importpath -type f
15-
fi
16-
done
12+
find_golang_src $GOPATH/src/$target
13+
14+
for dep in $deps;
15+
do
16+
importpath=$GOPATH/src/$dep
17+
if [ -d $importpath ];
18+
then
19+
find_golang_src $importpath
20+
fi
21+
done
22+
}
23+
24+
list_deps $1 | sort | uniq

0 commit comments

Comments
 (0)