js.core: Remove the -builtin_vdlroot flag.

The vdl tool needs access to its standard packages when compiling
and generating code.  It can either find the packages under
VDLROOT/JIRI_ROOT, or it can use the packages built-in to the
tool itself.

The previous behavior was that if -builtin_vdlroot=false (the
default), we'd always look under VDLROOT or JIRI_ROOT.  The new
behavior gets rid of the flag, and changes the behavior as if it
were set to true.  If VDLROOT or JIRI_ROOT are set, we always use
that value, otherwise we extract the built-in vdlroot to a
temporary directory.

The previous behavior was to write out the data as a
base64/gzipped/tarball with line breaks.  The new behavior writes
out a gzipped/tarball as raw binary data, without line breaks.
This is simpler; there's no need for the base64 encoding.

The previous behavior only included *.vdl files in the tarball;
we also need to include vdl.config files, since they affect code
generation for dependant packages.

Added an explicit test to make sure the builtin vdlroot data
contains exactly what we expect; the net result is similar to the
go-generate test (which reminds us when we've forgotten to run
go-generate), but is a bit more localized.

MultiPart: 4/6

Change-Id: I9044e185384785bdc8a8f15a3a95940d4cece84b
diff --git a/Makefile b/Makefile
index 8dc3eb4..2e7c0f8 100644
--- a/Makefile
+++ b/Makefile
@@ -3,8 +3,9 @@
 
 NODE_BIN := $(JIRI_ROOT)/release/javascript/core/node_modules/.bin
 GOPATH := $(JIRI_ROOT)/release/javascript/core/go
-VDLPATH := $(JIRI_ROOT)/release/go/src:$(GOPATH)/src
 GOBIN := $(JIRI_ROOT)/release/javascript/core/go/bin
+VDLPATH := $(JIRI_ROOT)/release/go/src:$(GOPATH)/src
+VDLROOT := $(JIRI_ROOT)/release/go/src/v.io/v23/vdlroot
 VGO := GOPATH="$(GOPATH)" VDLPATH="$(VDLPATH)" jiri go
 GO_FILES := $(shell find go/src $(JIRI_ROOT)/release/go/src/v.io -name "*.go")
 
@@ -154,7 +155,7 @@
 gen-vdl-test-expected-impl:
 	rm -rf $(JS_VDL_DIR)
 	echo $(VDLPATH)
-	VDLPATH=$(VDLPATH) vdl generate -lang=javascript \
+	VDLPATH=$(VDLPATH) VDLROOT=$(VDLROOT) vdl generate -lang=javascript \
 		-js-relative-path-to-core=$(JS_VDL_PATH_TO_CORE) \
 		-js-out-dir=$(JS_VDL_DIR) \
 		v.io/x/ref/lib/vdl/testdata/...
@@ -162,7 +163,7 @@
 gen-vdl-impl:
 ifndef NOVDLGEN
 	rm -rf $(JS_VDL_DIR)
-	VDLPATH=$(VDLPATH) vdl generate -lang=javascript \
+	VDLPATH=$(VDLPATH) VDLROOT=$(VDLROOT) vdl generate -lang=javascript \
 		-js-relative-path-to-core=$(JS_VDL_PATH_TO_CORE) \
 		-js-out-dir=$(JS_VDL_DIR) \
 		v.io/x/ref/lib/vdl/testdata/... \
@@ -175,10 +176,10 @@
 	# TODO(bjornick): We build the vdlroot stuff with a different set of command line options because the package
 	# path does not equal the directory path of the source file.  This is not ideal, but bjornick and toddw will
 	# discuss how to fix this later.
-	VDLPATH=$(VDLPATH) vdl generate -lang=javascript \
-			-js-relative-path-to-core=../../../$(JS_VDL_PATH_TO_CORE) \
-			-js-out-dir=$(JS_VDL_DIR) \
-			$(JIRI_ROOT)/release/go/src/v.io/v23/vdlroot/...
+	VDLPATH=$(VDLPATH) VDLROOT=$(VDLROOT) vdl generate -lang=javascript \
+		-js-relative-path-to-core=../../../$(JS_VDL_PATH_TO_CORE) \
+		-js-out-dir=$(JS_VDL_DIR) \
+		$(VDLROOT)/...
 endif
 
 test-vdl-node: test-precheck
diff --git a/extension/Makefile b/extension/Makefile
index cc38cc3..be12835 100644
--- a/extension/Makefile
+++ b/extension/Makefile
@@ -1,5 +1,7 @@
 NODE_DIR := $(shell jiri v23-profile list --info Target.InstallationDir nodejs)
 PATH := node_modules/.bin:${NODE_DIR}/bin:$(PATH)
+VDLPATH := $(JIRI_ROOT)/release/go/src
+VDLROOT := $(JIRI_ROOT)/release/go/src/v.io/v23/vdlroot
 WSPR_ROOT := $(JIRI_ROOT)/release/go/src/v.io/x/ref/services/wspr
 SHELL := /bin/bash -e -o pipefail
 .DEFAULT_GOAL := all
@@ -25,7 +27,7 @@
 	fi; \
 	if [ -f "$(JIRI_ROOT)/.jiri_v23_profiles" -a ! -z "`jiri v23-profile list nacl`" ]; then \
 		echo ">>>>>>> using new profiles"; \
- 		echo "unset GOARCH GOOS; jiri go --profiles=nacl --target=amd64p32-nacl build -o $2 $1"; \
+		echo "unset GOARCH GOOS; jiri go --profiles=nacl --target=amd64p32-nacl build -o $2 $1"; \
 		unset GOARCH GOOS; jiri -v go -v --profiles=nacl --target=amd64p32-nacl build -v -o $2 $1; \
 	else \
 		echo ">>>>>>> using old profiles"; \
@@ -130,17 +132,16 @@
 build-test: build-test/html build-test/images build-test/manifest.json build-test/js build-test/nacl
 
 gen-vdl: $(WSPR_ROOT)/internal/channel/channel.vdl $(WSPR_ROOT)/internal/browspr/browspr.vdl $(WSPR_ROOT)/internal/account/account.vdl
-	VDLPATH=$(JIRI_ROOT)/release/go/src vdl generate \
-		 -lang=javascript \
-		 -js-out-dir="$(JIRI_ROOT)/release/javascript/core/extension/vdl" \
-		 -js-relative-path-to-core=../../src $(dir $^)
+	VDLPATH=$(VDLPATH) VDLROOT=$(VDLROOT) vdl generate -lang=javascript \
+		-js-out-dir="$(JIRI_ROOT)/release/javascript/core/extension/vdl" \
+		-js-relative-path-to-core=../../src $(dir $^)
 	# TODO(bjornick): We build the vdlroot stuff with a different set of command line options because the package
 	# path does not equal the directory path of the source file.  This is not ideal, but bjornick and toddw will
 	# discuss how to fix this later.
-	VDLPATH=$(JIRI_ROOT)/release/go/src vdl generate -lang=javascript \
-	        -js-relative-path-to-core=../../../../../src \
-	        -js-out-dir="$(JIRI_ROOT)/release/javascript/core/extension/vdl" \
-	        $(JIRI_ROOT)/release/go/src/v.io/v23/vdlroot/...
+	VDLPATH=$(VDLPATH) VDLROOT=$(VDLROOT) vdl generate -lang=javascript \
+		-js-relative-path-to-core=../../../../../src \
+		-js-out-dir="$(JIRI_ROOT)/release/javascript/core/extension/vdl" \
+		$(VDLROOT)/...
 
 example-server: example/index.bundle.js
 	static "example" -H '{"Cache-Control": "no-cache, must-revalidate"}'