-
-
Notifications
You must be signed in to change notification settings - Fork 286
Add defs.bzl with core rules and notice about evolving APIs #955
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
ittaiz
merged 3 commits into
bazel-contrib:master
from
andyscott:andyscott/introduce-defs-bzl
Jan 29, 2020
Merged
Changes from 1 commit
Commits
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
""" | ||
Starlark rules for building Scala projects. | ||
|
||
These are the core rules under active development. Their APIs are | ||
not guaranteed stable and we anticipate some breaking changes. | ||
|
||
We do not recommend using these APIs for production codebases. Instead, | ||
use the stable rules exported by scala.bzl: | ||
|
||
``` | ||
load( | ||
"@io_bazel_rules_scala//scala:scala.bzl", | ||
"scala_library", | ||
"scala_binary", | ||
"scala_test" | ||
) | ||
``` | ||
|
||
""" | ||
|
||
load( | ||
"@io_bazel_rules_scala//scala/private:rules/scala_binary.bzl", | ||
_make_scala_binary = "make_scala_binary", | ||
) | ||
load( | ||
"@io_bazel_rules_scala//scala/private:rules/scala_library.bzl", | ||
_make_scala_library = "make_scala_library", | ||
) | ||
load( | ||
"@io_bazel_rules_scala//scala/private:rules/scala_test.bzl", | ||
_make_scala_test = "make_scala_test", | ||
) | ||
|
||
make_scala_library = _make_scala_library | ||
make_scala_binary = _make_scala_binary | ||
make_scala_test = _make_scala_test | ||
|
||
scala_library = _make_scala_library() | ||
scala_binary = _make_scala_binary() | ||
scala_test = _make_scala_test() |
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,27 @@ | ||
load( | ||
"//scala:defs.bzl", | ||
"scala_binary", | ||
"scala_library", | ||
"scala_test", | ||
) | ||
|
||
scala_binary( | ||
name = "binary", | ||
srcs = ["binary.scala"], | ||
main_class = "test.v2.Binary", | ||
deps = [":library"], | ||
) | ||
|
||
scala_library( | ||
name = "library", | ||
srcs = ["library.scala"], | ||
deps = [], | ||
) | ||
|
||
scala_test( | ||
name = "test", | ||
srcs = ["test.scala"], | ||
deps = [ | ||
":library", | ||
], | ||
) |
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,7 @@ | ||
package test.v2 | ||
|
||
object Binary { | ||
def main(args: Array[String]): Unit = { | ||
println(s"${Library.method1} ${Library.method2}") | ||
} | ||
} |
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,6 @@ | ||
package test.v2 | ||
|
||
object Library { | ||
def method1(): String = "hello" | ||
def method2(): String = "world" | ||
} |
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,13 @@ | ||
package test.v2 | ||
|
||
import org.scalatest.FunSuite | ||
|
||
class Test extends FunSuite { | ||
test("method1") { | ||
assert(Library.method1 == "hello") | ||
} | ||
|
||
test("method2") { | ||
assert(Library.method2 == "world") | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
I believe these 6 APIs should be exported.
Right now it's the same exact thing exported by
scala.bzl
+ the advance usage helpers, but they will likely deviate as we explore adding new functionality.