-
-
Notifications
You must be signed in to change notification settings - Fork 286
added scala_toolchain with scalacopts support #364
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
ba42f7f
WIP - added scala_toolchain with scalacopts support - tests fail
or-shachar 7caf47c
[FAIL] use bazel-integration-testing framework to test toolchain
or-shachar 43ef090
Revert "[FAIL] use bazel-integration-testing framework to test toolch…
or-shachar 001dfa7
falling back to sh test instead
or-shachar 29f5ca1
added newline
or-shachar 2c8df83
better classname
or-shachar 0eeee2e
Fixed ident issue
or-shachar d228974
Fixed test_run.sh script
or-shachar 5ce24ac
rule scalac options should come after toolchain scalac options
or-shachar 23ea806
[FAILING] - added command line flag to set the scala_toolchain
or-shachar 077156e
removing prefix from toolchain flag
or-shachar d2eed4f
load default (empty) toolchain on WORKSPACE
or-shachar 69e70cf
removed `scala_` prefix from toolchain type and implementation
or-shachar 4028bb7
fixed merge conflicts
or-shachar 597e639
re-organized toolchain BUILD file
or-shachar e091a8a
Updated README.md
or-shachar 2c4e804
updated READEME.md
or-shachar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("//scala:scala_toolchain.bzl", "scala_toolchain") | ||
|
||
toolchain_type( | ||
name = "toolchain_type", | ||
visibility = ["//visibility:public"] | ||
) | ||
|
||
|
||
scala_toolchain( | ||
name = 'default_toolchain_impl', | ||
scalacopts = [], | ||
visibility = ["//visibility:public"] | ||
) | ||
|
||
|
||
toolchain( | ||
name = 'default_toolchain', | ||
toolchain_type = '@io_bazel_rules_scala//scala:toolchain_type', | ||
toolchain = ':default_toolchain_impl', | ||
visibility = ["//visibility:public"] | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
def _scala_toolchain_impl(ctx): | ||
toolchain = platform_common.ToolchainInfo( | ||
scalacopts = ctx.attr.scalacopts, | ||
) | ||
return [toolchain] | ||
|
||
scala_toolchain = rule( | ||
_scala_toolchain_impl, | ||
attrs = { | ||
'scalacopts': attr.string_list(), | ||
} | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
|
||
def scala_register_toolchains(): | ||
native.register_toolchains("@io_bazel_rules_scala//scala:default_toolchain") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
load("//scala:scala_toolchain.bzl", "scala_toolchain") | ||
load("//scala:scala.bzl", "scala_library") | ||
|
||
scala_toolchain( | ||
name = "failing_toolchain_impl", | ||
scalacopts = ["-Ywarn-unused"], | ||
visibility = ["//visibility:public"] | ||
) | ||
|
||
toolchain( | ||
name = "failing_scala_toolchain", | ||
toolchain_type = "@io_bazel_rules_scala//scala:toolchain_type", | ||
toolchain = "failing_toolchain_impl", | ||
visibility = ["//visibility:public"] | ||
) | ||
|
||
scala_library( | ||
name = "failing_build", | ||
srcs = ["ClassWithUnused.scala"], | ||
scalacopts = ["-Xfatal-warnings"] | ||
) |
8 changes: 8 additions & 0 deletions
8
test_expect_failure/scalacopts_from_toolchain/ClassWithUnused.scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package test_expect_failure.scalacopts_from_toolchain | ||
|
||
class ClassWithUnused(name:String){ | ||
def talk():String = { | ||
val unusedValue = "I am not used :-(" | ||
s"hello $name" | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
could we move the scala_library and scala_compiler jars here as well? Since, ultimately, that is how we will be able to switch from 2.11 to 2.12, etc...
Also, we might have default plugins here (since scala native and scala_js use plugins).