-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
116 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,22 @@ | ||
load( | ||
"//test/phase:customizability_test.bzl", | ||
"add_phase_customizability_test_singleton", | ||
"customizability_test_scala_binary", | ||
"customizability_test_scala_library", | ||
) | ||
|
||
add_phase_customizability_test_singleton( | ||
name = "phase_customizability_test", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
customizability_test_scala_binary( | ||
name = "HelloBinary", | ||
srcs = ["HelloBinary.scala"], | ||
main_class = "scalarules.test.phase.HelloBinary", | ||
) | ||
|
||
customizability_test_scala_library( | ||
name = "HelloLibrary", | ||
srcs = ["HelloLibrary.scala"], | ||
) |
This file contains 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 scalarules.test.phase | ||
|
||
object HelloBinary { | ||
def main(args: Array[String]) { | ||
println("You can customize binary phases!") | ||
} | ||
} |
This file contains 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,5 @@ | ||
package scalarules.test.phase | ||
|
||
object HelloLibrary { | ||
println("You can customize library phases!") | ||
} |
This file contains 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,35 @@ | ||
load( | ||
"//scala:providers.bzl", | ||
_ScalaRulePhase = "ScalaRulePhase", | ||
) | ||
load( | ||
"//test/phase:phase_customizability_test.bzl", | ||
_phase_customizability_test = "phase_customizability_test", | ||
) | ||
load( | ||
"//scala:scala.bzl", | ||
_make_scala_binary = "make_scala_binary", | ||
_make_scala_library = "make_scala_library", | ||
) | ||
|
||
ext_add_phase_customizability_test = { | ||
"phase_providers": [ | ||
"//test/phase:phase_customizability_test", | ||
], | ||
} | ||
|
||
def _add_phase_customizability_test_singleton_implementation(ctx): | ||
return [ | ||
_ScalaRulePhase( | ||
phases = [ | ||
("-", "coda", "customizability_test", _phase_customizability_test), | ||
], | ||
), | ||
] | ||
|
||
add_phase_customizability_test_singleton = rule( | ||
implementation = _add_phase_customizability_test_singleton_implementation, | ||
) | ||
|
||
customizability_test_scala_binary = _make_scala_binary(ext_add_phase_customizability_test) | ||
customizability_test_scala_library = _make_scala_library(ext_add_phase_customizability_test) |
This file contains 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 @@ | ||
# | ||
# PHASE: customizability test | ||
# | ||
# A dummy test phase to make sure rules are customizable | ||
# | ||
def phase_customizability_test(ctx, p): | ||
print("customizable phase") |
This file contains 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 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,20 @@ | ||
# shellcheck source=./test_runner.sh | ||
dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
. "${dir}"/test_runner.sh | ||
. "${dir}"/test_helper.sh | ||
runner=$(get_test_runner "${1:-local}") | ||
|
||
test_binary_with_extra_phase() { | ||
action_should_contain_message \ | ||
"customizable phase" \ | ||
build //test/phase:HelloBinary | ||
} | ||
|
||
test_library_with_extra_phase() { | ||
action_should_contain_message \ | ||
"customizable phase" \ | ||
build //test/phase:HelloLibrary | ||
} | ||
|
||
$runner test_binary_with_extra_phase | ||
$runner test_library_with_extra_phase |
This file contains 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