-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This change only makes it possible to build with bazel and no changes to existing maven setup yet. PiperOrigin-RevId: 422630465
- Loading branch information
1 parent
bbd2f0d
commit dea06c1
Showing
68 changed files
with
1,450 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package_group( | ||
name = "src", | ||
packages = ["//..."], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright 2011 Google Inc. All rights reserved. | ||
# Author: [email protected] (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", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
# Copyright 2011 Google Inc. All rights reserved. | ||
# Author: [email protected] (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", | ||
]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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", | ||
]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.