Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add fetch_source parameter to scala_repositories #1027

Merged
merged 2 commits into from
Apr 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ buildifier_dependencies()

load("//scala:scala.bzl", "scala_repositories")

scala_repositories()
scala_repositories(fetch_sources = True)

load("//scala:scala_cross_version.bzl", "default_maven_server_urls")
load("//scala:scala_maven_import_external.bzl", "scala_maven_import_external")
Expand Down
10 changes: 9 additions & 1 deletion scala/private/macros/scala_repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ def scala_repositories(
_default_scala_version_jar_shas(),
),
maven_servers = _default_maven_server_urls(),
scala_extra_jars = _default_scala_extra_jars()):
scala_extra_jars = _default_scala_extra_jars(),
fetch_sources = False):
(scala_version, scala_version_jar_shas) = scala_version_shas
major_version = _extract_major_version(scala_version)

_new_scala_default_repository(
maven_servers = maven_servers,
scala_version = scala_version,
scala_version_jar_shas = scala_version_jar_shas,
fetch_sources = fetch_sources,
)

scala_version_extra_jars = scala_extra_jars[major_version]
Expand All @@ -79,6 +81,7 @@ def scala_repositories(
artifact_sha256 = scala_version_extra_jars["scalatest"]["sha256"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)
_scala_maven_import_external(
name = "io_bazel_rules_scala_scalactic",
Expand All @@ -89,6 +92,7 @@ def scala_repositories(
artifact_sha256 = scala_version_extra_jars["scalactic"]["sha256"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)

_scala_maven_import_external(
Expand All @@ -100,6 +104,7 @@ def scala_repositories(
artifact_sha256 = scala_version_extra_jars["scala_xml"]["sha256"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)

_scala_maven_import_external(
Expand All @@ -112,6 +117,7 @@ def scala_repositories(
artifact_sha256 = scala_version_extra_jars["scala_parser_combinators"]["sha256"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)

# used by ScalacProcessor
Expand All @@ -121,6 +127,7 @@ def scala_repositories(
artifact_sha256 = "f877d304660ac2a142f3865badfc971dec7ed73c747c7f8d5d2f5139ca736513",
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)

_scala_maven_import_external(
Expand All @@ -129,6 +136,7 @@ def scala_repositories(
artifact_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480",
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)

if not native.existing_rule("com_google_protobuf"):
Expand Down
6 changes: 5 additions & 1 deletion scala/scala_cross_version.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -64,25 +64,29 @@ def scala_mvn_artifact(
def new_scala_default_repository(
scala_version,
scala_version_jar_shas,
maven_servers):
maven_servers,
fetch_sources):
_scala_maven_import_external(
name = "io_bazel_rules_scala_scala_library",
artifact = "org.scala-lang:scala-library:{}".format(scala_version),
artifact_sha256 = scala_version_jar_shas["scala_library"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)
_scala_maven_import_external(
name = "io_bazel_rules_scala_scala_compiler",
artifact = "org.scala-lang:scala-compiler:{}".format(scala_version),
artifact_sha256 = scala_version_jar_shas["scala_compiler"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)
_scala_maven_import_external(
name = "io_bazel_rules_scala_scala_reflect",
artifact = "org.scala-lang:scala-reflect:{}".format(scala_version),
artifact_sha256 = scala_version_jar_shas["scala_reflect"],
licenses = ["notice"],
server_urls = maven_servers,
fetch_sources = fetch_sources,
)
9 changes: 6 additions & 3 deletions test_version/WORKSPACE.template
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ scala_version = "${scala_version}"

load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")

scala_repositories((scala_version, {
${scala_version_shas}
}))
scala_repositories(
(scala_version, {
${scala_version_shas}
}),
fetch_sources = True
)

load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library")

Expand Down