Remove buck build

Change-Id: Iac66f5540030031b8c4439a9c1e296035ff45dbc
diff --git a/.buckconfig b/.buckconfig
deleted file mode 100644
index f163b1c..0000000
--- a/.buckconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-[alias]
-  all = //:all
-  install = //:install
-  deploy = //:deploy
-
-[java]
-  source_level = 8
-  target_level = 8
-
-[buildfile]
-  includes = //bootstrap.defs \
-      //bucklets/java_sources.bucklet \
-      //bucklets/maven_package.bucklet
diff --git a/.buckversion b/.buckversion
deleted file mode 120000
index 6203e53..0000000
--- a/.buckversion
+++ /dev/null
@@ -1 +0,0 @@
-bucklets/buckversion
\ No newline at end of file
diff --git a/.classpath b/.classpath
index 25bbe3b..9b961e2 100644
--- a/.classpath
+++ b/.classpath
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
-	<classpathentry kind="src" path="java"/>
-	<classpathentry kind="lib" path="buck-out/gen/lib__builtin__output/builtin.jar"/>
+	<classpathentry excluding="**/BUILD" kind="src" path="java"/>
+	<classpathentry kind="lib" path="bazel-bin/libbuiltin.jar"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
 	<classpathentry kind="src" path=".apt_generated">
 		<attributes>
 			<attribute name="optional" value="true"/>
 		</attributes>
 	</classpathentry>
-	<classpathentry kind="output" path="buck-out/eclipse/classes"/>
+	<classpathentry kind="output" path="eclipse-out/classes"/>
 </classpath>
diff --git a/.gitignore b/.gitignore
index 8069d28..3aae328 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
-/.buckd
 /.settings
 /.apt_generated
-/buck-out
 /bazel-bin
 /bazel-genfiles
 /bazel-out
diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index 315c0c2..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,3 +0,0 @@
-[submodule "bucklets"]
-	path = bucklets
-	url = https://gerrit.googlesource.com/bucklets
diff --git a/.watchmanconfig b/.watchmanconfig
deleted file mode 120000
index 65be7a7..0000000
--- a/.watchmanconfig
+++ /dev/null
@@ -1 +0,0 @@
-bucklets/watchmanconfig
\ No newline at end of file
diff --git a/BUCK b/BUCK
deleted file mode 100644
index 6c87076..0000000
--- a/BUCK
+++ /dev/null
@@ -1,182 +0,0 @@
-VERSION = '1.4.2'
-SRC = 'java/com/googlecode/prolog_cafe/'
-
-REPL = [
-  SRC + 'builtin/PRED_$write_toString_2.java',
-]
-
-IO = [
-  SRC + 'builtin/PRED_close_2.java',
-  SRC + 'builtin/PRED_flush_output_1.java',
-  SRC + 'builtin/PRED_open_4.java',
-  SRC + 'builtin/PRED_read_line_2.java',
-  SRC + 'builtin/PRED_tab_2.java',
-]
-
-zip_file(
-  name = 'all',
-  srcs = [
-    ':cafeteria',
-    ':compiler',
-    ':runtime',
-  ],
-  out = 'all.zip',
-)
-
-java_binary(
-  name = 'runtime',
-  deps = [
-    ':builtin',
-    ':lang',
-  ],
-)
-
-java_library(
-  name = 'lang',
-  srcs = glob([
-      SRC + 'exceptions/*.java',
-      SRC + 'lang/*.java',
-    ],
-    excludes = REPL),
-)
-
-java_library(
-  name = 'builtin',
-  srcs = glob([SRC + 'builtin/*.java'], excludes = REPL + IO) + [
-    ':builtin_srcs',
-    ':system_srcs',
-  ],
-  deps = [':lang'],
-)
-
-pl2j(
-  name = 'builtin_srcs',
-  src = 'src/builtin/builtins.pl',
-  out = 'builtins.src.zip',
-)
-
-pl2j(
-  name = 'system_srcs',
-  src = 'src/builtin/system.pl',
-  out = 'system.src.zip',
-)
-
-java_library(
-  name = 'io',
-  srcs = IO + [':io_srcs'],
-  deps = [
-    ':builtin',
-    ':lang',
-  ],
-)
-
-pl2j(
-  name = 'io_srcs',
-  src = 'src/builtin/io.pl',
-  out = 'io.src.zip',
-)
-
-java_library(
-  name = 'compiler',
-  srcs = glob([SRC + 'compiler/**/*.java']) + [
-    ':pl2am_srcs',
-    ':am2j_srcs',
-  ],
-  deps = [
-    ':builtin',
-    ':io',
-    ':lang',
-  ],
-)
-
-pl2j(
-  name = 'pl2am_srcs',
-  src = 'src/compiler/pl2am.pl',
-  out = 'pl2am.src.zip',
-)
-
-pl2j(
-  name = 'am2j_srcs',
-  src = 'src/compiler/am2j.pl',
-  out = 'am2j.src.zip',
-)
-
-java_binary(
-  name = 'plc',
-  main_class = 'com.googlecode.prolog_cafe.compiler.Compiler',
-  deps = [':compiler'],
-)
-
-java_binary(
-  name = 'cafeteria',
-  main_class = 'com.googlecode.prolog_cafe.repl.PrologMain',
-  deps = [':cafeteria_lib'],
-)
-
-java_library(
-  name = 'cafeteria_lib',
-  srcs = glob([SRC + 'repl/*.java']) + REPL + [':cafeteria_srcs'],
-  deps = [
-    ':builtin',
-    ':io',
-    ':lang',
-  ],
-)
-
-pl2j(
-  name = 'cafeteria_srcs',
-  src = 'src/builtin/cafeteria.pl',
-  out = 'cafeteria.src.zip',
-)
-
-java_sources(
-  name = 'runtime_src',
-  srcs = glob([
-      SRC + 'builtin/*.java',
-      SRC + 'lang/*.java',
-    ],
-    excludes = REPL + IO
-  ) + [
-    'src/builtin/builtins.pl',
-    'src/builtin/system.pl',
-  ],
-)
-
-java_sources(
-  name = 'io_src',
-  srcs = IO + ['src/builtin/io.pl'],
-)
-
-java_sources(
-  name = 'compiler_src',
-  srcs = glob([SRC + 'compiler/**/*.java']) + [
-    'src/compiler/pl2am.pl',
-    'src/compiler/am2j.pl',
-  ],
-)
-
-java_sources(
-  name = 'cafeteria_src',
-  srcs = glob([SRC + 'repl/*.java']) + REPL + [
-    'src/builtin/cafeteria.pl',
-  ],
-)
-
-maven_package(
-  group = 'com.googlecode.prolog-cafe',
-  version = VERSION,
-  repository = 'gerrit-maven-repository',
-  url = 'gs://gerrit-maven/',
-  jar = {
-    'prolog-cafeteria': ':cafeteria_lib',
-    'prolog-compiler': ':compiler',
-    'prolog-io': ':io',
-    'prolog-runtime': ':runtime',
-  },
-  src = {
-    'prolog-cafeteria': ':cafeteria_src',
-    'prolog-compiler': ':compiler_src',
-    'prolog-io': ':io_src',
-    'prolog-runtime': ':runtime_src',
-  },
-)
diff --git a/README.md b/README.md
index ef53375..ff90c27 100644
--- a/README.md
+++ b/README.md
@@ -7,18 +7,18 @@
 
 ## Build
 
-To bootstrap [Buck] and [SWI-Prolog] >= 6.6.4 must be installed and
+To bootstrap [Bazel] and [SWI-Prolog] >= 6.6.4 must be installed and
 then build the runtime and compiler with:
 
-    buck build all
+    bazel build :all
 
 To package for Maven into the local `~/.m2/repository` directory:
 
-    buck build install
+    ./mvn.sh install
 
 To publish to the gerrit-maven storage bucket:
 
-    buck build deploy
+    ./mvn.sh deploy
 
-[Buck]: https://github.com/facebook/buck/
+[Bazel]: https://www.bazel.build/versions/master/docs/install.html
 [SWI-Prolog]: http://www.swi-prolog.org/
diff --git a/bootstrap.defs b/bootstrap.defs
deleted file mode 100644
index a9b22cf..0000000
--- a/bootstrap.defs
+++ /dev/null
@@ -1,60 +0,0 @@
-# Translating Prolog into WAM-based Intermediate Code
-def pl2am(name, src, out):
-  from os.path import basename, dirname
-
-  genrule(
-    name = name,
-    out = out,
-    cmd = 'echo "go :- '
-      + 'load_files(['
-        + "'$SRCDIR/src/compiler/package_fx.pl',"
-        + "'$SRCDIR/src/builtin/system.pl',"
-        + "'$SRCDIR/src/compiler/pl2am.pl'"
-      + ']),'
-      + 'pl2am(['
-        + "'%s'," % basename(src)
-        + "'$OUT',"
-        + '[ed,ac,ie,rc,idx]'
-      + ']).'
-      + '">$TMP/go.pl;'
-      + 'cd $SRCDIR/%s;' % dirname(src)
-      + 'swipl --traditional --quiet -g go,halt -t "halt(1)" $TMP/go.pl',
-    srcs = [
-      'src/compiler/package_fx.pl',
-      'src/compiler/pl2am.pl',
-      'src/builtin/system.pl',
-      src,
-    ],
-  )
-
-# Translating WAM-based Intermediate Code into Java
-def am2j(name, am, out):
-  genrule(
-    name = name,
-    out = out,
-    cmd = 'echo "go :- '
-      + 'load_files(['
-        + "'$SRCDIR/src/compiler/am2j.pl'"
-      + ']),'
-      + 'am2j(['
-        + "'$(location %s)'," % am
-        + "'$TMP/java'"
-      + ']).'
-      + '">$TMP/go.pl;'
-      + 'mkdir $TMP/java;'
-      + 'swipl --traditional --quiet -g go,halt -t "halt(1)" $TMP/go.pl;'
-      + 'cd $TMP/java; zip -qr $OUT .',
-    srcs = ['src/compiler/am2j.pl'],
-  )
-
-def pl2j(name, src, out):
-  pl2am(
-    name = name + '.am',
-    src = src,
-    out = name + '.am',
-  )
-  am2j(
-    name = name,
-    am = ':' + name + '.am',
-    out = out,
-  )
diff --git a/bucklets b/bucklets
deleted file mode 160000
index fa16504..0000000
--- a/bucklets
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit fa165048ab280b62a5b13819eaf9e48c659739e5
diff --git a/fake_pom_deploy.xml b/fake_pom_deploy.xml
index dec372e..8462923 100644
--- a/fake_pom_deploy.xml
+++ b/fake_pom_deploy.xml
@@ -2,7 +2,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.googlecode.prolog-cafe</groupId>
   <artifactId>prolog-cafe</artifactId>
-  <version>1</version> <!-- Do not edit; see BUCK. -->
+  <version>1</version> <!-- Do not edit; see BUILD. -->
   <build>
     <extensions>
       <extension>
diff --git a/fake_pom_install.xml b/fake_pom_install.xml
index dec372e..8462923 100644
--- a/fake_pom_install.xml
+++ b/fake_pom_install.xml
@@ -2,7 +2,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>com.googlecode.prolog-cafe</groupId>
   <artifactId>prolog-cafe</artifactId>
-  <version>1</version> <!-- Do not edit; see BUCK. -->
+  <version>1</version> <!-- Do not edit; see BUILD. -->
   <build>
     <extensions>
       <extension>