Skip to content

Instantly share code, notes, and snippets.

@jart jart/WORKSPACE
Last active Oct 29, 2018

Embed
What would you like to do?
Google Auto and Dagger Bazel Config
load("@bazel_tools//tools/build_defs/repo:java.bzl", "java_import_external")
java_import_external(
name = "com_google_auto_common",
jar_sha256 = "eee75e0d1b1b8f31584dcbe25e7c30752545001b46673d007d468d75cf6b2c52",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/auto/auto-common/0.7/auto-common-0.7.jar",
"http://repo1.maven.org/maven2/com/google/auto/auto-common/0.7/auto-common-0.7.jar",
],
licenses = ["notice"], # Apache 2.0
deps = ["@com_google_guava"],
)
java_import_external(
name = "com_google_auto_factory",
licenses = ["notice"], # Apache 2.0
jar_sha256 = "a038e409da90b9e065ec537cce2375b0bb0b07548dca0f9448671b0befb83439",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/auto/factory/auto-factory/1.0-beta3/auto-factory-1.0-beta3.jar",
"http://repo1.maven.org/maven2/com/google/auto/factory/auto-factory/1.0-beta3/auto-factory-1.0-beta3.jar",
],
# Auto Factory ships its annotations, runtime, and processor in the same
# jar. The generated code must link against this jar at runtime. So our
# goal is to introduce as little bloat as possible.The only class we need
# at runtime is com.google.auto.factory.internal.Preconditions. So we're
# not going to specify the deps of this jar as part of the java_import().
generated_rule_name = "jar",
extra_build_file_content = "\n".join([
"java_library(",
" name = \"processor\",",
" exports = [\":jar\"],",
" runtime_deps = [",
" \"@com_google_auto_common\",",
" \"@com_google_guava\",",
" \"@com_squareup_javawriter\",",
" \"@javax_inject\",",
" ],",
")",
"",
"java_plugin(",
" name = \"AutoFactoryProcessor\",",
" output_licenses = [\"unencumbered\"],",
" processor_class = \"com.google.auto.factory.processor.AutoFactoryProcessor\",",
" generates_api = 1,",
" tags = [\"annotation=com.google.auto.factory.AutoFactory;genclass=${package}.${outerclasses}@{className|${classname}Factory}\"],",
" deps = [\":processor\"],",
")",
"",
"java_library(",
" name = \"com_google_auto_factory\",",
" exported_plugins = [\":AutoFactoryProcessor\"],",
" exports = [",
" \":jar\",",
" \"@com_google_code_findbugs_jsr305\",",
" \"@javax_inject\",",
" ],",
")",
]),
)
java_import_external(
name = "com_google_auto_service",
jar_sha256 = "46808c92276b4c19e05781963432e6ab3e920b305c0e6df621517d3624a35d71",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/auto/service/auto-service/1.0-rc2/auto-service-1.0-rc2.jar",
"http://repo1.maven.org/maven2/com/google/auto/service/auto-service/1.0-rc2/auto-service-1.0-rc2.jar",
],
licenses = ["notice"], # Apache 2.0
neverlink = True,
generated_rule_name = "compile",
generated_linkable_rule_name = "processor",
deps = [
"@com_google_auto_common",
"@com_google_guava",
],
extra_build_file_content = "\n".join([
"java_plugin(",
" name = \"AutoServiceProcessor\",",
" output_licenses = [\"unencumbered\"],",
" processor_class = \"com.google.auto.service.processor.AutoServiceProcessor\",",
" deps = [\":processor\"],",
")",
"",
"java_library(",
" name = \"com_google_auto_service\",",
" exported_plugins = [\":AutoServiceProcessor\"],",
" exports = [\":compile\"],",
")",
]),
)
java_import_external(
name = "com_google_auto_value",
jar_sha256 = "ea26f99150825f61752efc8784739cf50dd25d7956774573f8cdc3b948b23086",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/auto/value/auto-value/1.4-rc2/auto-value-1.4-rc2.jar",
"http://repo1.maven.org/maven2/com/google/auto/value/auto-value/1.4-rc2/auto-value-1.4-rc2.jar",
],
licenses = ["notice"], # Apache 2.0
neverlink = True,
generated_rule_name = "compile",
generated_linkable_rule_name = "processor",
deps = [
"@com_google_auto_common",
"@com_google_code_findbugs_jsr305",
"@com_google_guava",
],
extra_build_file_content = "\n".join([
"java_plugin(",
" name = \"AutoAnnotationProcessor\",",
" output_licenses = [\"unencumbered\"],",
" processor_class = \"com.google.auto.value.processor.AutoAnnotationProcessor\",",
" tags = [\"annotation=com.google.auto.value.AutoAnnotation;genclass=${package}.AutoAnnotation_${outerclasses}${classname}_${methodname}\"],",
" deps = [\":processor\"],",
")",
"",
"java_plugin(",
" name = \"AutoValueProcessor\",",
" output_licenses = [\"unencumbered\"],",
" processor_class = \"com.google.auto.value.processor.AutoValueProcessor\",",
" tags = [\"annotation=com.google.auto.value.AutoValue;genclass=${package}.AutoValue_${outerclasses}${classname}\"],",
" deps = [\":processor\"],",
")",
"",
"java_library(",
" name = \"com_google_auto_value\",",
" exported_plugins = [",
" \":AutoAnnotationProcessor\",",
" \":AutoValueProcessor\",",
" ],",
" exports = [",
" \":compile\",",
" \"@com_google_code_findbugs_jsr305\",",
" ],",
")",
]),
)
java_import_external(
name = "com_google_dagger",
jar_sha256 = "5070e1dff5c551a4908ba7b93125c0243de2a688aed3d2f475357d86d9d7c0ad",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/dagger/dagger/2.8/dagger-2.8.jar",
"http://repo1.maven.org/maven2/com/google/dagger/dagger/2.8/dagger-2.8.jar",
],
licenses = ["notice"], # Apache 2.0
deps = ["@javax_inject"],
generated_rule_name = "runtime",
extra_build_file_content = "\n".join([
"java_library(",
" name = \"com_google_dagger\",",
" exported_plugins = [\"@com_google_dagger_compiler//:ComponentProcessor\"],",
" exports = [",
" \":runtime\",",
" \"@javax_inject\",",
" ],",
")",
]),
)
java_import_external(
name = "com_google_dagger_compiler",
jar_sha256 = "7b2686f94907868c5364e9965601ffe2f020ba4af1849ad9b57dad5fe3fa6242",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/dagger/dagger-compiler/2.8/dagger-compiler-2.8.jar",
"http://repo1.maven.org/maven2/com/google/dagger/dagger-compiler/2.8/dagger-compiler-2.8.jar",
],
licenses = ["notice"], # Apache 2.0
deps = [
"@com_google_code_findbugs_jsr305",
"@com_google_dagger//:runtime",
"@com_google_dagger_producers//:runtime",
"@com_google_guava",
],
extra_build_file_content = "\n".join([
"java_plugin(",
" name = \"ComponentProcessor\",",
# TODO(jart): https://github.com/bazelbuild/bazel/issues/2286
# " output_licenses = [\"unencumbered\"],",
" processor_class = \"dagger.internal.codegen.ComponentProcessor\",",
" generates_api = 1,",
" tags = [",
" \"annotation=dagger.Component;genclass=${package}.Dagger${outerclasses}${classname}\",",
" \"annotation=dagger.producers.ProductionComponent;genclass=${package}.Dagger${outerclasses}${classname}\",",
" ],",
" deps = [\":com_google_dagger_compiler\"],",
")",
]),
)
java_import_external(
name = "com_google_dagger_producers",
jar_sha256 = "1e4043e85f67de381d19e22c7932aaf7ff1611091be7e1aaae93f2c37f331cf2",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/dagger/dagger-producers/2.8/dagger-producers-2.8.jar",
"http://repo1.maven.org/maven2/com/google/dagger/dagger-producers/2.8/dagger-producers-2.8.jar",
],
licenses = ["notice"], # Apache 2.0
deps = [
"@com_google_dagger//:runtime",
"@com_google_guava",
],
generated_rule_name = "runtime",
extra_build_file_content = "\n".join([
"java_library(",
" name = \"com_google_dagger\",",
" exported_plugins = [\"@com_google_dagger_compiler//:ComponentProcessor\"],",
" exports = [",
" \":runtime\",",
" \"@javax_inject\",",
" ],",
")",
]),
)
java_import_external(
name = "com_google_guava",
jar_sha256 = "7baa80df284117e5b945b19b98d367a85ea7b7801bd358ff657946c3bd1b6596",
jar_urls = [
"http://repo1.maven.org/maven2/com/google/guava/guava/23.0/guava-23.0.jar",
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/guava/guava/23.0/guava-23.0.jar",
],
licenses = ["notice"], # The Apache Software License, Version 2.0
exports = [
"@com_google_code_findbugs_jsr305",
"@com_google_errorprone_error_prone_annotations",
],
)
java_import_external(
name = "com_google_code_findbugs_jsr305",
jar_sha256 = "905721a0eea90a81534abb7ee6ef4ea2e5e645fa1def0a5cd88402df1b46c9ed",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar",
"http://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar",
],
licenses = ["notice"], # The Apache Software License, Version 2.0
)
java_import_external(
name = "com_google_errorprone_error_prone_annotations",
jar_sha256 = "e7749ffdf03fb8ebe08a727ea205acb301c8791da837fee211b99b04f9d79c46",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.0.15/error_prone_annotations-2.0.15.jar",
"http://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.0.15/error_prone_annotations-2.0.15.jar",
],
licenses = ["notice"], # Apache 2.0
)
java_import_external(
name = "javax_inject",
jar_sha256 = "91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar",
"http://repo1.maven.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar",
],
licenses = ["notice"], # The Apache Software License, Version 2.0
)
java_import_external(
name = "com_squareup_javawriter",
jar_sha256 = "39b054910ff212d4379129a89070fb7dbb1f341371c925e9e99904f154a22d93",
jar_urls = [
"http://domain-registry-maven.storage.googleapis.com/repo1.maven.org/maven2/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar",
"http://repo1.maven.org/maven2/com/squareup/javawriter/2.5.1/javawriter-2.5.1.jar",
],
licenses = ["notice"], # Apache 2.0
)
@ribrdb

This comment has been minimized.

Copy link

ribrdb commented Oct 17, 2018

How do you use autoservice? I see the plugin option for java_library, but how do I build a jar containing the files autoservice generates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.