-
-
Notifications
You must be signed in to change notification settings - Fork 286
[discussion] Scala 2.12 support #251
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
Changes from all commits
705032d
e4276a9
30c0bdc
c23c422
18c54ee
cd4d3d6
bca505c
055b33e
55fd807
a2895c1
31e8e1f
5ef84d9
1c8cb77
f903c9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
java_library(name = "transitive_scalatest", exports = ["@scalatest//jar", "@scalactic//jar"]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this still needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think so. That's what actually creates a target that depends on scalatest and scalactic. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -972,7 +972,7 @@ scala_repl = rule( | |
|
||
def scala_version(): | ||
"""return the scala version for use in maven coordinates""" | ||
return "2.11" | ||
return "2.12" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wouldn't this be a problem? Don't we need to solve #80 (cross building) before merging this PR? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd probably go with the 2.12-specific branch for now and consolidate both when #80 is solved. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see. Main issue to consider is that we're in a few months of adding a host of new features to master so you'll need to catch up if we ever want to merge it in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A branch is okay, but I share ittaiz anxiety about a long lived branch. I hope we can very quickly get the version configurable. |
||
|
||
def scala_mvn_artifact(artifact): | ||
gav = artifact.split(":") | ||
|
@@ -985,13 +985,13 @@ SCALA_BUILD_FILE = """ | |
# scala.BUILD | ||
java_import( | ||
name = "scala-xml", | ||
jars = ["lib/scala-xml_2.11-1.0.5.jar"], | ||
jars = ["lib/scala-xml_2.12-1.0.6.jar"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
java_import( | ||
name = "scala-parser-combinators", | ||
jars = ["lib/scala-parser-combinators_2.11-1.0.4.jar"], | ||
jars = ["lib/scala-parser-combinators_2.12-1.0.6.jar"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
|
@@ -1012,22 +1012,35 @@ java_import( | |
jars = ["lib/scala-reflect.jar"], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
java_library( | ||
name = "transitive_scalatest", | ||
exports = ["@scalatest//jar", "@scalactic//jar"], | ||
visibility = ["//visibility:public"], | ||
) | ||
""" | ||
|
||
def scala_repositories(): | ||
native.new_http_archive( | ||
name = "scala", | ||
strip_prefix = "scala-2.11.11", | ||
sha256 = "12037ca64c68468e717e950f47fc77d5ceae5e74e3bdca56f6d02fd5bfd6900b", | ||
url = "https://downloads.lightbend.com/scala/2.11.11/scala-2.11.11.tgz", | ||
strip_prefix = "scala-2.12.3", | ||
sha256 = "2b796ab773fbedcc734ba881a6486d54180b699ade8ba7493e91912044267c8c", | ||
url = "https://downloads.lightbend.com/scala/2.12.3/scala-2.12.3.tgz", | ||
build_file_content = SCALA_BUILD_FILE, | ||
) | ||
|
||
# scalatest has macros, note http_jar is invoking ijar | ||
native.http_jar( | ||
name = "scalatest", | ||
url = "http://mirror.bazel.build/oss.sonatype.org/content/groups/public/org/scalatest/scalatest_2.11/2.2.6/scalatest_2.11-2.2.6.jar", | ||
sha256 = "f198967436a5e7a69cfd182902adcfbcb9f2e41b349e1a5c8881a2407f615962", | ||
url = "http://oss.sonatype.org/content/groups/public/org/scalatest/scalatest_2.12/3.0.3/scalatest_2.12-3.0.3.jar", | ||
sha256 = "353f7c2bdde22c4286ee6a3ae0e425a9463b102f4c4cf76055a24f4666996762", | ||
) | ||
|
||
# scalatest has macros, note http_jar is invoking ijar | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't understand how the comment and the code fit together. Doesn't the ijar mess things up? I hope to send late next week a PR to add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code predates me and I don't understand how all pieces fit together, either. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ijar destroys macros because it removes all code attributes from the jars. So if a dependency has macros it cannot filter through ijar. One approach to solve this, is as ittaiz said, just build a I don't know how what you have here can actually be working since it seems like you are stripping the macros, but maybe it isn't working yet. |
||
native.http_jar( | ||
name = "scalactic", | ||
url = "https://oss.sonatype.org/content/groups/public/org/scalactic/scalactic_2.12/3.0.3/scalactic_2.12-3.0.3.jar", | ||
sha256 = "245ad1baab6661aee70c137c5e1625771c2624596b349b305801d94618673292", | ||
) | ||
|
||
native.maven_server( | ||
|
@@ -1065,7 +1078,7 @@ def scala_repositories(): | |
|
||
native.bind(name = "io_bazel_rules_scala/dependency/scala/scala_xml", actual = "@scala//:scala-xml") | ||
|
||
native.bind(name = "io_bazel_rules_scala/dependency/scalatest/scalatest", actual = "@scalatest//jar") | ||
native.bind(name = "io_bazel_rules_scala/dependency/scalatest/scalatest", actual = "@scala//:transitive_scalatest") | ||
|
||
def _sanitize_string_for_usage(s): | ||
res_array = [] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,8 +8,8 @@ def tut_repositories(): | |
|
||
native.maven_jar( | ||
name = "io_bazel_rules_scala_org_tpolecat_tut_core", | ||
artifact = "org.tpolecat:tut-core_2.11:0.4.8", | ||
sha1 = "fc723eb822494580cc05d6b3b3a6039d2280a5a0", | ||
artifact = "org.tpolecat:tut-core_2.12:0.4.8", | ||
sha1 = "b68b5a52474bf249d1156f5002033498054b813c", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. similar comment about a |
||
server = "tut_repositories_maven_server", | ||
) | ||
native.bind(name = 'io_bazel_rules_scala/dependency/tut/tut_core', actual = '@io_bazel_rules_scala_org_tpolecat_tut_core//jar') | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ load("//scala:scala.bzl", | |
def twitter_scrooge(): | ||
native.maven_server( | ||
name = "twitter_scrooge_maven_server", | ||
url = "http://mirror.bazel.build/repo1.maven.org/maven2/", | ||
url = "http://repo1.maven.org/maven2/", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove the mirror? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It wasn't intentional, I think. Probably a hasty copy&paste. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if you could factor this currently into a second function: |
||
) | ||
|
||
native.maven_jar( | ||
|
@@ -22,33 +22,33 @@ def twitter_scrooge(): | |
|
||
native.maven_jar( | ||
name = "scrooge_core", | ||
artifact = scala_mvn_artifact("com.twitter:scrooge-core:4.6.0"), | ||
sha1 = "84b86c2e082aba6e0c780b3c76281703b891a2c8", | ||
artifact = scala_mvn_artifact("com.twitter:scrooge-core:4.18.0"), | ||
sha1 = "8a10e4da9fd636a8225a5068aa0b57072142a30b", | ||
server = "twitter_scrooge_maven_server", | ||
) | ||
native.bind(name = 'io_bazel_rules_scala/dependency/thrift/scrooge_core', actual = '@scrooge_core//jar') | ||
|
||
#scrooge-generator related dependencies | ||
native.maven_jar( | ||
name = "scrooge_generator", | ||
artifact = scala_mvn_artifact("com.twitter:scrooge-generator:4.6.0"), | ||
sha1 = "cacf72eedeb5309ca02b2d8325c587198ecaac82", | ||
artifact = scala_mvn_artifact("com.twitter:scrooge-generator:4.18.0"), | ||
sha1 = "d456f18b5c478b6356e2e09f4be4784cd4f05765", | ||
server = "twitter_scrooge_maven_server", | ||
) | ||
native.bind(name = 'io_bazel_rules_scala/dependency/thrift/scrooge_generator', actual = '@scrooge_generator//jar') | ||
|
||
native.maven_jar( | ||
name = "util_core", | ||
artifact = scala_mvn_artifact("com.twitter:util-core:6.33.0"), | ||
sha1 = "bb49fa66a3ca9b7db8cd764d0b26ce498bbccc83", | ||
artifact = scala_mvn_artifact("com.twitter:util-core:6.45.0"), | ||
sha1 = "d7bbc819d90d06dfd4c76c25b82869b27048c886", | ||
server = "twitter_scrooge_maven_server", | ||
) | ||
native.bind(name = 'io_bazel_rules_scala/dependency/thrift/util_core', actual = '@util_core//jar') | ||
|
||
native.maven_jar( | ||
name = "util_logging", | ||
artifact = scala_mvn_artifact("com.twitter:util-logging:6.33.0"), | ||
sha1 = "3d28e46f8ee3b7ad1b98a51b98089fc01c9755dd", | ||
artifact = scala_mvn_artifact("com.twitter:util-logging:6.45.0"), | ||
sha1 = "b83552e8980557b5dd767de40db1d44c3a39c400", | ||
server = "twitter_scrooge_maven_server", | ||
) | ||
native.bind(name = 'io_bazel_rules_scala/dependency/thrift/util_logging', actual = '@util_logging//jar') | ||
|
@@ -260,11 +260,13 @@ def scrooge_scala_library(name, deps=[], remote_jars=[], jvm_flags=[], visibilit | |
deps = deps + remote_jars + [ | ||
srcjar, | ||
"//external:io_bazel_rules_scala/dependency/thrift/libthrift", | ||
"//external:io_bazel_rules_scala/dependency/thrift/scrooge_core" | ||
"//external:io_bazel_rules_scala/dependency/thrift/scrooge_core", | ||
"//external:io_bazel_rules_scala/dependency/thrift/util_core", | ||
], | ||
exports = deps + remote_jars + [ | ||
"//external:io_bazel_rules_scala/dependency/thrift/libthrift", | ||
"//external:io_bazel_rules_scala/dependency/thrift/scrooge_core", | ||
"//external:io_bazel_rules_scala/dependency/thrift/util_core", | ||
], | ||
jvm_flags = jvm_flags, | ||
visibility = visibility, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can upgrade this one and the one below in mainline as well right? guessing they have a 2.11 version