File tree Expand file tree Collapse file tree 7 files changed +45
-13
lines changed Expand file tree Collapse file tree 7 files changed +45
-13
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,4 @@ before_install:
2323 - cat ~/.bazelrc >> .bazelrc
2424
2525script :
26- - bazel build test/...
27- - bazel run test:ScalaBinary
28- - bazel test test/...
26+ - bash test_run.sh
Original file line number Diff line number Diff line change @@ -26,12 +26,16 @@ def _adjust_resources_path(path):
2626 return dir_1 + dir_2 , rel_path
2727 return "" , path
2828
29- def _build_nosrc_jar (ctx , buildijar ):
29+ def _add_resources_cmd (ctx ):
3030 res_cmd = ""
3131 for f in ctx .files .resources :
3232 c_dir , res_path = _adjust_resources_path (f .path )
3333 change_dir = "-C " + c_dir if c_dir else ""
34- res_cmd = "\n {jar} uf {out} " + change_dir + " " + res_path
34+ res_cmd += "\n {jar} uf {out} " + change_dir + " " + res_path
35+ return res_cmd
36+
37+ def _build_nosrc_jar (ctx , buildijar ):
38+ res_cmd = _add_resources_cmd (ctx )
3539 ijar_cmd = ""
3640 if buildijar :
3741 ijar_cmd = "\n cp {out} {ijar_out}" .format (
@@ -61,11 +65,7 @@ touch -t 198001010000 {manifest}
6165 arguments = [])
6266
6367def _compile (ctx , jars , buildijar ):
64- res_cmd = ""
65- for f in ctx .files .resources :
66- c_dir , res_path = _adjust_resources_path (f .path )
67- change_dir = "-C " + c_dir if c_dir else ""
68- res_cmd = "\n {jar} uf {out} " + change_dir + " " + res_path
68+ res_cmd = _add_resources_cmd (ctx )
6969 ijar_cmd = ""
7070 if buildijar :
7171 ijar_cmd = "\n {ijar} {out} {ijar_out}" .format (
Original file line number Diff line number Diff line change @@ -14,7 +14,18 @@ java_binary(
1414# For now, we have to use a java_import proxy.
1515java_import (
1616 name = "lib_import" ,
17- jars = [":HelloLib_deploy.jar" ],
17+ # these are the outputs of the scala_library targets
18+ jars = [":HelloLib_deploy.jar" ,
19+ "OtherLib_deploy.jar" ,
20+ "Exported_deploy.jar" ,
21+ "Runtime_deploy.jar" ,
22+ ],
23+ runtime_deps = ["org_scala_lang__scala_library" , "OtherJavaLib" ]
24+ )
25+
26+ java_import (
27+ name = "org_scala_lang__scala_library" ,
28+ jars = ["@scala//:lib/scala-library.jar" ]
1829)
1930
2031scala_binary (
@@ -79,7 +90,7 @@ java_library(
7990scala_library (
8091 name = "ScalaLibResources" ,
8192 srcs = ["src/main/scala/scala/test/ScalaLibResources.scala" ],
82- resources = ["src/main/resources/scala/test/hellos" ],
93+ resources = ["src/main/resources/scala/test/hellos" , "src/main/resources/scala/test/byes" ],
8394)
8495
8596scala_binary (
Original file line number Diff line number Diff line change 1+ see ya
2+ later
3+ A hui hou
Original file line number Diff line number Diff line change @@ -17,5 +17,6 @@ package scala.test
1717object ScalaLibBinary {
1818 def main (args: Array [String ]) {
1919 ScalaLibResources .getGreetings foreach println
20+ ScalaLibResources .getFarewells foreach println
2021 }
2122}
Original file line number Diff line number Diff line change 1515package scala .test
1616
1717object ScalaLibResources {
18- def getGreetings () = scala.io.Source .fromInputStream(getClass.getResourceAsStream(" hellos" )).getLines.toList
18+ def getGreetings () =
19+ scala.io.Source
20+ .fromInputStream(getClass.getResourceAsStream(" hellos" ))
21+ .getLines
22+ .toList
23+
24+ def getFarewells () =
25+ scala.io.Source
26+ .fromInputStream(getClass.getResourceAsStream(" byes" ))
27+ .getLines
28+ .toList
1929}
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -e
4+
5+ bazel build test/... \
6+ && bazel run test:ScalaBinary \
7+ && bazel run test:ScalaLibBinary \
8+ && bazel run test:JavaBinary \
9+ && bazel test test/...
You can’t perform that action at this time.
0 commit comments