Skip to content

Commit

Permalink
Support runtime_deps rather than exports for maven deps (pgr0ss#12)
Browse files Browse the repository at this point in the history
* checkpoint support for runtime_deps

* update exports

* use runtime deps and not exports by default
  • Loading branch information
johnynek authored Jul 7, 2016
1 parent c896e17 commit 80f0abd
Show file tree
Hide file tree
Showing 18 changed files with 168 additions and 116 deletions.
4 changes: 2 additions & 2 deletions 3rdparty/jvm/com/fasterxml/jackson/core/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ java_library(name = "jackson_core",
visibility = ["//visibility:public"])

java_library(name = "jackson_databind",
exports = ["//external:jar/com/fasterxml/jackson/core/jackson_databind",
":jackson_annotations"],
exports = ["//external:jar/com/fasterxml/jackson/core/jackson_databind"],
runtime_deps = [":jackson_annotations"],
visibility = ["//visibility:public"])
8 changes: 4 additions & 4 deletions 3rdparty/jvm/com/fasterxml/jackson/dataformat/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
java_library(name = "jackson_dataformat_yaml",
exports = ["//3rdparty/jvm/com/fasterxml/jackson/core:jackson_core",
"//3rdparty/jvm/com/fasterxml/jackson/core:jackson_databind",
"//3rdparty/jvm/org/yaml:snakeyaml",
"//external:jar/com/fasterxml/jackson/dataformat/jackson_dataformat_yaml"],
exports = ["//external:jar/com/fasterxml/jackson/dataformat/jackson_dataformat_yaml"],
runtime_deps = ["//3rdparty/jvm/com/fasterxml/jackson/core:jackson_core",
"//3rdparty/jvm/com/fasterxml/jackson/core:jackson_databind",
"//3rdparty/jvm/org/yaml:snakeyaml"],
visibility = ["//visibility:public"])
4 changes: 2 additions & 2 deletions 3rdparty/jvm/com/google/guava/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
java_library(name = "guava",
exports = ["//3rdparty/jvm/com/google/code/findbugs:jsr305",
"//external:jar/com/google/guava/guava"],
exports = ["//external:jar/com/google/guava/guava"],
runtime_deps = ["//3rdparty/jvm/com/google/code/findbugs:jsr305"],
visibility = ["//visibility:public"])
38 changes: 20 additions & 18 deletions 3rdparty/jvm/io/circe/BUILD
Original file line number Diff line number Diff line change
@@ -1,38 +1,40 @@
scala_library(name = "circe_core",
exports = ["//3rdparty/jvm/org/scala_lang:scala_library",
"//3rdparty/jvm/org/typelevel:cats_core",
"//external:jar/io/circe/circe_core_2_11",
":circe_numbers_2_11"],
exports = ["//external:jar/io/circe/circe_core_2_11"],
runtime_deps = ["//3rdparty/jvm/org/scala_lang:scala_library",
"//3rdparty/jvm/org/typelevel:cats_core",
":circe_numbers_2_11"],
visibility = ["//visibility:public"])

scala_library(name = "circe_generic",
exports = ["//3rdparty/jvm/com/chuusai:shapeless",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//3rdparty/jvm/org/typelevel:cats_core",
"//3rdparty/jvm/org/typelevel:cats_kernel",
"//3rdparty/jvm/org/typelevel:macro_compat",
"//external:jar/io/circe/circe_generic_2_11",
":circe_core"],
"//external:jar/io/circe/circe_generic_2_11"],
runtime_deps = ["//3rdparty/jvm/org/scala_lang:scala_library",
":circe_core"],
visibility = ["//visibility:public"])

scala_library(name = "circe_jackson",
exports = ["//3rdparty/jvm/com/fasterxml/jackson/core:jackson_core",
"//3rdparty/jvm/com/fasterxml/jackson/core:jackson_databind",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//external:jar/io/circe/circe_jackson_2_11",
":circe_core"],
exports = ["//external:jar/io/circe/circe_jackson_2_11"],
runtime_deps = ["//3rdparty/jvm/com/fasterxml/jackson/core:jackson_core",
"//3rdparty/jvm/com/fasterxml/jackson/core:jackson_databind",
"//3rdparty/jvm/org/scala_lang:scala_library",
":circe_core"],
visibility = ["//visibility:public"])

java_library(name = "circe_jawn_2_11",
exports = ["//3rdparty/jvm/org/spire_math:jawn_parser_2_11",
"//external:jar/io/circe/circe_jawn_2_11"],
exports = ["//external:jar/io/circe/circe_jawn_2_11"],
runtime_deps = ["//3rdparty/jvm/org/spire_math:jawn_parser_2_11"],
visibility = ["//visibility:public"])

java_library(name = "circe_numbers_2_11",
exports = ["//external:jar/io/circe/circe_numbers_2_11"],
visibility = ["//visibility:public"])

scala_library(name = "circe_parser",
exports = ["//3rdparty/jvm/org/scala_lang:scala_library",
"//external:jar/io/circe/circe_parser_2_11",
":circe_core",
":circe_jawn_2_11"],
exports = ["//external:jar/io/circe/circe_parser_2_11"],
runtime_deps = ["//3rdparty/jvm/org/scala_lang:scala_library",
":circe_core",
":circe_jawn_2_11"],
visibility = ["//visibility:public"])
4 changes: 2 additions & 2 deletions 3rdparty/jvm/javax/enterprise/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
java_library(name = "cdi_api",
exports = ["//3rdparty/jvm/javax/annotation:jsr250_api",
"//external:jar/javax/enterprise/cdi_api"],
exports = ["//external:jar/javax/enterprise/cdi_api"],
runtime_deps = ["//3rdparty/jvm/javax/annotation:jsr250_api"],
visibility = ["//visibility:public"])
6 changes: 3 additions & 3 deletions 3rdparty/jvm/org/apache/httpcomponents/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
java_library(name = "httpclient",
exports = ["//3rdparty/jvm/commons_codec:commons_codec",
"//external:jar/org/apache/httpcomponents/httpclient",
":httpcore"],
exports = ["//external:jar/org/apache/httpcomponents/httpclient"],
runtime_deps = ["//3rdparty/jvm/commons_codec:commons_codec",
":httpcore"],
visibility = ["//visibility:public"])

java_library(name = "httpcore",
Expand Down
26 changes: 13 additions & 13 deletions 3rdparty/jvm/org/apache/maven/BUILD
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
java_library(name = "maven_aether_provider",
exports = ["//3rdparty/jvm/org/codehaus/plexus:plexus_component_annotations",
"//3rdparty/jvm/org/codehaus/plexus:plexus_utils",
"//3rdparty/jvm/org/eclipse/aether:aether_api",
"//3rdparty/jvm/org/eclipse/aether:aether_impl",
"//3rdparty/jvm/org/eclipse/aether:aether_spi",
"//3rdparty/jvm/org/eclipse/aether:aether_util",
"//3rdparty/jvm/org/eclipse/sisu:org_eclipse_sisu_plexus",
"//external:jar/org/apache/maven/maven_aether_provider",
":maven_model",
":maven_model_builder",
":maven_repository_metadata"],
exports = ["//external:jar/org/apache/maven/maven_aether_provider"],
runtime_deps = ["//3rdparty/jvm/org/codehaus/plexus:plexus_component_annotations",
"//3rdparty/jvm/org/codehaus/plexus:plexus_utils",
"//3rdparty/jvm/org/eclipse/aether:aether_api",
"//3rdparty/jvm/org/eclipse/aether:aether_impl",
"//3rdparty/jvm/org/eclipse/aether:aether_spi",
"//3rdparty/jvm/org/eclipse/aether:aether_util",
"//3rdparty/jvm/org/eclipse/sisu:org_eclipse_sisu_plexus",
":maven_model",
":maven_model_builder",
":maven_repository_metadata"],
visibility = ["//visibility:public"])

java_library(name = "maven_model",
exports = ["//external:jar/org/apache/maven/maven_model"],
visibility = ["//visibility:public"])

java_library(name = "maven_model_builder",
exports = ["//3rdparty/jvm/org/codehaus/plexus:plexus_interpolation",
"//external:jar/org/apache/maven/maven_model_builder"],
exports = ["//external:jar/org/apache/maven/maven_model_builder"],
runtime_deps = ["//3rdparty/jvm/org/codehaus/plexus:plexus_interpolation"],
visibility = ["//visibility:public"])

java_library(name = "maven_repository_metadata",
Expand Down
36 changes: 18 additions & 18 deletions 3rdparty/jvm/org/eclipse/aether/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,37 @@ java_library(name = "aether_api",
visibility = ["//visibility:public"])

java_library(name = "aether_connector_basic",
exports = ["//external:jar/org/eclipse/aether/aether_connector_basic",
":aether_api",
":aether_spi",
":aether_util"],
exports = ["//external:jar/org/eclipse/aether/aether_connector_basic"],
runtime_deps = [":aether_api",
":aether_spi",
":aether_util"],
visibility = ["//visibility:public"])

java_library(name = "aether_impl",
exports = ["//external:jar/org/eclipse/aether/aether_impl",
":aether_api",
":aether_spi",
":aether_util"],
exports = ["//external:jar/org/eclipse/aether/aether_impl"],
runtime_deps = [":aether_api",
":aether_spi",
":aether_util"],
visibility = ["//visibility:public"])

java_library(name = "aether_spi",
exports = ["//external:jar/org/eclipse/aether/aether_spi"],
visibility = ["//visibility:public"])

java_library(name = "aether_transport_file",
exports = ["//external:jar/org/eclipse/aether/aether_transport_file",
":aether_api",
":aether_spi",
":aether_util"],
exports = ["//external:jar/org/eclipse/aether/aether_transport_file"],
runtime_deps = [":aether_api",
":aether_spi",
":aether_util"],
visibility = ["//visibility:public"])

java_library(name = "aether_transport_http",
exports = ["//3rdparty/jvm/org/apache/httpcomponents:httpclient",
"//3rdparty/jvm/org/slf4j:jcl_over_slf4j",
"//external:jar/org/eclipse/aether/aether_transport_http",
":aether_api",
":aether_spi",
":aether_util"],
exports = ["//external:jar/org/eclipse/aether/aether_transport_http"],
runtime_deps = ["//3rdparty/jvm/org/apache/httpcomponents:httpclient",
"//3rdparty/jvm/org/slf4j:jcl_over_slf4j",
":aether_api",
":aether_spi",
":aether_util"],
visibility = ["//visibility:public"])

java_library(name = "aether_util",
Expand Down
14 changes: 7 additions & 7 deletions 3rdparty/jvm/org/eclipse/sisu/BUILD
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
java_library(name = "org_eclipse_sisu_inject",
exports = ["//3rdparty/jvm/asm:asm",
"//external:jar/org/eclipse/sisu/org_eclipse_sisu_inject"],
exports = ["//external:jar/org/eclipse/sisu/org_eclipse_sisu_inject"],
runtime_deps = ["//3rdparty/jvm/asm:asm"],
visibility = ["//visibility:public"])

java_library(name = "org_eclipse_sisu_plexus",
exports = ["//3rdparty/jvm/com/google/guava:guava",
"//3rdparty/jvm/javax/enterprise:cdi_api",
"//3rdparty/jvm/org/codehaus/plexus:plexus_classworlds",
"//external:jar/org/eclipse/sisu/org_eclipse_sisu_plexus",
":org_eclipse_sisu_inject"],
exports = ["//external:jar/org/eclipse/sisu/org_eclipse_sisu_plexus"],
runtime_deps = ["//3rdparty/jvm/com/google/guava:guava",
"//3rdparty/jvm/javax/enterprise:cdi_api",
"//3rdparty/jvm/org/codehaus/plexus:plexus_classworlds",
":org_eclipse_sisu_inject"],
visibility = ["//visibility:public"])
8 changes: 4 additions & 4 deletions 3rdparty/jvm/org/scalacheck/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
scala_library(name = "scalacheck",
exports = ["//3rdparty/jvm/org/scala_lang/modules:scala_parser_combinators",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//3rdparty/jvm/org/scala_sbt:test_interface",
"//external:jar/org/scalacheck/scalacheck_2_11"],
exports = ["//external:jar/org/scalacheck/scalacheck_2_11"],
runtime_deps = ["//3rdparty/jvm/org/scala_lang/modules:scala_parser_combinators",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//3rdparty/jvm/org/scala_sbt:test_interface"],
visibility = ["//visibility:public"])
4 changes: 2 additions & 2 deletions 3rdparty/jvm/org/slf4j/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
java_library(name = "jcl_over_slf4j",
exports = ["//external:jar/org/slf4j/jcl_over_slf4j",
":slf4j_api"],
exports = ["//external:jar/org/slf4j/jcl_over_slf4j"],
runtime_deps = [":slf4j_api"],
visibility = ["//visibility:public"])

java_library(name = "slf4j_api",
Expand Down
40 changes: 20 additions & 20 deletions 3rdparty/jvm/org/typelevel/BUILD
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
scala_library(name = "cats_core",
exports = ["//3rdparty/jvm/com/github/mpilquist:simulacrum",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//external:jar/org/typelevel/cats_core_2_11",
":cats_kernel",
":cats_macros",
":machinist"],
exports = ["//external:jar/org/typelevel/cats_core_2_11",
":cats_kernel"],
runtime_deps = ["//3rdparty/jvm/com/github/mpilquist:simulacrum",
"//3rdparty/jvm/org/scala_lang:scala_library",
":cats_macros",
":machinist"],
visibility = ["//visibility:public"])

scala_library(name = "cats_free",
exports = ["//3rdparty/jvm/com/github/mpilquist:simulacrum",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//external:jar/org/typelevel/cats_free_2_11",
":cats_core",
":cats_macros",
":machinist"],
exports = ["//external:jar/org/typelevel/cats_free_2_11"],
runtime_deps = ["//3rdparty/jvm/com/github/mpilquist:simulacrum",
"//3rdparty/jvm/org/scala_lang:scala_library",
":cats_core",
":cats_macros",
":machinist"],
visibility = ["//visibility:public"])

scala_library(name = "cats_kernel",
exports = ["//3rdparty/jvm/org/scala_lang:scala_library",
"//external:jar/org/typelevel/cats_kernel_2_11"],
exports = ["//external:jar/org/typelevel/cats_kernel_2_11"],
runtime_deps = ["//3rdparty/jvm/org/scala_lang:scala_library"],
visibility = ["//visibility:public"])

scala_library(name = "cats_macros",
exports = ["//3rdparty/jvm/com/github/mpilquist:simulacrum",
"//3rdparty/jvm/org/scala_lang:scala_library",
"//external:jar/org/typelevel/cats_macros_2_11",
":machinist"],
exports = ["//external:jar/org/typelevel/cats_macros_2_11"],
runtime_deps = ["//3rdparty/jvm/com/github/mpilquist:simulacrum",
"//3rdparty/jvm/org/scala_lang:scala_library",
":machinist"],
visibility = ["//visibility:public"])

scala_library(name = "machinist",
exports = ["//3rdparty/jvm/org/scala_lang:scala_reflect",
"//external:jar/org/typelevel/machinist_2_11"],
exports = ["//external:jar/org/typelevel/machinist_2_11"],
runtime_deps = ["//3rdparty/jvm/org/scala_lang:scala_reflect"],
visibility = ["//visibility:public"])

scala_library(name = "macro_compat",
Expand Down
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ dependencies:
Each group id can only appear once, so you should collocate dependencies by group.

### <a name="options">Options</a>
In the options, we set the allowed languages (and in the case of scala, the version).
In the options we set:

* languages: java and scala
* versionConflictPolicy: `fixed`, `fail` or `highest`
* transitivity: `runtime_deps` or `exports`
* resolvers: the maven servers to use.

In the default case, with no options given, we use the `highest` versionConflictPolicy,
allow java and scala `2.11`, and use maven central as the resolver.
exports transitivity, allow java and scala `2.11`, and use maven central as the resolver.

### <a name="replacements">Replacements</a>
Some maven jars should not be used and instead are replaced by internal targets. Here are
Expand Down
19 changes: 17 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
options:
languages: ["java", "scala:2.11.8"]
versionConflictPolicy: highest
transitivity: runtime_deps
resolvers:
- id: mavencentral
type: default
Expand All @@ -16,8 +17,16 @@ dependencies:
io.circe:
circe:
version: "0.5.0-M2"
modules: [core, generic, jackson, parser]
modules: [core, jackson, parser]
lang: scala
circe-generic:
version: "0.5.0-M2"
lang: scala
exports:
- "com.chuusai:shapeless"
- "org.typelevel:cats-core"
- "org.typelevel:cats-kernel"
- "org.typelevel:macro-compat"

org.apache.maven:
maven-aether-provider:
Expand All @@ -38,7 +47,12 @@ dependencies:
cats:
version: 0.6.0
lang: scala
modules: [core, kernel, macros, free]
modules: [kernel, macros, free]
cats-core:
version: 0.6.0
lang: scala
exports: ["org.typelevel:cats-kernel"]

macro-compat:
lang: scala

Expand All @@ -49,6 +63,7 @@ dependencies:
com.github.mpilquist:
simulacrum:
lang: scala # not using explicitly, declaring as scala
exports: ["org.typelevel:macro-compat"]

replacements:
org.scala-lang:
Expand Down
11 changes: 9 additions & 2 deletions src/scala/com/github/johnynek/bazel_deps/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ scala_repl(name = "repl",
scala_library(name = "resolver",
srcs = ["Resolver.scala"],
deps = [
"//3rdparty/jvm/org/apache/maven:maven_aether_provider",
"//3rdparty/jvm/org/apache/maven:maven_aether_provider",
"//3rdparty/jvm/org/eclipse/aether:aether_api",
"//3rdparty/jvm/org/eclipse/aether:aether_spi",
"//3rdparty/jvm/org/eclipse/aether:aether_connector_basic",
"//3rdparty/jvm/org/eclipse/aether:aether_impl",
"//3rdparty/jvm/org/eclipse/aether:aether_transport_file",
Expand All @@ -25,7 +26,10 @@ scala_library(name = "resolver",

scala_library(name = "io",
srcs = ["IO.scala"],
deps = ["//3rdparty/jvm/org/typelevel:cats_free"],
deps = [
"//3rdparty/jvm/org/typelevel:cats_core",
"//3rdparty/jvm/org/typelevel:cats_free"
],
visibility = ["//visibility:public"])

scala_library(name = "normalizer",
Expand Down Expand Up @@ -77,8 +81,11 @@ scala_binary(name = "parseproject",
scala_library(name = "circeyaml",
srcs = ["CirceYaml.scala"],
deps = [
"//3rdparty/jvm/org/typelevel:cats_core",
"//3rdparty/jvm/io/circe:circe_core",
"//3rdparty/jvm/io/circe:circe_jackson",
"//3rdparty/jvm/com/fasterxml/jackson/core:jackson_core",
"//3rdparty/jvm/com/fasterxml/jackson/core:jackson_databind",
"//3rdparty/jvm/com/fasterxml/jackson/dataformat:jackson_dataformat_yaml",
],
visibility = ["//visibility:public"])
Expand Down
Loading

0 comments on commit 80f0abd

Please sign in to comment.