Skip to content

Commit dcffc08

Browse files
committed
regen 'bindata.go' only when necessary
* if nothing has changed under 'webapp/', don't regenerate 'bindata.go' * timesaver and when someone clone this repo, 'go-bindata' is not necessary to build this project
1 parent 14794cd commit dcffc08

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

build.pl

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,19 @@ sub git_describe {
159159
# generate 'bindata.go' per 'go-bindata' cmd
160160
#
161161
sub gen_bindata {
162-
# validate that 'go-bindata' is installed
163-
system("go-bindata -version 2>&1 > /dev/null") == 0 or
164-
die "'go-bindata' missing! - please install per: 'go get -u github.com/jteeuwen/go-bindata/...'";
165162

166-
my @ignore = qw{go-bindata .git config.json README angular-mocks.js 'emacs.*core'};
167-
my $cmd = "go-bindata " . join(" ", map("-ignore=$_", @ignore)) . " webapp/...";
163+
# only regenerate 'bindata.go' if something under 'webapp/' has changed
164+
if((! -e "bindata.go") || qx{git diff webapp} ne ""){
165+
# validate that 'go-bindata' is installed
166+
system("go-bindata -version > /dev/null 2>&1") == 0 or (sub {
167+
say "'go-bindata' missing! - please install per: 'go get -u github.com/jteeuwen/go-bindata/...'";
168+
exit 1;
169+
})->();
170+
171+
my @ignore = qw{go-bindata .git config.json README angular-mocks.js 'emacs.*core'};
172+
my $cmd = "go-bindata " . join(" ", map("-ignore=$_", @ignore)) . " webapp/...";
168173

169-
say "generate 'bindata.go': ($cmd)";
170-
system($cmd) == 0 or die "unable to build 'bindata.go'";
174+
say "generate 'bindata.go': ($cmd)";
175+
system($cmd) == 0 or die "unable to build 'bindata.go'";
176+
}
171177
}

0 commit comments

Comments
 (0)