Skip to content

Commit

Permalink
[FAB-2211] Use discretion in building shim filelist
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ghaskins committed Feb 13, 2017
1 parent 4e051ed commit 26007a4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ EXECUTABLES = go docker git curl
K := $(foreach exec,$(EXECUTABLES),\
$(if $(shell which $(exec)),some string,$(error "No $(exec) in PATH: Check dependencies")))

GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim | sort | uniq)
GOSHIM_DEPS = $(shell ./scripts/goListFiles.sh $(PKGNAME)/core/chaincode/shim)
JAVASHIM_DEPS = $(shell git ls-files core/chaincode/shim/java)
PROTOS = $(shell git ls-files *.proto | grep -v vendor)
MSP_SAMPLECONFIG = $(shell git ls-files msp/sampleconfig/*.pem)
Expand Down
30 changes: 19 additions & 11 deletions scripts/goListFiles.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
#!/bin/bash

target=$1
find_golang_src() {
find $1 -name "*.go" -or -name "*.h" -or -name "*.c"
}

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

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

for dep in $deps;
do
importpath=$GOPATH/src/$dep
if [ -d $importpath ];
then
find $importpath -type f
fi
done
find_golang_src $GOPATH/src/$target

for dep in $deps;
do
importpath=$GOPATH/src/$dep
if [ -d $importpath ];
then
find_golang_src $importpath
fi
done
}

list_deps $1 | sort | uniq

0 comments on commit 26007a4

Please sign in to comment.