diff --git a/BUILD b/BUILD
new file mode 100644
index 0000000000..e683e5f5be
--- /dev/null
+++ b/BUILD
@@ -0,0 +1,4 @@
+package_group(
+ name = "src",
+ packages = ["//..."],
+)
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 0000000000..0aa5b8f3fb
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,85 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+RULES_JVM_EXTERNAL_TAG = "4.2"
+RULES_JVM_EXTERNAL_SHA = "cd1a77b7b02e8e008439ca76fd34f5b07aecb8c752961f9640dea15e9e5ba1ca"
+
+http_archive(
+ name = "rules_jvm_external",
+ strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
+ sha256 = RULES_JVM_EXTERNAL_SHA,
+ url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
+)
+
+load("@rules_jvm_external//:defs.bzl", "maven_install")
+load("@rules_jvm_external//:specs.bzl", "maven")
+
+http_archive(
+ name = "google_bazel_common",
+ sha256 = "61cd7c2a24a1b066848a68c56deca799dd9d0329cb9032d1686859cdd2c05be2",
+ strip_prefix = "bazel-common-2e42988b7a3d1e3b11ab4db2d7c28f794500a672",
+ urls = ["https://github.com/google/bazel-common/archive/2e42988b7a3d1e3b11ab4db2d7c28f794500a672.zip"],
+)
+
+load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")
+
+google_common_workspace_rules()
+
+maven_install(
+ artifacts = [
+ "aopalliance:aopalliance:1.0",
+ "com.google.auto.value:auto-value:1.6.3",
+ "com.google.code.findbugs:jsr305:3.0.1",
+ "com.google.dagger:dagger:2.22.1",
+ "com.google.dagger:dagger-producers:2.22.1",
+ "com.google.errorprone:error_prone_annotations:2.0.18",
+ "com.google.guava:guava:30.1-jre",
+ "commons-logging:commons-logging:1.2",
+ "javax.inject:javax.inject:1",
+ "javax.persistence:javax.persistence-api:2.2",
+ "javax.servlet:servlet-api:2.5",
+ "org.apache.struts:struts2-core:2.3.37",
+ "org.apache.struts.xwork:xwork-core:2.3.37",
+ "org.ow2.asm:asm:9.2",
+ "org.springframework:spring-core:3.2.18.RELEASE",
+ "org.springframework:spring-beans:3.2.18.RELEASE",
+ maven.artifact(
+ "biz.aQute", "bnd", "0.0.384", testonly = True
+ ),
+ maven.artifact(
+ "com.google.guava", "guava-testlib", "30.1-jre", testonly = True
+ ),
+ maven.artifact(
+ "com.google.truth", "truth", "0.45", testonly = True
+ ),
+ maven.artifact(
+ "javax.inject", "javax.inject-tck", "1", testonly = True
+ ),
+ maven.artifact(
+ "junit", "junit", "4.13.2", testonly = True
+ ),
+ maven.artifact(
+ "org.apache.felix", "org.apache.felix.framework", "3.0.5", testonly = True
+ ),
+ maven.artifact(
+ "org.easymock", "easymock", "3.1", testonly = True
+ ),
+ maven.artifact(
+ "org.hamcrest", "hamcrest", "2.2", testonly = True
+ ),
+ maven.artifact(
+ "org.hibernate.javax.persistence", "hibernate-jpa-2.0-api", "1.0.0.Final", testonly = True
+ ),
+ maven.artifact(
+ "org.hibernate", "hibernate-core", "5.6.3.Final", testonly = True
+ ),
+ maven.artifact(
+ "org.hsqldb", "hsqldb-j5", "2.0.0", testonly = True
+ ),
+ maven.artifact(
+ "org.mockito", "mockito-core", "1.9.5", testonly = True
+ ),
+ ],
+ repositories = [
+ "https://repo1.maven.org/maven2",
+ ],
+)
\ No newline at end of file
diff --git a/core/src/com/google/inject/BUILD b/core/src/com/google/inject/BUILD
new file mode 100644
index 0000000000..fa15bcff1d
--- /dev/null
+++ b/core/src/com/google/inject/BUILD
@@ -0,0 +1,73 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(
+ default_visibility = ["//:src"],
+)
+
+ANNOTATION_SRCS = [
+ "BindingAnnotation.java",
+ "Exposed.java",
+ "Inject.java",
+ "ProvidedBy.java",
+ "Provides.java",
+ "ScopeAnnotation.java",
+ "Singleton.java",
+]
+
+IMPLEMENTED_BY_SRCS = [
+ "ImplementedBy.java",
+]
+
+java_library(
+ name = "implemented_by",
+ srcs = IMPLEMENTED_BY_SRCS,
+)
+
+# TODO(lukes,user): It'd be nice if this wasn't one big rule.
+# Unfortunately, splitting it apart would not be easy. We looked into
+# it and the main issues appear to be:
+# - Utility classes like internal/MoreTypes (choke point dependencies)
+# - Cyclical dependencies between Binder and spi/Element
+java_library(
+ name = "inject",
+ srcs = glob(
+ ["**/*.java"],
+ exclude = IMPLEMENTED_BY_SRCS + ANNOTATION_SRCS,
+ ),
+ plugins = [
+ ],
+ exports = [
+ ":annotations",
+ ":implemented_by",
+ ],
+ deps = [
+ # Warning: Be very careful adding new dependencies,
+ # These all have to mirrored in the open-source
+ # build (and jarjar'd up).
+ ":annotations",
+ ":implemented_by",
+ "//third_party/java/guava/annotations",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/cache",
+ "//third_party/java/guava/collect",
+ "//third_party/java/guava/primitives",
+ "//third_party/java/aopalliance",
+ "//third_party/java/asm",
+ "//third_party/java/error_prone:annotations",
+ "//third_party/java/jsr305_annotations",
+ "//third_party/java/jsr330_inject",
+ ],
+)
+
+java_library(
+ name = "annotations",
+ srcs = ANNOTATION_SRCS,
+ plugins = [
+ ],
+ deps = [
+ "//third_party/java/error_prone:annotations",
+ "//third_party/java/jsr330_inject",
+ ],
+)
diff --git a/core/test/com/google/inject/BUILD b/core/test/com/google/inject/BUILD
new file mode 100644
index 0000000000..9117e4910f
--- /dev/null
+++ b/core/test/com/google/inject/BUILD
@@ -0,0 +1,112 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+TEST_SUPPORT_SRCS = [
+ "Asserts.java",
+ "internal/WeakKeySetUtils.java",
+]
+
+# Files that are shared by extensions also.
+# Typically this would go in a java/../testing package,
+# but we need to work with the open-source code structure,
+# so it is here.
+java_library(
+ name = "testsupport",
+ srcs = TEST_SUPPORT_SRCS,
+ javacopts = ["-Xep:BetaApi:OFF"],
+ visibility = [
+ "//:src",
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/guava/testing",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+# All the actual XTest classes & friends.
+java_library(
+ name = "tests",
+ srcs = glob(
+ ["**/*.java"], # glob ignores subfolder that has its own BUILD files
+ exclude = TEST_SUPPORT_SRCS + [
+ "AllTests.java",
+ ],
+ ),
+ javacopts = ["-Xep:BetaApi:OFF"],
+ plugins = [
+ ],
+ deps = [
+ ":testsupport",
+ "//core/src/com/google/inject",
+ "//third_party/java/aopalliance",
+ "//third_party/java/asm",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/guava/testing",
+ "//third_party/java/guava/util/concurrent",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+# This target is unused, but exists so that we can more easily
+# ensure the opensource build maintains compiling code.
+java_library(
+ name = "AllTests",
+ srcs = ["AllTests.java"],
+ deps = [
+ ":tests",
+ "//core/test/com/googlecode/guice:tests",
+ "//third_party/java/junit",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = [
+ "small",
+ "medium",
+ ],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_stack_trace_%s" % include_stack_trace_option,
+ args = [
+ "--guice_include_stack_traces=%s" % include_stack_trace_option,
+ ],
+ sizes = [
+ "small",
+ "medium",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
+
+[guice_test_suites(
+ name = "gen_tests_class_loading_%s" % custom_class_loading_option,
+ args = [
+ "--guice_custom_class_loading=%s" % custom_class_loading_option,
+ ],
+ sizes = [
+ "small",
+ "medium",
+ ],
+ suffix = "_custom_class_loading_%s" % custom_class_loading_option,
+ deps = [":tests"],
+) for custom_class_loading_option in [
+ "OFF",
+ "CHILD",
+ "ANONYMOUS",
+]]
diff --git a/core/test/com/google/inject/errors/BUILD b/core/test/com/google/inject/errors/BUILD
new file mode 100644
index 0000000000..f064c843f3
--- /dev/null
+++ b/core/test/com/google/inject/errors/BUILD
@@ -0,0 +1,46 @@
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(
+ default_testonly = 1,
+)
+
+java_library(
+ name = "tests",
+ srcs = glob(["*.java"]),
+ javacopts = ["-Xep:BetaApi:OFF"],
+ plugins = [
+ ],
+ resources = [
+ ":test_error_files",
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/guava/annotations",
+ "//third_party/java/guava/collect",
+ "//third_party/java/guava/io",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+filegroup(
+ name = "test_error_files",
+ srcs = glob(["testdata/*.txt"]),
+)
+
+[guice_test_suites(
+ name = "gen_tests_stack_trace%s" % include_stack_trace_option,
+ args = [
+ "--guice_include_stack_traces=%s" % include_stack_trace_option,
+ ],
+ sizes = [
+ "small",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+ "ONLY_FOR_DECLARING_SOURCE",
+]]
diff --git a/core/test/com/google/inject/errors/ErrorMessageTestUtils.java b/core/test/com/google/inject/errors/ErrorMessageTestUtils.java
index 6ce5a21faa..df6639ad70 100644
--- a/core/test/com/google/inject/errors/ErrorMessageTestUtils.java
+++ b/core/test/com/google/inject/errors/ErrorMessageTestUtils.java
@@ -5,6 +5,7 @@
import com.google.common.io.Resources;
import java.io.IOException;
+import java.net.URL;
final class ErrorMessageTestUtils {
private static final String LINE_NUMBER_REGEX = ":\\d+";
@@ -38,7 +39,14 @@ private static void assertErrorMessage(String actual, String expected) {
}
private static String getExpectedError(String fileName) throws IOException {
- return Resources.toString(
- ErrorMessageTestUtils.class.getResource("testdata/" + fileName), UTF_8);
+ URL resource = ErrorMessageTestUtils.class.getResource("testdata/" + fileName);
+ // The location of the resource depends on if we are using maven or bazel.
+ // TODO: remove this once we no longer use maven.
+ if (resource == null) {
+ resource =
+ ErrorMessageTestUtils.class.getResource(
+ "/core/test/com/google/inject/errors/testdata/" + fileName);
+ }
+ return Resources.toString(resource, UTF_8);
}
}
diff --git a/core/test/com/googlecode/guice/BUILD b/core/test/com/googlecode/guice/BUILD
new file mode 100644
index 0000000000..fee50891f2
--- /dev/null
+++ b/core/test/com/googlecode/guice/BUILD
@@ -0,0 +1,53 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(
+ default_testonly = 1,
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "tests",
+ srcs = glob([
+ "**/*.java",
+ ]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//core/test/com/google/inject:testsupport",
+ "//third_party/java/aopalliance",
+ "//third_party/java/guava/testing",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/jsr330_inject:tck",
+ "//third_party/java/junit",
+ "@maven//:biz_aQute_bnd",
+ "@maven//:org_apache_felix_org_apache_felix_framework",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = [
+ "small",
+ "medium",
+ ],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_class_loading_%s" % custom_class_loading_option,
+ args = [
+ "--guice_custom_class_loading=%s" % custom_class_loading_option,
+ ],
+ sizes = [
+ "small",
+ "medium",
+ ],
+ suffix = "_custom_class_loading_%s" % custom_class_loading_option,
+ deps = [":tests"],
+) for custom_class_loading_option in [
+ "OFF",
+ "CHILD",
+ "ANONYMOUS",
+]]
diff --git a/extensions/assistedinject/src/com/google/inject/assistedinject/BUILD b/extensions/assistedinject/src/com/google/inject/assistedinject/BUILD
new file mode 100644
index 0000000000..c1fc230163
--- /dev/null
+++ b/extensions/assistedinject/src/com/google/inject/assistedinject/BUILD
@@ -0,0 +1,21 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "assistedinject",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/error_prone:annotations",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr330_inject",
+ ],
+)
diff --git a/extensions/assistedinject/test/com/google/inject/assistedinject/BUILD b/extensions/assistedinject/test/com/google/inject/assistedinject/BUILD
new file mode 100644
index 0000000000..c13553a05c
--- /dev/null
+++ b/extensions/assistedinject/test/com/google/inject/assistedinject/BUILD
@@ -0,0 +1,43 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//core/test/com/google/inject:testsupport",
+ "//extensions/assistedinject/src/com/google/inject/assistedinject",
+ "//third_party/java/aopalliance",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = [
+ "--guice_include_stack_traces=%s" % include_stack_trace_option,
+ ],
+ sizes = [
+ "small",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/dagger-adapter/src/com/google/inject/daggeradapter/BUILD b/extensions/dagger-adapter/src/com/google/inject/daggeradapter/BUILD
new file mode 100644
index 0000000000..5a65f8af77
--- /dev/null
+++ b/extensions/dagger-adapter/src/com/google/inject/daggeradapter/BUILD
@@ -0,0 +1,21 @@
+# Copyright 2015 Google Inc. All rights reserved.
+# Author: cgruber@google.com (Christian Gruber)
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "daggeradapter",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/dagger",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr330_inject",
+ ],
+)
diff --git a/extensions/dagger-adapter/test/com/google/inject/daggeradapter/BUILD b/extensions/dagger-adapter/test/com/google/inject/daggeradapter/BUILD
new file mode 100644
index 0000000000..91a60ec0c2
--- /dev/null
+++ b/extensions/dagger-adapter/test/com/google/inject/daggeradapter/BUILD
@@ -0,0 +1,45 @@
+# Copyright 2015 Google Inc. All rights reserved.
+# Author: cgruber@google.com (Christian Gruber)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/dagger-adapter/src/com/google/inject/daggeradapter",
+ "//third_party/java/auto:value",
+ "//third_party/java/dagger",
+ "//third_party/java/dagger:producers",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = [
+ "--guice_include_stack_traces=%s" % include_stack_trace_option,
+ ],
+ sizes = [
+ "small",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/grapher/src/com/google/inject/grapher/BUILD b/extensions/grapher/src/com/google/inject/grapher/BUILD
new file mode 100644
index 0000000000..1f6d9c25c8
--- /dev/null
+++ b/extensions/grapher/src/com/google/inject/grapher/BUILD
@@ -0,0 +1,19 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "grapher",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ ],
+)
diff --git a/extensions/grapher/test/com/google/inject/grapher/BUILD b/extensions/grapher/test/com/google/inject/grapher/BUILD
new file mode 100644
index 0000000000..16d1683f19
--- /dev/null
+++ b/extensions/grapher/test/com/google/inject/grapher/BUILD
@@ -0,0 +1,42 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/assistedinject/src/com/google/inject/assistedinject",
+ "//extensions/grapher/src/com/google/inject/grapher",
+ "//third_party/java/guava/collect",
+ "//third_party/java/junit",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = [
+ "small",
+ "medium",
+ ],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = ["--guice_include_stack_traces=%s" % include_stack_trace_option],
+ sizes = [
+ "small",
+ "medium",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/jmx/src/com/google/inject/tools/jmx/BUILD b/extensions/jmx/src/com/google/inject/tools/jmx/BUILD
new file mode 100644
index 0000000000..ef44f0cf0c
--- /dev/null
+++ b/extensions/jmx/src/com/google/inject/tools/jmx/BUILD
@@ -0,0 +1,13 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "jmx",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ ],
+)
diff --git a/extensions/jmx/test/com/google/inject/tools/jmx/BUILD b/extensions/jmx/test/com/google/inject/tools/jmx/BUILD
new file mode 100644
index 0000000000..d4c82e7076
--- /dev/null
+++ b/extensions/jmx/test/com/google/inject/tools/jmx/BUILD
@@ -0,0 +1,24 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/jmx/src/com/google/inject/tools/jmx",
+ ],
+)
+
+# There are no actual tests here, just some code that's intended to be
+# run manually.
+# TODO(sameb): Add some tests.
+#load("//testing/build_defs:junit3_test_suites.bzl", "junit3_test_suites")
+#junit3_test_suites(name = "gen_tests",
+# deps = [ ":tests", ],
+# sizes = [ 'small', ],
+# include_suites = True,
+# subpackages = True,)
diff --git a/extensions/jndi/src/com/google/inject/jndi/BUILD b/extensions/jndi/src/com/google/inject/jndi/BUILD
new file mode 100644
index 0000000000..ee3bdd4681
--- /dev/null
+++ b/extensions/jndi/src/com/google/inject/jndi/BUILD
@@ -0,0 +1,15 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "jndi",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ ],
+)
diff --git a/extensions/mini/src/com/google/inject/mini/BUILD b/extensions/mini/src/com/google/inject/mini/BUILD
new file mode 100644
index 0000000000..3aeb353838
--- /dev/null
+++ b/extensions/mini/src/com/google/inject/mini/BUILD
@@ -0,0 +1,14 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "mini",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/jsr330_inject",
+ ],
+)
diff --git a/extensions/mini/test/com/google/inject/mini/BUILD b/extensions/mini/test/com/google/inject/mini/BUILD
new file mode 100644
index 0000000000..d170984d60
--- /dev/null
+++ b/extensions/mini/test/com/google/inject/mini/BUILD
@@ -0,0 +1,23 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/mini/src/com/google/inject/mini",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/junit",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
diff --git a/extensions/persist/pom.xml b/extensions/persist/pom.xml
index 2269448148..a29da4b9b8 100644
--- a/extensions/persist/pom.xml
+++ b/extensions/persist/pom.xml
@@ -34,8 +34,8 @@
org.hibernate
- hibernate-entitymanager
- 4.1.7.Final
+ hibernate-core
+ 5.6.3.Final
test
diff --git a/extensions/persist/src/com/google/inject/persist/BUILD b/extensions/persist/src/com/google/inject/persist/BUILD
new file mode 100644
index 0000000000..876ad2e034
--- /dev/null
+++ b/extensions/persist/src/com/google/inject/persist/BUILD
@@ -0,0 +1,23 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "persist",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/servlet/src/com/google/inject/servlet",
+ "//third_party/java/aopalliance",
+ "//third_party/java/guava/annotations",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/javax_persistence",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/servlet/servlet_api",
+ ],
+)
diff --git a/extensions/persist/test/com/google/inject/persist/BUILD b/extensions/persist/test/com/google/inject/persist/BUILD
new file mode 100644
index 0000000000..cc01cfb963
--- /dev/null
+++ b/extensions/persist/test/com/google/inject/persist/BUILD
@@ -0,0 +1,55 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+# This has an additional dependency on a genrule config:metainf,
+# because we need that file to end up in META-INF/persistence.xml,
+# but due to the way the packages are built, it's hard to do that.
+# It's even more confusing because in the open-source repository,
+# that file *is* in the proper place.
+
+java_import(
+ name = "metainf",
+ jars = ["//extensions/persist/test/com/google/inject/persist/config:metainf"],
+)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ ":metainf",
+ "//core/src/com/google/inject",
+ "//extensions/persist/src/com/google/inject/persist",
+ "//third_party/java/hamcrest",
+ "//third_party/java/hibernate:hibernate5",
+ "//third_party/java/hsqldb:hsqldb2",
+ "//third_party/java/javax_persistence",
+ "//third_party/java/junit",
+ "//third_party/java/mockito",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = [
+ "small",
+ "medium",
+ ],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = ["--guice_include_stack_traces=%s" % include_stack_trace_option],
+ sizes = [
+ "small",
+ "medium",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/persist/test/com/google/inject/persist/config/BUILD b/extensions/persist/test/com/google/inject/persist/config/BUILD
new file mode 100644
index 0000000000..3efd2567e4
--- /dev/null
+++ b/extensions/persist/test/com/google/inject/persist/config/BUILD
@@ -0,0 +1,15 @@
+# Copyright 2011 Google Inc. All Rights Reserved.
+# Author: sameb@google.com (Sam Berlin)
+
+package(default_visibility = ["//:src"])
+
+# A genrule to take everything under META-INF and move it the
+# root of the classpath.
+genrule(
+ name = "metainf",
+ srcs = glob(["META-INF/*"]),
+ outs = ["jpa-manifest.jar"],
+ cmd = "$(location @local_jdk//:jar) cvf $@ -C " +
+ "extensions/persist/test/com/google/inject/persist/config META-INF",
+ tools = ["@local_jdk//:jar"],
+)
diff --git a/extensions/persist/test/com/google/inject/persist/config/META-INF/persistence.xml b/extensions/persist/test/com/google/inject/persist/config/META-INF/persistence.xml
new file mode 100644
index 0000000000..bed97f5912
--- /dev/null
+++ b/extensions/persist/test/com/google/inject/persist/config/META-INF/persistence.xml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ org.hibernate.ejb.HibernatePersistence
+
+ com.google.inject.persist.jpa.JpaTestEntity
+ com.google.inject.persist.jpa.JpaParentTestEntity
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.hibernate.ejb.HibernatePersistence
+
+ com.google.inject.persist.jpa.JpaTestEntity
+ com.google.inject.persist.jpa.JpaParentTestEntity
+ true
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java b/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java
index 1318b6303a..6cd1caef11 100644
--- a/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java
+++ b/extensions/persist/test/com/google/inject/persist/jpa/EnsureJpaCanTakeObjectsInPropertiesTest.java
@@ -19,19 +19,15 @@
import com.google.inject.Injector;
import com.google.inject.persist.PersistService;
import com.google.inject.persist.UnitOfWork;
-
-import junit.framework.TestCase;
-
-import org.hibernate.cfg.Environment;
-import org.hibernate.ejb.connection.InjectedDataSourceConnectionProvider;
-import org.hsqldb.jdbc.JDBCDataSource;
-
import java.util.HashMap;
import java.util.Map;
-
import javax.persistence.EntityManagerFactory;
import javax.persistence.PersistenceException;
import javax.sql.DataSource;
+import junit.framework.TestCase;
+import org.hibernate.cfg.Environment;
+import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl;
+import org.hsqldb.jdbc.JDBCDataSource;
public class EnsureJpaCanTakeObjectsInPropertiesTest extends TestCase {
@@ -50,8 +46,7 @@ public static class DBModule extends AbstractModule {
@Override
protected void configure() {
Map p = new HashMap<>();
-
- p.put(Environment.CONNECTION_PROVIDER, InjectedDataSourceConnectionProvider.class.getName());
+ p.put(Environment.CONNECTION_PROVIDER, DatasourceConnectionProviderImpl.class.getName());
if (passDataSource) {
p.put(Environment.DATASOURCE, ds);
}
diff --git a/extensions/service/src/com/google/inject/service/BUILD b/extensions/service/src/com/google/inject/service/BUILD
new file mode 100644
index 0000000000..c27d5e80dd
--- /dev/null
+++ b/extensions/service/src/com/google/inject/service/BUILD
@@ -0,0 +1,18 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "service",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/guava/util/concurrent",
+ ],
+)
diff --git a/extensions/service/test/com/google/inject/service/BUILD b/extensions/service/test/com/google/inject/service/BUILD
new file mode 100644
index 0000000000..0b48630b1f
--- /dev/null
+++ b/extensions/service/test/com/google/inject/service/BUILD
@@ -0,0 +1,22 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ javacopts = ["-Xep:FutureReturnValueIgnored:OFF"],
+ deps = [
+ "//extensions/service/src/com/google/inject/service",
+ "//third_party/java/junit",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["medium"],
+ deps = [":tests"],
+)
diff --git a/extensions/servlet/src/com/google/inject/servlet/BUILD b/extensions/servlet/src/com/google/inject/servlet/BUILD
new file mode 100644
index 0000000000..c6b8c1cd6b
--- /dev/null
+++ b/extensions/servlet/src/com/google/inject/servlet/BUILD
@@ -0,0 +1,36 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "request-scoped-annotation",
+ srcs = ["RequestScoped.java"],
+ plugins = [
+ ],
+ deps = [
+ "//third_party/java/jsr330_inject",
+ ],
+)
+
+java_library(
+ name = "servlet",
+ srcs = glob(
+ ["**/*.java"],
+ exclude = ["RequestScoped.java"],
+ ),
+ plugins = [
+ ],
+ exports = [":request-scoped-annotation"],
+ deps = [
+ ":request-scoped-annotation",
+ "//core/src/com/google/inject",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/guava/escape",
+ "//third_party/java/guava/net",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/servlet/servlet_api",
+ ],
+)
diff --git a/extensions/servlet/test/com/google/inject/servlet/BUILD b/extensions/servlet/test/com/google/inject/servlet/BUILD
new file mode 100644
index 0000000000..7c351bed9c
--- /dev/null
+++ b/extensions/servlet/test/com/google/inject/servlet/BUILD
@@ -0,0 +1,48 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ javacopts = ["-Xep:FutureReturnValueIgnored:OFF"],
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//core/test/com/google/inject:testsupport",
+ "//extensions/servlet/src/com/google/inject/servlet",
+ "//third_party/java/easymock",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/junit",
+ "//third_party/java/servlet/servlet_api",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = [
+ "small",
+ "medium",
+ ],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = [
+ "--guice_include_stack_traces=%s" % include_stack_trace_option,
+ ],
+ sizes = [
+ "small",
+ "medium",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/spring/src/com/google/inject/spring/BUILD b/extensions/spring/src/com/google/inject/spring/BUILD
new file mode 100644
index 0000000000..776074a596
--- /dev/null
+++ b/extensions/spring/src/com/google/inject/spring/BUILD
@@ -0,0 +1,18 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "spring",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/guava/base",
+ "//third_party/java/spring:beans",
+ ],
+)
diff --git a/extensions/spring/test/com/google/inject/spring/BUILD b/extensions/spring/test/com/google/inject/spring/BUILD
new file mode 100644
index 0000000000..93414b5e83
--- /dev/null
+++ b/extensions/spring/test/com/google/inject/spring/BUILD
@@ -0,0 +1,35 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/spring/src/com/google/inject/spring",
+ "//third_party/java/junit",
+ "//third_party/java/spring:beans",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = ["--guice_include_stack_traces=%s" % include_stack_trace_option],
+ sizes = [
+ "small",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/struts2/src/com/google/inject/struts2/BUILD b/extensions/struts2/src/com/google/inject/struts2/BUILD
new file mode 100644
index 0000000000..9ecae59830
--- /dev/null
+++ b/extensions/struts2/src/com/google/inject/struts2/BUILD
@@ -0,0 +1,16 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "struts2",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/servlet/src/com/google/inject/servlet",
+ "//third_party/java/struts2",
+ ],
+)
diff --git a/extensions/struts2/test/com/google/inject/struts2/BUILD b/extensions/struts2/test/com/google/inject/struts2/BUILD
new file mode 100644
index 0000000000..b3dea5ff83
--- /dev/null
+++ b/extensions/struts2/test/com/google/inject/struts2/BUILD
@@ -0,0 +1,36 @@
+# Copyright 2011 Google Inc. All Rights Reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ deps = [
+ "//core/src/com/google/inject",
+ "//extensions/servlet/src/com/google/inject/servlet",
+ "//extensions/struts2/src/com/google/inject/struts2",
+ "//third_party/java/junit",
+ "//third_party/java/struts2",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = ["--guice_include_stack_traces=%s" % include_stack_trace_option],
+ sizes = [
+ "small",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/extensions/testlib/src/com/google/inject/testing/fieldbinder/BUILD b/extensions/testlib/src/com/google/inject/testing/fieldbinder/BUILD
new file mode 100644
index 0000000000..6a25ab2d61
--- /dev/null
+++ b/extensions/testlib/src/com/google/inject/testing/fieldbinder/BUILD
@@ -0,0 +1,20 @@
+# Copyright 2014 Google Inc. All rights reserved.
+# Author: eatnumber1@google.com (Russ Harmon)
+package(
+ default_testonly = 1,
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "fieldbinder",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/error_prone:annotations",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr330_inject",
+ ],
+)
diff --git a/extensions/testlib/src/com/google/inject/testing/throwingproviders/BUILD b/extensions/testlib/src/com/google/inject/testing/throwingproviders/BUILD
new file mode 100644
index 0000000000..fcabcfb027
--- /dev/null
+++ b/extensions/testlib/src/com/google/inject/testing/throwingproviders/BUILD
@@ -0,0 +1,14 @@
+package(
+ default_testonly = 1,
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "throwingproviders",
+ srcs = glob(["*.java"]),
+ deps = [
+ "//extensions/throwingproviders/src/com/google/inject/throwingproviders",
+ "//third_party/java/jsr305_annotations",
+ "//third_party/java/truth",
+ ],
+)
diff --git a/extensions/testlib/test/com/google/inject/testing/fieldbinder/BUILD b/extensions/testlib/test/com/google/inject/testing/fieldbinder/BUILD
new file mode 100644
index 0000000000..c7c3db3703
--- /dev/null
+++ b/extensions/testlib/test/com/google/inject/testing/fieldbinder/BUILD
@@ -0,0 +1,41 @@
+# Copyright 2014 Google Inc. All rights reserved.
+# Author: eatnumber1@google.com (Russ Harmon)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//core/test/com/google/inject:testsupport",
+ "//extensions/testlib/src/com/google/inject/testing/fieldbinder",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr330_inject",
+ "//third_party/java/junit",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [
+ ":tests",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests_OFF",
+ args = [
+ "--guice_include_stack_traces=OFF",
+ ],
+ sizes = ["small"],
+ suffix = "_stack_trace_OFF",
+ deps = [
+ ":tests",
+ ],
+)
diff --git a/extensions/testlib/test/com/google/inject/testing/throwingproviders/BUILD b/extensions/testlib/test/com/google/inject/testing/throwingproviders/BUILD
new file mode 100644
index 0000000000..d4d65b40df
--- /dev/null
+++ b/extensions/testlib/test/com/google/inject/testing/throwingproviders/BUILD
@@ -0,0 +1,21 @@
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["*.java"]),
+ deps = [
+ "//extensions/testlib/src/com/google/inject/testing/throwingproviders",
+ "//extensions/throwingproviders/src/com/google/inject/throwingproviders",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
diff --git a/extensions/throwingproviders/src/com/google/inject/throwingproviders/BUILD b/extensions/throwingproviders/src/com/google/inject/throwingproviders/BUILD
new file mode 100644
index 0000000000..7a5617494f
--- /dev/null
+++ b/extensions/throwingproviders/src/com/google/inject/throwingproviders/BUILD
@@ -0,0 +1,19 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+package(
+ default_visibility = ["//:src"],
+)
+
+java_library(
+ name = "throwingproviders",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//third_party/java/error_prone:annotations",
+ "//third_party/java/guava/base",
+ "//third_party/java/guava/collect",
+ "//third_party/java/jsr305_annotations",
+ ],
+)
diff --git a/extensions/throwingproviders/test/com/google/inject/throwingproviders/BUILD b/extensions/throwingproviders/test/com/google/inject/throwingproviders/BUILD
new file mode 100644
index 0000000000..e0d6c113fd
--- /dev/null
+++ b/extensions/throwingproviders/test/com/google/inject/throwingproviders/BUILD
@@ -0,0 +1,41 @@
+# Copyright 2011 Google Inc. All rights reserved.
+# Author: sameb@google.com (Sam Berlin)
+load("@rules_java//java:defs.bzl", "java_library")
+load("//:test_defs.bzl", "guice_test_suites")
+
+package(default_testonly = 1)
+
+java_library(
+ name = "tests",
+ srcs = glob(["**/*.java"]),
+ plugins = [
+ ],
+ deps = [
+ "//core/src/com/google/inject",
+ "//core/test/com/google/inject:testsupport",
+ "//extensions/throwingproviders/src/com/google/inject/throwingproviders",
+ "//third_party/java/guava/collect",
+ "//third_party/java/junit",
+ "//third_party/java/truth",
+ ],
+)
+
+guice_test_suites(
+ name = "gen_tests",
+ sizes = ["small"],
+ deps = [":tests"],
+)
+
+[guice_test_suites(
+ name = "gen_tests_%s" % include_stack_trace_option,
+ args = [
+ "--guice_include_stack_traces=%s" % include_stack_trace_option,
+ ],
+ sizes = [
+ "small",
+ ],
+ suffix = "_stack_trace_%s" % include_stack_trace_option,
+ deps = [":tests"],
+) for include_stack_trace_option in [
+ "OFF",
+]]
diff --git a/test_defs.bzl b/test_defs.bzl
new file mode 100644
index 0000000000..64910f39a7
--- /dev/null
+++ b/test_defs.bzl
@@ -0,0 +1,64 @@
+# Copyright (C) 2022 Google Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""starlark marcors to generate test suites."""
+
+def guice_test_suites(name, deps, srcs = None, args = [], suffix = "", sizes = None):
+ """
+ Generates tests for test file in srcs ending in "Test.java"
+
+ Args:
+ name: name of the test suite to generate
+ srcs: list of test source files, uses 'glob(["**/*Test.java"])' if not specified
+ deps: list of runtime dependencies requried to run the test
+ args: list of flags to pass to the test
+ suffix: suffix to apend to the generated test name
+ sizes: not used, exists only so that the opensource guice_test_suites mirror exactly the internal one
+ """
+ test_files = srcs or native.glob(["**/*Test.java"])
+ jvm_flags = []
+
+ # transform flags to JVM options used externally
+ for arg in args:
+ if arg.startswith("--"):
+ jvm_flags.append(arg.replace("--", "-D"))
+ else:
+ jvm_flags.append(arg)
+
+ package_name = native.package_name()
+
+ # strip the path prefix from package name so that we get the correct test class name
+ # "core/test/com/google/inject" becomes "com/google/inject"
+ # "extensions/service/test/com/google/inject/service" becomes "com/google/inject/service"
+ if package_name.startswith("core/test/") or package_name.startswith("extensions/"):
+ package_name = package_name.rpartition("/test/")[2]
+
+ test_names = []
+ for test_file in test_files:
+ name = test_file.replace(".java", "")
+ test_name = name + suffix
+ test_names.append(test_name)
+ test_class = (package_name + "/" + name).replace("/", ".")
+
+ native.java_test(
+ name = test_name,
+ test_class = test_class,
+ runtime_deps = deps,
+ jvm_flags = jvm_flags,
+ )
+
+ native.test_suite(
+ name = name + suffix + "_suite",
+ tests = test_names,
+ )
diff --git a/third_party/java/aopalliance/BUILD b/third_party/java/aopalliance/BUILD
new file mode 100644
index 0000000000..d3be41a490
--- /dev/null
+++ b/third_party/java/aopalliance/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "aopalliance",
+ actual = "@maven//:aopalliance_aopalliance",
+)
diff --git a/third_party/java/asm/BUILD b/third_party/java/asm/BUILD
new file mode 100644
index 0000000000..c50c9ad2e3
--- /dev/null
+++ b/third_party/java/asm/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "asm",
+ actual = "@maven//:org_ow2_asm_asm",
+)
diff --git a/third_party/java/auto/BUILD b/third_party/java/auto/BUILD
new file mode 100644
index 0000000000..3f083e724f
--- /dev/null
+++ b/third_party/java/auto/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "value",
+ actual = "@maven//:com_google_auto_value_auto_value",
+)
diff --git a/third_party/java/dagger/BUILD b/third_party/java/dagger/BUILD
new file mode 100644
index 0000000000..b0de94c249
--- /dev/null
+++ b/third_party/java/dagger/BUILD
@@ -0,0 +1,11 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "dagger",
+ actual = "@maven//:com_google_dagger_dagger",
+)
+
+alias(
+ name = "producers",
+ actual = "@maven//:com_google_dagger_dagger_producers",
+)
diff --git a/third_party/java/easymock/BUILD b/third_party/java/easymock/BUILD
new file mode 100644
index 0000000000..c5d60fea5f
--- /dev/null
+++ b/third_party/java/easymock/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "easymock",
+ actual = "@maven//:org_easymock_easymock",
+)
diff --git a/third_party/java/error_prone/BUILD b/third_party/java/error_prone/BUILD
new file mode 100644
index 0000000000..293e4bdb8f
--- /dev/null
+++ b/third_party/java/error_prone/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "annotations",
+ actual = "@maven//:com_google_errorprone_error_prone_annotations",
+)
diff --git a/third_party/java/guava/BUILD b/third_party/java/guava/BUILD
new file mode 100644
index 0000000000..06d3153395
--- /dev/null
+++ b/third_party/java/guava/BUILD
@@ -0,0 +1 @@
+package(default_visibility = ["//:src"])
diff --git a/third_party/java/guava/annotations/BUILD b/third_party/java/guava/annotations/BUILD
new file mode 100644
index 0000000000..c605187411
--- /dev/null
+++ b/third_party/java/guava/annotations/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "annotations",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/base/BUILD b/third_party/java/guava/base/BUILD
new file mode 100644
index 0000000000..a134dec83a
--- /dev/null
+++ b/third_party/java/guava/base/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "base",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/cache/BUILD b/third_party/java/guava/cache/BUILD
new file mode 100644
index 0000000000..66994654e5
--- /dev/null
+++ b/third_party/java/guava/cache/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "cache",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/collect/BUILD b/third_party/java/guava/collect/BUILD
new file mode 100644
index 0000000000..91ac7f67e1
--- /dev/null
+++ b/third_party/java/guava/collect/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "collect",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/escape/BUILD b/third_party/java/guava/escape/BUILD
new file mode 100644
index 0000000000..a2c6245f80
--- /dev/null
+++ b/third_party/java/guava/escape/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "escape",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/io/BUILD b/third_party/java/guava/io/BUILD
new file mode 100644
index 0000000000..08732a1787
--- /dev/null
+++ b/third_party/java/guava/io/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "io",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/net/BUILD b/third_party/java/guava/net/BUILD
new file mode 100644
index 0000000000..0a53654038
--- /dev/null
+++ b/third_party/java/guava/net/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "net",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/primitives/BUILD b/third_party/java/guava/primitives/BUILD
new file mode 100644
index 0000000000..aa4517309c
--- /dev/null
+++ b/third_party/java/guava/primitives/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "primitives",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/guava/testing/BUILD b/third_party/java/guava/testing/BUILD
new file mode 100644
index 0000000000..3368d02beb
--- /dev/null
+++ b/third_party/java/guava/testing/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "testing",
+ actual = "@maven//:com_google_guava_guava_testlib",
+)
diff --git a/third_party/java/guava/util/concurrent/BUILD b/third_party/java/guava/util/concurrent/BUILD
new file mode 100644
index 0000000000..4cf9eb885d
--- /dev/null
+++ b/third_party/java/guava/util/concurrent/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "concurrent",
+ actual = "@maven//:com_google_guava_guava",
+)
diff --git a/third_party/java/hamcrest/BUILD b/third_party/java/hamcrest/BUILD
new file mode 100644
index 0000000000..3c77ccf4a0
--- /dev/null
+++ b/third_party/java/hamcrest/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "hamcrest",
+ actual = "@maven//:org_hamcrest_hamcrest",
+)
diff --git a/third_party/java/hibernate/BUILD b/third_party/java/hibernate/BUILD
new file mode 100644
index 0000000000..2d9730d851
--- /dev/null
+++ b/third_party/java/hibernate/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "hibernate5",
+ actual = "@maven//:org_hibernate_hibernate_core",
+)
diff --git a/third_party/java/hsqldb/BUILD b/third_party/java/hsqldb/BUILD
new file mode 100644
index 0000000000..7d97336275
--- /dev/null
+++ b/third_party/java/hsqldb/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "hsqldb2",
+ actual = "@maven//:org_hsqldb_hsqldb_j5",
+)
diff --git a/third_party/java/javax_persistence/BUILD b/third_party/java/javax_persistence/BUILD
new file mode 100644
index 0000000000..7da4d72455
--- /dev/null
+++ b/third_party/java/javax_persistence/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "javax_persistence",
+ actual = "@maven//:javax_persistence_javax_persistence_api",
+)
diff --git a/third_party/java/jsr305_annotations/BUILD b/third_party/java/jsr305_annotations/BUILD
new file mode 100644
index 0000000000..147c2e3465
--- /dev/null
+++ b/third_party/java/jsr305_annotations/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "jsr305_annotations",
+ actual = "@maven//:com_google_code_findbugs_jsr305",
+)
diff --git a/third_party/java/jsr330_inject/BUILD b/third_party/java/jsr330_inject/BUILD
new file mode 100644
index 0000000000..56649a729f
--- /dev/null
+++ b/third_party/java/jsr330_inject/BUILD
@@ -0,0 +1,11 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "jsr330_inject",
+ actual = "@maven//:javax_inject_javax_inject",
+)
+
+alias(
+ name = "tck",
+ actual = "@maven//:javax_inject_javax_inject_tck",
+)
diff --git a/third_party/java/junit/BUILD b/third_party/java/junit/BUILD
new file mode 100644
index 0000000000..5ce159821a
--- /dev/null
+++ b/third_party/java/junit/BUILD
@@ -0,0 +1,12 @@
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(default_visibility = ["//:src"])
+
+java_library(
+ name = "junit",
+ testonly = 1,
+ exports = [
+ "@maven//:junit_junit",
+ "@maven//:org_hamcrest_hamcrest",
+ ],
+)
diff --git a/third_party/java/mockito/BUILD b/third_party/java/mockito/BUILD
new file mode 100644
index 0000000000..b9ea3b0409
--- /dev/null
+++ b/third_party/java/mockito/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "mockito",
+ actual = "@maven//:org_mockito_mockito_core",
+)
diff --git a/third_party/java/servlet/servlet_api/BUILD b/third_party/java/servlet/servlet_api/BUILD
new file mode 100644
index 0000000000..374ba5b09a
--- /dev/null
+++ b/third_party/java/servlet/servlet_api/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "servlet_api",
+ actual = "@maven//:javax_servlet_servlet_api",
+)
diff --git a/third_party/java/spring/BUILD b/third_party/java/spring/BUILD
new file mode 100644
index 0000000000..c2782f1f6e
--- /dev/null
+++ b/third_party/java/spring/BUILD
@@ -0,0 +1,11 @@
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(default_visibility = ["//:src"])
+
+java_library(
+ name = "beans",
+ exports = [
+ "@maven//:org_springframework_spring_beans",
+ "@maven//:org_springframework_spring_core",
+ ],
+)
diff --git a/third_party/java/struts2/BUILD b/third_party/java/struts2/BUILD
new file mode 100644
index 0000000000..706de6f783
--- /dev/null
+++ b/third_party/java/struts2/BUILD
@@ -0,0 +1,11 @@
+load("@rules_java//java:defs.bzl", "java_library")
+
+package(default_visibility = ["//:src"])
+
+java_library(
+ name = "struts2",
+ exports = [
+ "@maven//:org_apache_struts_struts2_core",
+ "@maven//:org_apache_struts_xwork_xwork_core",
+ ],
+)
diff --git a/third_party/java/truth/BUILD b/third_party/java/truth/BUILD
new file mode 100644
index 0000000000..88a8c1fdc4
--- /dev/null
+++ b/third_party/java/truth/BUILD
@@ -0,0 +1,6 @@
+package(default_visibility = ["//:src"])
+
+alias(
+ name = "truth",
+ actual = "@maven//:com_google_truth_truth",
+)