Skip to content

Commit 4afc7ab

Browse files
natansilittaiz
authored andcommitted
Scala maven import external (#473)
* original jave_import_external * allow for direct jar file usage in dependencies * change java_import to scala_import * replace jar_urls with artifact + server_urls * remove filegroup target and use maven_jar for specific places that need files directly. an issue will be open for scala_import to support direct file output * rename to scala_maven_import_external. still need to decide on splitting to jvm_import_external/maven_import_external * _concat_with_needed_slash * fix typo * add 'return' in new method * extract common code to 'jvm_import_external' rule. introduce macros for 'scala_maven_import_external', 'maven_import_external', 'java_import_external' * CR changes * added documentation * moved license notice back to the top
1 parent b64c230 commit 4afc7ab

File tree

7 files changed

+403
-11
lines changed

7 files changed

+403
-11
lines changed

WORKSPACE

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ maven_jar(
4343

4444
# test of strict deps (scalac plugin UT + E2E)
4545
maven_jar(
46-
name = "com_google_guava_guava_21_0",
46+
name = "com_google_guava_guava_21_0_with_file",
4747
artifact = "com.google.guava:guava:21.0",
4848
sha1 = "3a3d111be1be1b745edfa7d91678a12d7ed38709"
4949
)
@@ -83,3 +83,24 @@ filegroup(
8383

8484
load("@io_bazel_rules_scala//scala:toolchains.bzl","scala_register_toolchains")
8585
scala_register_toolchains()
86+
87+
load("//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "java_import_external")
88+
scala_maven_import_external(
89+
name = "com_google_guava_guava_21_0",
90+
licenses = ["notice"], # Apache 2.0
91+
artifact = "com.google.guava:guava:21.0",
92+
server_urls = ["https://mirror.bazel.build/repo1.maven.org/maven2"],
93+
jar_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480",
94+
)
95+
96+
# bazel's java_import_external has been altered in rules_scala to be a macro based on jvm_import_external
97+
# in order to allow for other jvm-language imports (e.g. scala_import)
98+
# the 3rd-party dependency below is using the java_import_external macro
99+
# in order to make sure no regression with the original java_import_external
100+
load("//scala:scala_maven_import_external.bzl", "java_import_external")
101+
java_import_external(
102+
name = "org_apache_commons_commons_lang_3_5_without_file",
103+
licenses = ["notice"], # Apache 2.0
104+
jar_urls = ["http://central.maven.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"],
105+
jar_sha256 = "8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c",
106+
)

0 commit comments

Comments
 (0)