reader: adds initial VDL files and generation tasks.

To help with interop between the Java and Web versions initial VDL files for the
types we expect to store have been created in the vdl directory.

Closes #22

Change-Id: Idc73de741243ec8c730b01b30ceb140a3af0996d
diff --git a/.gitignore b/.gitignore
index a816bc9..052563c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,14 @@
 web/bin/syncbased
 web/coverage
 web/credentials
-web/disc.html
+web/disk.html
 web/node_modules
 web/npm-debug.log
 web/public/bundle.*
 web/tmp
+
+# VDL generated stubs should be ignored
+web/browser/vanadium/v.io/*
+web/browser/vanadium/vdl/*
+android/src/main/java/io/v/*
+android/src/main/java/vdl/*
diff --git a/Makefile b/Makefile
index a3bd750..1afa3bc 100644
--- a/Makefile
+++ b/Makefile
@@ -5,6 +5,9 @@
 .DEFAULT_GOAL := all
 .SUFFIXES:
 
+VDLPATH = $(JIRI_ROOT)/release/go/src:$(shell pwd)
+vdl_files = $(wildcard vdl/*.vdl)
+
 .PHONY:
 clean:
 	$(MAKE) -C web clean
@@ -12,3 +15,25 @@
 .PHONY:
 test:
 	$(MAKE) -C web test
+
+.PHONY:
+vdl: web/browser/vanadium/vdl/index.js
+	@true  # silence "make: Nothing to be done for `vdl'."
+
+# TODO(jasoncampbell): Move this to web/Makefile so it can be used as a
+# dependency in tests etc.
+web/browser/vanadium/vdl/index.js: $(vdl_files)
+	VDLPATH=$(VDLPATH) vdl generate --lang javascript \
+		-js-out-dir ./web/browser/vanadium \
+		vdl
+
+# The vdl command will general mutliple Java files in the --java-out-dir + /vdl
+# directory. In order tie the $(vdl_files) dependencies to the building of the
+# Java files the mtime on the android/src/main/java/vdl is used. Note the @touch
+# at the end of this definition, this makes it so that the task only runs if the
+# dependencies have updated since the last run.
+android/src/main/java/vdl: $(vdl_files)
+	VDLPATH=$(VDLPATH) vdl generate --lang java \
+		--java-out-dir android/src/main/java \
+		vdl
+	@touch android/src/main/java/vdl
diff --git a/vdl/device-set.vdl b/vdl/device-set.vdl
new file mode 100644
index 0000000..c77dc5a
--- /dev/null
+++ b/vdl/device-set.vdl
@@ -0,0 +1,18 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package reader
+
+type DeviceMeta struct {
+  DeviceId string
+  Page int32
+  Zoom int32
+  Linked bool
+}
+
+type DeviceSet struct {
+  Id string
+  FileId string
+  Devices map[string]DeviceMeta
+}
diff --git a/vdl/device.vdl b/vdl/device.vdl
new file mode 100644
index 0000000..d742693
--- /dev/null
+++ b/vdl/device.vdl
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package reader
+
+type Screen struct {
+  Width int32
+  Height int32
+}
+
+type Device struct {
+  Id string
+  Name string
+  Arch string
+  Screen Screen
+}
diff --git a/vdl/error.vdl b/vdl/error.vdl
new file mode 100644
index 0000000..6cb515e
--- /dev/null
+++ b/vdl/error.vdl
@@ -0,0 +1,12 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package reader
+
+type Error struct {
+  Id string
+  Name string
+  Message string
+  Stack string
+}
diff --git a/vdl/file.vdl b/vdl/file.vdl
new file mode 100644
index 0000000..28ba384
--- /dev/null
+++ b/vdl/file.vdl
@@ -0,0 +1,17 @@
+// Copyright 2015 The Vanadium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package reader
+
+import (
+  "v.io/v23/services/syncbase/nosql"
+)
+
+type File struct {
+  Id string
+  Ref nosql.BlobRef
+  Title string
+  Size int64
+  Type string
+}
diff --git a/web/.jshintignore b/web/.jshintignore
index 0d4db1c..efe23e2 100644
--- a/web/.jshintignore
+++ b/web/.jshintignore
@@ -1,3 +1,5 @@
 node_modules
 public/*.js
 coverage
+browser/vanadium/vdl/*
+browser/vanadium/v.io/*
diff --git a/web/Makefile b/web/Makefile
index 1d3314c..a983f65 100644
--- a/web/Makefile
+++ b/web/Makefile
@@ -66,8 +66,8 @@
 	@istanbul cover --report html --print detail ./test/index.js
 	@touch coverage
 
-disk.html: browser/index.js $(js_files) node_modules
-	browserify --full-paths $< | discify > $@
+disk.html: browser/main.js $(js_files) node_modules
+	browserify --full-paths --transform ./lib/transform-css $< | discify > $@
 
 .PHONY:
 start: all
diff --git a/web/package.json b/web/package.json
index 30f2f27..4212266 100644
--- a/web/package.json
+++ b/web/package.json
@@ -13,7 +13,6 @@
   "license": "BSD",
   "devDependencies": {
     "concat-stream": "^1.5.0",
-    "dependency-check": "^2.5.0",
     "disc": "^1.3.2",
     "istanbul": "^0.3.17",
     "jshint": "^2.8.0",
@@ -34,6 +33,7 @@
     "cuid": "^1.3.8",
     "debug": "^2.2.0",
     "deep-equal": "^1.0.1",
+    "dependency-check": "^2.5.1",
     "dezalgo": "^1.0.3",
     "domready": "^1.0.8",
     "end-of-stream": "^1.1.0",