Dissolve gerrit-index top-level directory

Change-Id: Id480f7a9408389ef0af05cce567148799f66fc19
diff --git a/gerrit-acceptance-framework/BUILD b/gerrit-acceptance-framework/BUILD
index 60dfe86347..5d21a37 100644
--- a/gerrit-acceptance-framework/BUILD
+++ b/gerrit-acceptance-framework/BUILD
@@ -12,8 +12,8 @@
     "//java/com/google/gerrit/common:annotations",
     "//java/com/google/gerrit/common:server",
     "//java/com/google/gerrit/extensions:api",
+    "//java/com/google/gerrit/index",
     "//gerrit-httpd:httpd",
-    "//gerrit-index:index",
     "//gerrit-lucene:lucene",
     "//gerrit-pgm:init",
     "//java/com/google/gerrit/reviewdb:server",
@@ -41,13 +41,13 @@
     srcs = SRCS,
     exported_deps = [
         "//gerrit-gpg:gpg",
-        "//gerrit-index:query_exception",
         "//gerrit-launcher:launcher",
         "//gerrit-openid:openid",
         "//gerrit-pgm:daemon",
         "//gerrit-pgm:http-jetty",
         "//gerrit-pgm:util-nodep",
         "//gerrit-server:testutil",
+        "//java/com/google/gerrit/index:query_exception",
         "//lib:jimfs",
         "//lib:truth",
         "//lib:truth-java8-extension",
diff --git a/gerrit-elasticsearch/BUILD b/gerrit-elasticsearch/BUILD
index 22c8871..72344fb 100644
--- a/gerrit-elasticsearch/BUILD
+++ b/gerrit-elasticsearch/BUILD
@@ -3,10 +3,10 @@
     srcs = glob(["src/main/java/**/*.java"]),
     visibility = ["//visibility:public"],
     deps = [
-        "//gerrit-index:index",
-        "//gerrit-index:query_exception",
         "//gerrit-server:server",
         "//java/com/google/gerrit/extensions:api",
+        "//java/com/google/gerrit/index",
+        "//java/com/google/gerrit/index:query_exception",
         "//java/com/google/gerrit/reviewdb:server",
         "//lib:gson",
         "//lib:guava",
@@ -35,9 +35,9 @@
     srcs = glob(["src/test/java/**/ElasticTestUtils.java"]),
     deps = [
         ":elasticsearch",
-        "//gerrit-index:index",
         "//gerrit-server:server",
         "//java/com/google/gerrit/extensions:api",
+        "//java/com/google/gerrit/index",
         "//java/com/google/gerrit/reviewdb:server",
         "//lib:gson",
         "//lib:guava",
diff --git a/gerrit-httpd/BUILD b/gerrit-httpd/BUILD
index a816553..9d11c0c 100644
--- a/gerrit-httpd/BUILD
+++ b/gerrit-httpd/BUILD
@@ -16,7 +16,6 @@
     resources = RESOURCES,
     visibility = ["//visibility:public"],
     deps = [
-        "//gerrit-index:query_exception",
         "//gerrit-launcher:launcher",
         "//gerrit-server:metrics",
         "//gerrit-server:receive",
@@ -25,6 +24,7 @@
         "//java/com/google/gerrit/common:annotations",
         "//java/com/google/gerrit/common:server",
         "//java/com/google/gerrit/extensions:api",
+        "//java/com/google/gerrit/index:query_exception",
         "//java/com/google/gerrit/prettify:server",
         "//java/com/google/gerrit/reviewdb:server",
         "//java/com/google/gerrit/util/cli",
diff --git a/gerrit-index/BUILD b/gerrit-index/BUILD
deleted file mode 100644
index 5cda187..0000000
--- a/gerrit-index/BUILD
+++ /dev/null
@@ -1,62 +0,0 @@
-load("//tools/bzl:genrule2.bzl", "genrule2")
-load("//tools/bzl:junit.bzl", "junit_tests")
-
-QUERY_PARSE_EXCEPTION_SRCS = [
-    "src/main/java/com/google/gerrit/index/query/QueryParseException.java",
-    "src/main/java/com/google/gerrit/index/query/QueryRequiresAuthException.java",
-]
-
-java_library(
-    name = "query_exception",
-    srcs = QUERY_PARSE_EXCEPTION_SRCS,
-    visibility = ["//visibility:public"],
-)
-
-java_library(
-    name = "query_parser",
-    srcs = ["//antlr3:query"],
-    visibility = ["//gerrit-plugin-api:__pkg__"],
-    deps = [
-        ":query_exception",
-        "//lib/antlr:java_runtime",
-    ],
-)
-
-java_library(
-    name = "index",
-    srcs = glob(
-        ["src/main/java/**/*.java"],
-        exclude = QUERY_PARSE_EXCEPTION_SRCS,
-    ),
-    visibility = ["//visibility:public"],
-    deps = [
-        ":query_exception",
-        ":query_parser",
-        "//gerrit-server:metrics",
-        "//java/com/google/gerrit/common:annotations",
-        "//java/com/google/gerrit/extensions:api",
-        "//lib:guava",
-        "//lib:gwtjsonrpc",
-        "//lib:gwtorm",
-        "//lib/antlr:java_runtime",
-        "//lib/auto:auto-value",
-        "//lib/jgit/org.eclipse.jgit:jgit",
-        "//lib/log:api",
-    ],
-)
-
-junit_tests(
-    name = "index_tests",
-    size = "small",
-    srcs = glob(["src/test/java/**/*.java"]),
-    visibility = ["//visibility:public"],
-    deps = [
-        ":index",
-        ":query_exception",
-        ":query_parser",
-        "//lib:junit",
-        "//lib:truth",
-        "//lib/antlr:java_runtime",
-        "//lib/jgit/org.eclipse.jgit:jgit",
-    ],
-)
diff --git a/gerrit-lucene/BUILD b/gerrit-lucene/BUILD
index 1434b0d..525cee0 100644
--- a/gerrit-lucene/BUILD
+++ b/gerrit-lucene/BUILD
@@ -7,9 +7,9 @@
     srcs = QUERY_BUILDER,
     visibility = ["//visibility:public"],
     deps = [
-        "//gerrit-index:index",
-        "//gerrit-index:query_exception",
         "//gerrit-server:server",
+        "//java/com/google/gerrit/index",
+        "//java/com/google/gerrit/index:query_exception",
         "//java/com/google/gerrit/reviewdb:server",
         "//lib:guava",
         "//lib:gwtorm",
@@ -26,12 +26,12 @@
     visibility = ["//visibility:public"],
     deps = [
         ":query_builder",
-        "//gerrit-index:index",
-        "//gerrit-index:query_exception",
         "//gerrit-server:server",
         "//java/com/google/gerrit/common:annotations",
         "//java/com/google/gerrit/common:server",
         "//java/com/google/gerrit/extensions:api",
+        "//java/com/google/gerrit/index",
+        "//java/com/google/gerrit/index:query_exception",
         "//java/com/google/gerrit/reviewdb:server",
         "//lib:guava",
         "//lib:gwtorm",
diff --git a/gerrit-pgm/BUILD b/gerrit-pgm/BUILD
index d581617..d23b7b9 100644
--- a/gerrit-pgm/BUILD
+++ b/gerrit-pgm/BUILD
@@ -50,7 +50,7 @@
     deps = DEPS + [
         ":init-api",
         ":util",
-        "//gerrit-index:index",
+        "//java/com/google/gerrit/index",
         "//gerrit-elasticsearch:elasticsearch",
         "//gerrit-launcher:launcher",  # We want this dep to be provided_deps
         "//gerrit-lucene:lucene",
@@ -117,7 +117,7 @@
     "//gerrit-cache-h2:cache-h2",
     "//gerrit-elasticsearch:elasticsearch",
     "//gerrit-gpg:gpg",
-    "//gerrit-index:index",
+    "//java/com/google/gerrit/index",
     "//gerrit-lucene:lucene",
     "//gerrit-oauth:oauth",
     "//gerrit-openid:openid",
diff --git a/gerrit-plugin-api/BUILD b/gerrit-plugin-api/BUILD
index 319609b..6b2c13b 100644
--- a/gerrit-plugin-api/BUILD
+++ b/gerrit-plugin-api/BUILD
@@ -6,12 +6,12 @@
 ]
 
 EXPORTS = [
-    "//gerrit-index:index",
-    "//gerrit-index:query_exception",
-    "//gerrit-index:query_parser",
     "//java/com/google/gerrit/common:annotations",
     "//java/com/google/gerrit/common:server",
     "//java/com/google/gerrit/extensions:api",
+    "//java/com/google/gerrit/index",
+    "//java/com/google/gerrit/index:query_exception",
+    "//java/com/google/gerrit/index:query_parser",
     "//java/com/google/gwtexpui/server",
     "//gerrit-server:metrics",
     "//java/com/google/gerrit/reviewdb:server",
@@ -76,14 +76,15 @@
     visibility = ["//visibility:public"],
     runtime_deps = [
         "//gerrit-httpd:libhttpd-src.jar",
-        "//gerrit-index:libquery_exception-src.jar",
-        "//gerrit-index:libquery_parser-src.jar",
         "//gerrit-pgm:libinit-api-src.jar",
         "//gerrit-server:libserver-src.jar",
         "//gerrit-sshd:libsshd-src.jar",
         "//java/com/google/gerrit/common:libannotations-src.jar",
         "//java/com/google/gerrit/common:libserver-src.jar",
         "//java/com/google/gerrit/extensions:libapi-src.jar",
+        "//java/com/google/gerrit/index:libindex-src.jar",
+        "//java/com/google/gerrit/index:libquery_exception-src.jar",
+        "//java/com/google/gerrit/index:libquery_parser-src.jar",
         "//java/com/google/gerrit/reviewdb:libserver-src.jar",
         "//java/com/google/gwtexpui/server:libserver-src.jar",
     ],
@@ -94,8 +95,9 @@
 java_doc(
     name = "plugin-api-javadoc",
     libs = PLUGIN_API + [
-        "//gerrit-index:query_exception",
-        "//gerrit-index:query_parser",
+        "//java/com/google/gerrit/index",
+        "//java/com/google/gerrit/index:query_exception",
+        "//java/com/google/gerrit/index:query_parser",
         "//java/com/google/gerrit/common:annotations",
         "//java/com/google/gerrit/common:server",
         "//java/com/google/gerrit/extensions:api",
diff --git a/gerrit-server/BUILD b/gerrit-server/BUILD
index c421ba0..2b0aec5 100644
--- a/gerrit-server/BUILD
+++ b/gerrit-server/BUILD
@@ -40,11 +40,11 @@
     deps = [
         ":constants",
         ":metrics",
-        "//gerrit-index:index",
-        "//gerrit-index:query_exception",
         "//java/com/google/gerrit/common:annotations",
         "//java/com/google/gerrit/common:server",
         "//java/com/google/gerrit/extensions:api",
+        "//java/com/google/gerrit/index",
+        "//java/com/google/gerrit/index:query_exception",
         "//java/com/google/gerrit/prettify:server",
         "//java/com/google/gerrit/reviewdb:server",
         "//java/com/google/gerrit/util/cli",
@@ -160,7 +160,7 @@
     "//gerrit-cache-h2:cache-h2",
     "//java/com/google/gerrit/extensions:api",
     "//gerrit-gpg:gpg",
-    "//gerrit-index:index",
+    "//java/com/google/gerrit/index",
     "//gerrit-lucene:lucene",
     "//java/com/google/gerrit/reviewdb:server",
     "//lib:gwtorm",
@@ -297,7 +297,7 @@
     deps = TESTUTIL_DEPS + [
         ":custom-truth-subjects",
         ":testutil",
-        "//gerrit-index:query_exception",
+        "//java/com/google/gerrit/index:query_exception",
         "//java/org/eclipse/jgit:server",
         "//java/com/google/gerrit/extensions/common/testing:common-test-util",
         "//lib:args4j",
diff --git a/java/com/google/gerrit/index/BUILD b/java/com/google/gerrit/index/BUILD
new file mode 100644
index 0000000..b597170
--- /dev/null
+++ b/java/com/google/gerrit/index/BUILD
@@ -0,0 +1,48 @@
+load("//tools/bzl:genrule2.bzl", "genrule2")
+
+QUERY_PARSE_EXCEPTION_SRCS = [
+    "query/QueryParseException.java",
+    "query/QueryRequiresAuthException.java",
+]
+
+java_library(
+    name = "query_exception",
+    srcs = QUERY_PARSE_EXCEPTION_SRCS,
+    visibility = ["//visibility:public"],
+)
+
+java_library(
+    name = "query_parser",
+    srcs = ["//antlr3:query"],
+    visibility = [
+        "//gerrit-plugin-api:__pkg__",
+        "//javatests/com/google/gerrit/index:__pkg__",
+    ],
+    deps = [
+        ":query_exception",
+        "//lib/antlr:java_runtime",
+    ],
+)
+
+java_library(
+    name = "index",
+    srcs = glob(
+        ["**/*.java"],
+        exclude = QUERY_PARSE_EXCEPTION_SRCS,
+    ),
+    visibility = ["//visibility:public"],
+    deps = [
+        ":query_exception",
+        ":query_parser",
+        "//gerrit-server:metrics",
+        "//java/com/google/gerrit/common:annotations",
+        "//java/com/google/gerrit/extensions:api",
+        "//lib:guava",
+        "//lib:gwtjsonrpc",
+        "//lib:gwtorm",
+        "//lib/antlr:java_runtime",
+        "//lib/auto:auto-value",
+        "//lib/jgit/org.eclipse.jgit:jgit",
+        "//lib/log:api",
+    ],
+)
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/FieldDef.java b/java/com/google/gerrit/index/FieldDef.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/FieldDef.java
rename to java/com/google/gerrit/index/FieldDef.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/FieldType.java b/java/com/google/gerrit/index/FieldType.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/FieldType.java
rename to java/com/google/gerrit/index/FieldType.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/Index.java b/java/com/google/gerrit/index/Index.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/Index.java
rename to java/com/google/gerrit/index/Index.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/IndexCollection.java b/java/com/google/gerrit/index/IndexCollection.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/IndexCollection.java
rename to java/com/google/gerrit/index/IndexCollection.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/IndexConfig.java b/java/com/google/gerrit/index/IndexConfig.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/IndexConfig.java
rename to java/com/google/gerrit/index/IndexConfig.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/IndexDefinition.java b/java/com/google/gerrit/index/IndexDefinition.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/IndexDefinition.java
rename to java/com/google/gerrit/index/IndexDefinition.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/IndexRewriter.java b/java/com/google/gerrit/index/IndexRewriter.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/IndexRewriter.java
rename to java/com/google/gerrit/index/IndexRewriter.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/IndexedQuery.java b/java/com/google/gerrit/index/IndexedQuery.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/IndexedQuery.java
rename to java/com/google/gerrit/index/IndexedQuery.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/QueryOptions.java b/java/com/google/gerrit/index/QueryOptions.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/QueryOptions.java
rename to java/com/google/gerrit/index/QueryOptions.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/Schema.java b/java/com/google/gerrit/index/Schema.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/Schema.java
rename to java/com/google/gerrit/index/Schema.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/SchemaDefinitions.java b/java/com/google/gerrit/index/SchemaDefinitions.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/SchemaDefinitions.java
rename to java/com/google/gerrit/index/SchemaDefinitions.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/SchemaUtil.java b/java/com/google/gerrit/index/SchemaUtil.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/SchemaUtil.java
rename to java/com/google/gerrit/index/SchemaUtil.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/SiteIndexer.java b/java/com/google/gerrit/index/SiteIndexer.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/SiteIndexer.java
rename to java/com/google/gerrit/index/SiteIndexer.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/AndPredicate.java b/java/com/google/gerrit/index/query/AndPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/AndPredicate.java
rename to java/com/google/gerrit/index/query/AndPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/AndSource.java b/java/com/google/gerrit/index/query/AndSource.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/AndSource.java
rename to java/com/google/gerrit/index/query/AndSource.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/DataSource.java b/java/com/google/gerrit/index/query/DataSource.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/DataSource.java
rename to java/com/google/gerrit/index/query/DataSource.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/IndexPredicate.java b/java/com/google/gerrit/index/query/IndexPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/IndexPredicate.java
rename to java/com/google/gerrit/index/query/IndexPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/IntPredicate.java b/java/com/google/gerrit/index/query/IntPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/IntPredicate.java
rename to java/com/google/gerrit/index/query/IntPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/IntegerRangePredicate.java b/java/com/google/gerrit/index/query/IntegerRangePredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/IntegerRangePredicate.java
rename to java/com/google/gerrit/index/query/IntegerRangePredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/InternalQuery.java b/java/com/google/gerrit/index/query/InternalQuery.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/InternalQuery.java
rename to java/com/google/gerrit/index/query/InternalQuery.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/IsVisibleToPredicate.java b/java/com/google/gerrit/index/query/IsVisibleToPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/IsVisibleToPredicate.java
rename to java/com/google/gerrit/index/query/IsVisibleToPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/LimitPredicate.java b/java/com/google/gerrit/index/query/LimitPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/LimitPredicate.java
rename to java/com/google/gerrit/index/query/LimitPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/Matchable.java b/java/com/google/gerrit/index/query/Matchable.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/Matchable.java
rename to java/com/google/gerrit/index/query/Matchable.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/NotPredicate.java b/java/com/google/gerrit/index/query/NotPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/NotPredicate.java
rename to java/com/google/gerrit/index/query/NotPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/OperatorPredicate.java b/java/com/google/gerrit/index/query/OperatorPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/OperatorPredicate.java
rename to java/com/google/gerrit/index/query/OperatorPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/OrPredicate.java b/java/com/google/gerrit/index/query/OrPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/OrPredicate.java
rename to java/com/google/gerrit/index/query/OrPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/Paginated.java b/java/com/google/gerrit/index/query/Paginated.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/Paginated.java
rename to java/com/google/gerrit/index/query/Paginated.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/Predicate.java b/java/com/google/gerrit/index/query/Predicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/Predicate.java
rename to java/com/google/gerrit/index/query/Predicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/QueryBuilder.java b/java/com/google/gerrit/index/query/QueryBuilder.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/QueryBuilder.java
rename to java/com/google/gerrit/index/query/QueryBuilder.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/QueryParseException.java b/java/com/google/gerrit/index/query/QueryParseException.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/QueryParseException.java
rename to java/com/google/gerrit/index/query/QueryParseException.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/QueryProcessor.java b/java/com/google/gerrit/index/query/QueryProcessor.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/QueryProcessor.java
rename to java/com/google/gerrit/index/query/QueryProcessor.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/QueryRequiresAuthException.java b/java/com/google/gerrit/index/query/QueryRequiresAuthException.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/QueryRequiresAuthException.java
rename to java/com/google/gerrit/index/query/QueryRequiresAuthException.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/QueryResult.java b/java/com/google/gerrit/index/query/QueryResult.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/QueryResult.java
rename to java/com/google/gerrit/index/query/QueryResult.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/RangeUtil.java b/java/com/google/gerrit/index/query/RangeUtil.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/RangeUtil.java
rename to java/com/google/gerrit/index/query/RangeUtil.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/RegexPredicate.java b/java/com/google/gerrit/index/query/RegexPredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/RegexPredicate.java
rename to java/com/google/gerrit/index/query/RegexPredicate.java
diff --git a/gerrit-index/src/main/java/com/google/gerrit/index/query/TimestampRangePredicate.java b/java/com/google/gerrit/index/query/TimestampRangePredicate.java
similarity index 100%
rename from gerrit-index/src/main/java/com/google/gerrit/index/query/TimestampRangePredicate.java
rename to java/com/google/gerrit/index/query/TimestampRangePredicate.java
diff --git a/javatests/com/google/gerrit/index/BUILD b/javatests/com/google/gerrit/index/BUILD
new file mode 100644
index 0000000..bd79860
--- /dev/null
+++ b/javatests/com/google/gerrit/index/BUILD
@@ -0,0 +1,17 @@
+load("//tools/bzl:junit.bzl", "junit_tests")
+
+junit_tests(
+    name = "tests",
+    size = "small",
+    srcs = glob(["**/*.java"]),
+    visibility = ["//visibility:public"],
+    deps = [
+        "//java/com/google/gerrit/index",
+        "//java/com/google/gerrit/index:query_exception",
+        "//java/com/google/gerrit/index:query_parser",
+        "//lib:junit",
+        "//lib:truth",
+        "//lib/antlr:java_runtime",
+        "//lib/jgit/org.eclipse.jgit:jgit",
+    ],
+)
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/SchemaUtilTest.java b/javatests/com/google/gerrit/index/SchemaUtilTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/SchemaUtilTest.java
rename to javatests/com/google/gerrit/index/SchemaUtilTest.java
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/AndPredicateTest.java b/javatests/com/google/gerrit/index/query/AndPredicateTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/query/AndPredicateTest.java
rename to javatests/com/google/gerrit/index/query/AndPredicateTest.java
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/FieldPredicateTest.java b/javatests/com/google/gerrit/index/query/FieldPredicateTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/query/FieldPredicateTest.java
rename to javatests/com/google/gerrit/index/query/FieldPredicateTest.java
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/NotPredicateTest.java b/javatests/com/google/gerrit/index/query/NotPredicateTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/query/NotPredicateTest.java
rename to javatests/com/google/gerrit/index/query/NotPredicateTest.java
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/OrPredicateTest.java b/javatests/com/google/gerrit/index/query/OrPredicateTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/query/OrPredicateTest.java
rename to javatests/com/google/gerrit/index/query/OrPredicateTest.java
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/PredicateTest.java b/javatests/com/google/gerrit/index/query/PredicateTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/query/PredicateTest.java
rename to javatests/com/google/gerrit/index/query/PredicateTest.java
diff --git a/gerrit-index/src/test/java/com/google/gerrit/index/query/QueryParserTest.java b/javatests/com/google/gerrit/index/query/QueryParserTest.java
similarity index 100%
rename from gerrit-index/src/test/java/com/google/gerrit/index/query/QueryParserTest.java
rename to javatests/com/google/gerrit/index/query/QueryParserTest.java
diff --git a/lib/antlr/BUILD b/lib/antlr/BUILD
index 3642b90..08c320b 100644
--- a/lib/antlr/BUILD
+++ b/lib/antlr/BUILD
@@ -1,4 +1,4 @@
-package(default_visibility = ["//gerrit-index:__pkg__"])
+package(default_visibility = ["//java/com/google/gerrit/index:__pkg__"])
 
 [java_library(
     name = n,
diff --git a/tools/eclipse/BUILD b/tools/eclipse/BUILD
index a0ca7da..e7202ea 100644
--- a/tools/eclipse/BUILD
+++ b/tools/eclipse/BUILD
@@ -11,7 +11,6 @@
     "//gerrit-gpg:gpg_tests",
     "//gerrit-gwtui:ui_tests",
     "//gerrit-httpd:httpd_tests",
-    "//gerrit-index:index_tests",
     "//gerrit-server:server_tests",
 ]