Package in Maven format for Gerrit Code Review
Move CompileException into lang as this is heavily used by the
runtime RulesCache inside Gerrit Code Review.
Change-Id: Ie9235507ae20a4bda936e94fddd1c277bbaf7933
diff --git a/.buckconfig b/.buckconfig
index 7b75112..4e88473 100644
--- a/.buckconfig
+++ b/.buckconfig
@@ -1,5 +1,9 @@
[alias]
all = //:all
+ install = //:install
+ deploy = //:deploy
[buildfile]
- includes = //bootstrap.defs
+ includes = //bootstrap.defs \
+ //bucklets/java_sources.bucklet \
+ //bucklets/maven_package.bucklet
diff --git a/.buckversion b/.buckversion
deleted file mode 100644
index 9c09744..0000000
--- a/.buckversion
+++ /dev/null
@@ -1 +0,0 @@
-79d36de9f5284f6e833cca81867d6088a25685fb
diff --git a/.buckversion b/.buckversion
new file mode 120000
index 0000000..6203e53
--- /dev/null
+++ b/.buckversion
@@ -0,0 +1 @@
+bucklets/buckversion
\ No newline at end of file
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..315c0c2
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "bucklets"]
+ path = bucklets
+ url = https://gerrit.googlesource.com/bucklets
diff --git a/.watchmanconfig b/.watchmanconfig
new file mode 120000
index 0000000..65be7a7
--- /dev/null
+++ b/.watchmanconfig
@@ -0,0 +1 @@
+bucklets/watchmanconfig
\ No newline at end of file
diff --git a/BUCK b/BUCK
index 03a0c9a..a8a7a37 100644
--- a/BUCK
+++ b/BUCK
@@ -1,3 +1,4 @@
+VERSION = '1.4'
SRC = 'java/com/googlecode/prolog_cafe/'
REPL = [
@@ -119,3 +120,53 @@
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 = 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 585a67b..ef53375 100644
--- a/README.md
+++ b/README.md
@@ -12,5 +12,13 @@
buck build all
+To package for Maven into the local `~/.m2/repository` directory:
+
+ buck build install
+
+To publish to the gerrit-maven storage bucket:
+
+ buck build deploy
+
[Buck]: https://github.com/facebook/buck/
[SWI-Prolog]: http://www.swi-prolog.org/
diff --git a/bucklets b/bucklets
new file mode 160000
index 0000000..2aaf133
--- /dev/null
+++ b/bucklets
@@ -0,0 +1 @@
+Subproject commit 2aaf133748dc46b917f6869dce03979aff510b34
diff --git a/fake_pom_install.xml b/fake_pom_install.xml
new file mode 100644
index 0000000..dec372e
--- /dev/null
+++ b/fake_pom_install.xml
@@ -0,0 +1,21 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.googlecode.prolog-cafe</groupId>
+ <artifactId>prolog-cafe</artifactId>
+ <version>1</version> <!-- Do not edit; see BUCK. -->
+ <build>
+ <extensions>
+ <extension>
+ <groupId>com.googlesource.gerrit</groupId>
+ <artifactId>gs-maven-wagon</artifactId>
+ <version>3.3</version>
+ </extension>
+ </extensions>
+ </build>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>gerrit-maven-repository</id>
+ <url>https://gerrit-maven.storage.googleapis.com/</url>
+ </pluginRepository>
+ </pluginRepositories>
+</project>
diff --git a/src/compiler/Compiler.java b/src/compiler/Compiler.java
index 6b446cc..dbc2839 100644
--- a/src/compiler/Compiler.java
+++ b/src/compiler/Compiler.java
@@ -1,5 +1,6 @@
package com.googlecode.prolog_cafe.compiler;
import com.googlecode.prolog_cafe.lang.BufferingPrologControl;
+import com.googlecode.prolog_cafe.lang.CompileException;
import com.googlecode.prolog_cafe.lang.ListTerm;
import com.googlecode.prolog_cafe.lang.Prolog;
import com.googlecode.prolog_cafe.lang.PrologClassLoader;
diff --git a/src/compiler/CompileException.java b/src/lang/CompileException.java
similarity index 88%
rename from src/compiler/CompileException.java
rename to src/lang/CompileException.java
index f9d515c..6cc899b 100644
--- a/src/compiler/CompileException.java
+++ b/src/lang/CompileException.java
@@ -1,4 +1,4 @@
-package com.googlecode.prolog_cafe.compiler;
+package com.googlecode.prolog_cafe.lang;
/** Indicates compiling did not succeed. */
public class CompileException extends Exception {