From d27e73fd415cbd31ad9dfbe4be4dfd8b5de07b67 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 13 Jun 2018 16:34:37 -0700 Subject: [PATCH 01/63] WIP compile using worker supplied from provider * Provider[ScalaWorker] contains (will contain) everything needed to run a specific version of the scala compiler * Manually create ScalaWorker for 2.11/2.12 --- scala/private/rule_impls.bzl | 9 ++- scala/providers.bzl | 23 ++++++ scala/scala.bzl | 76 ++++++++++++++++++- src/java/io/bazel/rulesscala/scalac/BUILD | 21 +++++ .../rulesscala/scalac/ScalacProcessor.java | 1 + test/crossbuild/BUILD | 11 +++ test/crossbuild/HelloWorldLib.scala | 12 +++ test/crossbuild/test | 22 ++++++ 8 files changed, 170 insertions(+), 5 deletions(-) create mode 100644 test/crossbuild/BUILD create mode 100644 test/crossbuild/HelloWorldLib.scala create mode 100755 test/crossbuild/test diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index d8df45262..c2c63b8ac 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -14,7 +14,7 @@ """Rules for supporting the Scala language.""" load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain") -load("@io_bazel_rules_scala//scala:providers.bzl", "create_scala_provider") +load("@io_bazel_rules_scala//scala:providers.bzl", "create_scala_provider", _ScalaWorker = "ScalaWorker") load(":common.bzl", "add_labels_of_jars_to", "create_java_provider", @@ -264,10 +264,13 @@ StatsfileOutput: {statsfile_output} [ctx.outputs.manifest, ctx.executable._ijar, argfile]) + worker = ctx.attr.scalaworker[_ScalaWorker] + _, _, input_manifests = ctx.resolve_command(tools = [worker.scalac]) ctx.actions.run( inputs=ins, outputs=outs, - executable=ctx.executable._scalac, + executable=worker.scalac.files_to_run.executable, + input_manifests=input_manifests, mnemonic="Scalac", progress_message="scala %s" % ctx.label, execution_requirements={"supports-workers": "1"}, @@ -502,7 +505,7 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], extra_runtime_deps = []) dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) # Get jars from deps - auto_deps = [ctx.attr._scalalib, ctx.attr._scalareflect] + auto_deps = [ctx.attr.scalaworker[_ScalaWorker].scalalib, ctx.attr._scalareflect] deps_jars = collect_jars(ctx.attr.deps + auto_deps + extra_deps, dependency_analyzer_is_off) (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = (deps_jars.compile_jars, deps_jars.transitive_runtime_jars, deps_jars.jars2labels, deps_jars.transitive_compile_jars) diff --git a/scala/providers.bzl b/scala/providers.bzl index f275d5ef2..3279ba3b7 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -30,3 +30,26 @@ def create_scala_provider( transitive_runtime_jars = transitive_runtime_jars, transitive_exports = [] #needed by intellij plugin ) + + +ScalaWorker = provider( + doc = "ScalaWorker", + fields = [ + "scalac", + "scalalib" + ] +) + +def _declare_scala_worker(ctx): + return [ScalaWorker( + scalac = ctx.attr.scalac, + scalalib = ctx.attr.scalalib + )] + +declare_scala_worker = rule( + implementation = _declare_scala_worker, + attrs = { + "scalac": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/scalac"), allow_files=True), + "scalalib": attr.label(default=Label("@scala_2_12//:scala-library"), allow_files=True), + } +) diff --git a/scala/scala.bzl b/scala/scala.bzl index 69d16f66d..e88c29191 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -7,6 +7,10 @@ load("@io_bazel_rules_scala//scala/private:rule_impls.bzl", _scala_junit_test_impl = "scala_junit_test_impl", ) +load("@io_bazel_rules_scala//scala:providers.bzl", + _ScalaWorker = "ScalaWorker", +) + load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", _specs2_junit_dependencies = "specs2_junit_dependencies" @@ -22,15 +26,20 @@ _implicit_deps = { "_singlejar": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:singlejar"), allow_files=True), "_ijar": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:ijar"), allow_files=True), "_scalac": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/scalac"), allow_files=True), - "_scalalib": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_library"), allow_files=True), + "_scalalib": attr.label(default=Label("@scala_2_12//:scala-library"), allow_files=True), "_scalacompiler": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_compiler"), allow_files=True), "_scalareflect": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_reflect"), allow_files=True), "_zipper": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/zip:zipper"), allow_files=True), "_java_toolchain": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_toolchain")), "_host_javabase": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_runtime"), cfg="host"), - "_java_runtime": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_runtime")) + "_java_runtime": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_runtime")), +} + +scala_deps = { + "scalaworker": attr.label(default=Label("@scala//:worker"), providers=[_ScalaWorker]) } + # Single dep to allow IDEs to pickup all the implicit dependencies. _resolve_deps = { "_scala_toolchain" : attr.label_list(default=[ @@ -101,6 +110,7 @@ _library_outputs.update({ _scala_library_attrs = {} _scala_library_attrs.update(_implicit_deps) +_scala_library_attrs.update(scala_deps) _scala_library_attrs.update(_common_attrs) _scala_library_attrs.update(_library_attrs) _scala_library_attrs.update(_resolve_deps) @@ -118,6 +128,7 @@ scala_library = rule( # which does not contain plugin related attributes, and thus avoids the cyclic dependency issue _scala_library_for_plugin_bootstrapping_attrs = {} _scala_library_for_plugin_bootstrapping_attrs.update(_implicit_deps) +_scala_library_for_plugin_bootstrapping_attrs.update(scala_deps) _scala_library_for_plugin_bootstrapping_attrs.update(_library_attrs) _scala_library_for_plugin_bootstrapping_attrs.update(_resolve_deps) _scala_library_for_plugin_bootstrapping_attrs.update(_common_attrs_for_plugin_bootstrapping) @@ -201,6 +212,9 @@ scala_repl = rule( _SCALA_BUILD_FILE = """ # scala.BUILD +load("@io_bazel_rules_scala//scala:providers.bzl", + _declare_scala_worker = "declare_scala_worker", +) java_import( name = "scala-xml", jars = ["lib/scala-xml_2.11-1.0.5.jar"], @@ -230,6 +244,56 @@ java_import( jars = ["lib/scala-reflect.jar"], visibility = ["//visibility:public"], ) + +_declare_scala_worker( + name = "worker", + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac", + scalalib = "@scala//:scala-library", + visibility = ["//visibility:public"], +) +""" +_SCALA_BUILD_FILE_2_12 = """ +# scala.BUILD +load("@io_bazel_rules_scala//scala:providers.bzl", + _declare_scala_worker = "declare_scala_worker", +) + +java_import( + name = "scala-xml", + 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.12-1.0.7.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-library", + jars = ["lib/scala-library.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-compiler", + jars = ["lib/scala-compiler.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-reflect", + jars = ["lib/scala-reflect.jar"], + visibility = ["//visibility:public"], +) + +_declare_scala_worker( + name = "worker", + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_12", + scalalib = "@scala_2_12//:scala-library", + visibility = ["//visibility:public"], +) """ def scala_repositories(): @@ -241,6 +305,14 @@ def scala_repositories(): build_file_content = _SCALA_BUILD_FILE, ) + # Johan: temp + native.new_http_archive( + name = "scala_2_12", + strip_prefix = "scala-2.12.5", + url = "https://downloads.lightbend.com/scala/2.12.5/scala-2.12.5.tgz", + build_file_content = _SCALA_BUILD_FILE_2_12, + ) + # scalatest has macros, note http_jar is invoking ijar native.http_jar( name = "scalatest", diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index 417849884..5d9f64797 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -18,3 +18,24 @@ java_binary( '//external:io_bazel_rules_scala/dependency/scala/scala_reflect', ], ) + +java_binary( + name = "scalac_2_12", + srcs = [ + "CompileOptions.java", + "ScalaCInvoker.java", + "ScalacProcessor.java", + "Resource.java", + ], + main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", + visibility = ["//visibility:public"], + deps = [ + "//src/java/com/google/devtools/build/lib:worker", + "//src/java/io/bazel/rulesscala/jar", + "//src/java/io/bazel/rulesscala/worker", + '//external:io_bazel_rules_scala/dependency/commons_io/commons_io', + '@scala_2_12//:scala-compiler', + '@scala_2_12//:scala-library', + '@scala_2_12//:scala-reflect', + ], +) diff --git a/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java b/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java index d25423b7f..61b8803b6 100644 --- a/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java +++ b/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java @@ -41,6 +41,7 @@ class ScalacProcessor implements Processor { @Override public void processRequest(List args) throws Exception { Path tmpPath = null; + System.out.println(scala.tools.nsc.Properties.versionString()); try { CompileOptions ops = new CompileOptions(args); diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD new file mode 100644 index 000000000..62e9b2b86 --- /dev/null +++ b/test/crossbuild/BUILD @@ -0,0 +1,11 @@ +load( + "//scala:scala.bzl", + "scala_library" +) + + +scala_library( + name = "hello_world_lib", + srcs = ["HelloWorldLib.scala"], + scalaworker = "@scala_2_12//:worker" +) diff --git a/test/crossbuild/HelloWorldLib.scala b/test/crossbuild/HelloWorldLib.scala new file mode 100644 index 000000000..79bfa5a4d --- /dev/null +++ b/test/crossbuild/HelloWorldLib.scala @@ -0,0 +1,12 @@ +package anx +import scala.util.{Either, Right} + +trait Hello { + def hello: String = "hfnos" + val either: Either[Int, Int] = Right(1) + either.toOption +} + +trait World { + def world: String = "wptoh" +} diff --git a/test/crossbuild/test b/test/crossbuild/test new file mode 100755 index 000000000..7b714aea6 --- /dev/null +++ b/test/crossbuild/test @@ -0,0 +1,22 @@ +#!/bin/zsh -e + +printf "\u001b[1;39m:::\u001b[0m\n" +printf "\u001b[1;39m test file: $0\u001b[0m\n" +printf "\u001b[1;39m:::\u001b[0m\n" + +error() { + set +x + printf "\u001b[1;31m::FAILURE::\u001b[0m $FILE:$2 exited with code $1\n" +} + +finish() { + set +x + [ $1 != 0 ] || printf "\u001b[1;32m::SUCCESS::\u001b[0m\n" +} + +trap 'error $? $LINENO' ERR +trap 'finish $?' EXIT + +set -x + +bazel build //test/crossbuild:hello_world_lib From abae2b23c527a4da72e35a8612c709dfee9ad95e Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 13 Jun 2018 17:11:43 -0700 Subject: [PATCH 02/63] Add scalareflect + scalacompiler to [ScalaWorker] * Run scala_repl using compiler from [ScalaWorker] --- scala/private/rule_impls.bzl | 5 +++-- scala/providers.bzl | 12 +++++++++--- scala/scala.bzl | 9 +++------ test/crossbuild/BUILD | 17 ++++++++++++++--- test/crossbuild/HelloWorldLib211.scala | 9 +++++++++ ...lloWorldLib.scala => HelloWorldLib212.scala} | 0 test/crossbuild/test | 3 ++- 7 files changed, 40 insertions(+), 15 deletions(-) create mode 100644 test/crossbuild/HelloWorldLib211.scala rename test/crossbuild/{HelloWorldLib.scala => HelloWorldLib212.scala} (100%) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index c2c63b8ac..9a81ee20b 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -505,7 +505,8 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], extra_runtime_deps = []) dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) # Get jars from deps - auto_deps = [ctx.attr.scalaworker[_ScalaWorker].scalalib, ctx.attr._scalareflect] + scalaworker = ctx.attr.scalaworker[_ScalaWorker] + auto_deps = [scalaworker.scalalib, scalaworker.scalareflect] deps_jars = collect_jars(ctx.attr.deps + auto_deps + extra_deps, dependency_analyzer_is_off) (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = (deps_jars.compile_jars, deps_jars.transitive_runtime_jars, deps_jars.jars2labels, deps_jars.transitive_compile_jars) @@ -632,7 +633,7 @@ def scala_binary_impl(ctx): def scala_repl_impl(ctx): # need scala-compiler for MainGenericRunner below - jars = _collect_jars_from_common_ctx(ctx, extra_runtime_deps = [ctx.attr._scalacompiler]) + jars = _collect_jars_from_common_ctx(ctx, extra_runtime_deps = [ctx.attr.scalaworker[_ScalaWorker].scalacompiler]) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) args = " ".join(ctx.attr.scalacopts) diff --git a/scala/providers.bzl b/scala/providers.bzl index 3279ba3b7..7396794b5 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -36,20 +36,26 @@ ScalaWorker = provider( doc = "ScalaWorker", fields = [ "scalac", - "scalalib" + "scalalib", + "scalareflect", + "scalacompiler" ] ) def _declare_scala_worker(ctx): return [ScalaWorker( scalac = ctx.attr.scalac, - scalalib = ctx.attr.scalalib + scalalib = ctx.attr.scalalib, + scalareflect = ctx.attr.scalareflect, + scalacompiler = ctx.attr.scalacompiler, )] declare_scala_worker = rule( implementation = _declare_scala_worker, attrs = { "scalac": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/scalac"), allow_files=True), - "scalalib": attr.label(default=Label("@scala_2_12//:scala-library"), allow_files=True), + "scalalib": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_library"), allow_files=True), + "scalareflect": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_reflect"), allow_files=True), + "scalacompiler": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_compiler"), allow_files=True), } ) diff --git a/scala/scala.bzl b/scala/scala.bzl index e88c29191..cc088f136 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -25,10 +25,6 @@ _launcher_template = { _implicit_deps = { "_singlejar": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:singlejar"), allow_files=True), "_ijar": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:ijar"), allow_files=True), - "_scalac": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/scalac"), allow_files=True), - "_scalalib": attr.label(default=Label("@scala_2_12//:scala-library"), allow_files=True), - "_scalacompiler": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_compiler"), allow_files=True), - "_scalareflect": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_reflect"), allow_files=True), "_zipper": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/zip:zipper"), allow_files=True), "_java_toolchain": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_toolchain")), "_host_javabase": attr.label(default = Label("@bazel_tools//tools/jdk:current_java_runtime"), cfg="host"), @@ -199,6 +195,7 @@ scala_test = rule( _scala_repl_attrs = {} _scala_repl_attrs.update(_launcher_template) _scala_repl_attrs.update(_implicit_deps) +_scala_repl_attrs.update(scala_deps) _scala_repl_attrs.update(_common_attrs) _scala_repl_attrs.update(_resolve_deps) scala_repl = rule( @@ -247,8 +244,6 @@ java_import( _declare_scala_worker( name = "worker", - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac", - scalalib = "@scala//:scala-library", visibility = ["//visibility:public"], ) """ @@ -292,6 +287,8 @@ _declare_scala_worker( name = "worker", scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_12", scalalib = "@scala_2_12//:scala-library", + scalareflect = "@scala_2_12//:scala-reflect", + scalacompiler = "@scala_2_12//:scala-compiler", visibility = ["//visibility:public"], ) """ diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 62e9b2b86..a604b15ae 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -1,11 +1,22 @@ load( "//scala:scala.bzl", - "scala_library" + "scala_library", + "scala_repl", ) scala_library( - name = "hello_world_lib", - srcs = ["HelloWorldLib.scala"], + name = "lib", + srcs = ["HelloWorldLib212.scala"], scalaworker = "@scala_2_12//:worker" ) + +scala_library( + name = "lib211", + srcs = ["HelloWorldLib211.scala"], +) + +scala_repl( + name = "repl", + deps = [":lib211"] +) diff --git a/test/crossbuild/HelloWorldLib211.scala b/test/crossbuild/HelloWorldLib211.scala new file mode 100644 index 000000000..3ffeb8555 --- /dev/null +++ b/test/crossbuild/HelloWorldLib211.scala @@ -0,0 +1,9 @@ +package anx + +trait Hello { + def hello: String = "hfnos" +} + +trait World { + def world: String = "wptoh" +} diff --git a/test/crossbuild/HelloWorldLib.scala b/test/crossbuild/HelloWorldLib212.scala similarity index 100% rename from test/crossbuild/HelloWorldLib.scala rename to test/crossbuild/HelloWorldLib212.scala diff --git a/test/crossbuild/test b/test/crossbuild/test index 7b714aea6..d17488210 100755 --- a/test/crossbuild/test +++ b/test/crossbuild/test @@ -19,4 +19,5 @@ trap 'finish $?' EXIT set -x -bazel build //test/crossbuild:hello_world_lib +bazel build //test/crossbuild:lib +bazel build //test/crossbuild:repl From f6704360fe23eda1a4c7e6687e78b205317bd1a2 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 13 Jun 2018 17:56:48 -0700 Subject: [PATCH 03/63] All rules using [ScalaWorker] * run scala_binary, scala_macro_library, scala_test, scala_junit_test using [ScalaWorker] * Tests now working with 2.12 --- scala/scala.bzl | 4 ++ test/crossbuild/BUILD | 58 +++++++++++++++++++++++--- test/crossbuild/HelloWorldLib211.scala | 2 +- test/crossbuild/HelloWorldLib212.scala | 2 +- test/crossbuild/JunitTests.scala | 13 ++++++ test/crossbuild/MacroTest.scala | 17 ++++++++ test/crossbuild/ScalaBinary.scala | 7 ++++ test/crossbuild/Test.scala | 10 +++++ test/crossbuild/test | 13 ++++++ 9 files changed, 119 insertions(+), 7 deletions(-) create mode 100644 test/crossbuild/JunitTests.scala create mode 100644 test/crossbuild/MacroTest.scala create mode 100644 test/crossbuild/ScalaBinary.scala create mode 100644 test/crossbuild/Test.scala diff --git a/scala/scala.bzl b/scala/scala.bzl index cc088f136..ed707029a 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -141,6 +141,7 @@ _scala_macro_library_attrs = { "exports": attr.label_list(allow_files=False), } _scala_macro_library_attrs.update(_implicit_deps) +_scala_macro_library_attrs.update(scala_deps) _scala_macro_library_attrs.update(_common_attrs) _scala_macro_library_attrs.update(_library_attrs) _scala_macro_library_attrs.update(_resolve_deps) @@ -158,6 +159,7 @@ _scala_binary_attrs = { } _scala_binary_attrs.update(_launcher_template) _scala_binary_attrs.update(_implicit_deps) +_scala_binary_attrs.update(scala_deps) _scala_binary_attrs.update(_common_attrs) _scala_binary_attrs.update(_resolve_deps) scala_binary = rule( @@ -180,6 +182,7 @@ _scala_test_attrs = { } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) +_scala_test_attrs.update(scala_deps) _scala_test_attrs.update(_common_attrs) _scala_test_attrs.update(_test_resolve_deps) scala_test = rule( @@ -439,6 +442,7 @@ _scala_junit_test_attrs = { } _scala_junit_test_attrs.update(_launcher_template) _scala_junit_test_attrs.update(_implicit_deps) +_scala_junit_test_attrs.update(scala_deps) _scala_junit_test_attrs.update(_common_attrs) _scala_junit_test_attrs.update(_junit_resolve_deps) scala_junit_test = rule( diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index a604b15ae..30dab0e98 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -2,21 +2,69 @@ load( "//scala:scala.bzl", "scala_library", "scala_repl", + "scala_test", + "scala_binary", + "scala_macro_library", + "scala_junit_test" ) scala_library( name = "lib", - srcs = ["HelloWorldLib212.scala"], - scalaworker = "@scala_2_12//:worker" + srcs = ["HelloWorldLib211.scala"], ) scala_library( - name = "lib211", - srcs = ["HelloWorldLib211.scala"], + name = "lib212", + srcs = ["HelloWorldLib212.scala"], + scalaworker = "@scala_2_12//:worker" ) scala_repl( name = "repl", - deps = [":lib211"] + deps = [":lib"], +) + +scala_repl( + name = "repl212", + deps = [":lib212"], + scalaworker = "@scala_2_12//:worker" +) + +# TODO: scalatest not working with 2.12 +scala_test( + name = "test", + srcs = ["Test.scala"], +) + +scala_binary( + name = "binary", + srcs = ["ScalaBinary.scala"], + main_class = "scala.test.crossbuild.ScalaBinary", +) + +scala_binary( + name = "binary212", + srcs = ["ScalaBinary.scala"], + main_class = "scala.test.crossbuild.ScalaBinary", + scalaworker = "@scala_2_12//:worker" +) + +scala_macro_library( + name = "macro", + srcs = ["MacroTest.scala"], +) + +scala_macro_library( + name = "macro212", + srcs = ["MacroTest.scala"], + scalaworker = "@scala_2_12//:worker" +) + +# TODO: junit not working with 2.12 +scala_junit_test( + name = "junit", + srcs = ["JunitTests.scala"], + suffixes = ["Test"], + size = "small", ) diff --git a/test/crossbuild/HelloWorldLib211.scala b/test/crossbuild/HelloWorldLib211.scala index 3ffeb8555..ebc32216f 100644 --- a/test/crossbuild/HelloWorldLib211.scala +++ b/test/crossbuild/HelloWorldLib211.scala @@ -1,4 +1,4 @@ -package anx +package scala.test.crossbuild trait Hello { def hello: String = "hfnos" diff --git a/test/crossbuild/HelloWorldLib212.scala b/test/crossbuild/HelloWorldLib212.scala index 79bfa5a4d..ce27427de 100644 --- a/test/crossbuild/HelloWorldLib212.scala +++ b/test/crossbuild/HelloWorldLib212.scala @@ -1,4 +1,4 @@ -package anx +package scala.test.crossbuild import scala.util.{Either, Right} trait Hello { diff --git a/test/crossbuild/JunitTests.scala b/test/crossbuild/JunitTests.scala new file mode 100644 index 000000000..a226f8c45 --- /dev/null +++ b/test/crossbuild/JunitTests.scala @@ -0,0 +1,13 @@ +package scala.test.junit + +import org.junit.Test + +class JunitTest { + + @Test + def simple: Unit = { + println("junit test") + } + +} + diff --git a/test/crossbuild/MacroTest.scala b/test/crossbuild/MacroTest.scala new file mode 100644 index 000000000..f48017d19 --- /dev/null +++ b/test/crossbuild/MacroTest.scala @@ -0,0 +1,17 @@ +package scala.test + +import language.experimental.macros + +import reflect.macros.Context + +object MacroTest { + def hello(param: Any): Unit = macro hello_impl + + def hello_impl(c: Context)(param: c.Expr[Any]): c.Expr[Unit] = { + import c.universe._ + val paramRep = show(param.tree) + val paramRepTree = Literal(Constant(paramRep)) + val paramRepExpr = c.Expr[String](paramRepTree) + reify { println(paramRepExpr.splice + " = " + param.splice) } + } +} diff --git a/test/crossbuild/ScalaBinary.scala b/test/crossbuild/ScalaBinary.scala new file mode 100644 index 000000000..8369260c0 --- /dev/null +++ b/test/crossbuild/ScalaBinary.scala @@ -0,0 +1,7 @@ +package scala.test.crossbuild + +object ScalaBinary { + def main(args: Array[String]) { + println("Hello") + } +} diff --git a/test/crossbuild/Test.scala b/test/crossbuild/Test.scala new file mode 100644 index 000000000..f0c355c23 --- /dev/null +++ b/test/crossbuild/Test.scala @@ -0,0 +1,10 @@ +package scala.test + +import org.scalatest._ + +class ScalaSuite extends FlatSpec { + "HelloLib" should "work" in { + assert(true) + } +} + diff --git a/test/crossbuild/test b/test/crossbuild/test index d17488210..bf99a0e5d 100755 --- a/test/crossbuild/test +++ b/test/crossbuild/test @@ -20,4 +20,17 @@ trap 'finish $?' EXIT set -x bazel build //test/crossbuild:lib +bazel build //test/crossbuild:lib212 + bazel build //test/crossbuild:repl +bazel build //test/crossbuild:repl212 + +bazel test //test/crossbuild:test + +bazel run //test/crossbuild:binary +bazel run //test/crossbuild:binary212 + +bazel build //test/crossbuild:macro +bazel build //test/crossbuild:macro212 + +bazel test //test/crossbuild:junit From 50deaf3f209dfd5d0526a72df20faa801f0a7f58 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 14 Jun 2018 14:07:10 -0700 Subject: [PATCH 04/63] Create [ScalaWorker] using new_scala_repository * Generate build file for scalac_2_12 in repository_rule --- scala/scala.bzl | 57 ++------------ scala/scala_cross_version.bzl | 96 +++++++++++++++++++++++ src/java/io/bazel/rulesscala/scalac/BUILD | 26 ++---- test/crossbuild/BUILD | 8 +- 4 files changed, 111 insertions(+), 76 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index ed707029a..24cab7f4c 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -11,6 +11,10 @@ load("@io_bazel_rules_scala//scala:providers.bzl", _ScalaWorker = "ScalaWorker", ) +load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", + _new_scala_repository = "new_scala_repository", +) + load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", _specs2_junit_dependencies = "specs2_junit_dependencies" @@ -250,51 +254,6 @@ _declare_scala_worker( visibility = ["//visibility:public"], ) """ -_SCALA_BUILD_FILE_2_12 = """ -# scala.BUILD -load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scala_worker = "declare_scala_worker", -) - -java_import( - name = "scala-xml", - 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.12-1.0.7.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-library", - jars = ["lib/scala-library.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-compiler", - jars = ["lib/scala-compiler.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-reflect", - jars = ["lib/scala-reflect.jar"], - visibility = ["//visibility:public"], -) - -_declare_scala_worker( - name = "worker", - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_12", - scalalib = "@scala_2_12//:scala-library", - scalareflect = "@scala_2_12//:scala-reflect", - scalacompiler = "@scala_2_12//:scala-compiler", - visibility = ["//visibility:public"], -) -""" def scala_repositories(): native.new_http_archive( @@ -305,13 +264,7 @@ def scala_repositories(): build_file_content = _SCALA_BUILD_FILE, ) - # Johan: temp - native.new_http_archive( - name = "scala_2_12", - strip_prefix = "scala-2.12.5", - url = "https://downloads.lightbend.com/scala/2.12.5/scala-2.12.5.tgz", - build_file_content = _SCALA_BUILD_FILE_2_12, - ) + _new_scala_repository() # scalatest has macros, note http_jar is invoking ijar native.http_jar( diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 23b459570..510355948 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -26,3 +26,99 @@ def scala_mvn_artifact(artifact): artifactid = gav[1] version = gav[2] return "%s:%s_%s:%s" % (groupid, artifactid, scala_version(), version) + +_SCALA_BUILD_FILE_2_12 = """ +# scala.BUILD +load("@io_bazel_rules_scala//scala:providers.bzl", + _declare_scala_worker = "declare_scala_worker", +) + +java_import( + name = "scala-xml", + 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.12-1.0.7.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-library", + jars = ["lib/scala-library.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-compiler", + jars = ["lib/scala-compiler.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-reflect", + jars = ["lib/scala-reflect.jar"], + visibility = ["//visibility:public"], +) +""" + + +def _generate_scala_build_file_impl(ctx): + contents = """ +load("@io_bazel_rules_scala//scala:providers.bzl", + _declare_scala_worker = "declare_scala_worker", +) + +java_binary( + name = "scalac_2_12", + srcs = [ + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:CompileOptions.java", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:ScalaCInvoker.java", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:ScalacProcessor.java", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:Resource.java", + ], + main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", + visibility = ["//visibility:public"], + deps = [ + "@io_bazel_rules_scala//src/java/com/google/devtools/build/lib:worker", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker", + '//external:io_bazel_rules_scala/dependency/commons_io/commons_io', + '@scala_2_12//:scala-compiler', + '@scala_2_12//:scala-library', + '@scala_2_12//:scala-reflect', + ], +) + +_declare_scala_worker( + name = "worker", + scalac = ":scalac_2_12", + scalalib = "@scala_2_12//:scala-library", + scalareflect = "@scala_2_12//:scala-reflect", + scalacompiler = "@scala_2_12//:scala-compiler", + visibility = ["//visibility:public"], +) + """ + ctx.file("BUILD", contents, False) + + +_generate_scala_build_file = repository_rule( + implementation = _generate_scala_build_file_impl, + attrs = {} +) + + +def new_scala_repository(): + native.new_http_archive( + name = "scala_2_12", + strip_prefix = "scala-2.12.5", + url = "https://downloads.lightbend.com/scala/2.12.5/scala-2.12.5.tgz", + build_file_content = _SCALA_BUILD_FILE_2_12, + ) + + _generate_scala_build_file( + name = "scala_2_12_bf", + visibility = ["//visibility:public"] + ) diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index 5d9f64797..fe65ec47b 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -19,23 +19,9 @@ java_binary( ], ) -java_binary( - name = "scalac_2_12", - srcs = [ - "CompileOptions.java", - "ScalaCInvoker.java", - "ScalacProcessor.java", - "Resource.java", - ], - main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", - visibility = ["//visibility:public"], - deps = [ - "//src/java/com/google/devtools/build/lib:worker", - "//src/java/io/bazel/rulesscala/jar", - "//src/java/io/bazel/rulesscala/worker", - '//external:io_bazel_rules_scala/dependency/commons_io/commons_io', - '@scala_2_12//:scala-compiler', - '@scala_2_12//:scala-library', - '@scala_2_12//:scala-reflect', - ], -) +exports_files([ + "CompileOptions.java", + "ScalaCInvoker.java", + "ScalacProcessor.java", + "Resource.java", +]) diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 30dab0e98..a59bbaf53 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -17,7 +17,7 @@ scala_library( scala_library( name = "lib212", srcs = ["HelloWorldLib212.scala"], - scalaworker = "@scala_2_12//:worker" + scalaworker = "@scala_2_12_bf//:worker" ) scala_repl( @@ -28,7 +28,7 @@ scala_repl( scala_repl( name = "repl212", deps = [":lib212"], - scalaworker = "@scala_2_12//:worker" + scalaworker = "@scala_2_12_bf//:worker" ) # TODO: scalatest not working with 2.12 @@ -47,7 +47,7 @@ scala_binary( name = "binary212", srcs = ["ScalaBinary.scala"], main_class = "scala.test.crossbuild.ScalaBinary", - scalaworker = "@scala_2_12//:worker" + scalaworker = "@scala_2_12_bf//:worker" ) scala_macro_library( @@ -58,7 +58,7 @@ scala_macro_library( scala_macro_library( name = "macro212", srcs = ["MacroTest.scala"], - scalaworker = "@scala_2_12//:worker" + scalaworker = "@scala_2_12_bf//:worker" ) # TODO: junit not working with 2.12 From b9f1b221b909ccf56bd6f0426f9f4443ba114408 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 14 Jun 2018 14:22:51 -0700 Subject: [PATCH 05/63] Use filegroup for scalac worker files --- scala/scala_cross_version.bzl | 5 +---- src/java/io/bazel/rulesscala/scalac/BUILD | 16 ++++++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 510355948..4e18dccea 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -74,10 +74,7 @@ load("@io_bazel_rules_scala//scala:providers.bzl", java_binary( name = "scalac_2_12", srcs = [ - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:CompileOptions.java", - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:ScalaCInvoker.java", - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:ScalacProcessor.java", - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:Resource.java", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_files", ], main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", visibility = ["//visibility:public"], diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index fe65ec47b..05506b610 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -19,9 +19,13 @@ java_binary( ], ) -exports_files([ - "CompileOptions.java", - "ScalaCInvoker.java", - "ScalacProcessor.java", - "Resource.java", -]) +filegroup( + name = "scalac_files", + srcs = [ + "CompileOptions.java", + "ScalaCInvoker.java", + "ScalacProcessor.java", + "Resource.java", + ], + visibility = ["//visibility:public"] +) From 2aa315cbff774a3b369bf0addac41823025fad57 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 14 Jun 2018 16:09:47 -0700 Subject: [PATCH 06/63] Specify scala version and label in new_scala_repository * Download scala version specified as parameter * Set label for ScalaWorker as @{name}//:{name} --- scala/scala.bzl | 3 ++- scala/scala_cross_version.bzl | 39 +++++++++++++++++++++-------------- test/crossbuild/BUILD | 14 +++++++++---- test/crossbuild/test | 29 +++++++++++++------------- 4 files changed, 50 insertions(+), 35 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 24cab7f4c..88d8ee926 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -264,7 +264,8 @@ def scala_repositories(): build_file_content = _SCALA_BUILD_FILE, ) - _new_scala_repository() + _new_scala_repository("scala_2_12", "2.12.4") + _new_scala_repository("scala_2_11_1", "2.11.1") # scalatest has macros, note http_jar is invoking ijar native.http_jar( diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 4e18dccea..2eb9dab49 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -72,7 +72,7 @@ load("@io_bazel_rules_scala//scala:providers.bzl", ) java_binary( - name = "scalac_2_12", + name = "scalac_worker", srcs = [ "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_files", ], @@ -83,39 +83,46 @@ java_binary( "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar", "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker", '//external:io_bazel_rules_scala/dependency/commons_io/commons_io', - '@scala_2_12//:scala-compiler', - '@scala_2_12//:scala-library', - '@scala_2_12//:scala-reflect', + '@{archive}//:scala-compiler', + '@{archive}//:scala-library', + '@{archive}//:scala-reflect', ], ) _declare_scala_worker( - name = "worker", - scalac = ":scalac_2_12", - scalalib = "@scala_2_12//:scala-library", - scalareflect = "@scala_2_12//:scala-reflect", - scalacompiler = "@scala_2_12//:scala-compiler", + name = "{name}", + scalac = ":scalac_worker", + scalalib = "@{archive}//:scala-library", + scalareflect = "@{archive}//:scala-reflect", + scalacompiler = "@{archive}//:scala-compiler", visibility = ["//visibility:public"], ) - """ + """.format( + archive = ctx.attr.archive, + name = ctx.attr.name + ) + ctx.file("BUILD", contents, False) _generate_scala_build_file = repository_rule( implementation = _generate_scala_build_file_impl, - attrs = {} + attrs = { "archive": attr.string() } ) -def new_scala_repository(): +def new_scala_repository(name, version): + archive = "{name}_archive".format(name=name) native.new_http_archive( - name = "scala_2_12", - strip_prefix = "scala-2.12.5", - url = "https://downloads.lightbend.com/scala/2.12.5/scala-2.12.5.tgz", + name = archive, + strip_prefix = "scala-{version}".format(version=version), + url = "https://downloads.lightbend.com/scala/{version}/scala-{version}.tgz".format(version=version), build_file_content = _SCALA_BUILD_FILE_2_12, ) _generate_scala_build_file( - name = "scala_2_12_bf", + name = name, + archive = archive, visibility = ["//visibility:public"] ) + diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index a59bbaf53..b26232a99 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -14,10 +14,16 @@ scala_library( srcs = ["HelloWorldLib211.scala"], ) +scala_library( + name = "lib2111", + srcs = ["HelloWorldLib211.scala"], + scalaworker = "@scala_2_11_1" +) + scala_library( name = "lib212", srcs = ["HelloWorldLib212.scala"], - scalaworker = "@scala_2_12_bf//:worker" + scalaworker = "@scala_2_12" ) scala_repl( @@ -28,7 +34,7 @@ scala_repl( scala_repl( name = "repl212", deps = [":lib212"], - scalaworker = "@scala_2_12_bf//:worker" + scalaworker = "@scala_2_12//:worker" ) # TODO: scalatest not working with 2.12 @@ -47,7 +53,7 @@ scala_binary( name = "binary212", srcs = ["ScalaBinary.scala"], main_class = "scala.test.crossbuild.ScalaBinary", - scalaworker = "@scala_2_12_bf//:worker" + scalaworker = "@scala_2_12//:worker" ) scala_macro_library( @@ -58,7 +64,7 @@ scala_macro_library( scala_macro_library( name = "macro212", srcs = ["MacroTest.scala"], - scalaworker = "@scala_2_12_bf//:worker" + scalaworker = "@scala_2_12//:worker" ) # TODO: junit not working with 2.12 diff --git a/test/crossbuild/test b/test/crossbuild/test index bf99a0e5d..4810578ce 100755 --- a/test/crossbuild/test +++ b/test/crossbuild/test @@ -19,18 +19,19 @@ trap 'finish $?' EXIT set -x -bazel build //test/crossbuild:lib +#bazel build //test/crossbuild:lib +bazel build //test/crossbuild:lib2111 bazel build //test/crossbuild:lib212 - -bazel build //test/crossbuild:repl -bazel build //test/crossbuild:repl212 - -bazel test //test/crossbuild:test - -bazel run //test/crossbuild:binary -bazel run //test/crossbuild:binary212 - -bazel build //test/crossbuild:macro -bazel build //test/crossbuild:macro212 - -bazel test //test/crossbuild:junit +# +#bazel build //test/crossbuild:repl +#bazel build //test/crossbuild:repl212 +# +#bazel test //test/crossbuild:test +# +#bazel run //test/crossbuild:binary +#bazel run //test/crossbuild:binary212 +# +#bazel build //test/crossbuild:macro +#bazel build //test/crossbuild:macro212 +# +#bazel test //test/crossbuild:junit From 0e5c5ddac1f21f0b63c0aed3f00fe45e868bbd55 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 14 Jun 2018 16:39:14 -0700 Subject: [PATCH 07/63] Run formatter --- scala/private/rule_impls.bzl | 12 ++++++--- scala/providers.bzl | 50 +++++++++++++++++++++-------------- scala/scala.bzl | 14 +++++----- scala/scala_cross_version.bzl | 34 +++++++++--------------- 4 files changed, 59 insertions(+), 51 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index e39ea10d5..78dea476c 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -13,7 +13,10 @@ # limitations under the License. """Rules for supporting the Scala language.""" load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain") -load("@io_bazel_rules_scala//scala:providers.bzl", "create_scala_provider", _ScalaWorker = "ScalaWorker") +load( + "@io_bazel_rules_scala//scala:providers.bzl", + "create_scala_provider", + _ScalaWorker = "ScalaWorker") load( ":common.bzl", "add_labels_of_jars_to", @@ -255,8 +258,8 @@ StatsfileOutput: {statsfile_output} ctx.actions.run( inputs = ins, outputs = outs, - executable=worker.scalac.files_to_run.executable, - input_manifests=input_manifests, + executable = worker.scalac.files_to_run.executable, + input_manifests = input_manifests, mnemonic = "Scalac", progress_message = "scala %s" % ctx.label, execution_requirements = {"supports-workers": "1"}, @@ -647,7 +650,8 @@ def scala_binary_impl(ctx): def scala_repl_impl(ctx): # need scala-compiler for MainGenericRunner below jars = _collect_jars_from_common_ctx( - ctx, extra_runtime_deps = [ctx.attr.scalaworker[_ScalaWorker].scalacompiler]) + ctx, + extra_runtime_deps = [ctx.attr.scalaworker[_ScalaWorker].scalacompiler]) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) args = " ".join(ctx.attr.scalacopts) diff --git a/scala/providers.bzl b/scala/providers.bzl index 5e9ca7759..df2c37ee2 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -25,31 +25,41 @@ def create_scala_provider(ijar, class_jar, compile_jars, transitive_exports = [] #needed by intellij plugin ) - ScalaWorker = provider( doc = "ScalaWorker", - fields = [ - "scalac", - "scalalib", - "scalareflect", - "scalacompiler" - ] -) + fields = ["scalac", "scalalib", "scalareflect", "scalacompiler"]) def _declare_scala_worker(ctx): - return [ScalaWorker( - scalac = ctx.attr.scalac, - scalalib = ctx.attr.scalalib, - scalareflect = ctx.attr.scalareflect, - scalacompiler = ctx.attr.scalacompiler, - )] + return [ + ScalaWorker( + scalac = ctx.attr.scalac, + scalalib = ctx.attr.scalalib, + scalareflect = ctx.attr.scalareflect, + scalacompiler = ctx.attr.scalacompiler, + ) + ] declare_scala_worker = rule( implementation = _declare_scala_worker, attrs = { - "scalac": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/scalac"), allow_files=True), - "scalalib": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_library"), allow_files=True), - "scalareflect": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_reflect"), allow_files=True), - "scalacompiler": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala/scala_compiler"), allow_files=True), - } -) + "scalac": attr.label( + executable = True, + cfg = "host", + default = Label("//src/java/io/bazel/rulesscala/scalac"), + allow_files = True), + "scalalib": attr.label( + default = Label( + "//external:io_bazel_rules_scala/dependency/scala/scala_library" + ), + allow_files = True), + "scalareflect": attr.label( + default = Label( + "//external:io_bazel_rules_scala/dependency/scala/scala_reflect" + ), + allow_files = True), + "scalacompiler": attr.label( + default = Label( + "//external:io_bazel_rules_scala/dependency/scala/scala_compiler" + ), + allow_files = True), + }) diff --git a/scala/scala.bzl b/scala/scala.bzl index f1e340d9a..7da6aca7e 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -8,12 +8,14 @@ load( _scala_junit_test_impl = "scala_junit_test_impl", ) -load("@io_bazel_rules_scala//scala:providers.bzl", - _ScalaWorker = "ScalaWorker", +load( + "@io_bazel_rules_scala//scala:providers.bzl", + _ScalaWorker = "ScalaWorker", ) -load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", - _new_scala_repository = "new_scala_repository", +load( + "@io_bazel_rules_scala//scala:scala_cross_version.bzl", + _new_scala_repository = "new_scala_repository", ) load( @@ -68,10 +70,10 @@ _implicit_deps = { } scala_deps = { - "scalaworker": attr.label(default=Label("@scala//:worker"), providers=[_ScalaWorker]) + "scalaworker": attr.label( + default = Label("@scala//:worker"), providers = [_ScalaWorker]) } - # Single dep to allow IDEs to pickup all the implicit dependencies. _resolve_deps = { "_scala_toolchain": attr.label_list( diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 0d254c0b4..8c1f02ef2 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -63,9 +63,8 @@ java_import( ) """ - def _generate_scala_build_file_impl(ctx): - contents = """ + contents = """ load("@io_bazel_rules_scala//scala:providers.bzl", _declare_scala_worker = "declare_scala_worker", ) @@ -97,31 +96,24 @@ _declare_scala_worker( visibility = ["//visibility:public"], ) """.format( - archive = ctx.attr.archive, - name = ctx.attr.name - ) - - ctx.file("BUILD", contents, False) + archive = ctx.attr.archive, name = ctx.attr.name) + ctx.file("BUILD", contents, False) _generate_scala_build_file = repository_rule( - implementation = _generate_scala_build_file_impl, - attrs = { "archive": attr.string() } -) - + implementation = _generate_scala_build_file_impl, + attrs = {"archive": attr.string()}) def new_scala_repository(name, version): - archive = "{name}_archive".format(name=name) + archive = "{name}_archive".format(name = name) native.new_http_archive( - name = archive, - strip_prefix = "scala-{version}".format(version=version), - url = "https://downloads.lightbend.com/scala/{version}/scala-{version}.tgz".format(version=version), - build_file_content = _SCALA_BUILD_FILE_2_12, + name = archive, + strip_prefix = "scala-{version}".format(version = version), + url = + "https://downloads.lightbend.com/scala/{version}/scala-{version}.tgz". + format(version = version), + build_file_content = _SCALA_BUILD_FILE_2_12, ) _generate_scala_build_file( - name = name, - archive = archive, - visibility = ["//visibility:public"] - ) - + name = name, archive = archive, visibility = ["//visibility:public"]) From 72aba586083014416be156d5fd76998609bae112 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Fri, 15 Jun 2018 17:02:11 -0700 Subject: [PATCH 08/63] Run scalatest for both 2.11/2.12 * Add initial [ScalaWorker] for both 2.11/2.12 * import scalatest + scalactic for 2.12 * Add 2.12 versions of scalatest_runner and scalatest_reporter * Manually specify scalatest_reporter for scala_test rule --- scala/build_files.bzl | 88 ++++++++++++++ scala/private/rule_impls.bzl | 8 +- scala/providers.bzl | 23 +++- scala/scala.bzl | 109 ++++++------------ scala/scala_cross_version.bzl | 25 ++-- scala/support/BUILD | 34 +++++- src/java/io/bazel/rulesscala/scala_test/BUILD | 15 ++- src/java/io/bazel/rulesscala/scalac/BUILD | 21 ++++ test/crossbuild/BUILD | 16 ++- test/crossbuild/test | 2 + 10 files changed, 252 insertions(+), 89 deletions(-) create mode 100644 scala/build_files.bzl diff --git a/scala/build_files.bzl b/scala/build_files.bzl new file mode 100644 index 000000000..b836785c1 --- /dev/null +++ b/scala/build_files.bzl @@ -0,0 +1,88 @@ +SCALA_BUILD_FILE_2_11 = """ +# scala.BUILD +load("@io_bazel_rules_scala//scala:providers.bzl", + _declare_scala_worker = "declare_scala_worker", +) +java_import( + name = "scala-xml", + jars = ["lib/scala-xml_2.11-1.0.5.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-parser-combinators", + jars = ["lib/scala-parser-combinators_2.11-1.0.4.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-library", + jars = ["lib/scala-library.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-compiler", + jars = ["lib/scala-compiler.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-reflect", + jars = ["lib/scala-reflect.jar"], + visibility = ["//visibility:public"], +) + +_declare_scala_worker( + name = "scala", + visibility = ["//visibility:public"], +) +""" + + +SCALA_BUILD_FILE_2_12 = """ +# scala.BUILD +load("@io_bazel_rules_scala//scala:providers.bzl", + _declare_scala_worker = "declare_scala_worker", +) +java_import( + name = "scala-xml", + 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.12-1.0.7.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-library", + jars = ["lib/scala-library.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-compiler", + jars = ["lib/scala-compiler.jar"], + visibility = ["//visibility:public"], +) + +java_import( + name = "scala-reflect", + jars = ["lib/scala-reflect.jar"], + visibility = ["//visibility:public"], +) + +_declare_scala_worker( + name = "scala_2_12", + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_12", + scalalib = "@scala_2_12//:scala-library", + scalareflect = "@scala_2_12//:scala-reflect", + scalacompiler = "@scala_2_12//:scala-compiler", + scalatest = ["@scalatest_2_12//jar", "@scalactic_2_12//jar"], + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2_12.jar", + visibility = ["//visibility:public"], +) +""" diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 78dea476c..d7f053fd0 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -699,10 +699,12 @@ def _scala_test_flags(ctx): def scala_test_impl(ctx): if len(ctx.attr.suites) != 0: print("suites attribute is deprecated. All scalatest test suites are run") + + scalaworker = ctx.attr.scalaworker[_ScalaWorker] jars = _collect_jars_from_common_ctx( ctx, extra_runtime_deps = [ - ctx.attr._scalatest_reporter, ctx.attr._scalatest_runner + ctx.attr.scalatest_reporter, scalaworker.scalatest_runner ], ) (cjars, transitive_rjars, transitive_compile_jars, @@ -710,7 +712,7 @@ def scala_test_impl(ctx): jars.transitive_compile_jars, jars.jars2labels) # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately - scalatest_jars = collect_jars([ctx.attr._scalatest]).transitive_runtime_jars + scalatest_jars = collect_jars(scalaworker.scalatest).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) @@ -718,7 +720,7 @@ def scala_test_impl(ctx): transitive_compile_jars = depset( transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() - add_labels_of_jars_to(jars_to_labels, ctx.attr._scalatest, + add_labels_of_jars_to(jars_to_labels, scalaworker.scalatest, scalatest_jars_list, scalatest_jars_list) args = " ".join([ diff --git a/scala/providers.bzl b/scala/providers.bzl index df2c37ee2..0d8d2bdb9 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -27,7 +27,12 @@ def create_scala_provider(ijar, class_jar, compile_jars, ScalaWorker = provider( doc = "ScalaWorker", - fields = ["scalac", "scalalib", "scalareflect", "scalacompiler"]) + fields = ["scalac", + "scalalib", + "scalareflect", + "scalacompiler", + "scalatest", + "scalatest_runner"]) def _declare_scala_worker(ctx): return [ @@ -36,6 +41,8 @@ def _declare_scala_worker(ctx): scalalib = ctx.attr.scalalib, scalareflect = ctx.attr.scalareflect, scalacompiler = ctx.attr.scalacompiler, + scalatest = ctx.attr.scalatest, + scalatest_runner = ctx.attr.scalatest_runner, ) ] @@ -62,4 +69,18 @@ declare_scala_worker = rule( "//external:io_bazel_rules_scala/dependency/scala/scala_compiler" ), allow_files = True), + "scalaxml": attr.label( + default = Label( + "//external:io_bazel_rules_scala/dependency/scala/scala_xml" + ), + allow_files = True), + "scalatest": attr.label_list( + default = [Label( + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11")], + allow_files = True), + "scalatest_runner": attr.label( + executable = True, + cfg = "host", + default = Label("//src/java/io/bazel/rulesscala/scala_test:runner_2_11.jar"), + allow_files = True), }) diff --git a/scala/scala.bzl b/scala/scala.bzl index 7da6aca7e..0b2f6bef9 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -22,11 +22,18 @@ load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", _specs2_junit_dependencies = "specs2_junit_dependencies") +load( + "@io_bazel_rules_scala//scala:build_files.bzl", + _SCALA_BUILD_FILE_2_11 = "SCALA_BUILD_FILE_2_11", + _SCALA_BUILD_FILE_2_12 = "SCALA_BUILD_FILE_2_12", +) _launcher_template = { "_java_stub_template": attr.label( default = Label("@java_stub_template//file")), } + + _implicit_deps = { "_singlejar": attr.label( executable = True, @@ -38,23 +45,6 @@ _implicit_deps = { cfg = "host", default = Label("@bazel_tools//tools/jdk:ijar"), allow_files = True), - "_scalac": attr.label( - executable = True, - cfg = "host", - default = Label("//src/java/io/bazel/rulesscala/scalac"), - allow_files = True), - "_scalalib": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_library"), - allow_files = True), - "_scalacompiler": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_compiler"), - allow_files = True), - "_scalareflect": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_reflect"), - allow_files = True), "_zipper": attr.label( executable = True, cfg = "host", @@ -71,7 +61,7 @@ _implicit_deps = { scala_deps = { "scalaworker": attr.label( - default = Label("@scala//:worker"), providers = [_ScalaWorker]) + default = Label("@scala"), providers = [_ScalaWorker]) } # Single dep to allow IDEs to pickup all the implicit dependencies. @@ -85,6 +75,7 @@ _resolve_deps = { allow_files = False), } +# TODO not version specific _test_resolve_deps = { "_scala_toolchain": attr.label_list( default = [ @@ -92,7 +83,7 @@ _test_resolve_deps = { "//external:io_bazel_rules_scala/dependency/scala/scala_library" ), Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest" + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11" ), ], allow_files = False), @@ -236,17 +227,13 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest"), - allow_files = True), "_scalatest_runner": attr.label( executable = True, cfg = "host", - default = Label("//src/java/io/bazel/rulesscala/scala_test:runner.jar"), + default = Label("//src/java/io/bazel/rulesscala/scala_test:runner_2_11.jar"), allow_files = True), - "_scalatest_reporter": attr.label( - default = Label("//scala/support:test_reporter")), + "scalatest_reporter": attr.label( + default = Label("//scala/support:test_reporter_2_11")), } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) @@ -278,47 +265,6 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -_SCALA_BUILD_FILE = """ -# scala.BUILD -load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scala_worker = "declare_scala_worker", -) -java_import( - name = "scala-xml", - jars = ["lib/scala-xml_2.11-1.0.5.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-parser-combinators", - jars = ["lib/scala-parser-combinators_2.11-1.0.4.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-library", - jars = ["lib/scala-library.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-compiler", - jars = ["lib/scala-compiler.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-reflect", - jars = ["lib/scala-reflect.jar"], - visibility = ["//visibility:public"], -) - -_declare_scala_worker( - name = "worker", - visibility = ["//visibility:public"], -) -""" - def scala_repositories(): native.new_http_archive( name = "scala", @@ -326,21 +272,36 @@ def scala_repositories(): sha256 = "12037ca64c68468e717e950f47fc77d5ceae5e74e3bdca56f6d02fd5bfd6900b", url = "https://downloads.lightbend.com/scala/2.11.11/scala-2.11.11.tgz", - build_file_content = _SCALA_BUILD_FILE, + build_file_content = _SCALA_BUILD_FILE_2_11, + ) + native.new_http_archive( + name = "scala_2_12", + strip_prefix = "scala-2.12.5", + url = "https://downloads.lightbend.com/scala/2.12.5/scala-2.12.5.tgz", + build_file_content = _SCALA_BUILD_FILE_2_12, ) - _new_scala_repository("scala_2_12", "2.12.4") + _new_scala_repository("scala_2_12_4", "2.12.4") _new_scala_repository("scala_2_11_1", "2.11.1") # scalatest has macros, note http_jar is invoking ijar native.http_jar( - name = "scalatest", + name = "scalatest_2_11", url = "https://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", ) + native.http_jar( + name = "scalatest_2_12", + url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.jar" + ) + native.http_jar( + name = "scalactic_2_12", + url = "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar" + ) + native.maven_server( name = "scalac_deps_maven_server", url = "https://mirror.bazel.build/repo1.maven.org/maven2/", @@ -408,8 +369,12 @@ def scala_repositories(): actual = "@scala//:scala-xml") native.bind( - name = "io_bazel_rules_scala/dependency/scalatest/scalatest", - actual = "@scalatest//jar") + name = "io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", + actual = "@scalatest_2_11//jar") + + native.bind( + name = "io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", + actual = "@scalatest_2_12//jar") def _sanitize_string_for_usage(s): res_array = [] diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 8c1f02ef2..5ceb3bb78 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -26,7 +26,8 @@ def scala_mvn_artifact(artifact): version = gav[2] return "%s:%s_%s:%s" % (groupid, artifactid, scala_version(), version) -_SCALA_BUILD_FILE_2_12 = """ +def _generate_scala_worker(version): + return """ # scala.BUILD load("@io_bazel_rules_scala//scala:providers.bzl", _declare_scala_worker = "declare_scala_worker", @@ -34,13 +35,13 @@ load("@io_bazel_rules_scala//scala:providers.bzl", java_import( name = "scala-xml", - jars = ["lib/scala-xml_2.12-1.0.6.jar"], + jars = ["lib/scala-xml_{version}-1.0.6.jar"], visibility = ["//visibility:public"], ) java_import( name = "scala-parser-combinators", - jars = ["lib/scala-parser-combinators_2.12-1.0.7.jar"], + jars = ["lib/scala-parser-combinators_{version}-1.0.7.jar"], visibility = ["//visibility:public"], ) @@ -61,9 +62,14 @@ java_import( jars = ["lib/scala-reflect.jar"], visibility = ["//visibility:public"], ) -""" + """.format(version = version) def _generate_scala_build_file_impl(ctx): + if ctx.attr.version == "2_12": + scalatest = """["@scalatest_{version}//jar", "@scalactic_{version}//jar"]""".format(version = ctx.attr.version) + else: + scalatest = """["@scalatest_{version}//jar"]""".format(version = ctx.attr.version) + contents = """ load("@io_bazel_rules_scala//scala:providers.bzl", _declare_scala_worker = "declare_scala_worker", @@ -93,18 +99,21 @@ _declare_scala_worker( scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", scalacompiler = "@{archive}//:scala-compiler", + scalatest = {scalatest}, + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_{version}.jar", visibility = ["//visibility:public"], ) """.format( - archive = ctx.attr.archive, name = ctx.attr.name) + archive = ctx.attr.archive, name = ctx.attr.name, version = ctx.attr.version, scalatest = scalatest) ctx.file("BUILD", contents, False) _generate_scala_build_file = repository_rule( implementation = _generate_scala_build_file_impl, - attrs = {"archive": attr.string()}) + attrs = {"archive": attr.string(), "version": attr.string()}) def new_scala_repository(name, version): + major_version = version[:version.find(".", 2)] archive = "{name}_archive".format(name = name) native.new_http_archive( name = archive, @@ -112,8 +121,8 @@ def new_scala_repository(name, version): url = "https://downloads.lightbend.com/scala/{version}/scala-{version}.tgz". format(version = version), - build_file_content = _SCALA_BUILD_FILE_2_12, + build_file_content = _generate_scala_worker(major_version), ) _generate_scala_build_file( - name = name, archive = archive, visibility = ["//visibility:public"]) + name = name, archive = archive, version = major_version.replace(".", "_"), visibility = ["//visibility:public"]) diff --git a/scala/support/BUILD b/scala/support/BUILD index 2f70647da..8a9605bf4 100644 --- a/scala/support/BUILD +++ b/scala/support/BUILD @@ -1,7 +1,7 @@ load("//scala:scala.bzl", "scala_library") scala_library( - name = "test_reporter", + name = "test_reporter_2_11", srcs = ["JUnitXmlReporter.scala"], scalacopts = [ "-deprecation:true", @@ -25,6 +25,36 @@ scala_library( visibility = ["//visibility:public"], deps = [ "//external:io_bazel_rules_scala/dependency/scala/scala_xml", - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", + ], +) + +scala_library( + name = "test_reporter_2_12", + srcs = ["JUnitXmlReporter.scala"], + scalacopts = [ + "-deprecation:true", + "-encoding", + "UTF-8", + "-feature", + "-language:existentials", + "-language:higherKinds", + "-language:implicitConversions", + "-unchecked", + "-Xfatal-warnings", + "-Xlint", + "-Yno-adapted-args", + "-Ywarn-dead-code", + "-Ywarn-numeric-widen", + "-Ywarn-value-discard", + "-Xfuture", + "-Ywarn-unused-import", + "-Ypartial-unification", + ], + visibility = ["//visibility:public"], + scalaworker = "@scala_2_12", + deps = [ + "@scala_2_12//:scala-xml", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", ], ) diff --git a/src/java/io/bazel/rulesscala/scala_test/BUILD b/src/java/io/bazel/rulesscala/scala_test/BUILD index 4520a832e..5e28ccd06 100644 --- a/src/java/io/bazel/rulesscala/scala_test/BUILD +++ b/src/java/io/bazel/rulesscala/scala_test/BUILD @@ -1,8 +1,19 @@ java_binary( - name = "runner", + name = "runner_2_11", srcs = ["Runner.java"], visibility = ["//visibility:public"], deps = [ - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", ], ) + +java_binary( + name = "runner_2_12", + srcs = ["Runner.java"], + visibility = ["//visibility:public"], + deps = [ + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", + "@scalactic_2_12//jar", + ], +) + diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index 1a0879fa3..024330ea7 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -19,6 +19,27 @@ java_binary( ], ) +java_binary( + name = "scalac_2_12", + srcs = [ + "CompileOptions.java", + "Resource.java", + "ScalaCInvoker.java", + "ScalacProcessor.java", + ], + main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", + visibility = ["//visibility:public"], + deps = [ + "//external:io_bazel_rules_scala/dependency/commons_io/commons_io", + '@scala_2_12//:scala-compiler', + '@scala_2_12//:scala-library', + '@scala_2_12//:scala-reflect', + "//src/java/com/google/devtools/build/lib:worker", + "//src/java/io/bazel/rulesscala/jar", + "//src/java/io/bazel/rulesscala/worker", + ], +) + filegroup( name = "scalac_files", srcs = [ diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index da15a9f8a..753a6e8f9 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -23,7 +23,7 @@ scala_library( scala_library( name = "lib212", srcs = ["HelloWorldLib212.scala"], - scalaworker = "@scala_2_12" + scalaworker = "@scala_2_12", ) scala_repl( @@ -43,6 +43,20 @@ scala_test( srcs = ["Test.scala"], ) +scala_test( + name = "test212", + srcs = ["Test.scala"], + scalaworker = "@scala_2_12", + scalatest_reporter = "//scala/support:test_reporter_2_12" +) + +scala_test( + name = "test2124", + srcs = ["Test.scala"], + scalaworker = "@scala_2_12_4", + scalatest_reporter = "//scala/support:test_reporter_2_12" +) + scala_binary( name = "binary", srcs = ["ScalaBinary.scala"], diff --git a/test/crossbuild/test b/test/crossbuild/test index 002932512..437c50f14 100755 --- a/test/crossbuild/test +++ b/test/crossbuild/test @@ -27,6 +27,8 @@ bazel build //test/crossbuild:repl bazel build //test/crossbuild:repl212 bazel test //test/crossbuild:test +bazel test //test/crossbuild:test212 +bazel test //test/crossbuild:test2124 bazel run //test/crossbuild:binary bazel run //test/crossbuild:binary212 From 25132c9e72ad9a56873a0e934e2f23aefd104a52 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 18 Jun 2018 11:09:23 -0700 Subject: [PATCH 09/63] Update scalatest to 3.0.5 + remove defaults from ScalaWorker - rename scalac -> scalac_2_11 --- scala/build_files.bzl | 8 ++++++++ scala/providers.bzl | 25 ++++++++--------------- scala/scala.bzl | 19 +++++++---------- scala/scala_cross_version.bzl | 1 + src/java/io/bazel/rulesscala/scalac/BUILD | 2 +- test/crossbuild/BUILD | 1 + 6 files changed, 26 insertions(+), 30 deletions(-) diff --git a/scala/build_files.bzl b/scala/build_files.bzl index b836785c1..33577e0af 100644 --- a/scala/build_files.bzl +++ b/scala/build_files.bzl @@ -36,6 +36,13 @@ java_import( _declare_scala_worker( name = "scala", visibility = ["//visibility:public"], + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_11", + scalalib = "//:scala-library", + scalareflect = "//:scala-reflect", + scalaxml = "//:scala-xml", + scalacompiler = "//:scala-compiler", + scalatest = ["@scalatest_2_11//jar", "@scalactic_2_11//jar"], + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2_11.jar", ) """ @@ -80,6 +87,7 @@ _declare_scala_worker( scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_12", scalalib = "@scala_2_12//:scala-library", scalareflect = "@scala_2_12//:scala-reflect", + scalaxml = "//:scala-xml", scalacompiler = "@scala_2_12//:scala-compiler", scalatest = ["@scalatest_2_12//jar", "@scalactic_2_12//jar"], scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2_12.jar", diff --git a/scala/providers.bzl b/scala/providers.bzl index 0d8d2bdb9..330af99bf 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -52,35 +52,26 @@ declare_scala_worker = rule( "scalac": attr.label( executable = True, cfg = "host", - default = Label("//src/java/io/bazel/rulesscala/scalac"), - allow_files = True), + allow_files = True, + mandatory = True), "scalalib": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_library" - ), + mandatory = True, allow_files = True), "scalareflect": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_reflect" - ), + mandatory = True, allow_files = True), "scalacompiler": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_compiler" - ), + mandatory = True, allow_files = True), "scalaxml": attr.label( - default = Label( - "//external:io_bazel_rules_scala/dependency/scala/scala_xml" - ), + mandatory = True, allow_files = True), "scalatest": attr.label_list( - default = [Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11")], + mandatory = True, allow_files = True), "scalatest_runner": attr.label( executable = True, cfg = "host", - default = Label("//src/java/io/bazel/rulesscala/scala_test:runner_2_11.jar"), + mandatory = True, allow_files = True), }) diff --git a/scala/scala.bzl b/scala/scala.bzl index 0b2f6bef9..bba806be2 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -227,13 +227,7 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest_runner": attr.label( - executable = True, - cfg = "host", - default = Label("//src/java/io/bazel/rulesscala/scala_test:runner_2_11.jar"), - allow_files = True), - "scalatest_reporter": attr.label( - default = Label("//scala/support:test_reporter_2_11")), + "scalatest_reporter": attr.label(mandatory = True), } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) @@ -287,15 +281,16 @@ def scala_repositories(): # scalatest has macros, note http_jar is invoking ijar native.http_jar( name = "scalatest_2_11", - url = - "https://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://central.maven.org/maven2/org/scalatest/scalatest_2.11/2.2.6/scalatest_2.11-2.2.6.jar" + ) + native.http_jar( + name = "scalactic_2_11", + url = "http://central.maven.org/maven2/org/scalactic/scalactic_2.11/3.0.5/scalactic_2.11-3.0.5.jar" ) native.http_jar( name = "scalatest_2_12", - url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.1/scalatest_2.12-3.0.1.jar" + url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar" ) native.http_jar( name = "scalactic_2_12", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 5ceb3bb78..3b228a040 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -98,6 +98,7 @@ _declare_scala_worker( scalac = ":scalac_worker", scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", + scalaxml = "@{archive}//:scala-xml", scalacompiler = "@{archive}//:scala-compiler", scalatest = {scalatest}, scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_{version}.jar", diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index 024330ea7..ced439ad2 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -1,5 +1,5 @@ java_binary( - name = "scalac", + name = "scalac_2_11", srcs = [ "CompileOptions.java", "Resource.java", diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 753a6e8f9..5ea7c6142 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -41,6 +41,7 @@ scala_repl( scala_test( name = "test", srcs = ["Test.scala"], + scalatest_reporter = "//scala/support:test_reporter_2_11" ) scala_test( From d8edfb6085e0136b5abf66c29cf7732802c2494b Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 18 Jun 2018 14:07:35 -0700 Subject: [PATCH 10/63] Symlink scalac_worker sources to repo_rule workspace --- scala/scala_cross_version.bzl | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 3b228a040..e84c70ac3 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -64,11 +64,22 @@ java_import( ) """.format(version = version) -def _generate_scala_build_file_impl(ctx): - if ctx.attr.version == "2_12": - scalatest = """["@scalatest_{version}//jar", "@scalactic_{version}//jar"]""".format(version = ctx.attr.version) +def _generate_scala_build_file_impl(repository_ctx): + if repository_ctx.attr.version == "2_12": + scalatest = """["@scalatest_{version}//jar", "@scalactic_{version}//jar"]""".format(version = repository_ctx.attr.version) else: - scalatest = """["@scalatest_{version}//jar"]""".format(version = ctx.attr.version) + scalatest = """["@scalatest_{version}//jar"]""".format(version = repository_ctx.attr.version) + + scalac_worker_srcs = [ + "CompileOptions.java", + "ScalaCInvoker.java", + "ScalacProcessor.java", + "Resource.java", + ] + + for src in scalac_worker_srcs: + path = Label("@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:{}".format(src)) + repository_ctx.symlink(path, "scalac_worker_srcs_symlinked/{}".format(src)) contents = """ load("@io_bazel_rules_scala//scala:providers.bzl", @@ -77,9 +88,7 @@ load("@io_bazel_rules_scala//scala:providers.bzl", java_binary( name = "scalac_worker", - srcs = [ - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_files", - ], + srcs = glob(["scalac_worker_srcs_symlinked/*.java"]), main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", visibility = ["//visibility:public"], deps = [ @@ -105,9 +114,9 @@ _declare_scala_worker( visibility = ["//visibility:public"], ) """.format( - archive = ctx.attr.archive, name = ctx.attr.name, version = ctx.attr.version, scalatest = scalatest) + archive = repository_ctx.attr.archive, name = repository_ctx.attr.name, version = repository_ctx.attr.version, scalatest = scalatest) - ctx.file("BUILD", contents, False) + repository_ctx.file("BUILD", contents, False) _generate_scala_build_file = repository_rule( implementation = _generate_scala_build_file_impl, From cf37e0fa6c2241df7036fe12a7c221f4cf051874 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 18 Jun 2018 22:15:25 -0700 Subject: [PATCH 11/63] Resolve scalatest_reporter version in rule - Pass both 2.11/2.12 versions as implicit attrs - Add "major_version" to [ScalaWorker] --- scala/build_files.bzl | 10 ++++++---- scala/private/rule_impls.bzl | 8 +++++++- scala/providers.bzl | 5 ++++- scala/scala.bzl | 8 ++++---- scala/scala_cross_version.bzl | 19 +++++++++---------- scala/support/BUILD | 5 +++-- src/java/io/bazel/rulesscala/scala_test/BUILD | 4 ++-- src/java/io/bazel/rulesscala/scalac/BUILD | 4 ++-- test/crossbuild/BUILD | 3 --- 9 files changed, 37 insertions(+), 29 deletions(-) diff --git a/scala/build_files.bzl b/scala/build_files.bzl index 33577e0af..67991b0f8 100644 --- a/scala/build_files.bzl +++ b/scala/build_files.bzl @@ -36,13 +36,14 @@ java_import( _declare_scala_worker( name = "scala", visibility = ["//visibility:public"], - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_11", + major_version = "2.11", + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2.11", scalalib = "//:scala-library", scalareflect = "//:scala-reflect", scalaxml = "//:scala-xml", scalacompiler = "//:scala-compiler", scalatest = ["@scalatest_2_11//jar", "@scalactic_2_11//jar"], - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2_11.jar", + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2.11.jar", ) """ @@ -84,13 +85,14 @@ java_import( _declare_scala_worker( name = "scala_2_12", - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2_12", + major_version = "2.12", + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2.12", scalalib = "@scala_2_12//:scala-library", scalareflect = "@scala_2_12//:scala-reflect", scalaxml = "//:scala-xml", scalacompiler = "@scala_2_12//:scala-compiler", scalatest = ["@scalatest_2_12//jar", "@scalactic_2_12//jar"], - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2_12.jar", + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2.12.jar", visibility = ["//visibility:public"], ) """ diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index d7f053fd0..55bb8813d 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -701,10 +701,16 @@ def scala_test_impl(ctx): print("suites attribute is deprecated. All scalatest test suites are run") scalaworker = ctx.attr.scalaworker[_ScalaWorker] + + if scalaworker.major_version == "2.11": + scalatest_reporter = ctx.attr._scalatest_reporter_2_11 + else: + scalatest_reporter = ctx.attr._scalatest_reporter_2_12 + jars = _collect_jars_from_common_ctx( ctx, extra_runtime_deps = [ - ctx.attr.scalatest_reporter, scalaworker.scalatest_runner + scalatest_reporter, scalaworker.scalatest_runner ], ) (cjars, transitive_rjars, transitive_compile_jars, diff --git a/scala/providers.bzl b/scala/providers.bzl index 330af99bf..6cb69d892 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -27,7 +27,8 @@ def create_scala_provider(ijar, class_jar, compile_jars, ScalaWorker = provider( doc = "ScalaWorker", - fields = ["scalac", + fields = ["major_version", + "scalac", "scalalib", "scalareflect", "scalacompiler", @@ -37,6 +38,7 @@ ScalaWorker = provider( def _declare_scala_worker(ctx): return [ ScalaWorker( + major_version = ctx.attr.major_version, scalac = ctx.attr.scalac, scalalib = ctx.attr.scalalib, scalareflect = ctx.attr.scalareflect, @@ -49,6 +51,7 @@ def _declare_scala_worker(ctx): declare_scala_worker = rule( implementation = _declare_scala_worker, attrs = { + "major_version": attr.string(mandatory = True), "scalac": attr.label( executable = True, cfg = "host", diff --git a/scala/scala.bzl b/scala/scala.bzl index bba806be2..37fd91d0f 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -15,7 +15,7 @@ load( load( "@io_bazel_rules_scala//scala:scala_cross_version.bzl", - _new_scala_repository = "new_scala_repository", + _new_scala_repository = "new_scala_repository" ) load( @@ -60,8 +60,7 @@ _implicit_deps = { } scala_deps = { - "scalaworker": attr.label( - default = Label("@scala"), providers = [_ScalaWorker]) + "scalaworker": attr.label(default = Label("@scala"), providers = [_ScalaWorker]) } # Single dep to allow IDEs to pickup all the implicit dependencies. @@ -227,7 +226,8 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "scalatest_reporter": attr.label(mandatory = True), + "_scalatest_reporter_2_11": attr.label(default = "//scala/support:test_reporter_2.11"), + "_scalatest_reporter_2_12": attr.label(default = "//scala/support:test_reporter_2.12"), } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index e84c70ac3..6fde2c359 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -65,11 +65,6 @@ java_import( """.format(version = version) def _generate_scala_build_file_impl(repository_ctx): - if repository_ctx.attr.version == "2_12": - scalatest = """["@scalatest_{version}//jar", "@scalactic_{version}//jar"]""".format(version = repository_ctx.attr.version) - else: - scalatest = """["@scalatest_{version}//jar"]""".format(version = repository_ctx.attr.version) - scalac_worker_srcs = [ "CompileOptions.java", "ScalaCInvoker.java", @@ -104,23 +99,27 @@ java_binary( _declare_scala_worker( name = "{name}", + major_version = "{major_version}", scalac = ":scalac_worker", scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", scalaxml = "@{archive}//:scala-xml", scalacompiler = "@{archive}//:scala-compiler", - scalatest = {scalatest}, - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_{version}.jar", + scalatest = ["@scalatest_{version_with_underscore}//jar", "@scalactic_{version_with_underscore}//jar"], + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_{major_version}.jar", visibility = ["//visibility:public"], ) """.format( - archive = repository_ctx.attr.archive, name = repository_ctx.attr.name, version = repository_ctx.attr.version, scalatest = scalatest) + archive = repository_ctx.attr.archive, + name = repository_ctx.attr.name, + major_version = repository_ctx.attr.major_version, + version_with_underscore = repository_ctx.attr.major_version.replace(".", "_")) repository_ctx.file("BUILD", contents, False) _generate_scala_build_file = repository_rule( implementation = _generate_scala_build_file_impl, - attrs = {"archive": attr.string(), "version": attr.string()}) + attrs = {"archive": attr.string(), "major_version": attr.string()}) def new_scala_repository(name, version): major_version = version[:version.find(".", 2)] @@ -135,4 +134,4 @@ def new_scala_repository(name, version): ) _generate_scala_build_file( - name = name, archive = archive, version = major_version.replace(".", "_"), visibility = ["//visibility:public"]) + name = name, archive = archive, major_version = major_version, visibility = ["//visibility:public"]) diff --git a/scala/support/BUILD b/scala/support/BUILD index 8a9605bf4..57aba641d 100644 --- a/scala/support/BUILD +++ b/scala/support/BUILD @@ -1,7 +1,7 @@ load("//scala:scala.bzl", "scala_library") scala_library( - name = "test_reporter_2_11", + name = "test_reporter_2.11", srcs = ["JUnitXmlReporter.scala"], scalacopts = [ "-deprecation:true", @@ -23,6 +23,7 @@ scala_library( "-Ypartial-unification", ], visibility = ["//visibility:public"], + scalaworker = "@scala", deps = [ "//external:io_bazel_rules_scala/dependency/scala/scala_xml", "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", @@ -30,7 +31,7 @@ scala_library( ) scala_library( - name = "test_reporter_2_12", + name = "test_reporter_2.12", srcs = ["JUnitXmlReporter.scala"], scalacopts = [ "-deprecation:true", diff --git a/src/java/io/bazel/rulesscala/scala_test/BUILD b/src/java/io/bazel/rulesscala/scala_test/BUILD index 5e28ccd06..d9610c57b 100644 --- a/src/java/io/bazel/rulesscala/scala_test/BUILD +++ b/src/java/io/bazel/rulesscala/scala_test/BUILD @@ -1,5 +1,5 @@ java_binary( - name = "runner_2_11", + name = "runner_2.11", srcs = ["Runner.java"], visibility = ["//visibility:public"], deps = [ @@ -8,7 +8,7 @@ java_binary( ) java_binary( - name = "runner_2_12", + name = "runner_2.12", srcs = ["Runner.java"], visibility = ["//visibility:public"], deps = [ diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index ced439ad2..7b3d7a8f4 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -1,5 +1,5 @@ java_binary( - name = "scalac_2_11", + name = "scalac_2.11", srcs = [ "CompileOptions.java", "Resource.java", @@ -20,7 +20,7 @@ java_binary( ) java_binary( - name = "scalac_2_12", + name = "scalac_2.12", srcs = [ "CompileOptions.java", "Resource.java", diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 5ea7c6142..7567936e4 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -41,21 +41,18 @@ scala_repl( scala_test( name = "test", srcs = ["Test.scala"], - scalatest_reporter = "//scala/support:test_reporter_2_11" ) scala_test( name = "test212", srcs = ["Test.scala"], scalaworker = "@scala_2_12", - scalatest_reporter = "//scala/support:test_reporter_2_12" ) scala_test( name = "test2124", srcs = ["Test.scala"], scalaworker = "@scala_2_12_4", - scalatest_reporter = "//scala/support:test_reporter_2_12" ) scala_binary( From 5b2a0538c38740c3060a8f7f81a8780b8af190ac Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 18 Jun 2018 23:05:32 -0700 Subject: [PATCH 12/63] Use new_scala_repository for default 2.11/2.12 --- scala/build_files.bzl | 98 ----------------------------------- scala/scala.bzl | 54 ++++++++----------- scala/scala_cross_version.bzl | 16 +----- scala/support/BUILD | 4 +- test/crossbuild/BUILD | 12 ----- test/crossbuild/test | 3 -- 6 files changed, 26 insertions(+), 161 deletions(-) delete mode 100644 scala/build_files.bzl diff --git a/scala/build_files.bzl b/scala/build_files.bzl deleted file mode 100644 index 67991b0f8..000000000 --- a/scala/build_files.bzl +++ /dev/null @@ -1,98 +0,0 @@ -SCALA_BUILD_FILE_2_11 = """ -# scala.BUILD -load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scala_worker = "declare_scala_worker", -) -java_import( - name = "scala-xml", - jars = ["lib/scala-xml_2.11-1.0.5.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-parser-combinators", - jars = ["lib/scala-parser-combinators_2.11-1.0.4.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-library", - jars = ["lib/scala-library.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-compiler", - jars = ["lib/scala-compiler.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-reflect", - jars = ["lib/scala-reflect.jar"], - visibility = ["//visibility:public"], -) - -_declare_scala_worker( - name = "scala", - visibility = ["//visibility:public"], - major_version = "2.11", - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2.11", - scalalib = "//:scala-library", - scalareflect = "//:scala-reflect", - scalaxml = "//:scala-xml", - scalacompiler = "//:scala-compiler", - scalatest = ["@scalatest_2_11//jar", "@scalactic_2_11//jar"], - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2.11.jar", -) -""" - - -SCALA_BUILD_FILE_2_12 = """ -# scala.BUILD -load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scala_worker = "declare_scala_worker", -) -java_import( - name = "scala-xml", - 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.12-1.0.7.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-library", - jars = ["lib/scala-library.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-compiler", - jars = ["lib/scala-compiler.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-reflect", - jars = ["lib/scala-reflect.jar"], - visibility = ["//visibility:public"], -) - -_declare_scala_worker( - name = "scala_2_12", - major_version = "2.12", - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_2.12", - scalalib = "@scala_2_12//:scala-library", - scalareflect = "@scala_2_12//:scala-reflect", - scalaxml = "//:scala-xml", - scalacompiler = "@scala_2_12//:scala-compiler", - scalatest = ["@scalatest_2_12//jar", "@scalactic_2_12//jar"], - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_2.12.jar", - visibility = ["//visibility:public"], -) -""" diff --git a/scala/scala.bzl b/scala/scala.bzl index 37fd91d0f..4db383011 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -22,11 +22,6 @@ load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", _specs2_junit_dependencies = "specs2_junit_dependencies") -load( - "@io_bazel_rules_scala//scala:build_files.bzl", - _SCALA_BUILD_FILE_2_11 = "SCALA_BUILD_FILE_2_11", - _SCALA_BUILD_FILE_2_12 = "SCALA_BUILD_FILE_2_12", -) _launcher_template = { "_java_stub_template": attr.label( default = Label("@java_stub_template//file")), @@ -260,23 +255,9 @@ scala_repl = rule( ) 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", - build_file_content = _SCALA_BUILD_FILE_2_11, - ) - native.new_http_archive( - name = "scala_2_12", - strip_prefix = "scala-2.12.5", - url = "https://downloads.lightbend.com/scala/2.12.5/scala-2.12.5.tgz", - build_file_content = _SCALA_BUILD_FILE_2_12, - ) - _new_scala_repository("scala_2_12_4", "2.12.4") - _new_scala_repository("scala_2_11_1", "2.11.1") + _new_scala_repository("scala", "2.11.11") + _new_scala_repository("scala_2_12", "2.12.5") # scalatest has macros, note http_jar is invoking ijar native.http_jar( @@ -296,6 +277,23 @@ def scala_repositories(): name = "scalactic_2_12", url = "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar" ) + native.http_jar( + name = "scala_xml_2_11", + url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.11/1.0.5/scala-xml_2.11-1.0.5.jar" + ) + native.http_jar( + name = "scala_xml_2_12", + url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.5/scala-xml_2.12-1.0.5.jar" + ) + native.http_jar( + name = "scala_parser_combinators_2_11", + url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar" + ) + + native.http_jar( + name = "scala_parser_combinators_2_12", + url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar" + ) native.maven_server( name = "scalac_deps_maven_server", @@ -343,25 +341,17 @@ def scala_repositories(): name = "io_bazel_rules_scala/dependency/commons_io/commons_io", actual = "@scalac_rules_commons_io//jar") - native.bind( - name = "io_bazel_rules_scala/dependency/scala/parser_combinators", - actual = "@scala//:scala-parser-combinators") - native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_compiler", - actual = "@scala//:scala-compiler") + actual = "@scala_imports//:scala-compiler") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_library", - actual = "@scala//:scala-library") + actual = "@scala_imports//:scala-library") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_reflect", - actual = "@scala//:scala-reflect") - - native.bind( - name = "io_bazel_rules_scala/dependency/scala/scala_xml", - actual = "@scala//:scala-xml") + actual = "@scala_imports//:scala-reflect") native.bind( name = "io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 6fde2c359..9b1f0427f 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -33,18 +33,6 @@ load("@io_bazel_rules_scala//scala:providers.bzl", _declare_scala_worker = "declare_scala_worker", ) -java_import( - name = "scala-xml", - jars = ["lib/scala-xml_{version}-1.0.6.jar"], - visibility = ["//visibility:public"], -) - -java_import( - name = "scala-parser-combinators", - jars = ["lib/scala-parser-combinators_{version}-1.0.7.jar"], - visibility = ["//visibility:public"], -) - java_import( name = "scala-library", jars = ["lib/scala-library.jar"], @@ -103,7 +91,7 @@ _declare_scala_worker( scalac = ":scalac_worker", scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", - scalaxml = "@{archive}//:scala-xml", + scalaxml = "@scala_xml_{version_with_underscore}//jar", scalacompiler = "@{archive}//:scala-compiler", scalatest = ["@scalatest_{version_with_underscore}//jar", "@scalactic_{version_with_underscore}//jar"], scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_{major_version}.jar", @@ -123,7 +111,7 @@ _generate_scala_build_file = repository_rule( def new_scala_repository(name, version): major_version = version[:version.find(".", 2)] - archive = "{name}_archive".format(name = name) + archive = "{name}_imports".format(name = name) native.new_http_archive( name = archive, strip_prefix = "scala-{version}".format(version = version), diff --git a/scala/support/BUILD b/scala/support/BUILD index 57aba641d..c7cfcfa19 100644 --- a/scala/support/BUILD +++ b/scala/support/BUILD @@ -25,7 +25,7 @@ scala_library( visibility = ["//visibility:public"], scalaworker = "@scala", deps = [ - "//external:io_bazel_rules_scala/dependency/scala/scala_xml", + "@scala_xml_2_11//jar", "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", ], ) @@ -55,7 +55,7 @@ scala_library( visibility = ["//visibility:public"], scalaworker = "@scala_2_12", deps = [ - "@scala_2_12//:scala-xml", + "@scala_xml_2_12//jar", "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", ], ) diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 7567936e4..1502a7361 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -14,12 +14,6 @@ scala_library( srcs = ["HelloWorldLib211.scala"], ) -scala_library( - name = "lib2111", - srcs = ["HelloWorldLib211.scala"], - scalaworker = "@scala_2_11_1" -) - scala_library( name = "lib212", srcs = ["HelloWorldLib212.scala"], @@ -49,12 +43,6 @@ scala_test( scalaworker = "@scala_2_12", ) -scala_test( - name = "test2124", - srcs = ["Test.scala"], - scalaworker = "@scala_2_12_4", -) - scala_binary( name = "binary", srcs = ["ScalaBinary.scala"], diff --git a/test/crossbuild/test b/test/crossbuild/test index 437c50f14..cb1c011b3 100755 --- a/test/crossbuild/test +++ b/test/crossbuild/test @@ -20,15 +20,12 @@ trap 'finish $?' EXIT set -x bazel build //test/crossbuild:lib -bazel build //test/crossbuild:lib2111 bazel build //test/crossbuild:lib212 bazel build //test/crossbuild:repl -bazel build //test/crossbuild:repl212 bazel test //test/crossbuild:test bazel test //test/crossbuild:test212 -bazel test //test/crossbuild:test2124 bazel run //test/crossbuild:binary bazel run //test/crossbuild:binary212 From 2dc260ff76106ea4be548b2c3d56b91dbc016a39 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 19 Jun 2018 09:27:50 -0700 Subject: [PATCH 13/63] scala_repositories takes scala versions as parameters --- scala/scala.bzl | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 4db383011..ce255e5c3 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -55,7 +55,7 @@ _implicit_deps = { } scala_deps = { - "scalaworker": attr.label(default = Label("@scala"), providers = [_ScalaWorker]) + "scalaworker": attr.label(default = Label("@scala_default"), providers = [_ScalaWorker]) } # Single dep to allow IDEs to pickup all the implicit dependencies. @@ -254,11 +254,15 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -def scala_repositories(): - +def scala_repositories(scala_default = "2.11.11", additional_scala_versions = [("scala_version_label", "2.12.6")]): + # required for bootstrapping scalatest_reporter _new_scala_repository("scala", "2.11.11") _new_scala_repository("scala_2_12", "2.12.5") + _new_scala_repository("scala_default", scala_default) + for scala_version_label, version in additional_scala_versions: + _new_scala_repository(scala_version_label, version) + # scalatest has macros, note http_jar is invoking ijar native.http_jar( name = "scalatest_2_11", From 94d0ab1699f2612a6c097ae56c0319cccda59f7f Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 19 Jun 2018 10:10:51 -0700 Subject: [PATCH 14/63] improve naming --- scala/private/rule_impls.bzl | 20 ++++++++++---------- scala/providers.bzl | 12 ++++++------ scala/scala.bzl | 4 ++-- scala/scala_cross_version.bzl | 18 +++++++++--------- scala/support/BUILD | 4 ++-- test/crossbuild/BUILD | 10 +++++----- 6 files changed, 34 insertions(+), 34 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 55bb8813d..f7bb1c290 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -16,7 +16,7 @@ load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain") load( "@io_bazel_rules_scala//scala:providers.bzl", "create_scala_provider", - _ScalaWorker = "ScalaWorker") + _ScalacProvider = "ScalacProvider") load( ":common.bzl", "add_labels_of_jars_to", @@ -252,7 +252,7 @@ StatsfileOutput: {statsfile_output} ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime + [ctx.outputs.manifest, ctx.executable._ijar, argfile]) - worker = ctx.attr.scalaworker[_ScalaWorker] + worker = ctx.attr.scalac[_ScalacProvider] _, _, input_manifests = ctx.resolve_command(tools = [worker.scalac]) ctx.actions.run( @@ -494,8 +494,8 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) # Get jars from deps - scalaworker = ctx.attr.scalaworker[_ScalaWorker] - auto_deps = [scalaworker.scalalib, scalaworker.scalareflect] + scalac = ctx.attr.scalac[_ScalacProvider] + auto_deps = [scalac.scalalib, scalac.scalareflect] deps_jars = collect_jars(ctx.attr.deps + auto_deps + extra_deps, dependency_analyzer_is_off) (cjars, transitive_rjars, jars2labels, @@ -651,7 +651,7 @@ def scala_repl_impl(ctx): # need scala-compiler for MainGenericRunner below jars = _collect_jars_from_common_ctx( ctx, - extra_runtime_deps = [ctx.attr.scalaworker[_ScalaWorker].scalacompiler]) + extra_runtime_deps = [ctx.attr.scalac[_ScalacProvider].scalacompiler]) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) args = " ".join(ctx.attr.scalacopts) @@ -700,9 +700,9 @@ def scala_test_impl(ctx): if len(ctx.attr.suites) != 0: print("suites attribute is deprecated. All scalatest test suites are run") - scalaworker = ctx.attr.scalaworker[_ScalaWorker] + scalac = ctx.attr.scalac[_ScalacProvider] - if scalaworker.major_version == "2.11": + if scalac.major_version == "2.11": scalatest_reporter = ctx.attr._scalatest_reporter_2_11 else: scalatest_reporter = ctx.attr._scalatest_reporter_2_12 @@ -710,7 +710,7 @@ def scala_test_impl(ctx): jars = _collect_jars_from_common_ctx( ctx, extra_runtime_deps = [ - scalatest_reporter, scalaworker.scalatest_runner + scalatest_reporter, scalac.scalatest_runner ], ) (cjars, transitive_rjars, transitive_compile_jars, @@ -718,7 +718,7 @@ def scala_test_impl(ctx): jars.transitive_compile_jars, jars.jars2labels) # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately - scalatest_jars = collect_jars(scalaworker.scalatest).transitive_runtime_jars + scalatest_jars = collect_jars(scalac.scalatest).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) @@ -726,7 +726,7 @@ def scala_test_impl(ctx): transitive_compile_jars = depset( transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() - add_labels_of_jars_to(jars_to_labels, scalaworker.scalatest, + add_labels_of_jars_to(jars_to_labels, scalac.scalatest, scalatest_jars_list, scalatest_jars_list) args = " ".join([ diff --git a/scala/providers.bzl b/scala/providers.bzl index 6cb69d892..c01909954 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -25,8 +25,8 @@ def create_scala_provider(ijar, class_jar, compile_jars, transitive_exports = [] #needed by intellij plugin ) -ScalaWorker = provider( - doc = "ScalaWorker", +ScalacProvider = provider( + doc = "ScalaProvider", fields = ["major_version", "scalac", "scalalib", @@ -35,9 +35,9 @@ ScalaWorker = provider( "scalatest", "scalatest_runner"]) -def _declare_scala_worker(ctx): +def _declare_scalac_provider(ctx): return [ - ScalaWorker( + ScalacProvider( major_version = ctx.attr.major_version, scalac = ctx.attr.scalac, scalalib = ctx.attr.scalalib, @@ -48,8 +48,8 @@ def _declare_scala_worker(ctx): ) ] -declare_scala_worker = rule( - implementation = _declare_scala_worker, +declare_scalac_provider = rule( + implementation = _declare_scalac_provider, attrs = { "major_version": attr.string(mandatory = True), "scalac": attr.label( diff --git a/scala/scala.bzl b/scala/scala.bzl index ce255e5c3..1149b11c9 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -10,7 +10,7 @@ load( load( "@io_bazel_rules_scala//scala:providers.bzl", - _ScalaWorker = "ScalaWorker", + _ScalacProvider = "ScalacProvider", ) load( @@ -55,7 +55,7 @@ _implicit_deps = { } scala_deps = { - "scalaworker": attr.label(default = Label("@scala_default"), providers = [_ScalaWorker]) + "scalac": attr.label(default = Label("@scala_default"), providers = [_ScalacProvider]) } # Single dep to allow IDEs to pickup all the implicit dependencies. diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 9b1f0427f..90de240fe 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -26,11 +26,11 @@ def scala_mvn_artifact(artifact): version = gav[2] return "%s:%s_%s:%s" % (groupid, artifactid, scala_version(), version) -def _generate_scala_worker(version): +def _generate_scala_imports(version): return """ # scala.BUILD load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scala_worker = "declare_scala_worker", + _declare_scalac_provider = "declare_scalac_provider", ) java_import( @@ -52,7 +52,7 @@ java_import( ) """.format(version = version) -def _generate_scala_build_file_impl(repository_ctx): +def _generate_scalac_build_file_impl(repository_ctx): scalac_worker_srcs = [ "CompileOptions.java", "ScalaCInvoker.java", @@ -66,7 +66,7 @@ def _generate_scala_build_file_impl(repository_ctx): contents = """ load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scala_worker = "declare_scala_worker", + _declare_scalac_provider = "declare_scalac_provider", ) java_binary( @@ -85,7 +85,7 @@ java_binary( ], ) -_declare_scala_worker( +_declare_scalac_provider( name = "{name}", major_version = "{major_version}", scalac = ":scalac_worker", @@ -105,8 +105,8 @@ _declare_scala_worker( repository_ctx.file("BUILD", contents, False) -_generate_scala_build_file = repository_rule( - implementation = _generate_scala_build_file_impl, +_generate_scalac_build_file = repository_rule( + implementation = _generate_scalac_build_file_impl, attrs = {"archive": attr.string(), "major_version": attr.string()}) def new_scala_repository(name, version): @@ -118,8 +118,8 @@ def new_scala_repository(name, version): url = "https://downloads.lightbend.com/scala/{version}/scala-{version}.tgz". format(version = version), - build_file_content = _generate_scala_worker(major_version), + build_file_content = _generate_scala_imports(major_version), ) - _generate_scala_build_file( + _generate_scalac_build_file( name = name, archive = archive, major_version = major_version, visibility = ["//visibility:public"]) diff --git a/scala/support/BUILD b/scala/support/BUILD index c7cfcfa19..5af96e488 100644 --- a/scala/support/BUILD +++ b/scala/support/BUILD @@ -23,7 +23,7 @@ scala_library( "-Ypartial-unification", ], visibility = ["//visibility:public"], - scalaworker = "@scala", + scalac = "@scala", deps = [ "@scala_xml_2_11//jar", "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", @@ -53,7 +53,7 @@ scala_library( "-Ypartial-unification", ], visibility = ["//visibility:public"], - scalaworker = "@scala_2_12", + scalac = "@scala_2_12", deps = [ "@scala_xml_2_12//jar", "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 1502a7361..911b49b13 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -17,7 +17,7 @@ scala_library( scala_library( name = "lib212", srcs = ["HelloWorldLib212.scala"], - scalaworker = "@scala_2_12", + scalac = "@scala_2_12", ) scala_repl( @@ -28,7 +28,7 @@ scala_repl( scala_repl( name = "repl212", deps = [":lib212"], - scalaworker = "@scala_2_12" + scalac = "@scala_2_12" ) # TODO: scalatest not working with 2.12 @@ -40,7 +40,7 @@ scala_test( scala_test( name = "test212", srcs = ["Test.scala"], - scalaworker = "@scala_2_12", + scalac = "@scala_version_label", ) scala_binary( @@ -53,7 +53,7 @@ scala_binary( name = "binary212", srcs = ["ScalaBinary.scala"], main_class = "scala.test.crossbuild.ScalaBinary", - scalaworker = "@scala_2_12" + scalac = "@scala_2_12" ) scala_macro_library( @@ -64,7 +64,7 @@ scala_macro_library( scala_macro_library( name = "macro212", srcs = ["MacroTest.scala"], - scalaworker = "@scala_2_12" + scalac = "@scala_2_12" ) # TODO: junit not working with 2.12 From a47af87d5aac17c67cf3ec6bef0c749466f5a474 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 21 Jun 2018 11:27:01 -0700 Subject: [PATCH 15/63] Use single scala version --- scala/private/rule_impls.bzl | 27 +++++------ scala/scala.bzl | 47 ++++++++++--------- scala/scala_cross_version.bzl | 2 +- scala/support/BUILD | 37 ++------------- src/java/io/bazel/rulesscala/scala_test/BUILD | 15 ++---- src/java/io/bazel/rulesscala/scalac/BUILD | 42 ----------------- test/crossbuild/BUILD | 33 ------------- test/crossbuild/test | 4 -- third_party/plugin/src/main/BUILD | 5 +- 9 files changed, 45 insertions(+), 167 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index f7bb1c290..2aa7d7eeb 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -252,13 +252,13 @@ StatsfileOutput: {statsfile_output} ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime + [ctx.outputs.manifest, ctx.executable._ijar, argfile]) - worker = ctx.attr.scalac[_ScalacProvider] - _, _, input_manifests = ctx.resolve_command(tools = [worker.scalac]) + scalac_provider = ctx.attr._scalac[_ScalacProvider] + _, _, input_manifests = ctx.resolve_command(tools = [scalac_provider.scalac]) ctx.actions.run( inputs = ins, outputs = outs, - executable = worker.scalac.files_to_run.executable, + executable = scalac_provider.scalac.files_to_run.executable, input_manifests = input_manifests, mnemonic = "Scalac", progress_message = "scala %s" % ctx.label, @@ -494,10 +494,11 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) # Get jars from deps - scalac = ctx.attr.scalac[_ScalacProvider] - auto_deps = [scalac.scalalib, scalac.scalareflect] + scalac_provider = ctx.attr._scalac[_ScalacProvider] + auto_deps = [scalac_provider.scalalib, scalac_provider.scalareflect] deps_jars = collect_jars(ctx.attr.deps + auto_deps + extra_deps, dependency_analyzer_is_off) + print(deps_jars) (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = (deps_jars.compile_jars, deps_jars.transitive_runtime_jars, @@ -507,6 +508,7 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], transitive_rjars = depset( transitive = [transitive_rjars] + _collect_runtime_jars(ctx.attr.runtime_deps + extra_runtime_deps)) + print(transitive_rjars) return struct( compile_jars = cjars, @@ -651,7 +653,7 @@ def scala_repl_impl(ctx): # need scala-compiler for MainGenericRunner below jars = _collect_jars_from_common_ctx( ctx, - extra_runtime_deps = [ctx.attr.scalac[_ScalacProvider].scalacompiler]) + extra_runtime_deps = [ctx.attr._scalac[_ScalacProvider].scalacompiler]) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) args = " ".join(ctx.attr.scalacopts) @@ -700,17 +702,12 @@ def scala_test_impl(ctx): if len(ctx.attr.suites) != 0: print("suites attribute is deprecated. All scalatest test suites are run") - scalac = ctx.attr.scalac[_ScalacProvider] - - if scalac.major_version == "2.11": - scalatest_reporter = ctx.attr._scalatest_reporter_2_11 - else: - scalatest_reporter = ctx.attr._scalatest_reporter_2_12 + scalac_provider = ctx.attr._scalac[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, extra_runtime_deps = [ - scalatest_reporter, scalac.scalatest_runner + ctx.attr._scalatest_reporter, scalac_provider.scalatest_runner ], ) (cjars, transitive_rjars, transitive_compile_jars, @@ -718,7 +715,7 @@ def scala_test_impl(ctx): jars.transitive_compile_jars, jars.jars2labels) # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately - scalatest_jars = collect_jars(scalac.scalatest).transitive_runtime_jars + scalatest_jars = collect_jars(scalac_provider.scalatest).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) @@ -726,7 +723,7 @@ def scala_test_impl(ctx): transitive_compile_jars = depset( transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() - add_labels_of_jars_to(jars_to_labels, scalac.scalatest, + add_labels_of_jars_to(jars_to_labels, scalac_provider.scalatest, scalatest_jars_list, scalatest_jars_list) args = " ".join([ diff --git a/scala/scala.bzl b/scala/scala.bzl index 1149b11c9..b43cac55a 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -22,6 +22,7 @@ load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", _specs2_junit_dependencies = "specs2_junit_dependencies") + _launcher_template = { "_java_stub_template": attr.label( default = Label("@java_stub_template//file")), @@ -55,7 +56,7 @@ _implicit_deps = { } scala_deps = { - "scalac": attr.label(default = Label("@scala_default"), providers = [_ScalacProvider]) + "_scalac": attr.label(default = Label("@scala_default"), providers = [_ScalacProvider]) } # Single dep to allow IDEs to pickup all the implicit dependencies. @@ -77,7 +78,7 @@ _test_resolve_deps = { "//external:io_bazel_rules_scala/dependency/scala/scala_library" ), Label( - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11" + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest" ), ], allow_files = False), @@ -221,8 +222,7 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest_reporter_2_11": attr.label(default = "//scala/support:test_reporter_2.11"), - "_scalatest_reporter_2_12": attr.label(default = "//scala/support:test_reporter_2.12"), + "_scalatest_reporter": attr.label(default = "//scala/support:test_reporter"), } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) @@ -254,19 +254,15 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -def scala_repositories(scala_default = "2.11.11", additional_scala_versions = [("scala_version_label", "2.12.6")]): - # required for bootstrapping scalatest_reporter - _new_scala_repository("scala", "2.11.11") - _new_scala_repository("scala_2_12", "2.12.5") +def scala_repositories(scala_default = "2.11.1"): + major_version_underscore = scala_default[:scala_default.find(".", 2)].replace(".", "_") _new_scala_repository("scala_default", scala_default) - for scala_version_label, version in additional_scala_versions: - _new_scala_repository(scala_version_label, version) # scalatest has macros, note http_jar is invoking ijar native.http_jar( name = "scalatest_2_11", - url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/2.2.6/scalatest_2.11-2.2.6.jar" + url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.5/scalatest_2.11-3.0.5.jar" ) native.http_jar( name = "scalactic_2_11", @@ -293,7 +289,6 @@ def scala_repositories(scala_default = "2.11.11", additional_scala_versions = [( name = "scala_parser_combinators_2_11", url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar" ) - native.http_jar( name = "scala_parser_combinators_2_12", url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar" @@ -346,24 +341,32 @@ def scala_repositories(scala_default = "2.11.11", additional_scala_versions = [( actual = "@scalac_rules_commons_io//jar") native.bind( - name = "io_bazel_rules_scala/dependency/scala/scala_compiler", - actual = "@scala_imports//:scala-compiler") + name = "io_bazel_rules_scala/dependency/scalatest/scalatest", + actual = "@scalatest_{}//jar".format(major_version_underscore)) native.bind( - name = "io_bazel_rules_scala/dependency/scala/scala_library", - actual = "@scala_imports//:scala-library") + name = "io_bazel_rules_scala/dependency/scalactic/scalactic", + actual = "@scalactic_{}//jar".format(major_version_underscore)) native.bind( - name = "io_bazel_rules_scala/dependency/scala/scala_reflect", - actual = "@scala_imports//:scala-reflect") + name = "io_bazel_rules_scala/dependency/scala/scala_xml", + actual = "@scala_xml_{}//jar".format(major_version_underscore)) + + native.bind( + name = "io_bazel_rules_scala/dependency/scala/parser_combinators", + actual = "@scala_parser_combinators_{}//jar".format(major_version_underscore)) + + native.bind( + name = "io_bazel_rules_scala/dependency/scala/scala_compiler", + actual = "@scala_default_imports//:scala-compiler") native.bind( - name = "io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", - actual = "@scalatest_2_11//jar") + name = "io_bazel_rules_scala/dependency/scala/scala_library", + actual = "@scala_default_imports//:scala-library") native.bind( - name = "io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", - actual = "@scalatest_2_12//jar") + name = "io_bazel_rules_scala/dependency/scala/scala_reflect", + actual = "@scala_default_imports//:scala-reflect") def _sanitize_string_for_usage(s): res_array = [] diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 90de240fe..e288f70b1 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -94,7 +94,7 @@ _declare_scalac_provider( scalaxml = "@scala_xml_{version_with_underscore}//jar", scalacompiler = "@{archive}//:scala-compiler", scalatest = ["@scalatest_{version_with_underscore}//jar", "@scalactic_{version_with_underscore}//jar"], - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner_{major_version}.jar", + scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner.jar", visibility = ["//visibility:public"], ) """.format( diff --git a/scala/support/BUILD b/scala/support/BUILD index 5af96e488..2f70647da 100644 --- a/scala/support/BUILD +++ b/scala/support/BUILD @@ -1,7 +1,7 @@ load("//scala:scala.bzl", "scala_library") scala_library( - name = "test_reporter_2.11", + name = "test_reporter", srcs = ["JUnitXmlReporter.scala"], scalacopts = [ "-deprecation:true", @@ -23,39 +23,8 @@ scala_library( "-Ypartial-unification", ], visibility = ["//visibility:public"], - scalac = "@scala", deps = [ - "@scala_xml_2_11//jar", - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", - ], -) - -scala_library( - name = "test_reporter_2.12", - srcs = ["JUnitXmlReporter.scala"], - scalacopts = [ - "-deprecation:true", - "-encoding", - "UTF-8", - "-feature", - "-language:existentials", - "-language:higherKinds", - "-language:implicitConversions", - "-unchecked", - "-Xfatal-warnings", - "-Xlint", - "-Yno-adapted-args", - "-Ywarn-dead-code", - "-Ywarn-numeric-widen", - "-Ywarn-value-discard", - "-Xfuture", - "-Ywarn-unused-import", - "-Ypartial-unification", - ], - visibility = ["//visibility:public"], - scalac = "@scala_2_12", - deps = [ - "@scala_xml_2_12//jar", - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", + "//external:io_bazel_rules_scala/dependency/scala/scala_xml", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", ], ) diff --git a/src/java/io/bazel/rulesscala/scala_test/BUILD b/src/java/io/bazel/rulesscala/scala_test/BUILD index d9610c57b..42bae6600 100644 --- a/src/java/io/bazel/rulesscala/scala_test/BUILD +++ b/src/java/io/bazel/rulesscala/scala_test/BUILD @@ -1,19 +1,10 @@ java_binary( - name = "runner_2.11", + name = "runner", srcs = ["Runner.java"], visibility = ["//visibility:public"], deps = [ - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_11", - ], -) - -java_binary( - name = "runner_2.12", - srcs = ["Runner.java"], - visibility = ["//visibility:public"], - deps = [ - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_2_12", - "@scalactic_2_12//jar", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", + "//external:io_bazel_rules_scala/dependency/scalactic/scalactic", ], ) diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index 7b3d7a8f4..122e49dbf 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -1,45 +1,3 @@ -java_binary( - name = "scalac_2.11", - srcs = [ - "CompileOptions.java", - "Resource.java", - "ScalaCInvoker.java", - "ScalacProcessor.java", - ], - main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", - visibility = ["//visibility:public"], - deps = [ - "//external:io_bazel_rules_scala/dependency/commons_io/commons_io", - "//external:io_bazel_rules_scala/dependency/scala/scala_compiler", - "//external:io_bazel_rules_scala/dependency/scala/scala_library", - "//external:io_bazel_rules_scala/dependency/scala/scala_reflect", - "//src/java/com/google/devtools/build/lib:worker", - "//src/java/io/bazel/rulesscala/jar", - "//src/java/io/bazel/rulesscala/worker", - ], -) - -java_binary( - name = "scalac_2.12", - srcs = [ - "CompileOptions.java", - "Resource.java", - "ScalaCInvoker.java", - "ScalacProcessor.java", - ], - main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", - visibility = ["//visibility:public"], - deps = [ - "//external:io_bazel_rules_scala/dependency/commons_io/commons_io", - '@scala_2_12//:scala-compiler', - '@scala_2_12//:scala-library', - '@scala_2_12//:scala-reflect', - "//src/java/com/google/devtools/build/lib:worker", - "//src/java/io/bazel/rulesscala/jar", - "//src/java/io/bazel/rulesscala/worker", - ], -) - filegroup( name = "scalac_files", srcs = [ diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 911b49b13..4495a2e4d 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -14,60 +14,27 @@ scala_library( srcs = ["HelloWorldLib211.scala"], ) -scala_library( - name = "lib212", - srcs = ["HelloWorldLib212.scala"], - scalac = "@scala_2_12", -) - scala_repl( name = "repl", deps = [":lib"], ) -scala_repl( - name = "repl212", - deps = [":lib212"], - scalac = "@scala_2_12" -) - -# TODO: scalatest not working with 2.12 scala_test( name = "test", srcs = ["Test.scala"], ) -scala_test( - name = "test212", - srcs = ["Test.scala"], - scalac = "@scala_version_label", -) - scala_binary( name = "binary", srcs = ["ScalaBinary.scala"], main_class = "scala.test.crossbuild.ScalaBinary", ) -scala_binary( - name = "binary212", - srcs = ["ScalaBinary.scala"], - main_class = "scala.test.crossbuild.ScalaBinary", - scalac = "@scala_2_12" -) - scala_macro_library( name = "macro", srcs = ["MacroTest.scala"], ) -scala_macro_library( - name = "macro212", - srcs = ["MacroTest.scala"], - scalac = "@scala_2_12" -) - -# TODO: junit not working with 2.12 scala_junit_test( name = "junit", srcs = ["JunitTests.scala"], diff --git a/test/crossbuild/test b/test/crossbuild/test index cb1c011b3..53b624ced 100755 --- a/test/crossbuild/test +++ b/test/crossbuild/test @@ -20,17 +20,13 @@ trap 'finish $?' EXIT set -x bazel build //test/crossbuild:lib -bazel build //test/crossbuild:lib212 bazel build //test/crossbuild:repl bazel test //test/crossbuild:test -bazel test //test/crossbuild:test212 bazel run //test/crossbuild:binary -bazel run //test/crossbuild:binary212 bazel build //test/crossbuild:macro -bazel build //test/crossbuild:macro212 bazel test //test/crossbuild:junit diff --git a/third_party/plugin/src/main/BUILD b/third_party/plugin/src/main/BUILD index c9b712921..ddbd9ce32 100644 --- a/third_party/plugin/src/main/BUILD +++ b/third_party/plugin/src/main/BUILD @@ -1,6 +1,6 @@ licenses(["notice"]) # 3-clause BSD -load("//scala:scala.bzl", "scala_library", "scala_library_for_plugin_bootstrapping") +load("//scala:scala.bzl", "scala_library_for_plugin_bootstrapping") scala_library_for_plugin_bootstrapping( name = "dependency_analyzer", @@ -9,7 +9,4 @@ scala_library_for_plugin_bootstrapping( ], resources = ["resources/scalac-plugin.xml"], visibility = ["//visibility:public"], - deps = [ - "//external:io_bazel_rules_scala/dependency/scala/scala_compiler", - ], ) From 52bdef1434c292d0d93569e78d698fe018e207fe Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 21 Jun 2018 15:07:56 -0700 Subject: [PATCH 16/63] Fix runfiles not being generated --- scala/private/rule_impls.bzl | 10 ++++------ scala/scala.bzl | 2 +- scala/scala_cross_version.bzl | 5 +++-- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 2aa7d7eeb..ef266d5e2 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -243,6 +243,9 @@ StatsfileOutput: {statsfile_output} ctx.actions.write( output = argfile, content = scalac_args + optional_scalac_args) + scalac_provider = ctx.attr._scalac[_ScalacProvider] + _, _, input_manifests = ctx.resolve_command(tools = [scalac_provider.scalac]) + outs = [ctx.outputs.jar, ctx.outputs.statsfile] if buildijar: outs.extend([ctx.outputs.ijar]) @@ -250,10 +253,7 @@ StatsfileOutput: {statsfile_output} list(srcjars) + list(sources) + ctx.files.srcs + ctx.files.plugins + dependency_analyzer_plugin_jars + classpath_resources + ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime - + [ctx.outputs.manifest, ctx.executable._ijar, argfile]) - - scalac_provider = ctx.attr._scalac[_ScalacProvider] - _, _, input_manifests = ctx.resolve_command(tools = [scalac_provider.scalac]) + + [ctx.outputs.manifest, ctx.executable._ijar, argfile] + [scalac_provider.scalac.files_to_run.runfiles_manifest]) ctx.actions.run( inputs = ins, @@ -498,7 +498,6 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], auto_deps = [scalac_provider.scalalib, scalac_provider.scalareflect] deps_jars = collect_jars(ctx.attr.deps + auto_deps + extra_deps, dependency_analyzer_is_off) - print(deps_jars) (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = (deps_jars.compile_jars, deps_jars.transitive_runtime_jars, @@ -508,7 +507,6 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], transitive_rjars = depset( transitive = [transitive_rjars] + _collect_runtime_jars(ctx.attr.runtime_deps + extra_runtime_deps)) - print(transitive_rjars) return struct( compile_jars = cjars, diff --git a/scala/scala.bzl b/scala/scala.bzl index b43cac55a..3a8b4fb7c 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -254,7 +254,7 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -def scala_repositories(scala_default = "2.11.1"): +def scala_repositories(scala_default = "2.11.11"): major_version_underscore = scala_default[:scala_default.find(".", 2)].replace(".", "_") _new_scala_repository("scala_default", scala_default) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index e288f70b1..7b171e88a 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -64,6 +64,7 @@ def _generate_scalac_build_file_impl(repository_ctx): path = Label("@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:{}".format(src)) repository_ctx.symlink(path, "scalac_worker_srcs_symlinked/{}".format(src)) + contents = """ load("@io_bazel_rules_scala//scala:providers.bzl", _declare_scalac_provider = "declare_scalac_provider", @@ -78,7 +79,7 @@ java_binary( "@io_bazel_rules_scala//src/java/com/google/devtools/build/lib:worker", "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar", "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker", - '//external:io_bazel_rules_scala/dependency/commons_io/commons_io', + '@scalac_rules_commons_io//jar', '@{archive}//:scala-compiler', '@{archive}//:scala-library', '@{archive}//:scala-reflect', @@ -88,7 +89,7 @@ java_binary( _declare_scalac_provider( name = "{name}", major_version = "{major_version}", - scalac = ":scalac_worker", + scalac = "@{name}//:scalac_worker", scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", scalaxml = "@scala_xml_{version_with_underscore}//jar", From a125428061249349842e9dfb4e95c1a4a476b4cc Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Fri, 22 Jun 2018 13:06:53 -0700 Subject: [PATCH 17/63] Support multiple scala versions for tut and scrooge --- scala/scala.bzl | 6 +-- scala/scala_cross_version.bzl | 4 ++ tut_rule/tut.bzl | 12 ++++-- twitter_scrooge/twitter_scrooge.bzl | 67 +++++++++++++++++++---------- 4 files changed, 60 insertions(+), 29 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 3a8b4fb7c..4b2e6914d 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -254,10 +254,10 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -def scala_repositories(scala_default = "2.11.11"): - major_version_underscore = scala_default[:scala_default.find(".", 2)].replace(".", "_") +def scala_repositories(scala_version = "2.11.11"): + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace(".", "_") - _new_scala_repository("scala_default", scala_default) + _new_scala_repository("scala_default", scala_version) # scalatest has macros, note http_jar is invoking ijar native.http_jar( diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 7b171e88a..8907e6d28 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -73,6 +73,10 @@ load("@io_bazel_rules_scala//scala:providers.bzl", java_binary( name = "scalac_worker", srcs = glob(["scalac_worker_srcs_symlinked/*.java"]), + javacopts = [ + "-source 1.8", + "-target 1.8" + ], main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", visibility = ["//visibility:public"], deps = [ diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 92252021d..0c5e144a0 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -1,21 +1,27 @@ load("//scala:scala.bzl", "scala_binary") load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") -def tut_repositories(): +def tut_repositories(scala_version = "2.11.11"): + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace(".", "_") native.maven_server( name = "tut_repositories_maven_server", url = "https://dl.bintray.com/tpolecat/maven/", ) native.maven_jar( - name = "io_bazel_rules_scala_org_tpolecat_tut_core", + name = "io_bazel_rules_scala_org_tpolecat_tut_core_2_11", artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8"), sha1 = "fc723eb822494580cc05d6b3b3a6039d2280a5a0", server = "tut_repositories_maven_server", ) + native.maven_jar( + name = "io_bazel_rules_scala_org_tpolecat_tut_core_2_12", + artifact = "org.tpolecat:tut-core_2.12:0.4.8", + 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') + actual = '@io_bazel_rules_scala_org_tpolecat_tut_core_{}//jar'.format(major_version_underscore)) def scala_tut_doc(**kw): name = kw["name"] diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 6dda175d4..b1770dfec 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -15,7 +15,9 @@ load("//thrift:thrift.bzl", "ThriftInfo") _jar_filetype = FileType([".jar"]) -def twitter_scrooge(): +def twitter_scrooge(scala_version = "2.11.11"): + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace(".", "_") + native.maven_server( name = "twitter_scrooge_maven_server", url = "http://mirror.bazel.build/repo1.maven.org/maven2/", @@ -32,45 +34,61 @@ def twitter_scrooge(): actual = '@libthrift//jar') native.maven_jar( - name = "scrooge_core", - artifact = scala_mvn_artifact("com.twitter:scrooge-core:4.6.0"), - sha1 = "84b86c2e082aba6e0c780b3c76281703b891a2c8", - server = "twitter_scrooge_maven_server", + name = "scrooge_core_2_11", + artifact = "com.twitter:scrooge-core_2.11:18.6.0", + #server = "twitter_scrooge_maven_server" + ) + native.maven_jar( + name = "scrooge_core_2_12", + artifact = "com.twitter:scrooge-core_2.12:18.6.0", + #server = "twitter_scrooge_maven_server" ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/scrooge_core', - actual = '@scrooge_core//jar') + actual = '@scrooge_core_{}//jar'.format(major_version_underscore)) #scrooge-generator related dependencies native.maven_jar( - name = "scrooge_generator", - artifact = scala_mvn_artifact("com.twitter:scrooge-generator:4.6.0"), - sha1 = "cacf72eedeb5309ca02b2d8325c587198ecaac82", - server = "twitter_scrooge_maven_server", + name = "scrooge_generator_2_11", + artifact = "com.twitter:scrooge-generator_2.11:18.6.0", + #server = "twitter_scrooge_maven_server", + ) + native.maven_jar( + name = "scrooge_generator_2_12", + artifact = "com.twitter:scrooge-generator_2.12:18.6.0", + #server = "twitter_scrooge_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/scrooge_generator', - actual = '@scrooge_generator//jar') + actual = '@scrooge_generator_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "util_core", - artifact = scala_mvn_artifact("com.twitter:util-core:6.33.0"), - sha1 = "bb49fa66a3ca9b7db8cd764d0b26ce498bbccc83", - server = "twitter_scrooge_maven_server", + name = "util_core_2_11", + artifact = "com.twitter:util-core_2.11:18.6.0", + #server = "twitter_scrooge_maven_server", + ) + native.maven_jar( + name = "util_core_2_12", + artifact = "com.twitter:util-core_2.12:18.6.0", + #server = "twitter_scrooge_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/util_core', - actual = '@util_core//jar') + actual = '@util_core_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "util_logging", - artifact = scala_mvn_artifact("com.twitter:util-logging:6.33.0"), - sha1 = "3d28e46f8ee3b7ad1b98a51b98089fc01c9755dd", - server = "twitter_scrooge_maven_server", + name = "util_logging_2_11", + artifact = "com.twitter:util-logging_2.11:18.6.0", + #server = "twitter_scrooge_maven_server", + ) + native.maven_jar( + name = "util_logging_2_12", + artifact = "com.twitter:util-logging_2.12:18.6.0", + #server = "twitter_scrooge_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/util_logging', - actual = '@util_logging//jar') + actual = '@util_logging_{}//jar'.format(major_version_underscore)) def _collect_transitive_srcs(targets): r = [] @@ -294,12 +312,15 @@ def scrooge_scala_library(name, scala_library( name = name, deps = deps + remote_jars + [ - srcjar, "//external:io_bazel_rules_scala/dependency/thrift/libthrift", - "//external:io_bazel_rules_scala/dependency/thrift/scrooge_core" + 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/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, From dd28058d115fdaf786fb11d0e88dc893ffeb8045 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Fri, 22 Jun 2018 13:12:30 -0700 Subject: [PATCH 18/63] Format .bzl and BUILD files --- scala/private/rule_impls.bzl | 6 ++- scala/providers.bzl | 31 ++++---------- scala/scala.bzl | 42 +++++++++++-------- scala/scala_cross_version.bzl | 18 +++++--- src/java/io/bazel/rulesscala/scala_test/BUILD | 5 +-- src/java/io/bazel/rulesscala/scalac/BUILD | 16 +++---- test/crossbuild/BUILD | 5 +-- tut_rule/tut.bzl | 6 ++- twitter_scrooge/twitter_scrooge.bzl | 3 +- 9 files changed, 69 insertions(+), 63 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index ef266d5e2..69f4369de 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -253,7 +253,8 @@ StatsfileOutput: {statsfile_output} list(srcjars) + list(sources) + ctx.files.srcs + ctx.files.plugins + dependency_analyzer_plugin_jars + classpath_resources + ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime - + [ctx.outputs.manifest, ctx.executable._ijar, argfile] + [scalac_provider.scalac.files_to_run.runfiles_manifest]) + + [ctx.outputs.manifest, ctx.executable._ijar, argfile + ] + [scalac_provider.scalac.files_to_run.runfiles_manifest]) ctx.actions.run( inputs = ins, @@ -713,7 +714,8 @@ def scala_test_impl(ctx): jars.transitive_compile_jars, jars.jars2labels) # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately - scalatest_jars = collect_jars(scalac_provider.scalatest).transitive_runtime_jars + scalatest_jars = collect_jars( + scalac_provider.scalatest).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) diff --git a/scala/providers.bzl b/scala/providers.bzl index c01909954..d8296c45e 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -27,13 +27,10 @@ def create_scala_provider(ijar, class_jar, compile_jars, ScalacProvider = provider( doc = "ScalaProvider", - fields = ["major_version", - "scalac", - "scalalib", - "scalareflect", - "scalacompiler", - "scalatest", - "scalatest_runner"]) + fields = [ + "major_version", "scalac", "scalalib", "scalareflect", "scalacompiler", + "scalatest", "scalatest_runner" + ]) def _declare_scalac_provider(ctx): return [ @@ -57,21 +54,11 @@ declare_scalac_provider = rule( cfg = "host", allow_files = True, mandatory = True), - "scalalib": attr.label( - mandatory = True, - allow_files = True), - "scalareflect": attr.label( - mandatory = True, - allow_files = True), - "scalacompiler": attr.label( - mandatory = True, - allow_files = True), - "scalaxml": attr.label( - mandatory = True, - allow_files = True), - "scalatest": attr.label_list( - mandatory = True, - allow_files = True), + "scalalib": attr.label(mandatory = True, allow_files = True), + "scalareflect": attr.label(mandatory = True, allow_files = True), + "scalacompiler": attr.label(mandatory = True, allow_files = True), + "scalaxml": attr.label(mandatory = True, allow_files = True), + "scalatest": attr.label_list(mandatory = True, allow_files = True), "scalatest_runner": attr.label( executable = True, cfg = "host", diff --git a/scala/scala.bzl b/scala/scala.bzl index 4b2e6914d..202c96557 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -15,21 +15,17 @@ load( load( "@io_bazel_rules_scala//scala:scala_cross_version.bzl", - _new_scala_repository = "new_scala_repository" -) + _new_scala_repository = "new_scala_repository") load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", _specs2_junit_dependencies = "specs2_junit_dependencies") - _launcher_template = { "_java_stub_template": attr.label( default = Label("@java_stub_template//file")), } - - _implicit_deps = { "_singlejar": attr.label( executable = True, @@ -56,7 +52,8 @@ _implicit_deps = { } scala_deps = { - "_scalac": attr.label(default = Label("@scala_default"), providers = [_ScalacProvider]) + "_scalac": attr.label( + default = Label("@scala_default"), providers = [_ScalacProvider]) } # Single dep to allow IDEs to pickup all the implicit dependencies. @@ -222,7 +219,8 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest_reporter": attr.label(default = "//scala/support:test_reporter"), + "_scalatest_reporter": attr.label( + default = "//scala/support:test_reporter"), } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) @@ -255,43 +253,52 @@ scala_repl = rule( ) def scala_repositories(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace(".", "_") + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( + ".", "_") _new_scala_repository("scala_default", scala_version) # scalatest has macros, note http_jar is invoking ijar native.http_jar( name = "scalatest_2_11", - url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.5/scalatest_2.11-3.0.5.jar" + url = + "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.5/scalatest_2.11-3.0.5.jar" ) native.http_jar( name = "scalactic_2_11", - url = "http://central.maven.org/maven2/org/scalactic/scalactic_2.11/3.0.5/scalactic_2.11-3.0.5.jar" + url = + "http://central.maven.org/maven2/org/scalactic/scalactic_2.11/3.0.5/scalactic_2.11-3.0.5.jar" ) native.http_jar( name = "scalatest_2_12", - url = "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar" + url = + "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar" ) native.http_jar( name = "scalactic_2_12", - url = "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar" + url = + "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar" ) native.http_jar( name = "scala_xml_2_11", - url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.11/1.0.5/scala-xml_2.11-1.0.5.jar" + url = + "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.11/1.0.5/scala-xml_2.11-1.0.5.jar" ) native.http_jar( name = "scala_xml_2_12", - url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.5/scala-xml_2.12-1.0.5.jar" + url = + "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.5/scala-xml_2.12-1.0.5.jar" ) native.http_jar( name = "scala_parser_combinators_2_11", - url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar" + url = + "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar" ) native.http_jar( name = "scala_parser_combinators_2_12", - url = "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar" + url = + "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar" ) native.maven_server( @@ -354,7 +361,8 @@ def scala_repositories(scala_version = "2.11.11"): native.bind( name = "io_bazel_rules_scala/dependency/scala/parser_combinators", - actual = "@scala_parser_combinators_{}//jar".format(major_version_underscore)) + actual = "@scala_parser_combinators_{}//jar".format( + major_version_underscore)) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_compiler", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 8907e6d28..69f1dfadc 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -61,10 +61,11 @@ def _generate_scalac_build_file_impl(repository_ctx): ] for src in scalac_worker_srcs: - path = Label("@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:{}".format(src)) + path = Label( + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:{}".format( + src)) repository_ctx.symlink(path, "scalac_worker_srcs_symlinked/{}".format(src)) - contents = """ load("@io_bazel_rules_scala//scala:providers.bzl", _declare_scalac_provider = "declare_scalac_provider", @@ -106,13 +107,17 @@ _declare_scalac_provider( archive = repository_ctx.attr.archive, name = repository_ctx.attr.name, major_version = repository_ctx.attr.major_version, - version_with_underscore = repository_ctx.attr.major_version.replace(".", "_")) + version_with_underscore = repository_ctx.attr.major_version.replace( + ".", "_")) repository_ctx.file("BUILD", contents, False) _generate_scalac_build_file = repository_rule( implementation = _generate_scalac_build_file_impl, - attrs = {"archive": attr.string(), "major_version": attr.string()}) + attrs = { + "archive": attr.string(), + "major_version": attr.string() + }) def new_scala_repository(name, version): major_version = version[:version.find(".", 2)] @@ -127,4 +132,7 @@ def new_scala_repository(name, version): ) _generate_scalac_build_file( - name = name, archive = archive, major_version = major_version, visibility = ["//visibility:public"]) + name = name, + archive = archive, + major_version = major_version, + visibility = ["//visibility:public"]) diff --git a/src/java/io/bazel/rulesscala/scala_test/BUILD b/src/java/io/bazel/rulesscala/scala_test/BUILD index 42bae6600..6c3570052 100644 --- a/src/java/io/bazel/rulesscala/scala_test/BUILD +++ b/src/java/io/bazel/rulesscala/scala_test/BUILD @@ -3,8 +3,7 @@ java_binary( srcs = ["Runner.java"], visibility = ["//visibility:public"], deps = [ - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", - "//external:io_bazel_rules_scala/dependency/scalactic/scalactic", + "//external:io_bazel_rules_scala/dependency/scalactic/scalactic", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", ], ) - diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index 122e49dbf..bd5335a05 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -1,10 +1,10 @@ filegroup( - name = "scalac_files", - srcs = [ - "CompileOptions.java", - "ScalaCInvoker.java", - "ScalacProcessor.java", - "Resource.java", - ], - visibility = ["//visibility:public"] + name = "scalac_files", + srcs = [ + "CompileOptions.java", + "Resource.java", + "ScalaCInvoker.java", + "ScalacProcessor.java", + ], + visibility = ["//visibility:public"], ) diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD index 4495a2e4d..dc914555e 100644 --- a/test/crossbuild/BUILD +++ b/test/crossbuild/BUILD @@ -5,10 +5,9 @@ load( "scala_test", "scala_binary", "scala_macro_library", - "scala_junit_test" + "scala_junit_test", ) - scala_library( name = "lib", srcs = ["HelloWorldLib211.scala"], @@ -37,7 +36,7 @@ scala_macro_library( scala_junit_test( name = "junit", + size = "small", srcs = ["JunitTests.scala"], suffixes = ["Test"], - size = "small", ) diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 0c5e144a0..76a758413 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -2,7 +2,8 @@ load("//scala:scala.bzl", "scala_binary") load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") def tut_repositories(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace(".", "_") + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( + ".", "_") native.maven_server( name = "tut_repositories_maven_server", url = "https://dl.bintray.com/tpolecat/maven/", @@ -21,7 +22,8 @@ def tut_repositories(scala_version = "2.11.11"): ) native.bind( name = 'io_bazel_rules_scala/dependency/tut/tut_core', - actual = '@io_bazel_rules_scala_org_tpolecat_tut_core_{}//jar'.format(major_version_underscore)) + actual = '@io_bazel_rules_scala_org_tpolecat_tut_core_{}//jar'.format( + major_version_underscore)) def scala_tut_doc(**kw): name = kw["name"] diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index b1770dfec..3a052b419 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -16,7 +16,8 @@ load("//thrift:thrift.bzl", "ThriftInfo") _jar_filetype = FileType([".jar"]) def twitter_scrooge(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace(".", "_") + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( + ".", "_") native.maven_server( name = "twitter_scrooge_maven_server", From e6aff258fbdbe2bd435ddedfe777465763290435 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Fri, 22 Jun 2018 13:45:42 -0700 Subject: [PATCH 19/63] Tests passing with 2.11 --- test/BUILD | 2 +- test/aspect/aspect.bzl | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/test/BUILD b/test/BUILD index 4a759faa6..557ea5a09 100644 --- a/test/BUILD +++ b/test/BUILD @@ -26,7 +26,7 @@ java_binary( main_class = "scala.test.JavaBinary", runtime_deps = [ ":OtherJavaLib", - "@scala//:scala-library", + "//external:io_bazel_rules_scala/dependency/scala/scala_library", ], deps = [ ":Exported", diff --git a/test/aspect/aspect.bzl b/test/aspect/aspect.bzl index c37a53601..2312de302 100644 --- a/test/aspect/aspect.bzl +++ b/test/aspect/aspect.bzl @@ -23,30 +23,30 @@ def _rule_impl(ctx): expected_deps = { "scala_library": [ "//test/aspect:scala_library", - "@scala//:scala-library", + "@scala_default_imports//:scala-library", ], "scala_test": [ "//test/aspect:scala_test", - "@scala//:scala-library", - "@scalatest//jar:jar", + "@scala_default_imports//:scala-library", + "@scalatest_2_11//jar:jar", ], "scala_junit_test": [ "//test/aspect:scala_junit_test", - "@scala//:scala-library", + "@scala_default_imports//:scala-library", "@io_bazel_rules_scala_junit_junit//jar:jar", "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", ], "scala_specs2_junit_test": [ "//test/aspect:scala_specs2_junit_test", - "@scala//:scala-library", + "@scala_default_imports//:scala-library", "@io_bazel_rules_scala_junit_junit//jar:jar", "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", # From specs2/specs2.bzl:specs2_dependencies() "@io_bazel_rules_scala//specs2:specs2", - "@scala//:scala-xml", - "@scala//:scala-parser-combinators", - "@scala//:scala-library", - "@scala//:scala-reflect", + "@scala_xml_2_11//jar:jar", + "@scala_parser_combinators_2_11//jar:jar", + "@scala_default_imports//:scala-library", + "@scala_default_imports//:scala-reflect", # From specs2/specs2_junit.bzl:specs2_junit_dependencies() "@io_bazel_rules_scala_org_specs2_specs2_junit_2_11//jar:jar", ], From e60017739f18a95cb1bb66f7aa038d32b64a7eea Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Fri, 22 Jun 2018 17:09:00 -0700 Subject: [PATCH 20/63] Make scala_proto work with 2.12 --- scala_proto/scala_proto.bzl | 111 ++++++++++++++++++++++-------------- 1 file changed, 67 insertions(+), 44 deletions(-) diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index 18dbbf71b..98bc348a1 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -14,7 +14,10 @@ load( "create_java_provider", ) -def scala_proto_repositories(): +def scala_proto_repositories(scala_version = "2.11.11"): + major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( + ".", "_") + native.maven_server( name = "scala_proto_deps_maven_server", url = "http://central.maven.org/maven2/", @@ -32,85 +35,105 @@ def scala_proto_repositories(): actual = '@scala_proto_rules_protoc_jar//jar') native.maven_jar( - name = "scala_proto_rules_scalapb_plugin", - artifact = scala_mvn_artifact( - "com.trueaccord.scalapb:compilerplugin:0.6.5"), - sha1 = "290094c632c95b36b6f66d7dbfdc15242b9a247f", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_scalapb_plugin_2_11", + artifact = "com.trueaccord.scalapb:compilerplugin_2.11:0.6.5", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_scalapb_plugin_2_12", + artifact = "com.trueaccord.scalapb:compilerplugin_2.12:0.6.5", + #server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_plugin', - actual = '@scala_proto_rules_scalapb_plugin//jar') + actual = '@scala_proto_rules_scalapb_plugin_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "scala_proto_rules_protoc_bridge", - artifact = scala_mvn_artifact( - "com.trueaccord.scalapb:protoc-bridge:0.3.0-M1"), - sha1 = "73d38f045ea8f09cc1264991d1064add6eac9e00", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_protoc_bridge_2_11", + artifact = "com.trueaccord.scalapb:protoc-bridge_2.11:0.3.0-M1", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_protoc_bridge_2_12", + artifact = "com.trueaccord.scalapb:protoc-bridge_2.12:0.3.0-M1", + #server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/protoc_bridge', - actual = '@scala_proto_rules_protoc_bridge//jar') + actual = '@scala_proto_rules_protoc_bridge_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "scala_proto_rules_scalapbc", - artifact = scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5"), - sha1 = "b204d6d56a042b973af5b6fe28f81ece232d1fe4", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_scalapbc_2_11", + artifact = "com.trueaccord.scalapb:scalapbc_2.11:0.6.5", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_scalapbc_2_12", + artifact = "com.trueaccord.scalapb:scalapbc_2.12:0.6.5", + #server = "scala_proto_deps_maven_server", ) - native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapbc', - actual = '@scala_proto_rules_scalapbc//jar') + actual = '@scala_proto_rules_scalapbc_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "scala_proto_rules_scalapb_runtime", - artifact = scala_mvn_artifact( - "com.trueaccord.scalapb:scalapb-runtime:0.6.5"), - sha1 = "ac9287ff48c632df525773570ee4842e3ddf40e9", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_scalapb_runtime_2_11", + artifact = "com.trueaccord.scalapb:scalapb-runtime_2.11:0.6.5", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_scalapb_runtime_2_12", + artifact = "com.trueaccord.scalapb:scalapb-runtime_2.12:0.6.5", + #server = "scala_proto_deps_maven_server", ) - native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime', - actual = '@scala_proto_rules_scalapb_runtime//jar') + actual = '@scala_proto_rules_scalapb_runtime_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "scala_proto_rules_scalapb_runtime_grpc", - artifact = scala_mvn_artifact( - "com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5"), - sha1 = "9dc3374001f4190548db36a7dc87bd4f9bca6f9c", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_scalapb_runtime_grpc_2_11", + artifact = "com.trueaccord.scalapb:scalapb-runtime-grpc_2.11:0.6.5", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_scalapb_runtime_grpc_2_12", + artifact = "com.trueaccord.scalapb:scalapb-runtime-grpc_2.12:0.6.5", + #server = "scala_proto_deps_maven_server", ) - native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime_grpc', - actual = '@scala_proto_rules_scalapb_runtime_grpc//jar') + actual = '@scala_proto_rules_scalapb_runtime_grpc_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "scala_proto_rules_scalapb_lenses", - artifact = scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12"), - sha1 = "c5fbf5b872ce99d9a16d3392ccc0d15a0e43d823", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_scalapb_lenses_2_11", + artifact = "com.trueaccord.lenses:lenses_2.11:0.4.12", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_scalapb_lenses_2_12", + artifact = "com.trueaccord.lenses:lenses_2.12:0.4.12", + #server = "scala_proto_deps_maven_server", ) - native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_lenses', - actual = '@scala_proto_rules_scalapb_lenses//jar') + actual = '@scala_proto_rules_scalapb_lenses_{}//jar'.format(major_version_underscore)) native.maven_jar( - name = "scala_proto_rules_scalapb_fastparse", - artifact = scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4"), - sha1 = "f065fe0afe6fd2b4557d985c37362c36f08f9947", - server = "scala_proto_deps_maven_server", + name = "scala_proto_rules_scalapb_fastparse_2_11", + artifact = "com.lihaoyi:fastparse_2.11:0.4.4", + #server = "scala_proto_deps_maven_server", + ) + native.maven_jar( + name = "scala_proto_rules_scalapb_fastparse_2_12", + artifact = "com.lihaoyi:fastparse_2.12:0.4.4", + #server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_fastparse', - actual = '@scala_proto_rules_scalapb_fastparse//jar') + actual = '@scala_proto_rules_scalapb_fastparse_{}//jar'.format(major_version_underscore)) native.maven_jar( name = "scala_proto_rules_grpc_core", From 927e5f85fc6bca150343850a954152be98e71673 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 26 Jun 2018 10:34:47 -0700 Subject: [PATCH 21/63] Support specs2 for both 2.11/2.12 - remove unused attr major_version from ScalacProvider --- scala/private/rule_impls.bzl | 5 +- scala/providers.bzl | 4 +- scala/scala_cross_version.bzl | 13 ++-- specs2/specs2.bzl | 110 +++++++++++++++++++----------- specs2/specs2_junit.bzl | 16 +++-- third_party/plugin/src/main/BUILD | 3 + 6 files changed, 93 insertions(+), 58 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 69f4369de..b249bfb2f 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -723,8 +723,9 @@ def scala_test_impl(ctx): transitive_compile_jars = depset( transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() - add_labels_of_jars_to(jars_to_labels, scalac_provider.scalatest, - scalatest_jars_list, scalatest_jars_list) + for dep in scalac_provider.scalatest: + add_labels_of_jars_to(jars_to_labels, dep, + scalatest_jars_list, scalatest_jars_list) args = " ".join([ "-R \"{path}\"".format(path = ctx.outputs.jar.short_path), diff --git a/scala/providers.bzl b/scala/providers.bzl index d8296c45e..236c4490b 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -28,14 +28,13 @@ def create_scala_provider(ijar, class_jar, compile_jars, ScalacProvider = provider( doc = "ScalaProvider", fields = [ - "major_version", "scalac", "scalalib", "scalareflect", "scalacompiler", + "scalac", "scalalib", "scalareflect", "scalacompiler", "scalatest", "scalatest_runner" ]) def _declare_scalac_provider(ctx): return [ ScalacProvider( - major_version = ctx.attr.major_version, scalac = ctx.attr.scalac, scalalib = ctx.attr.scalalib, scalareflect = ctx.attr.scalareflect, @@ -48,7 +47,6 @@ def _declare_scalac_provider(ctx): declare_scalac_provider = rule( implementation = _declare_scalac_provider, attrs = { - "major_version": attr.string(mandatory = True), "scalac": attr.label( executable = True, cfg = "host", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 69f1dfadc..abee095bd 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -93,22 +93,19 @@ java_binary( _declare_scalac_provider( name = "{name}", - major_version = "{major_version}", scalac = "@{name}//:scalac_worker", scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", - scalaxml = "@scala_xml_{version_with_underscore}//jar", + scalaxml = "@scala_xml_{version_underscore}//jar", scalacompiler = "@{archive}//:scala-compiler", - scalatest = ["@scalatest_{version_with_underscore}//jar", "@scalactic_{version_with_underscore}//jar"], + scalatest = ["@scalatest_{version_underscore}//jar", "@scalactic_{version_underscore}//jar"], scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner.jar", visibility = ["//visibility:public"], ) """.format( archive = repository_ctx.attr.archive, name = repository_ctx.attr.name, - major_version = repository_ctx.attr.major_version, - version_with_underscore = repository_ctx.attr.major_version.replace( - ".", "_")) + version_underscore = repository_ctx.attr.version_underscore) repository_ctx.file("BUILD", contents, False) @@ -116,7 +113,7 @@ _generate_scalac_build_file = repository_rule( implementation = _generate_scalac_build_file_impl, attrs = { "archive": attr.string(), - "major_version": attr.string() + "version_underscore": attr.string() }) def new_scala_repository(name, version): @@ -134,5 +131,5 @@ def new_scala_repository(name, version): _generate_scalac_build_file( name = name, archive = archive, - major_version = major_version, + version_underscore = major_version.replace(".", "_"), visibility = ["//visibility:public"]) diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 260b34f18..85b8dbab6 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -6,44 +6,78 @@ load( def specs2_version(): return "3.8.8" -def specs2_repositories(): - - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_core", - artifact = scala_mvn_artifact( - "org.specs2:specs2-core:" + specs2_version()), - sha1 = "495bed00c73483f4f5f43945fde63c615d03e637", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_common", - artifact = scala_mvn_artifact( - "org.specs2:specs2-common:" + specs2_version()), - sha1 = "15bc009eaae3a574796c0f558d8696b57ae903c3", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_matcher", - artifact = scala_mvn_artifact( - "org.specs2:specs2-matcher:" + specs2_version()), - sha1 = "d2e967737abef7421e47b8994a8c92784e624d62", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", - artifact = scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7"), - sha1 = "824bbb83da12224b3537c354c51eb3da72c435b5", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_scalaz_scalaz_core", - artifact = scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7"), - sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", - ) - - native.bind( - name = 'io_bazel_rules_scala/dependency/specs2/specs2', - actual = "@io_bazel_rules_scala//specs2:specs2") +def specs2_repositories(scala_version = "2.11.11"): + major_version = scala_version[:scala_version.find(".", 2)] + + if major_version == "2.11": + native.maven_jar( + name = "io_bazel_rules_scala_org_specs2_specs2_core", + artifact = "org.specs2:specs2-core_2.11:" + specs2_version(), + sha1 = "495bed00c73483f4f5f43945fde63c615d03e637", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_specs2_specs2_common", + artifact = "org.specs2:specs2-common_2.11:" + specs2_version(), + sha1 = "15bc009eaae3a574796c0f558d8696b57ae903c3", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_specs2_specs2_matcher", + artifact = "org.specs2:specs2-matcher_2.11:" + specs2_version(), + sha1 = "d2e967737abef7421e47b8994a8c92784e624d62", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", + artifact = "org.scalaz:scalaz-effect_2.11:7.2.7", + sha1 = "824bbb83da12224b3537c354c51eb3da72c435b5", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_scalaz_scalaz_core", + artifact = "org.scalaz:scalaz-core_2.11:7.2.7", + sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", + ) + + native.bind( + name = 'io_bazel_rules_scala/dependency/specs2/specs2', + actual = "@io_bazel_rules_scala//specs2:specs2") + else: + native.maven_jar( + name = "io_bazel_rules_scala_org_specs2_specs2_core", + artifact = "org.specs2:specs2-core_2.12:" + specs2_version(), + #sha1 = "495bed00c73483f4f5f43945fde63c615d03e637", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_specs2_specs2_common", + artifact = "org.specs2:specs2-common_2.12:" + specs2_version(), + #sha1 = "15bc009eaae3a574796c0f558d8696b57ae903c3", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_specs2_specs2_matcher", + artifact = "org.specs2:specs2-matcher_2.12:" + specs2_version(), + #sha1 = "d2e967737abef7421e47b8994a8c92784e624d62", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", + artifact = "org.scalaz:scalaz-effect_2.12:7.2.7", + #sha1 = "824bbb83da12224b3537c354c51eb3da72c435b5", + ) + + native.maven_jar( + name = "io_bazel_rules_scala_org_scalaz_scalaz_core", + artifact = "org.scalaz:scalaz-core_2.12:7.2.7", + #sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", + ) + + native.bind( + name = 'io_bazel_rules_scala/dependency/specs2/specs2', + actual = "@io_bazel_rules_scala//specs2:specs2") + def specs2_dependencies(): return ["//external:io_bazel_rules_scala/dependency/specs2/specs2"] diff --git a/specs2/specs2_junit.bzl b/specs2/specs2_junit.bzl index 771e86f48..fc683c5ed 100644 --- a/specs2/specs2_junit.bzl +++ b/specs2/specs2_junit.bzl @@ -3,19 +3,21 @@ load("//specs2:specs2.bzl", "specs2_repositories", "specs2_dependencies", load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") load("//junit:junit.bzl", "junit_repositories") -def specs2_junit_repositories(): - specs2_repositories() +def specs2_junit_repositories(scala_version = "2.11.11"): + major_version = scala_version[:scala_version.find(".", 2)] + + specs2_repositories(scala_version) junit_repositories() # Aditional dependencies for specs2 junit runner native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_junit_2_11", - artifact = scala_mvn_artifact( - "org.specs2:specs2-junit:" + specs2_version()), - sha1 = "1dc9e43970557c308ee313842d84094bc6c1c1b5", + name = "io_bazel_rules_scala_org_specs2_specs2_junit", + artifact = "org.specs2:specs2-junit_{}:".format(major_version) + specs2_version(), + #sha1 = "1dc9e43970557c308ee313842d84094bc6c1c1b5", ) + native.bind( name = 'io_bazel_rules_scala/dependency/specs2/specs2_junit', - actual = '@io_bazel_rules_scala_org_specs2_specs2_junit_2_11//jar') + actual = '@io_bazel_rules_scala_org_specs2_specs2_junit//jar') def specs2_junit_dependencies(): return specs2_dependencies() + [ diff --git a/third_party/plugin/src/main/BUILD b/third_party/plugin/src/main/BUILD index ddbd9ce32..b5954ba50 100644 --- a/third_party/plugin/src/main/BUILD +++ b/third_party/plugin/src/main/BUILD @@ -9,4 +9,7 @@ scala_library_for_plugin_bootstrapping( ], resources = ["resources/scalac-plugin.xml"], visibility = ["//visibility:public"], + deps = [ + "//external:io_bazel_rules_scala/dependency/scala/scala_compiler", + ], ) From 22f216f12c4ada7ffc171c840ca2a32c2831bc2e Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 26 Jun 2018 10:51:03 -0700 Subject: [PATCH 22/63] Don't pass scalatest dependencies through provider --- scala/private/rule_impls.bzl | 8 +++----- scala/providers.bzl | 11 +---------- scala/scala.bzl | 10 ++++++++++ scala/scala_cross_version.bzl | 2 -- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index b249bfb2f..6abc09f52 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -701,12 +701,10 @@ def scala_test_impl(ctx): if len(ctx.attr.suites) != 0: print("suites attribute is deprecated. All scalatest test suites are run") - scalac_provider = ctx.attr._scalac[_ScalacProvider] - jars = _collect_jars_from_common_ctx( ctx, extra_runtime_deps = [ - ctx.attr._scalatest_reporter, scalac_provider.scalatest_runner + ctx.attr._scalatest_reporter, ctx.attr._scalatest_runner ], ) (cjars, transitive_rjars, transitive_compile_jars, @@ -715,7 +713,7 @@ def scala_test_impl(ctx): # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately scalatest_jars = collect_jars( - scalac_provider.scalatest).transitive_runtime_jars + ctx.attr._scalatest).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) @@ -723,7 +721,7 @@ def scala_test_impl(ctx): transitive_compile_jars = depset( transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() - for dep in scalac_provider.scalatest: + for dep in ctx.attr._scalatest: add_labels_of_jars_to(jars_to_labels, dep, scalatest_jars_list, scalatest_jars_list) diff --git a/scala/providers.bzl b/scala/providers.bzl index 236c4490b..6fba6e18a 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -29,7 +29,6 @@ ScalacProvider = provider( doc = "ScalaProvider", fields = [ "scalac", "scalalib", "scalareflect", "scalacompiler", - "scalatest", "scalatest_runner" ]) def _declare_scalac_provider(ctx): @@ -39,8 +38,6 @@ def _declare_scalac_provider(ctx): scalalib = ctx.attr.scalalib, scalareflect = ctx.attr.scalareflect, scalacompiler = ctx.attr.scalacompiler, - scalatest = ctx.attr.scalatest, - scalatest_runner = ctx.attr.scalatest_runner, ) ] @@ -55,11 +52,5 @@ declare_scalac_provider = rule( "scalalib": attr.label(mandatory = True, allow_files = True), "scalareflect": attr.label(mandatory = True, allow_files = True), "scalacompiler": attr.label(mandatory = True, allow_files = True), - "scalaxml": attr.label(mandatory = True, allow_files = True), - "scalatest": attr.label_list(mandatory = True, allow_files = True), - "scalatest_runner": attr.label( - executable = True, - cfg = "host", - mandatory = True, - allow_files = True), + "scalaxml": attr.label(mandatory = True, allow_files = True) }) diff --git a/scala/scala.bzl b/scala/scala.bzl index 202c96557..180238713 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -219,6 +219,16 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), + "_scalatest": attr.label_list( + default = [ + Label("//external:io_bazel_rules_scala/dependency/scalatest/scalatest"), + Label("//external:io_bazel_rules_scala/dependency/scalactic/scalactic"), + ]), + "_scalatest_runner": attr.label( + cfg = "host", + default = Label("//src/java/io/bazel/rulesscala/scala_test:runner.jar"), + executable = True, + allow_files = True), "_scalatest_reporter": attr.label( default = "//scala/support:test_reporter"), } diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index abee095bd..f744da3f1 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -98,8 +98,6 @@ _declare_scalac_provider( scalareflect = "@{archive}//:scala-reflect", scalaxml = "@scala_xml_{version_underscore}//jar", scalacompiler = "@{archive}//:scala-compiler", - scalatest = ["@scalatest_{version_underscore}//jar", "@scalactic_{version_underscore}//jar"], - scalatest_runner = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scala_test:runner.jar", visibility = ["//visibility:public"], ) """.format( From 87dad4060d900040cf8d23d63507f7a748013d82 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 26 Jun 2018 11:21:21 -0700 Subject: [PATCH 23/63] Pass _scalac through _implicit_deps --- scala/scala.bzl | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 180238713..44fb45092 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -48,10 +48,7 @@ _implicit_deps = { default = Label("@bazel_tools//tools/jdk:current_java_runtime"), cfg = "host"), "_java_runtime": attr.label( - default = Label("@bazel_tools//tools/jdk:current_java_runtime")) -} - -scala_deps = { + default = Label("@bazel_tools//tools/jdk:current_java_runtime")), "_scalac": attr.label( default = Label("@scala_default"), providers = [_ScalacProvider]) } @@ -147,7 +144,6 @@ _library_outputs.update({ _scala_library_attrs = {} _scala_library_attrs.update(_implicit_deps) -_scala_library_attrs.update(scala_deps) _scala_library_attrs.update(_common_attrs) _scala_library_attrs.update(_library_attrs) _scala_library_attrs.update(_resolve_deps) @@ -165,7 +161,6 @@ scala_library = rule( # which does not contain plugin related attributes, and thus avoids the cyclic dependency issue _scala_library_for_plugin_bootstrapping_attrs = {} _scala_library_for_plugin_bootstrapping_attrs.update(_implicit_deps) -_scala_library_for_plugin_bootstrapping_attrs.update(scala_deps) _scala_library_for_plugin_bootstrapping_attrs.update(_library_attrs) _scala_library_for_plugin_bootstrapping_attrs.update(_resolve_deps) _scala_library_for_plugin_bootstrapping_attrs.update( @@ -183,7 +178,6 @@ _scala_macro_library_attrs = { "exports": attr.label_list(allow_files = False), } _scala_macro_library_attrs.update(_implicit_deps) -_scala_macro_library_attrs.update(scala_deps) _scala_macro_library_attrs.update(_common_attrs) _scala_macro_library_attrs.update(_library_attrs) _scala_macro_library_attrs.update(_resolve_deps) @@ -201,7 +195,6 @@ _scala_binary_attrs = { } _scala_binary_attrs.update(_launcher_template) _scala_binary_attrs.update(_implicit_deps) -_scala_binary_attrs.update(scala_deps) _scala_binary_attrs.update(_common_attrs) _scala_binary_attrs.update(_resolve_deps) scala_binary = rule( @@ -234,7 +227,6 @@ _scala_test_attrs = { } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) -_scala_test_attrs.update(scala_deps) _scala_test_attrs.update(_common_attrs) _scala_test_attrs.update(_test_resolve_deps) scala_test = rule( @@ -250,7 +242,6 @@ scala_test = rule( _scala_repl_attrs = {} _scala_repl_attrs.update(_launcher_template) _scala_repl_attrs.update(_implicit_deps) -_scala_repl_attrs.update(scala_deps) _scala_repl_attrs.update(_common_attrs) _scala_repl_attrs.update(_resolve_deps) scala_repl = rule( @@ -488,7 +479,6 @@ _scala_junit_test_attrs = { } _scala_junit_test_attrs.update(_launcher_template) _scala_junit_test_attrs.update(_implicit_deps) -_scala_junit_test_attrs.update(scala_deps) _scala_junit_test_attrs.update(_common_attrs) _scala_junit_test_attrs.update(_junit_resolve_deps) scala_junit_test = rule( From d45943d7c6391e5e2fc2ab2f05f97dcbfee36cf8 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 26 Jun 2018 11:21:41 -0700 Subject: [PATCH 24/63] Remove temp test directory --- test/crossbuild/BUILD | 42 -------------------------- test/crossbuild/HelloWorldLib211.scala | 9 ------ test/crossbuild/HelloWorldLib212.scala | 12 -------- test/crossbuild/JunitTests.scala | 13 -------- test/crossbuild/MacroTest.scala | 17 ----------- test/crossbuild/ScalaBinary.scala | 7 ----- test/crossbuild/Test.scala | 10 ------ test/crossbuild/test | 32 -------------------- 8 files changed, 142 deletions(-) delete mode 100644 test/crossbuild/BUILD delete mode 100644 test/crossbuild/HelloWorldLib211.scala delete mode 100644 test/crossbuild/HelloWorldLib212.scala delete mode 100644 test/crossbuild/JunitTests.scala delete mode 100644 test/crossbuild/MacroTest.scala delete mode 100644 test/crossbuild/ScalaBinary.scala delete mode 100644 test/crossbuild/Test.scala delete mode 100755 test/crossbuild/test diff --git a/test/crossbuild/BUILD b/test/crossbuild/BUILD deleted file mode 100644 index dc914555e..000000000 --- a/test/crossbuild/BUILD +++ /dev/null @@ -1,42 +0,0 @@ -load( - "//scala:scala.bzl", - "scala_library", - "scala_repl", - "scala_test", - "scala_binary", - "scala_macro_library", - "scala_junit_test", -) - -scala_library( - name = "lib", - srcs = ["HelloWorldLib211.scala"], -) - -scala_repl( - name = "repl", - deps = [":lib"], -) - -scala_test( - name = "test", - srcs = ["Test.scala"], -) - -scala_binary( - name = "binary", - srcs = ["ScalaBinary.scala"], - main_class = "scala.test.crossbuild.ScalaBinary", -) - -scala_macro_library( - name = "macro", - srcs = ["MacroTest.scala"], -) - -scala_junit_test( - name = "junit", - size = "small", - srcs = ["JunitTests.scala"], - suffixes = ["Test"], -) diff --git a/test/crossbuild/HelloWorldLib211.scala b/test/crossbuild/HelloWorldLib211.scala deleted file mode 100644 index ebc32216f..000000000 --- a/test/crossbuild/HelloWorldLib211.scala +++ /dev/null @@ -1,9 +0,0 @@ -package scala.test.crossbuild - -trait Hello { - def hello: String = "hfnos" -} - -trait World { - def world: String = "wptoh" -} diff --git a/test/crossbuild/HelloWorldLib212.scala b/test/crossbuild/HelloWorldLib212.scala deleted file mode 100644 index ce27427de..000000000 --- a/test/crossbuild/HelloWorldLib212.scala +++ /dev/null @@ -1,12 +0,0 @@ -package scala.test.crossbuild -import scala.util.{Either, Right} - -trait Hello { - def hello: String = "hfnos" - val either: Either[Int, Int] = Right(1) - either.toOption -} - -trait World { - def world: String = "wptoh" -} diff --git a/test/crossbuild/JunitTests.scala b/test/crossbuild/JunitTests.scala deleted file mode 100644 index a226f8c45..000000000 --- a/test/crossbuild/JunitTests.scala +++ /dev/null @@ -1,13 +0,0 @@ -package scala.test.junit - -import org.junit.Test - -class JunitTest { - - @Test - def simple: Unit = { - println("junit test") - } - -} - diff --git a/test/crossbuild/MacroTest.scala b/test/crossbuild/MacroTest.scala deleted file mode 100644 index f48017d19..000000000 --- a/test/crossbuild/MacroTest.scala +++ /dev/null @@ -1,17 +0,0 @@ -package scala.test - -import language.experimental.macros - -import reflect.macros.Context - -object MacroTest { - def hello(param: Any): Unit = macro hello_impl - - def hello_impl(c: Context)(param: c.Expr[Any]): c.Expr[Unit] = { - import c.universe._ - val paramRep = show(param.tree) - val paramRepTree = Literal(Constant(paramRep)) - val paramRepExpr = c.Expr[String](paramRepTree) - reify { println(paramRepExpr.splice + " = " + param.splice) } - } -} diff --git a/test/crossbuild/ScalaBinary.scala b/test/crossbuild/ScalaBinary.scala deleted file mode 100644 index 8369260c0..000000000 --- a/test/crossbuild/ScalaBinary.scala +++ /dev/null @@ -1,7 +0,0 @@ -package scala.test.crossbuild - -object ScalaBinary { - def main(args: Array[String]) { - println("Hello") - } -} diff --git a/test/crossbuild/Test.scala b/test/crossbuild/Test.scala deleted file mode 100644 index f0c355c23..000000000 --- a/test/crossbuild/Test.scala +++ /dev/null @@ -1,10 +0,0 @@ -package scala.test - -import org.scalatest._ - -class ScalaSuite extends FlatSpec { - "HelloLib" should "work" in { - assert(true) - } -} - diff --git a/test/crossbuild/test b/test/crossbuild/test deleted file mode 100755 index 53b624ced..000000000 --- a/test/crossbuild/test +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/zsh -e - -printf "\u001b[1;39m:::\u001b[0m\n" -printf "\u001b[1;39m test file: $0\u001b[0m\n" -printf "\u001b[1;39m:::\u001b[0m\n" - -error() { - set +x - printf "\u001b[1;31m::FAILURE::\u001b[0m $FILE:$2 exited with code $1\n" -} - -finish() { - set +x - [ $1 != 0 ] || printf "\u001b[1;32m::SUCCESS::\u001b[0m\n" -} - -trap 'error $? $LINENO' ERR -trap 'finish $?' EXIT - -set -x - -bazel build //test/crossbuild:lib - -bazel build //test/crossbuild:repl - -bazel test //test/crossbuild:test - -bazel run //test/crossbuild:binary - -bazel build //test/crossbuild:macro - -bazel test //test/crossbuild:junit From 990cb9df30858040357e70f67f30154a1b8ea9aa Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 26 Jun 2018 11:44:52 -0700 Subject: [PATCH 25/63] Remove debugging println --- src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java b/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java index 3ecefea2b..f27032c8f 100644 --- a/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java +++ b/src/java/io/bazel/rulesscala/scalac/ScalacProcessor.java @@ -37,7 +37,6 @@ class ScalacProcessor implements Processor { @Override public void processRequest(List args) throws Exception { Path tmpPath = null; - System.out.println(scala.tools.nsc.Properties.versionString()); try { CompileOptions ops = new CompileOptions(args); From 57449bb03f06230afed25f9d88f3df59fa7bf4b1 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 27 Jun 2018 14:43:02 -0700 Subject: [PATCH 26/63] Cleanup --- scala/scala.bzl | 3 +-- scala/scala_cross_version.bzl | 5 ----- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 44fb45092..06343ee4b 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -64,7 +64,6 @@ _resolve_deps = { allow_files = False), } -# TODO not version specific _test_resolve_deps = { "_scala_toolchain": attr.label_list( default = [ @@ -223,7 +222,7 @@ _scala_test_attrs = { executable = True, allow_files = True), "_scalatest_reporter": attr.label( - default = "//scala/support:test_reporter"), + default = Label("//scala/support:test_reporter")), } _scala_test_attrs.update(_launcher_template) _scala_test_attrs.update(_implicit_deps) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index f744da3f1..6f6f74df9 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -28,11 +28,6 @@ def scala_mvn_artifact(artifact): def _generate_scala_imports(version): return """ -# scala.BUILD -load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scalac_provider = "declare_scalac_provider", -) - java_import( name = "scala-library", jars = ["lib/scala-library.jar"], From adeff15ba02899437c10bd57a79f201c62067aa8 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 27 Jun 2018 14:53:40 -0700 Subject: [PATCH 27/63] Run formatter --- scala/private/rule_impls.bzl | 7 +++---- scala/providers.bzl | 5 ++++- scala/scala.bzl | 9 ++++----- scala_proto/scala_proto.bzl | 21 ++++++++++++++------- specs2/specs2.bzl | 1 - specs2/specs2_junit.bzl | 3 ++- 6 files changed, 27 insertions(+), 19 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 6abc09f52..1010813cb 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -712,8 +712,7 @@ def scala_test_impl(ctx): jars.transitive_compile_jars, jars.jars2labels) # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately - scalatest_jars = collect_jars( - ctx.attr._scalatest).transitive_runtime_jars + scalatest_jars = collect_jars(ctx.attr._scalatest).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) @@ -722,8 +721,8 @@ def scala_test_impl(ctx): transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() for dep in ctx.attr._scalatest: - add_labels_of_jars_to(jars_to_labels, dep, - scalatest_jars_list, scalatest_jars_list) + add_labels_of_jars_to(jars_to_labels, dep, scalatest_jars_list, + scalatest_jars_list) args = " ".join([ "-R \"{path}\"".format(path = ctx.outputs.jar.short_path), diff --git a/scala/providers.bzl b/scala/providers.bzl index 6fba6e18a..52de8d7dd 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -28,7 +28,10 @@ def create_scala_provider(ijar, class_jar, compile_jars, ScalacProvider = provider( doc = "ScalaProvider", fields = [ - "scalac", "scalalib", "scalareflect", "scalacompiler", + "scalac", + "scalalib", + "scalareflect", + "scalacompiler", ]) def _declare_scalac_provider(ctx): diff --git a/scala/scala.bzl b/scala/scala.bzl index 06343ee4b..4aa808718 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -211,11 +211,10 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest": attr.label_list( - default = [ - Label("//external:io_bazel_rules_scala/dependency/scalatest/scalatest"), - Label("//external:io_bazel_rules_scala/dependency/scalactic/scalactic"), - ]), + "_scalatest": attr.label_list(default = [ + Label("//external:io_bazel_rules_scala/dependency/scalatest/scalatest"), + Label("//external:io_bazel_rules_scala/dependency/scalactic/scalactic"), + ]), "_scalatest_runner": attr.label( cfg = "host", default = Label("//src/java/io/bazel/rulesscala/scala_test:runner.jar"), diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index 98bc348a1..c2b3711ae 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -47,7 +47,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_plugin', - actual = '@scala_proto_rules_scalapb_plugin_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_scalapb_plugin_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_protoc_bridge_2_11", @@ -62,7 +63,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): native.bind( name = 'io_bazel_rules_scala/dependency/proto/protoc_bridge', - actual = '@scala_proto_rules_protoc_bridge_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_protoc_bridge_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_scalapbc_2_11", @@ -76,7 +78,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapbc', - actual = '@scala_proto_rules_scalapbc_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_scalapbc_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_scalapb_runtime_2_11", @@ -90,7 +93,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime', - actual = '@scala_proto_rules_scalapb_runtime_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_scalapb_runtime_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_scalapb_runtime_grpc_2_11", @@ -104,7 +108,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime_grpc', - actual = '@scala_proto_rules_scalapb_runtime_grpc_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_scalapb_runtime_grpc_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_scalapb_lenses_2_11", @@ -118,7 +123,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_lenses', - actual = '@scala_proto_rules_scalapb_lenses_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_scalapb_lenses_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_scalapb_fastparse_2_11", @@ -133,7 +139,8 @@ def scala_proto_repositories(scala_version = "2.11.11"): native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_fastparse', - actual = '@scala_proto_rules_scalapb_fastparse_{}//jar'.format(major_version_underscore)) + actual = '@scala_proto_rules_scalapb_fastparse_{}//jar'.format( + major_version_underscore)) native.maven_jar( name = "scala_proto_rules_grpc_core", diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 85b8dbab6..3ec1a8db5 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -78,6 +78,5 @@ def specs2_repositories(scala_version = "2.11.11"): name = 'io_bazel_rules_scala/dependency/specs2/specs2', actual = "@io_bazel_rules_scala//specs2:specs2") - def specs2_dependencies(): return ["//external:io_bazel_rules_scala/dependency/specs2/specs2"] diff --git a/specs2/specs2_junit.bzl b/specs2/specs2_junit.bzl index fc683c5ed..8ce15a914 100644 --- a/specs2/specs2_junit.bzl +++ b/specs2/specs2_junit.bzl @@ -11,7 +11,8 @@ def specs2_junit_repositories(scala_version = "2.11.11"): # Aditional dependencies for specs2 junit runner native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_junit", - artifact = "org.specs2:specs2-junit_{}:".format(major_version) + specs2_version(), + artifact = "org.specs2:specs2-junit_{}:".format(major_version) + + specs2_version(), #sha1 = "1dc9e43970557c308ee313842d84094bc6c1c1b5", ) From 2bd382507dce4633cdef040f43c5ec81abf3a1f8 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 27 Jun 2018 14:55:36 -0700 Subject: [PATCH 28/63] Use inputs from resolve_command --- scala/private/rule_impls.bzl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 1010813cb..febb36008 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -244,7 +244,7 @@ StatsfileOutput: {statsfile_output} output = argfile, content = scalac_args + optional_scalac_args) scalac_provider = ctx.attr._scalac[_ScalacProvider] - _, _, input_manifests = ctx.resolve_command(tools = [scalac_provider.scalac]) + scalac_inputs, _, scalac_input_manifests = ctx.resolve_command(tools = [scalac_provider.scalac]) outs = [ctx.outputs.jar, ctx.outputs.statsfile] if buildijar: @@ -254,13 +254,13 @@ StatsfileOutput: {statsfile_output} dependency_analyzer_plugin_jars + classpath_resources + ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime + [ctx.outputs.manifest, ctx.executable._ijar, argfile - ] + [scalac_provider.scalac.files_to_run.runfiles_manifest]) + ] + scalac_inputs) ctx.actions.run( inputs = ins, outputs = outs, executable = scalac_provider.scalac.files_to_run.executable, - input_manifests = input_manifests, + input_manifests = scalac_input_manifests, mnemonic = "Scalac", progress_message = "scala %s" % ctx.label, execution_requirements = {"supports-workers": "1"}, From e1846f5328386acd2f6309714df4fc97861b12da Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 27 Jun 2018 15:12:45 -0700 Subject: [PATCH 29/63] Combine scalatest+scalactic to single target --- scala/private/rule_impls.bzl | 7 +++---- scala/scala.bzl | 12 +++++++----- scala/scalatest/BUILD | 10 ++++++++++ 3 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 scala/scalatest/BUILD diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index febb36008..08d8eec67 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -712,7 +712,7 @@ def scala_test_impl(ctx): jars.transitive_compile_jars, jars.jars2labels) # _scalatest is an http_jar, so its compile jar is run through ijar # however, contains macros, so need to handle separately - scalatest_jars = collect_jars(ctx.attr._scalatest).transitive_runtime_jars + scalatest_jars = collect_jars([ctx.attr._scalatest]).transitive_runtime_jars cjars = depset(transitive = [cjars, scalatest_jars]) transitive_rjars = depset(transitive = [transitive_rjars, scalatest_jars]) @@ -720,9 +720,8 @@ def scala_test_impl(ctx): transitive_compile_jars = depset( transitive = [scalatest_jars, transitive_compile_jars]) scalatest_jars_list = scalatest_jars.to_list() - for dep in ctx.attr._scalatest: - add_labels_of_jars_to(jars_to_labels, dep, scalatest_jars_list, - scalatest_jars_list) + add_labels_of_jars_to(jars_to_labels, ctx.attr._scalatest, + scalatest_jars_list, scalatest_jars_list) args = " ".join([ "-R \"{path}\"".format(path = ctx.outputs.jar.short_path), diff --git a/scala/scala.bzl b/scala/scala.bzl index 4aa808718..2adbbcdc6 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -211,10 +211,8 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest": attr.label_list(default = [ - Label("//external:io_bazel_rules_scala/dependency/scalatest/scalatest"), - Label("//external:io_bazel_rules_scala/dependency/scalactic/scalactic"), - ]), + "_scalatest": attr.label(default = + Label("//external:io_bazel_rules_scala/dependency/scalatest/scalatest")), "_scalatest_runner": attr.label( cfg = "host", default = Label("//src/java/io/bazel/rulesscala/scala_test:runner.jar"), @@ -347,13 +345,17 @@ def scala_repositories(scala_version = "2.11.11"): actual = "@scalac_rules_commons_io//jar") native.bind( - name = "io_bazel_rules_scala/dependency/scalatest/scalatest", + name = "io_bazel_rules_scala/dependency/scalatest/scalatest_library", actual = "@scalatest_{}//jar".format(major_version_underscore)) native.bind( name = "io_bazel_rules_scala/dependency/scalactic/scalactic", actual = "@scalactic_{}//jar".format(major_version_underscore)) + native.bind( + name = "io_bazel_rules_scala/dependency/scalatest/scalatest", + actual = "@io_bazel_rules_scala//scala/scalatest:scalatest") + native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_xml", actual = "@scala_xml_{}//jar".format(major_version_underscore)) diff --git a/scala/scalatest/BUILD b/scala/scalatest/BUILD new file mode 100644 index 000000000..c09f59e4d --- /dev/null +++ b/scala/scalatest/BUILD @@ -0,0 +1,10 @@ +package(default_visibility = ["//visibility:public"]) + +java_import( + name = "scalatest", + jars = [], + exports = [ + "//external:io_bazel_rules_scala/dependency/scalactic/scalactic", + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_library", + ], +) From 5d67d4d7f7ea63eca6d76700c978cfd6668be6c8 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 27 Jun 2018 15:55:54 -0700 Subject: [PATCH 30/63] Add utils - extract_major_version_underscore() - default_scala_version() - run formatter --- scala/private/rule_impls.bzl | 15 ++++++++------- scala/scala.bzl | 14 ++++++++------ scala/scala_cross_version.bzl | 10 +++++++--- scala_proto/scala_proto.bzl | 8 ++++---- specs2/specs2.bzl | 3 ++- tut_rule/tut.bzl | 12 ++++++++---- twitter_scrooge/twitter_scrooge.bzl | 8 ++++---- 7 files changed, 41 insertions(+), 29 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 08d8eec67..9100b3eb6 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -244,17 +244,18 @@ StatsfileOutput: {statsfile_output} output = argfile, content = scalac_args + optional_scalac_args) scalac_provider = ctx.attr._scalac[_ScalacProvider] - scalac_inputs, _, scalac_input_manifests = ctx.resolve_command(tools = [scalac_provider.scalac]) + scalac_inputs, _, scalac_input_manifests = ctx.resolve_command( + tools = [scalac_provider.scalac]) outs = [ctx.outputs.jar, ctx.outputs.statsfile] if buildijar: outs.extend([ctx.outputs.ijar]) - ins = (compiler_classpath_jars.to_list() + dep_srcjars.to_list() + - list(srcjars) + list(sources) + ctx.files.srcs + ctx.files.plugins + - dependency_analyzer_plugin_jars + classpath_resources + - ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime - + [ctx.outputs.manifest, ctx.executable._ijar, argfile - ] + scalac_inputs) + ins = ( + compiler_classpath_jars.to_list() + dep_srcjars.to_list() + + list(srcjars) + list(sources) + ctx.files.srcs + ctx.files.plugins + + dependency_analyzer_plugin_jars + classpath_resources + + ctx.files.resources + ctx.files.resource_jars + ctx.files._java_runtime + + [ctx.outputs.manifest, ctx.executable._ijar, argfile] + scalac_inputs) ctx.actions.run( inputs = ins, diff --git a/scala/scala.bzl b/scala/scala.bzl index 2adbbcdc6..1df733bfe 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -15,7 +15,9 @@ load( load( "@io_bazel_rules_scala//scala:scala_cross_version.bzl", - _new_scala_repository = "new_scala_repository") + _new_scala_repository = "new_scala_repository", + _extract_major_version_underscore = "extract_major_version_underscore", + _default_scala_version = "default_scala_version") load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", @@ -211,8 +213,9 @@ _scala_test_attrs = { "suites": attr.string_list(), "colors": attr.bool(default = True), "full_stacktraces": attr.bool(default = True), - "_scalatest": attr.label(default = - Label("//external:io_bazel_rules_scala/dependency/scalatest/scalatest")), + "_scalatest": attr.label( + default = Label( + "//external:io_bazel_rules_scala/dependency/scalatest/scalatest")), "_scalatest_runner": attr.label( cfg = "host", default = Label("//src/java/io/bazel/rulesscala/scala_test:runner.jar"), @@ -249,9 +252,8 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -def scala_repositories(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( - ".", "_") +def scala_repositories(scala_version = _default_scala_version()): + major_version_underscore = _extract_major_version_underscore(scala_version) _new_scala_repository("scala_default", scala_version) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 6f6f74df9..b0a244398 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -15,16 +15,20 @@ of abstracting over Scala major version (2.11, 2.12, etc) for dependency resolution.""" -def scala_version(): +def default_scala_version(): """return the scala version for use in maven coordinates""" - return "2.11" + return "2.11.11" def scala_mvn_artifact(artifact): gav = artifact.split(":") groupid = gav[0] artifactid = gav[1] version = gav[2] - return "%s:%s_%s:%s" % (groupid, artifactid, scala_version(), version) + return "%s:%s_%s:%s" % (groupid, artifactid, "2.11", version) + +def extract_major_version_underscore(scala_version): + """Return major Scala version given a full version, e.g. "2.11.11" -> "2_11" """ + return scala_version[:scala_version.find(".", 2)].replace(".", "_") def _generate_scala_imports(version): return """ diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index c2b3711ae..ecead8b66 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -6,6 +6,8 @@ load( load( "//scala:scala_cross_version.bzl", "scala_mvn_artifact", + _extract_major_version_underscore = "extract_major_version_underscore", + _default_scala_version = "default_scala_version", ) load( @@ -14,10 +16,8 @@ load( "create_java_provider", ) -def scala_proto_repositories(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( - ".", "_") - +def scala_proto_repositories(scala_version = _default_scala_version()): + major_version_underscore = _extract_major_version_underscore(scala_version) native.maven_server( name = "scala_proto_deps_maven_server", url = "http://central.maven.org/maven2/", diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 3ec1a8db5..26893ab59 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -1,12 +1,13 @@ load( "//scala:scala_cross_version.bzl", "scala_mvn_artifact", + _default_scala_version = "default_scala_version", ) def specs2_version(): return "3.8.8" -def specs2_repositories(scala_version = "2.11.11"): +def specs2_repositories(scala_version = _default_scala_version()): major_version = scala_version[:scala_version.find(".", 2)] if major_version == "2.11": diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 76a758413..e6f6a39e9 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -1,9 +1,13 @@ load("//scala:scala.bzl", "scala_binary") -load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") +load( + "//scala:scala_cross_version.bzl", + "scala_mvn_artifact", + _extract_major_version_underscore = "extract_major_version_underscore", + _default_scala_version = "default_scala_version") + +def tut_repositories(scala_version = _default_scala_version()): + major_version_underscore = _extract_major_version_underscore(scala_version) -def tut_repositories(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( - ".", "_") native.maven_server( name = "tut_repositories_maven_server", url = "https://dl.bintray.com/tpolecat/maven/", diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 3a052b419..11f96e9dc 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -6,7 +6,8 @@ load( load( "//scala:scala_cross_version.bzl", "scala_mvn_artifact", -) + _default_scala_version = "default_scala_version", + _extract_major_version_underscore = "extract_major_version_underscore") load("//scala/private:common.bzl", "write_manifest", "collect_srcjars", "collect_jars") @@ -15,9 +16,8 @@ load("//thrift:thrift.bzl", "ThriftInfo") _jar_filetype = FileType([".jar"]) -def twitter_scrooge(scala_version = "2.11.11"): - major_version_underscore = scala_version[:scala_version.find(".", 2)].replace( - ".", "_") +def twitter_scrooge(scala_version = _default_scala_version()): + major_version_underscore = _extract_major_version_underscore(scala_version) native.maven_server( name = "twitter_scrooge_maven_server", From 0dc43619fb15cce256748d53f788e28b825ccd87 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 27 Jun 2018 16:39:20 -0700 Subject: [PATCH 31/63] Increase scala_mvn_artifact usage, add shas --- WORKSPACE | 6 +-- scala/scala.bzl | 24 ++++++++---- scala/scala_cross_version.bzl | 7 ++-- scala_proto/scala_proto.bzl | 58 ++++++++++++++--------------- specs2/specs2.bzl | 32 ++++++++-------- tut_rule/tut.bzl | 4 +- twitter_scrooge/twitter_scrooge.bzl | 18 ++++----- 7 files changed, 79 insertions(+), 70 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 4b587eb66..08c726729 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -29,21 +29,21 @@ load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") # test adding a scala jar: maven_jar( name = "com_twitter__scalding_date", - artifact = scala_mvn_artifact("com.twitter:scalding-date:0.17.0"), + artifact = scala_mvn_artifact("com.twitter:scalding-date:0.17.0", "2.11"), sha1 = "420fb0c4f737a24b851c4316ee0362095710caa5", ) # For testing that we don't include sources jars to the classpath maven_jar( name = "org_typelevel__cats_core", - artifact = scala_mvn_artifact("org.typelevel:cats-core:0.9.0"), + artifact = scala_mvn_artifact("org.typelevel:cats-core:0.9.0", "2.11"), sha1 = "b2f8629c6ec834d8b6321288c9fe77823f1e1314", ) # test of a plugin maven_jar( name = "org_psywerx_hairyfotr__linter", - artifact = scala_mvn_artifact("org.psywerx.hairyfotr:linter:0.1.13"), + artifact = scala_mvn_artifact("org.psywerx.hairyfotr:linter:0.1.13", "2.11"), sha1 = "e5b3e2753d0817b622c32aedcb888bcf39e275b4", ) diff --git a/scala/scala.bzl b/scala/scala.bzl index 1df733bfe..56344eaa4 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -261,43 +261,51 @@ def scala_repositories(scala_version = _default_scala_version()): native.http_jar( name = "scalatest_2_11", url = - "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.5/scalatest_2.11-3.0.5.jar" + "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.5/scalatest_2.11-3.0.5.jar", + sha256 = "2aafeb41257912cbba95f9d747df9ecdc7ff43f039d35014b4c2a8eb7ed9ba2f" ) native.http_jar( name = "scalactic_2_11", url = - "http://central.maven.org/maven2/org/scalactic/scalactic_2.11/3.0.5/scalactic_2.11-3.0.5.jar" + "http://central.maven.org/maven2/org/scalactic/scalactic_2.11/3.0.5/scalactic_2.11-3.0.5.jar", + sha256 = "84723064f5716f38990fe6e65468aa39700c725484efceef015771d267341cf2" ) native.http_jar( name = "scalatest_2_12", url = - "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar" + "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar", + sha256 = "b416b5bcef6720da469a8d8a5726e457fc2d1cd5d316e1bc283aa75a2ae005e5" ) native.http_jar( name = "scalactic_2_12", url = - "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar" + "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar", + sha256 = "57e25b4fd969b1758fe042595112c874dfea99dca5cc48eebe07ac38772a0c41" ) native.http_jar( name = "scala_xml_2_11", url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.11/1.0.5/scala-xml_2.11-1.0.5.jar" + "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.11/1.0.5/scala-xml_2.11-1.0.5.jar", + sha256 = "767e11f33eddcd506980f0ff213f9d553a6a21802e3be1330345f62f7ee3d50f" ) native.http_jar( name = "scala_xml_2_12", url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.5/scala-xml_2.12-1.0.5.jar" + "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.5/scala-xml_2.12-1.0.5.jar", + sha256 = "035015366f54f403d076d95f4529ce9eeaf544064dbc17c2d10e4f5908ef4256" ) native.http_jar( name = "scala_parser_combinators_2_11", url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar" + "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar", + sha256 = "0dfaafce29a9a245b0a9180ec2c1073d2bd8f0330f03a9f1f6a74d1bc83f62d6" ) native.http_jar( name = "scala_parser_combinators_2_12", url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar" + "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar", + sha256 = "282c78d064d3e8f09b3663190d9494b85e0bb7d96b0da05994fe994384d96111" ) native.maven_server( diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index b0a244398..adb0ef66f 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -19,15 +19,16 @@ def default_scala_version(): """return the scala version for use in maven coordinates""" return "2.11.11" -def scala_mvn_artifact(artifact): +def scala_mvn_artifact(artifact, major_scala_version): gav = artifact.split(":") groupid = gav[0] artifactid = gav[1] version = gav[2] - return "%s:%s_%s:%s" % (groupid, artifactid, "2.11", version) + return "%s:%s_%s:%s" % (groupid, artifactid, major_scala_version, version) def extract_major_version_underscore(scala_version): - """Return major Scala version given a full version, e.g. "2.11.11" -> "2_11" """ + """Return major Scala version with underscore given a full version, + e.g. "2.11.11" -> "2_11" """ return scala_version[:scala_version.find(".", 2)].replace(".", "_") def _generate_scala_imports(version): diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index ecead8b66..b1cab9827 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -5,7 +5,7 @@ load( load( "//scala:scala_cross_version.bzl", - "scala_mvn_artifact", + _scala_mvn_artifact = "scala_mvn_artifact", _extract_major_version_underscore = "extract_major_version_underscore", _default_scala_version = "default_scala_version", ) @@ -36,13 +36,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_scalapb_plugin_2_11", - artifact = "com.trueaccord.scalapb:compilerplugin_2.11:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:compilerplugin:0.6.5", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_scalapb_plugin_2_12", - artifact = "com.trueaccord.scalapb:compilerplugin_2.12:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:compilerplugin:0.6.5", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( @@ -52,13 +52,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_protoc_bridge_2_11", - artifact = "com.trueaccord.scalapb:protoc-bridge_2.11:0.3.0-M1", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_protoc_bridge_2_12", - artifact = "com.trueaccord.scalapb:protoc-bridge_2.12:0.3.0-M1", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( @@ -68,13 +68,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_scalapbc_2_11", - artifact = "com.trueaccord.scalapb:scalapbc_2.11:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_scalapbc_2_12", - artifact = "com.trueaccord.scalapb:scalapbc_2.12:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapbc', @@ -83,13 +83,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_scalapb_runtime_2_11", - artifact = "com.trueaccord.scalapb:scalapb-runtime_2.11:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime:0.6.5", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_scalapb_runtime_2_12", - artifact = "com.trueaccord.scalapb:scalapb-runtime_2.12:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime:0.6.5", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime', @@ -98,13 +98,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_scalapb_runtime_grpc_2_11", - artifact = "com.trueaccord.scalapb:scalapb-runtime-grpc_2.11:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_scalapb_runtime_grpc_2_12", - artifact = "com.trueaccord.scalapb:scalapb-runtime-grpc_2.12:0.6.5", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime_grpc', @@ -113,13 +113,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_scalapb_lenses_2_11", - artifact = "com.trueaccord.lenses:lenses_2.11:0.4.12", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_scalapb_lenses_2_12", - artifact = "com.trueaccord.lenses:lenses_2.12:0.4.12", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_lenses', @@ -128,13 +128,13 @@ def scala_proto_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "scala_proto_rules_scalapb_fastparse_2_11", - artifact = "com.lihaoyi:fastparse_2.11:0.4.4", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", "2.11"), + server = "scala_proto_deps_maven_server", ) native.maven_jar( name = "scala_proto_rules_scalapb_fastparse_2_12", - artifact = "com.lihaoyi:fastparse_2.12:0.4.4", - #server = "scala_proto_deps_maven_server", + artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", "2.12"), + server = "scala_proto_deps_maven_server", ) native.bind( diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 26893ab59..466f8a0f5 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -1,6 +1,6 @@ load( "//scala:scala_cross_version.bzl", - "scala_mvn_artifact", + _scala_mvn_artifact = "scala_mvn_artifact", _default_scala_version = "default_scala_version", ) @@ -13,31 +13,31 @@ def specs2_repositories(scala_version = _default_scala_version()): if major_version == "2.11": native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_core", - artifact = "org.specs2:specs2-core_2.11:" + specs2_version(), + artifact = _scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version(), "2.11"), sha1 = "495bed00c73483f4f5f43945fde63c615d03e637", ) native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_common", - artifact = "org.specs2:specs2-common_2.11:" + specs2_version(), + artifact = _scala_mvn_artifact("org.specs2:specs2-common:" + specs2_version(), "2.11"), sha1 = "15bc009eaae3a574796c0f558d8696b57ae903c3", ) native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_matcher", - artifact = "org.specs2:specs2-matcher_2.11:" + specs2_version(), + artifact = _scala_mvn_artifact("org.specs2:specs2-matcher:" + specs2_version(), "2.11"), sha1 = "d2e967737abef7421e47b8994a8c92784e624d62", ) native.maven_jar( name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", - artifact = "org.scalaz:scalaz-effect_2.11:7.2.7", + artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", "2.11"), sha1 = "824bbb83da12224b3537c354c51eb3da72c435b5", ) native.maven_jar( name = "io_bazel_rules_scala_org_scalaz_scalaz_core", - artifact = "org.scalaz:scalaz-core_2.11:7.2.7", + artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", "2.11"), sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", ) @@ -47,32 +47,32 @@ def specs2_repositories(scala_version = _default_scala_version()): else: native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_core", - artifact = "org.specs2:specs2-core_2.12:" + specs2_version(), - #sha1 = "495bed00c73483f4f5f43945fde63c615d03e637", + artifact = _scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version(), "2.12"), + sha1 = "86cb72427e64e1423edcbf082e8767a60493bbcc", ) native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_common", - artifact = "org.specs2:specs2-common_2.12:" + specs2_version(), - #sha1 = "15bc009eaae3a574796c0f558d8696b57ae903c3", + artifact = _scala_mvn_artifact("org.specs2:specs2-common:" + specs2_version(), "2.12"), + sha1 = "83bd14fb54f81a886901fa7ed136bcf887322440", ) native.maven_jar( name = "io_bazel_rules_scala_org_specs2_specs2_matcher", - artifact = "org.specs2:specs2-matcher_2.12:" + specs2_version(), - #sha1 = "d2e967737abef7421e47b8994a8c92784e624d62", + artifact = _scala_mvn_artifact("org.specs2:specs2-matcher:" + specs2_version(), "2.12"), + sha1 = "921d9ef6bf98c3e5a59d535e1139b5522625d6ba", ) native.maven_jar( name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", - artifact = "org.scalaz:scalaz-effect_2.12:7.2.7", - #sha1 = "824bbb83da12224b3537c354c51eb3da72c435b5", + artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", "2.12"), + sha1 = "5d0bbd74323d8c7467cde95dcdc298eb3d9dcdb1", ) native.maven_jar( name = "io_bazel_rules_scala_org_scalaz_scalaz_core", - artifact = "org.scalaz:scalaz-core_2.12:7.2.7", - #sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", + artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", "2.12"), + sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", ) native.bind( diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index e6f6a39e9..81f0d94b0 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -15,13 +15,13 @@ def tut_repositories(scala_version = _default_scala_version()): native.maven_jar( name = "io_bazel_rules_scala_org_tpolecat_tut_core_2_11", - artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8"), + artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", "2.11"), sha1 = "fc723eb822494580cc05d6b3b3a6039d2280a5a0", server = "tut_repositories_maven_server", ) native.maven_jar( name = "io_bazel_rules_scala_org_tpolecat_tut_core_2_12", - artifact = "org.tpolecat:tut-core_2.12:0.4.8", + artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", "2.12"), server = "tut_repositories_maven_server", ) native.bind( diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 11f96e9dc..cd0615f44 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -5,7 +5,7 @@ load( load( "//scala:scala_cross_version.bzl", - "scala_mvn_artifact", + _scala_mvn_artifact = "scala_mvn_artifact", _default_scala_version = "default_scala_version", _extract_major_version_underscore = "extract_major_version_underscore") @@ -36,12 +36,12 @@ def twitter_scrooge(scala_version = _default_scala_version()): native.maven_jar( name = "scrooge_core_2_11", - artifact = "com.twitter:scrooge-core_2.11:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", "2.11"), #server = "twitter_scrooge_maven_server" ) native.maven_jar( name = "scrooge_core_2_12", - artifact = "com.twitter:scrooge-core_2.12:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", "2.12"), #server = "twitter_scrooge_maven_server" ) native.bind( @@ -51,12 +51,12 @@ def twitter_scrooge(scala_version = _default_scala_version()): #scrooge-generator related dependencies native.maven_jar( name = "scrooge_generator_2_11", - artifact = "com.twitter:scrooge-generator_2.11:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", "2.11"), #server = "twitter_scrooge_maven_server", ) native.maven_jar( name = "scrooge_generator_2_12", - artifact = "com.twitter:scrooge-generator_2.12:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", "2.12"), #server = "twitter_scrooge_maven_server", ) native.bind( @@ -65,12 +65,12 @@ def twitter_scrooge(scala_version = _default_scala_version()): native.maven_jar( name = "util_core_2_11", - artifact = "com.twitter:util-core_2.11:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", "2.11"), #server = "twitter_scrooge_maven_server", ) native.maven_jar( name = "util_core_2_12", - artifact = "com.twitter:util-core_2.12:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", "2.12"), #server = "twitter_scrooge_maven_server", ) native.bind( @@ -79,12 +79,12 @@ def twitter_scrooge(scala_version = _default_scala_version()): native.maven_jar( name = "util_logging_2_11", - artifact = "com.twitter:util-logging_2.11:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", "2.11"), #server = "twitter_scrooge_maven_server", ) native.maven_jar( name = "util_logging_2_12", - artifact = "com.twitter:util-logging_2.12:18.6.0", + artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", "2.12"), #server = "twitter_scrooge_maven_server", ) native.bind( From a66d27abd40240b516643dee74ae703b740b7d18 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 28 Jun 2018 09:39:16 -0700 Subject: [PATCH 32/63] Add default_major_scala_version() --- WORKSPACE | 8 ++++---- scala/scala_cross_version.bzl | 10 +++++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 08c726729..2d95d2170 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -24,26 +24,26 @@ load("//specs2:specs2_junit.bzl", "specs2_junit_repositories") specs2_junit_repositories() -load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") +load("//scala:scala_cross_version.bzl", "scala_mvn_artifact", "default_scala_major_version") # test adding a scala jar: maven_jar( name = "com_twitter__scalding_date", - artifact = scala_mvn_artifact("com.twitter:scalding-date:0.17.0", "2.11"), + artifact = scala_mvn_artifact("com.twitter:scalding-date:0.17.0", default_scala_major_version()), sha1 = "420fb0c4f737a24b851c4316ee0362095710caa5", ) # For testing that we don't include sources jars to the classpath maven_jar( name = "org_typelevel__cats_core", - artifact = scala_mvn_artifact("org.typelevel:cats-core:0.9.0", "2.11"), + artifact = scala_mvn_artifact("org.typelevel:cats-core:0.9.0", default_scala_major_version()), sha1 = "b2f8629c6ec834d8b6321288c9fe77823f1e1314", ) # test of a plugin maven_jar( name = "org_psywerx_hairyfotr__linter", - artifact = scala_mvn_artifact("org.psywerx.hairyfotr:linter:0.1.13", "2.11"), + artifact = scala_mvn_artifact("org.psywerx.hairyfotr:linter:0.1.13", default_scala_major_version()), sha1 = "e5b3e2753d0817b622c32aedcb888bcf39e275b4", ) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index adb0ef66f..078d17221 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -20,16 +20,24 @@ def default_scala_version(): return "2.11.11" def scala_mvn_artifact(artifact, major_scala_version): + """Add scala version to maven artifact""" gav = artifact.split(":") groupid = gav[0] artifactid = gav[1] version = gav[2] return "%s:%s_%s:%s" % (groupid, artifactid, major_scala_version, version) +def extract_major_version(scala_version): + """Return major Scala version given a full version, e.g. "2.11.11" -> "2.11" """ + return scala_version[:scala_version.find(".", 2)] + def extract_major_version_underscore(scala_version): """Return major Scala version with underscore given a full version, e.g. "2.11.11" -> "2_11" """ - return scala_version[:scala_version.find(".", 2)].replace(".", "_") + return extract_major_version(scala_version).replace(".", "_") + +def default_scala_major_version(): + return extract_major_version(default_scala_version()) def _generate_scala_imports(version): return """ From 8b48a1e0c9e460e9542f826bce14b92bd53ab05e Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 28 Jun 2018 10:34:09 -0700 Subject: [PATCH 33/63] Add scala_jar_shas dict - Specify only one version of scalatest/scalactic... getting the shas from scala_jar_shas --- scala/scala.bzl | 86 ++++++++----------- scala/scala_cross_version.bzl | 7 +- scala/scalatest/BUILD | 7 +- src/java/io/bazel/rulesscala/scala_test/BUILD | 1 - 4 files changed, 41 insertions(+), 60 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 56344eaa4..e75c186da 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -16,7 +16,7 @@ load( load( "@io_bazel_rules_scala//scala:scala_cross_version.bzl", _new_scala_repository = "new_scala_repository", - _extract_major_version_underscore = "extract_major_version_underscore", + _extract_major_version = "extract_major_version", _default_scala_version = "default_scala_version") load( @@ -253,59 +253,52 @@ scala_repl = rule( ) def scala_repositories(scala_version = _default_scala_version()): - major_version_underscore = _extract_major_version_underscore(scala_version) + major_version = _extract_major_version(scala_version) _new_scala_repository("scala_default", scala_version) - # scalatest has macros, note http_jar is invoking ijar - native.http_jar( - name = "scalatest_2_11", - url = - "http://central.maven.org/maven2/org/scalatest/scalatest_2.11/3.0.5/scalatest_2.11-3.0.5.jar", - sha256 = "2aafeb41257912cbba95f9d747df9ecdc7ff43f039d35014b4c2a8eb7ed9ba2f" - ) - native.http_jar( - name = "scalactic_2_11", - url = - "http://central.maven.org/maven2/org/scalactic/scalactic_2.11/3.0.5/scalactic_2.11-3.0.5.jar", - sha256 = "84723064f5716f38990fe6e65468aa39700c725484efceef015771d267341cf2" - ) + scala_jar_shas = { + "2.11": { + "scalatest": "2aafeb41257912cbba95f9d747df9ecdc7ff43f039d35014b4c2a8eb7ed9ba2f", + "scalactic": "84723064f5716f38990fe6e65468aa39700c725484efceef015771d267341cf2", + "scala_xml": "767e11f33eddcd506980f0ff213f9d553a6a21802e3be1330345f62f7ee3d50f", + "scala_parser_combinators": "0dfaafce29a9a245b0a9180ec2c1073d2bd8f0330f03a9f1f6a74d1bc83f62d6" + }, + "2.12": { + "scalatest": "b416b5bcef6720da469a8d8a5726e457fc2d1cd5d316e1bc283aa75a2ae005e5", + "scalactic": "57e25b4fd969b1758fe042595112c874dfea99dca5cc48eebe07ac38772a0c41", + "scala_xml": "035015366f54f403d076d95f4529ce9eeaf544064dbc17c2d10e4f5908ef4256", + "scala_parser_combinators": "282c78d064d3e8f09b3663190d9494b85e0bb7d96b0da05994fe994384d96111" + }, + } native.http_jar( - name = "scalatest_2_12", + name = "scalatest", url = - "http://central.maven.org/maven2/org/scalatest/scalatest_2.12/3.0.5/scalatest_2.12-3.0.5.jar", - sha256 = "b416b5bcef6720da469a8d8a5726e457fc2d1cd5d316e1bc283aa75a2ae005e5" + "http://central.maven.org/maven2/org/scalatest/scalatest_{major_version}/3.0.5/scalatest_{major_version}-3.0.5.jar".format( + major_version = major_version), + sha256 = scala_jar_shas[major_version]["scalatest"] ) native.http_jar( - name = "scalactic_2_12", - url = - "http://central.maven.org/maven2/org/scalactic/scalactic_2.12/3.0.5/scalactic_2.12-3.0.5.jar", - sha256 = "57e25b4fd969b1758fe042595112c874dfea99dca5cc48eebe07ac38772a0c41" + name = "scalactic", + url = + "http://central.maven.org/maven2/org/scalactic/scalactic_{major_version}/3.0.5/scalactic_{major_version}-3.0.5.jar".format( + major_version = major_version), + sha256 = scala_jar_shas[major_version]["scalactic"] ) native.http_jar( - name = "scala_xml_2_11", + name = "scala_xml", url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.11/1.0.5/scala-xml_2.11-1.0.5.jar", - sha256 = "767e11f33eddcd506980f0ff213f9d553a6a21802e3be1330345f62f7ee3d50f" + "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_{major_version}/1.0.5/scala-xml_{major_version}-1.0.5.jar".format( + major_version = major_version), + sha256 = scala_jar_shas[major_version]["scala_xml"] ) native.http_jar( - name = "scala_xml_2_12", + name = "scala_parser_combinators", url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-xml_2.12/1.0.5/scala-xml_2.12-1.0.5.jar", - sha256 = "035015366f54f403d076d95f4529ce9eeaf544064dbc17c2d10e4f5908ef4256" - ) - native.http_jar( - name = "scala_parser_combinators_2_11", - url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.11/1.0.4/scala-parser-combinators_2.11-1.0.4.jar", - sha256 = "0dfaafce29a9a245b0a9180ec2c1073d2bd8f0330f03a9f1f6a74d1bc83f62d6" - ) - native.http_jar( - name = "scala_parser_combinators_2_12", - url = - "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_2.12/1.0.4/scala-parser-combinators_2.12-1.0.4.jar", - sha256 = "282c78d064d3e8f09b3663190d9494b85e0bb7d96b0da05994fe994384d96111" + "http://central.maven.org/maven2/org/scala-lang/modules/scala-parser-combinators_{major_version}/1.0.4/scala-parser-combinators_{major_version}-1.0.4.jar".format( + major_version = major_version), + sha256 = scala_jar_shas[major_version]["scala_parser_combinators"] ) native.maven_server( @@ -354,26 +347,17 @@ def scala_repositories(scala_version = _default_scala_version()): name = "io_bazel_rules_scala/dependency/commons_io/commons_io", actual = "@scalac_rules_commons_io//jar") - native.bind( - name = "io_bazel_rules_scala/dependency/scalatest/scalatest_library", - actual = "@scalatest_{}//jar".format(major_version_underscore)) - - native.bind( - name = "io_bazel_rules_scala/dependency/scalactic/scalactic", - actual = "@scalactic_{}//jar".format(major_version_underscore)) - native.bind( name = "io_bazel_rules_scala/dependency/scalatest/scalatest", actual = "@io_bazel_rules_scala//scala/scalatest:scalatest") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_xml", - actual = "@scala_xml_{}//jar".format(major_version_underscore)) + actual = "@scala_xml//jar") native.bind( name = "io_bazel_rules_scala/dependency/scala/parser_combinators", - actual = "@scala_parser_combinators_{}//jar".format( - major_version_underscore)) + actual = "@scala_parser_combinators//jar") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_compiler", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 078d17221..565cd965d 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -104,14 +104,13 @@ _declare_scalac_provider( scalac = "@{name}//:scalac_worker", scalalib = "@{archive}//:scala-library", scalareflect = "@{archive}//:scala-reflect", - scalaxml = "@scala_xml_{version_underscore}//jar", + scalaxml = "@scala_xml//jar", scalacompiler = "@{archive}//:scala-compiler", visibility = ["//visibility:public"], ) """.format( archive = repository_ctx.attr.archive, - name = repository_ctx.attr.name, - version_underscore = repository_ctx.attr.version_underscore) + name = repository_ctx.attr.name) repository_ctx.file("BUILD", contents, False) @@ -119,7 +118,6 @@ _generate_scalac_build_file = repository_rule( implementation = _generate_scalac_build_file_impl, attrs = { "archive": attr.string(), - "version_underscore": attr.string() }) def new_scala_repository(name, version): @@ -137,5 +135,4 @@ def new_scala_repository(name, version): _generate_scalac_build_file( name = name, archive = archive, - version_underscore = major_version.replace(".", "_"), visibility = ["//visibility:public"]) diff --git a/scala/scalatest/BUILD b/scala/scalatest/BUILD index c09f59e4d..e39f924c7 100644 --- a/scala/scalatest/BUILD +++ b/scala/scalatest/BUILD @@ -1,10 +1,11 @@ package(default_visibility = ["//visibility:public"]) +load("//scala:scala_import.bzl", "scala_import") -java_import( +scala_import( name = "scalatest", jars = [], exports = [ - "//external:io_bazel_rules_scala/dependency/scalactic/scalactic", - "//external:io_bazel_rules_scala/dependency/scalatest/scalatest_library", + "@scalactic//jar", + "@scalatest//jar" ], ) diff --git a/src/java/io/bazel/rulesscala/scala_test/BUILD b/src/java/io/bazel/rulesscala/scala_test/BUILD index 6c3570052..4520a832e 100644 --- a/src/java/io/bazel/rulesscala/scala_test/BUILD +++ b/src/java/io/bazel/rulesscala/scala_test/BUILD @@ -3,7 +3,6 @@ java_binary( srcs = ["Runner.java"], visibility = ["//visibility:public"], deps = [ - "//external:io_bazel_rules_scala/dependency/scalactic/scalactic", "//external:io_bazel_rules_scala/dependency/scalatest/scalatest", ], ) From 1648bd4b659487f645a3d0e0146351e23a0fd65f Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 28 Jun 2018 10:43:18 -0700 Subject: [PATCH 34/63] Fix aspect test --- test/aspect/aspect.bzl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/aspect/aspect.bzl b/test/aspect/aspect.bzl index 2312de302..e39afcb03 100644 --- a/test/aspect/aspect.bzl +++ b/test/aspect/aspect.bzl @@ -28,7 +28,7 @@ def _rule_impl(ctx): "scala_test": [ "//test/aspect:scala_test", "@scala_default_imports//:scala-library", - "@scalatest_2_11//jar:jar", + "@io_bazel_rules_scala//scala/scalatest:scalatest", ], "scala_junit_test": [ "//test/aspect:scala_junit_test", @@ -43,12 +43,12 @@ def _rule_impl(ctx): "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", # From specs2/specs2.bzl:specs2_dependencies() "@io_bazel_rules_scala//specs2:specs2", - "@scala_xml_2_11//jar:jar", - "@scala_parser_combinators_2_11//jar:jar", + "@scala_xml//jar:jar", + "@scala_parser_combinators//jar:jar", "@scala_default_imports//:scala-library", "@scala_default_imports//:scala-reflect", # From specs2/specs2_junit.bzl:specs2_junit_dependencies() - "@io_bazel_rules_scala_org_specs2_specs2_junit_2_11//jar:jar", + "@io_bazel_rules_scala_org_specs2_specs2_junit//jar:jar", ], } content = "" From b81916212aa53c42c058dddf0afb9ab93acb516d Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 2 Jul 2018 14:09:04 -0700 Subject: [PATCH 35/63] Use scala_maven_import_external for all imports specs2, tut, scrooge, protob --- scala_proto/scala_proto.bzl | 158 ++++++++++++++-------------- specs2/BUILD | 10 +- specs2/specs2.bzl | 127 +++++++++++----------- specs2/specs2_junit.bzl | 39 +++++-- tut_rule/tut.bzl | 40 +++---- twitter_scrooge/twitter_scrooge.bzl | 97 +++++++++-------- 6 files changed, 249 insertions(+), 222 deletions(-) diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index 9466014e0..a2551f411 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -6,18 +6,23 @@ load( load( "//scala:scala_cross_version.bzl", _scala_mvn_artifact = "scala_mvn_artifact", - _extract_major_version_underscore = "extract_major_version_underscore", + _extract_major_version = "extract_major_version", _default_scala_version = "default_scala_version", ) +load( + "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", + _scala_maven_import_external = "scala_maven_import_external") + load( "//scala/private:common.bzl", "collect_jars", "create_java_provider", ) -def scala_proto_repositories(scala_version = _default_scala_version()): - major_version_underscore = _extract_major_version_underscore(scala_version) +def scala_proto_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): + major_version = _extract_major_version(scala_version) + native.maven_server( name = "scala_proto_deps_maven_server", url = "http://central.maven.org/maven2/", @@ -34,113 +39,106 @@ def scala_proto_repositories(scala_version = _default_scala_version()): name = 'io_bazel_rules_scala/dependency/proto/protoc', actual = '@scala_proto_rules_protoc_jar//jar') - native.maven_jar( - name = "scala_proto_rules_scalapb_plugin_2_11", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:compilerplugin:0.6.5", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_scalapb_plugin_2_12", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:compilerplugin:0.6.5", "2.12"), - server = "scala_proto_deps_maven_server", + scala_jar_shas = { + "2.11": { + "scalapb_plugin": "c79e1e1398de88779611fda91ef1a9699f9390946bee6a4bba113f3cc036a838", + "protoc_bridge": "a5beafaa7d49822d1412cce675c226304c6499ff65ec6e8cff7e65ae537076b5", + "scalapbc": "32b7340a545b282c513d3c91e0ebf906e2ad1de45c0875e7e7bbaaa0909f5e60", + "scalapb_runtime": "d5b597f637a6f99560d674715647fc5bb199ebf4ca6e263ed1614ea4eb63baad", + "scalapb_runtime_grpc": "d7ce3059cc63b3e1bcc4f710cff55facb92a478cc2225e4c6830ab7ba0fd4fe8", + "scalapb_lenses": "1e9fa3830dfcee99ba20bb55468757bb35762b5ee243ddb8c4d238e749a95cd7", + "scalapb_fastparse": "9e07298f20ee37e828f2699b71b447008ebf122cc86cab1d1fcd8d00fad4837b", + }, + "2.12": { + "scalapb_plugin": "8fec3566010ffbd61b1b44e23bd344790533f5648d918b42ab683d79bdee9ddf", + "protoc_bridge": "bb53dacf3dcd588ea8039b44abc9d816f3150f01916d07a76e1e248389b35d71", + "scalapbc": "d2d3a7477f7c89b70476627c1eb44781ccb1c99f36ed208fca69849e5d8dd692", + "scalapb_runtime": "26a8446755b1b11a75a5e3a1d055ef251b7a479a07bf2285ee1aaf8df92a71f5", + "scalapb_runtime_grpc": "fb2ca8ea6c66ec79e4a9ad279c143af08ec9d0c9b607fb0965cc5aee19a8679a", + "scalapb_lenses": "7cedcbc3125ad3f156466d6f3aec24b7fe6954cdc54a426ea089b4a46cd84c1c", + "scalapb_fastparse": "7bc2a3131204e737f020f94e19b1e62a1bf5359f5741c35dff9351ef36d7a80e", + }, + } + + _scala_maven_import_external( + name = "scala_proto_rules_scalapb_plugin", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:compilerplugin:0.6.5", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalapb_plugin"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_plugin', - actual = '@scala_proto_rules_scalapb_plugin_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_scalapb_plugin') - native.maven_jar( - name = "scala_proto_rules_protoc_bridge_2_11", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_protoc_bridge_2_12", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", "2.12"), - server = "scala_proto_deps_maven_server", + _scala_maven_import_external( + name = "scala_proto_rules_protoc_bridge", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", major_version), + jar_sha256 = scala_jar_shas[major_version]["protoc_bridge"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/protoc_bridge', - actual = '@scala_proto_rules_protoc_bridge_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_protoc_bridge') - native.maven_jar( - name = "scala_proto_rules_scalapbc_2_11", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_scalapbc_2_12", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", "2.12"), - server = "scala_proto_deps_maven_server", + _scala_maven_import_external( + name = "scala_proto_rules_scalapbc", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalapbc"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapbc', - actual = '@scala_proto_rules_scalapbc_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_scalapbc') - native.maven_jar( - name = "scala_proto_rules_scalapb_runtime_2_11", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime:0.6.5", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_scalapb_runtime_2_12", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime:0.6.5", "2.12"), - server = "scala_proto_deps_maven_server", + _scala_maven_import_external( + name = "scala_proto_rules_scalapb_runtime", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime:0.6.5", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalapb_runtime"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime', - actual = '@scala_proto_rules_scalapb_runtime_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_scalapb_runtime') - native.maven_jar( - name = "scala_proto_rules_scalapb_runtime_grpc_2_11", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_scalapb_runtime_grpc_2_12", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", "2.12"), - server = "scala_proto_deps_maven_server", + _scala_maven_import_external( + name = "scala_proto_rules_scalapb_runtime_grpc", + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalapb_runtime_grpc"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime_grpc', - actual = '@scala_proto_rules_scalapb_runtime_grpc_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_scalapb_runtime_grpc') - native.maven_jar( - name = "scala_proto_rules_scalapb_lenses_2_11", - artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_scalapb_lenses_2_12", - artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", "2.12"), - server = "scala_proto_deps_maven_server", + _scala_maven_import_external( + name = "scala_proto_rules_scalapb_lenses", + artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalapb_lenses"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_lenses', - actual = '@scala_proto_rules_scalapb_lenses_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_scalapb_lenses') - native.maven_jar( - name = "scala_proto_rules_scalapb_fastparse_2_11", - artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", "2.11"), - server = "scala_proto_deps_maven_server", - ) - native.maven_jar( - name = "scala_proto_rules_scalapb_fastparse_2_12", - artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", "2.12"), - server = "scala_proto_deps_maven_server", + _scala_maven_import_external( + name = "scala_proto_rules_scalapb_fastparse", + artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalapb_fastparse"], + licenses = ["notice"], + server_urls = maven_servers ) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_fastparse', - actual = '@scala_proto_rules_scalapb_fastparse_{}//jar'.format( - major_version_underscore)) + actual = '@scala_proto_rules_scalapb_fastparse') native.maven_jar( name = "scala_proto_rules_grpc_core", diff --git a/specs2/BUILD b/specs2/BUILD index 3b73536df..8106d7c6a 100644 --- a/specs2/BUILD +++ b/specs2/BUILD @@ -4,11 +4,11 @@ java_import( name = "specs2", jars = [], exports = [ - "@io_bazel_rules_scala_org_scalaz_scalaz_core//jar", - "@io_bazel_rules_scala_org_scalaz_scalaz_effect//jar", - "@io_bazel_rules_scala_org_specs2_specs2_common//jar", - "@io_bazel_rules_scala_org_specs2_specs2_core//jar", - "@io_bazel_rules_scala_org_specs2_specs2_matcher//jar", + "@io_bazel_rules_scala_org_scalaz_scalaz_core", + "@io_bazel_rules_scala_org_scalaz_scalaz_effect", + "@io_bazel_rules_scala_org_specs2_specs2_common", + "@io_bazel_rules_scala_org_specs2_specs2_core", + "@io_bazel_rules_scala_org_specs2_specs2_matcher", ], deps = [ "//external:io_bazel_rules_scala/dependency/scala/parser_combinators", diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 466f8a0f5..22612487a 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -2,82 +2,79 @@ load( "//scala:scala_cross_version.bzl", _scala_mvn_artifact = "scala_mvn_artifact", _default_scala_version = "default_scala_version", + _extract_major_version = "extract_major_version" ) +load( + "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", + _scala_maven_import_external = "scala_maven_import_external") + def specs2_version(): return "3.8.8" -def specs2_repositories(scala_version = _default_scala_version()): - major_version = scala_version[:scala_version.find(".", 2)] - - if major_version == "2.11": - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_core", - artifact = _scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version(), "2.11"), - sha1 = "495bed00c73483f4f5f43945fde63c615d03e637", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_common", - artifact = _scala_mvn_artifact("org.specs2:specs2-common:" + specs2_version(), "2.11"), - sha1 = "15bc009eaae3a574796c0f558d8696b57ae903c3", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_matcher", - artifact = _scala_mvn_artifact("org.specs2:specs2-matcher:" + specs2_version(), "2.11"), - sha1 = "d2e967737abef7421e47b8994a8c92784e624d62", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", - artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", "2.11"), - sha1 = "824bbb83da12224b3537c354c51eb3da72c435b5", - ) - - native.maven_jar( - name = "io_bazel_rules_scala_org_scalaz_scalaz_core", - artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", "2.11"), - sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", - ) +def specs2_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): + major_version = _extract_major_version(scala_version) - native.bind( - name = 'io_bazel_rules_scala/dependency/specs2/specs2', - actual = "@io_bazel_rules_scala//specs2:specs2") - else: - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_core", - artifact = _scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version(), "2.12"), - sha1 = "86cb72427e64e1423edcbf082e8767a60493bbcc", - ) + scala_jar_shas = { + "2.11": { + "specs2_core": "692eafc052a838c0c8552afc1a15e10978979d1703c812bd16f572d77ddd07ab", + "specs2_common": "ba06a6218704cff61296e13300a87b07ac5ab5ad45fc82dce37e550101b8cdb5", + "specs2_matcher": "9c8cc2148a6692aa4e2fcd1282c28971215f501f10d532d1a3a3c33fd803fedc", + "scalaz_effect": "4d45f0d1bb6958f5c6781a5e94d9528934b6a1404346d224dda25da064b0c964", + "scalaz_core": "810504bc8d669913af830dd5d9c87f83e0570898f09be6474f0d5603bba8ba79", + }, + "2.12": { + "specs2_core": "1fc47c1199675ed60b58923c84006cc4f776818b11e0a18a47db29c03a60ee97", + "specs2_common": "c0a892fd1a5a1aaf5bb29792e39da5459f1564a721d9a6a0954fb52c395b2deb", + "specs2_matcher": "c17b8f1e4c3da6c1489c59f67e03374b358fdfbe90d9def2a7e4e1b1b10f5046", + "scalaz_effect": "eca21ba69a1532c74ea77356b59d6175a5fd54dac7f57f1d1979738c98521919", + "scalaz_core": "b53cd091daec1c8df8c4244e5b8b460b7416c2cc86aecd25dec4c93d2baf2b04", + }, + } - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_common", - artifact = _scala_mvn_artifact("org.specs2:specs2-common:" + specs2_version(), "2.12"), - sha1 = "83bd14fb54f81a886901fa7ed136bcf887322440", - ) + _scala_maven_import_external( + name = "io_bazel_rules_scala_org_specs2_specs2_core", + artifact = _scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version(), major_version), + jar_sha256 = scala_jar_shas[major_version]["specs2_core"], + licenses = ["notice"], + server_urls = maven_servers, + ) - native.maven_jar( - name = "io_bazel_rules_scala_org_specs2_specs2_matcher", - artifact = _scala_mvn_artifact("org.specs2:specs2-matcher:" + specs2_version(), "2.12"), - sha1 = "921d9ef6bf98c3e5a59d535e1139b5522625d6ba", - ) + _scala_maven_import_external( + name = "io_bazel_rules_scala_org_specs2_specs2_common", + artifact = _scala_mvn_artifact("org.specs2:specs2-common:" + specs2_version(), major_version), + jar_sha256 = scala_jar_shas[major_version]["specs2_common"], + licenses = ["notice"], + server_urls = maven_servers, + ) + + _scala_maven_import_external( + name = "io_bazel_rules_scala_org_specs2_specs2_matcher", + artifact = _scala_mvn_artifact("org.specs2:specs2-matcher:" + specs2_version(), major_version), + jar_sha256 = scala_jar_shas[major_version]["specs2_matcher"], + licenses = ["notice"], + server_urls = maven_servers, + ) - native.maven_jar( - name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", - artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", "2.12"), - sha1 = "5d0bbd74323d8c7467cde95dcdc298eb3d9dcdb1", - ) + _scala_maven_import_external( + name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", + artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalaz_effect"], + licenses = ["notice"], + server_urls = maven_servers, + ) - native.maven_jar( - name = "io_bazel_rules_scala_org_scalaz_scalaz_core", - artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", "2.12"), - sha1 = "ebf85118d0bf4ce18acebf1d8475ee7deb7f19f1", - ) + _scala_maven_import_external( + name = "io_bazel_rules_scala_org_scalaz_scalaz_core", + artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", major_version), + jar_sha256 = scala_jar_shas[major_version]["scalaz_core"], + licenses = ["notice"], + server_urls = maven_servers, + ) - native.bind( - name = 'io_bazel_rules_scala/dependency/specs2/specs2', - actual = "@io_bazel_rules_scala//specs2:specs2") + native.bind( + name = 'io_bazel_rules_scala/dependency/specs2/specs2', + actual = "@io_bazel_rules_scala//specs2:specs2") def specs2_dependencies(): return ["//external:io_bazel_rules_scala/dependency/specs2/specs2"] diff --git a/specs2/specs2_junit.bzl b/specs2/specs2_junit.bzl index 8ce15a914..eb8b22882 100644 --- a/specs2/specs2_junit.bzl +++ b/specs2/specs2_junit.bzl @@ -1,24 +1,45 @@ load("//specs2:specs2.bzl", "specs2_repositories", "specs2_dependencies", "specs2_version") -load("//scala:scala_cross_version.bzl", "scala_mvn_artifact") + load("//junit:junit.bzl", "junit_repositories") -def specs2_junit_repositories(scala_version = "2.11.11"): - major_version = scala_version[:scala_version.find(".", 2)] +load( + "//scala:scala_cross_version.bzl", + _scala_mvn_artifact = "scala_mvn_artifact", + _default_scala_version = "default_scala_version", + _extract_major_version = "extract_major_version" +) + +load( + "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", + _scala_maven_import_external = "scala_maven_import_external") - specs2_repositories(scala_version) +def specs2_junit_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): + major_version = _extract_major_version(scala_version) + + specs2_repositories(scala_version, maven_servers) junit_repositories() + + scala_jar_shas = { + "2.11": { + "specs2_junit": "516e1c07340878bd2d37ee764c0c0f03985a658af2d638810d8cff7bec4a89f3", + }, + "2.12": { + "specs2_junit": "4704f2e706d5df76e7993fe0d3fb10499dd623f9cef98fe4ac7f84f66823b35f", + }, + } # Aditional dependencies for specs2 junit runner - native.maven_jar( + _scala_maven_import_external( name = "io_bazel_rules_scala_org_specs2_specs2_junit", - artifact = "org.specs2:specs2-junit_{}:".format(major_version) + - specs2_version(), - #sha1 = "1dc9e43970557c308ee313842d84094bc6c1c1b5", + artifact = _scala_mvn_artifact("org.specs2:specs2-junit:" + specs2_version(), major_version), + jar_sha256 = scala_jar_shas[major_version]["specs2_junit"], + licenses = ["notice"], + server_urls = maven_servers, ) native.bind( name = 'io_bazel_rules_scala/dependency/specs2/specs2_junit', - actual = '@io_bazel_rules_scala_org_specs2_specs2_junit//jar') + actual = '@io_bazel_rules_scala_org_specs2_specs2_junit') def specs2_junit_dependencies(): return specs2_dependencies() + [ diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 81f0d94b0..6ea3ef8dc 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -2,32 +2,36 @@ load("//scala:scala.bzl", "scala_binary") load( "//scala:scala_cross_version.bzl", "scala_mvn_artifact", - _extract_major_version_underscore = "extract_major_version_underscore", + _extract_major_version = "extract_major_version", _default_scala_version = "default_scala_version") +load( + "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", + _scala_maven_import_external = "scala_maven_import_external") + def tut_repositories(scala_version = _default_scala_version()): - major_version_underscore = _extract_major_version_underscore(scala_version) + major_version = _extract_major_version(scala_version) - native.maven_server( - name = "tut_repositories_maven_server", - url = "https://dl.bintray.com/tpolecat/maven/", - ) + scala_jar_shas = { + "2.11": { + "tut_core": "edab4e9963dd7dbab1a8bfff2ef087eb6b6882804dfb3a2641895c958a62ba89", + }, + "2.12": { + "tut_core": "767735128b6d5694d59ccb3bd1f5544a05d83146577121bcf7b6a32327adf281", + }, + } - native.maven_jar( - name = "io_bazel_rules_scala_org_tpolecat_tut_core_2_11", - artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", "2.11"), - sha1 = "fc723eb822494580cc05d6b3b3a6039d2280a5a0", - server = "tut_repositories_maven_server", - ) - native.maven_jar( - name = "io_bazel_rules_scala_org_tpolecat_tut_core_2_12", - artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", "2.12"), - server = "tut_repositories_maven_server", + _scala_maven_import_external( + name = "io_bazel_rules_scala_org_tpolecat_tut_core", + artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", major_version), + jar_sha256 = scala_jar_shas[major_version]["tut_core"], + licenses = ["notice"], + server_urls = ["https://dl.bintray.com/tpolecat/maven/"], ) + native.bind( name = 'io_bazel_rules_scala/dependency/tut/tut_core', - actual = '@io_bazel_rules_scala_org_tpolecat_tut_core_{}//jar'.format( - major_version_underscore)) + actual = '@io_bazel_rules_scala_org_tpolecat_tut_core') def scala_tut_doc(**kw): name = kw["name"] diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 5d1e4a819..1dc52e06f 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -2,7 +2,11 @@ load( "//scala:scala_cross_version.bzl", _scala_mvn_artifact = "scala_mvn_artifact", _default_scala_version = "default_scala_version", - _extract_major_version_underscore = "extract_major_version_underscore") + _extract_major_version = "extract_major_version") + +load( + "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", + _scala_maven_import_external = "scala_maven_import_external") load("//scala/private:common.bzl", "write_manifest_file", "collect_srcjars", "collect_jars") @@ -20,8 +24,8 @@ load( _jar_extension = ".jar" -def twitter_scrooge(scala_version = _default_scala_version()): - major_version_underscore = _extract_major_version_underscore(scala_version) +def twitter_scrooge(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): + major_version = _extract_major_version(scala_version) native.maven_server( name = "twitter_scrooge_maven_server", @@ -38,62 +42,65 @@ def twitter_scrooge(scala_version = _default_scala_version()): name = 'io_bazel_rules_scala/dependency/thrift/libthrift', actual = '@libthrift//jar') - native.maven_jar( - name = "scrooge_core_2_11", - artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", "2.11"), - #server = "twitter_scrooge_maven_server" - ) - native.maven_jar( - name = "scrooge_core_2_12", - artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", "2.12"), - #server = "twitter_scrooge_maven_server" + scala_jar_shas = { + "2.11": { + "util_logging": "73ddd61cedabd4dab82b30e6c52c1be6c692b063b8ba310d716ead9e3b4e9267", + "scrooge_core": "00351f73b555d61cfe7320ef3b1367a9641e694cfb8dfa8a733cfcf49df872e8", + "scrooge_generator": "0f0027e815e67985895a6f3caa137f02366ceeea4966498f34fb82cabb11dee6", + "util_core": "5336da4846dfc3db8ffe5ae076be1021828cfee35aa17bda9af461e203cf265c" + }, + "2.12": { + "util_logging": "c0cba01705e9321b3444adcd4a9ce27c2acefd27e14c13b5aec2c318ce1b4fdf", + "scrooge_core": "02a6d7cf9fe8d872dfabd20298e4315d677748708e153d8b464fd5abac9a7430", + "scrooge_generator": "e7d5da1e3f0e494d3c81a26f44f3e3dc92d7efd757133de8c71758646fd5a833", + "util_core": "65bb92e70f95cbbfc640e54a5823a16154eac1a2631dc0211347e085aaa6ed0b" + }, + } + + _scala_maven_import_external( + name = "io_bazel_rules_scala_scrooge_core", + artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", major_version), + jar_sha256 = scala_jar_shas[major_version]["scrooge_core"], + licenses = ["notice"], + server_urls = maven_servers, ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/scrooge_core', - actual = '@scrooge_core_{}//jar'.format(major_version_underscore)) + actual = '@io_bazel_rules_scala_scrooge_core') #scrooge-generator related dependencies - native.maven_jar( - name = "scrooge_generator_2_11", - artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", "2.11"), - #server = "twitter_scrooge_maven_server", - ) - native.maven_jar( - name = "scrooge_generator_2_12", - artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", "2.12"), - #server = "twitter_scrooge_maven_server", + _scala_maven_import_external( + name = "io_bazel_rules_scala_scrooge_generator", + artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", major_version), + jar_sha256 = scala_jar_shas[major_version]["scrooge_generator"], + licenses = ["notice"], + server_urls = maven_servers, ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/scrooge_generator', - actual = '@scrooge_generator_{}//jar'.format(major_version_underscore)) - - native.maven_jar( - name = "util_core_2_11", - artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", "2.11"), - #server = "twitter_scrooge_maven_server", - ) - native.maven_jar( - name = "util_core_2_12", - artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", "2.12"), - #server = "twitter_scrooge_maven_server", + actual = '@io_bazel_rules_scala_scrooge_generator') + + _scala_maven_import_external( + name = "io_bazel_rules_scala_util_core", + artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", major_version), + jar_sha256 = scala_jar_shas[major_version]["util_core"], + licenses = ["notice"], + server_urls = maven_servers, ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/util_core', - actual = '@util_core_{}//jar'.format(major_version_underscore)) - - native.maven_jar( - name = "util_logging_2_11", - artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", "2.11"), - #server = "twitter_scrooge_maven_server", - ) - native.maven_jar( - name = "util_logging_2_12", - artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", "2.12"), - #server = "twitter_scrooge_maven_server", + actual = '@io_bazel_rules_scala_util_core') + + _scala_maven_import_external( + name = "io_bazel_rules_scala_util_logging", + artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", major_version), + jar_sha256 = scala_jar_shas[major_version]["util_logging"], + licenses = ["notice"], + server_urls = maven_servers, ) native.bind( name = 'io_bazel_rules_scala/dependency/thrift/util_logging', - actual = '@util_logging_{}//jar'.format(major_version_underscore)) + actual = '@io_bazel_rules_scala_util_logging') def _colon_paths(data): return ':'.join([f.path for f in sorted(data)]) From b6c58065ed9642a9382ba949277330b9e7fa919a Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 2 Jul 2018 15:04:36 -0700 Subject: [PATCH 36/63] Add util_core to scrooge, fix aspect test --- test/aspect/aspect.bzl | 2 +- twitter_scrooge/twitter_scrooge.bzl | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/aspect/aspect.bzl b/test/aspect/aspect.bzl index 927aa5a0a..73ed5b327 100644 --- a/test/aspect/aspect.bzl +++ b/test/aspect/aspect.bzl @@ -48,7 +48,7 @@ def _rule_impl(ctx): "@io_bazel_rules_scala_scala_library_2_11_11//:io_bazel_rules_scala_scala_library_2_11_11", "@io_bazel_rules_scala_scala_reflect_2_11_11//:io_bazel_rules_scala_scala_reflect_2_11_11", # From specs2/specs2_junit.bzl:specs2_junit_dependencies() - "@io_bazel_rules_scala_org_specs2_specs2_junit//jar:jar", + "@io_bazel_rules_scala_org_specs2_specs2_junit//:io_bazel_rules_scala_org_specs2_specs2_junit", ], } content = "" diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 1dc52e06f..f85312e78 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -307,6 +307,9 @@ scrooge_aspect = aspect( Label( "//external:io_bazel_rules_scala/dependency/thrift/scrooge_core" ), + Label( + "//external:io_bazel_rules_scala/dependency/thrift/util_core" + ), ]), }, required_aspect_providers = [[ThriftInfo], From ed646b430f662bea66e5b37c3280db0816c1e440 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 2 Jul 2018 15:28:38 -0700 Subject: [PATCH 37/63] Supply shas to scala_library,compiler and reflect - User can add shas for custom scala versions - run formatter --- WORKSPACE | 15 ++++-- scala/private/rule_impls.bzl | 7 +-- scala/scala.bzl | 57 ++++++++++++-------- scala/scala_cross_version.bzl | 41 ++++++++------ scala/scalatest/BUILD | 3 +- scala_proto/scala_proto.bzl | 84 +++++++++++++++-------------- specs2/specs2.bzl | 51 ++++++++++-------- specs2/specs2_junit.bzl | 22 ++++---- tut_rule/tut.bzl | 15 +++--- twitter_scrooge/twitter_scrooge.bzl | 39 ++++++++------ 10 files changed, 191 insertions(+), 143 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index 2d95d2170..c378150b4 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -29,21 +29,30 @@ load("//scala:scala_cross_version.bzl", "scala_mvn_artifact", "default_scala_maj # test adding a scala jar: maven_jar( name = "com_twitter__scalding_date", - artifact = scala_mvn_artifact("com.twitter:scalding-date:0.17.0", default_scala_major_version()), + artifact = scala_mvn_artifact( + "com.twitter:scalding-date:0.17.0", + default_scala_major_version(), + ), sha1 = "420fb0c4f737a24b851c4316ee0362095710caa5", ) # For testing that we don't include sources jars to the classpath maven_jar( name = "org_typelevel__cats_core", - artifact = scala_mvn_artifact("org.typelevel:cats-core:0.9.0", default_scala_major_version()), + artifact = scala_mvn_artifact( + "org.typelevel:cats-core:0.9.0", + default_scala_major_version(), + ), sha1 = "b2f8629c6ec834d8b6321288c9fe77823f1e1314", ) # test of a plugin maven_jar( name = "org_psywerx_hairyfotr__linter", - artifact = scala_mvn_artifact("org.psywerx.hairyfotr:linter:0.1.13", default_scala_major_version()), + artifact = scala_mvn_artifact( + "org.psywerx.hairyfotr:linter:0.1.13", + default_scala_major_version(), + ), sha1 = "e5b3e2753d0817b622c32aedcb888bcf39e275b4", ) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 99ac3ed57..983653533 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -230,9 +230,10 @@ StatsfileOutput: {statsfile_output} tools = [scalac_provider.scalac]) outs = [output, statsfile] - ins = (compiler_classpath_jars.to_list() + all_srcjars.to_list() + - list(sources) + plugins_list + dependency_analyzer_plugin_jars + - classpath_resources + resources + resource_jars + [manifest, argfile] + scalac_inputs) + ins = ( + compiler_classpath_jars.to_list() + all_srcjars.to_list() + list(sources) + + plugins_list + dependency_analyzer_plugin_jars + classpath_resources + + resources + resource_jars + [manifest, argfile] + scalac_inputs) ctx.actions.run( inputs = ins, diff --git a/scala/scala.bzl b/scala/scala.bzl index 26b832fb9..554e250d4 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -23,7 +23,8 @@ load( "@io_bazel_rules_scala//scala:scala_cross_version.bzl", _new_scala_repository = "new_scala_repository", _extract_major_version = "extract_major_version", - _default_scala_version = "default_scala_version") + _default_scala_version = "default_scala_version", + _default_scala_version_jar_shas = "default_scala_version_jar_shas") load( "@io_bazel_rules_scala//specs2:specs2_junit.bzl", @@ -253,30 +254,38 @@ scala_repl = rule( toolchains = ['@io_bazel_rules_scala//scala:toolchain_type'], ) -def scala_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): +def scala_repositories( + scala_version = _default_scala_version(), + scala_version_jar_shas = _default_scala_version_jar_shas(), + maven_servers = ["http://central.maven.org/maven2"]): major_version = _extract_major_version(scala_version) version_underscore = scala_version.replace(".", "_") - _new_scala_repository("scala_default", scala_version, maven_servers) + _new_scala_repository( + name = "scala_default", + scala_version = scala_version, + scala_version_jar_shas = scala_version_jar_shas, + maven_servers = maven_servers) scala_jar_shas = { - "2.11": { - "scalatest": "2aafeb41257912cbba95f9d747df9ecdc7ff43f039d35014b4c2a8eb7ed9ba2f", - "scalactic": "84723064f5716f38990fe6e65468aa39700c725484efceef015771d267341cf2", - "scala_xml": "767e11f33eddcd506980f0ff213f9d553a6a21802e3be1330345f62f7ee3d50f", - "scala_parser_combinators": "0dfaafce29a9a245b0a9180ec2c1073d2bd8f0330f03a9f1f6a74d1bc83f62d6" - }, - "2.12": { - "scalatest": "b416b5bcef6720da469a8d8a5726e457fc2d1cd5d316e1bc283aa75a2ae005e5", - "scalactic": "57e25b4fd969b1758fe042595112c874dfea99dca5cc48eebe07ac38772a0c41", - "scala_xml": "035015366f54f403d076d95f4529ce9eeaf544064dbc17c2d10e4f5908ef4256", - "scala_parser_combinators": "282c78d064d3e8f09b3663190d9494b85e0bb7d96b0da05994fe994384d96111" - }, + "2.11": { + "scalatest": "2aafeb41257912cbba95f9d747df9ecdc7ff43f039d35014b4c2a8eb7ed9ba2f", + "scalactic": "84723064f5716f38990fe6e65468aa39700c725484efceef015771d267341cf2", + "scala_xml": "767e11f33eddcd506980f0ff213f9d553a6a21802e3be1330345f62f7ee3d50f", + "scala_parser_combinators": "0dfaafce29a9a245b0a9180ec2c1073d2bd8f0330f03a9f1f6a74d1bc83f62d6" + }, + "2.12": { + "scalatest": "b416b5bcef6720da469a8d8a5726e457fc2d1cd5d316e1bc283aa75a2ae005e5", + "scalactic": "57e25b4fd969b1758fe042595112c874dfea99dca5cc48eebe07ac38772a0c41", + "scala_xml": "035015366f54f403d076d95f4529ce9eeaf544064dbc17c2d10e4f5908ef4256", + "scala_parser_combinators": "282c78d064d3e8f09b3663190d9494b85e0bb7d96b0da05994fe994384d96111" + }, } _scala_maven_import_external( name = "io_bazel_rules_scala_scalatest", - artifact = "org.scalatest:scalatest_{major_version}:3.0.5".format(major_version = major_version), + artifact = "org.scalatest:scalatest_{major_version}:3.0.5".format( + major_version = major_version), jar_sha256 = scala_jar_shas[major_version]["scalatest"], licenses = ["notice"], server_urls = maven_servers, @@ -292,7 +301,8 @@ def scala_repositories(scala_version = _default_scala_version(), maven_servers = _scala_maven_import_external( name = "io_bazel_rules_scala_scala_xml", - artifact = "org.scala-lang.modules:scala-xml_{major_version}:1.0.5".format(major_version = major_version), + artifact = "org.scala-lang.modules:scala-xml_{major_version}:1.0.5". + format(major_version = major_version), jar_sha256 = scala_jar_shas[major_version]["scala_xml"], licenses = ["notice"], server_urls = maven_servers, @@ -300,7 +310,9 @@ def scala_repositories(scala_version = _default_scala_version(), maven_servers = _scala_maven_import_external( name = "io_bazel_rules_scala_scala_parser_combinators", - artifact = "org.scala-lang.modules:scala-parser-combinators_{major_version}:1.0.4".format(major_version = major_version), + artifact = + "org.scala-lang.modules:scala-parser-combinators_{major_version}:1.0.4". + format(major_version = major_version), jar_sha256 = scala_jar_shas[major_version]["scala_parser_combinators"], licenses = ["notice"], server_urls = maven_servers, @@ -358,15 +370,18 @@ def scala_repositories(scala_version = _default_scala_version(), maven_servers = native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_compiler", - actual = "@io_bazel_rules_scala_scala_compiler_{}".format(version_underscore)) + actual = "@io_bazel_rules_scala_scala_compiler_{}".format( + version_underscore)) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_library", - actual = "@io_bazel_rules_scala_scala_library_{}".format(version_underscore)) + actual = "@io_bazel_rules_scala_scala_library_{}".format( + version_underscore)) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_reflect", - actual = "@io_bazel_rules_scala_scala_reflect_{}".format(version_underscore)) + actual = "@io_bazel_rules_scala_scala_reflect_{}".format( + version_underscore)) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_xml", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index e7e48f9d8..88598bcf0 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -15,7 +15,6 @@ load( "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", _scala_maven_import_external = "scala_maven_import_external") - """Helper functions for Scala cross-version support. Encapsulates the logic of abstracting over Scala major version (2.11, 2.12, etc) for dependency resolution.""" @@ -24,6 +23,13 @@ def default_scala_version(): """return the scala version for use in maven coordinates""" return "2.11.11" +def default_scala_version_jar_shas(): + return { + "scala_compiler": "5f929ed57c515ef9545497374eec88ffd129b8f04079dedb7e32107104325cdd", + "scala_library": "f2ba1550a39304e5d06caaddfa226cdf0a4cbccee189828fa8c1ddf1110c4872", + "scala_reflect": "73aef1a6ccabd3a3c15cc153ec846e12d0f045587a2a1d88cc1b49293f47cb20", + } + def scala_mvn_artifact(artifact, major_scala_version): """Add scala version to maven artifact""" gav = artifact.split(":") @@ -42,7 +48,7 @@ def extract_major_version_underscore(scala_version): return extract_major_version(scala_version).replace(".", "_") def default_scala_major_version(): - return extract_major_version(default_scala_version()) + return extract_major_version(default_scala_version()) def _generate_scalac_build_file_impl(repository_ctx): scalac_worker_srcs = [ @@ -104,35 +110,36 @@ _generate_scalac_build_file = repository_rule( "version_underscore": attr.string(), }) -def new_scala_repository(name, version, maven_servers): - version_underscore = version.replace(".", "_") +def new_scala_repository(name, scala_version, scala_version_jar_shas, + maven_servers): + scala_version_underscore = scala_version.replace(".", "_") _scala_maven_import_external( - name = "io_bazel_rules_scala_scala_library_{}".format(version_underscore), - artifact = "org.scala-lang:scala-library:{}".format(version), - #jar_sha256 = - #"0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce", + name = "io_bazel_rules_scala_scala_library_{}".format( + scala_version_underscore), + artifact = "org.scala-lang:scala-library:{}".format(scala_version), + jar_sha256 = scala_version_jar_shas["scala_library"], licenses = ["notice"], server_urls = maven_servers, ) _scala_maven_import_external( - name = "io_bazel_rules_scala_scala_compiler_{}".format(version_underscore), - artifact = "org.scala-lang:scala-compiler:{}".format(version), - #jar_sha256 = - #"3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0", + name = "io_bazel_rules_scala_scala_compiler_{}".format( + scala_version_underscore), + artifact = "org.scala-lang:scala-compiler:{}".format(scala_version), + jar_sha256 = scala_version_jar_shas["scala_compiler"], licenses = ["notice"], server_urls = maven_servers, ) _scala_maven_import_external( - name = "io_bazel_rules_scala_scala_reflect_{}".format(version_underscore), - artifact = "org.scala-lang:scala-reflect:{}".format(version), - jar_sha256 = - "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04", + name = "io_bazel_rules_scala_scala_reflect_{}".format( + scala_version_underscore), + artifact = "org.scala-lang:scala-reflect:{}".format(scala_version), + jar_sha256 = scala_version_jar_shas["scala_reflect"], licenses = ["notice"], server_urls = maven_servers, ) _generate_scalac_build_file( name = name, - version_underscore = version_underscore, + version_underscore = scala_version_underscore, visibility = ["//visibility:public"]) diff --git a/scala/scalatest/BUILD b/scala/scalatest/BUILD index f1e518593..2e4ad67bb 100644 --- a/scala/scalatest/BUILD +++ b/scala/scalatest/BUILD @@ -1,11 +1,12 @@ package(default_visibility = ["//visibility:public"]) + load("//scala:scala_import.bzl", "scala_import") scala_import( name = "scalatest", jars = [], exports = [ - "@io_bazel_rules_scala_scalatest", "@io_bazel_rules_scala_scalactic", + "@io_bazel_rules_scala_scalatest", ], ) diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index a2551f411..19088f61d 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -5,7 +5,7 @@ load( load( "//scala:scala_cross_version.bzl", - _scala_mvn_artifact = "scala_mvn_artifact", + _scala_mvn_artifact = "scala_mvn_artifact", _extract_major_version = "extract_major_version", _default_scala_version = "default_scala_version", ) @@ -20,7 +20,9 @@ load( "create_java_provider", ) -def scala_proto_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): +def scala_proto_repositories( + scala_version = _default_scala_version(), + maven_servers = ["http://central.maven.org/maven2"]): major_version = _extract_major_version(scala_version) native.maven_server( @@ -40,33 +42,33 @@ def scala_proto_repositories(scala_version = _default_scala_version(), maven_ser actual = '@scala_proto_rules_protoc_jar//jar') scala_jar_shas = { - "2.11": { - "scalapb_plugin": "c79e1e1398de88779611fda91ef1a9699f9390946bee6a4bba113f3cc036a838", - "protoc_bridge": "a5beafaa7d49822d1412cce675c226304c6499ff65ec6e8cff7e65ae537076b5", - "scalapbc": "32b7340a545b282c513d3c91e0ebf906e2ad1de45c0875e7e7bbaaa0909f5e60", - "scalapb_runtime": "d5b597f637a6f99560d674715647fc5bb199ebf4ca6e263ed1614ea4eb63baad", - "scalapb_runtime_grpc": "d7ce3059cc63b3e1bcc4f710cff55facb92a478cc2225e4c6830ab7ba0fd4fe8", - "scalapb_lenses": "1e9fa3830dfcee99ba20bb55468757bb35762b5ee243ddb8c4d238e749a95cd7", - "scalapb_fastparse": "9e07298f20ee37e828f2699b71b447008ebf122cc86cab1d1fcd8d00fad4837b", - }, - "2.12": { - "scalapb_plugin": "8fec3566010ffbd61b1b44e23bd344790533f5648d918b42ab683d79bdee9ddf", - "protoc_bridge": "bb53dacf3dcd588ea8039b44abc9d816f3150f01916d07a76e1e248389b35d71", - "scalapbc": "d2d3a7477f7c89b70476627c1eb44781ccb1c99f36ed208fca69849e5d8dd692", - "scalapb_runtime": "26a8446755b1b11a75a5e3a1d055ef251b7a479a07bf2285ee1aaf8df92a71f5", - "scalapb_runtime_grpc": "fb2ca8ea6c66ec79e4a9ad279c143af08ec9d0c9b607fb0965cc5aee19a8679a", - "scalapb_lenses": "7cedcbc3125ad3f156466d6f3aec24b7fe6954cdc54a426ea089b4a46cd84c1c", - "scalapb_fastparse": "7bc2a3131204e737f020f94e19b1e62a1bf5359f5741c35dff9351ef36d7a80e", - }, + "2.11": { + "scalapb_plugin": "c79e1e1398de88779611fda91ef1a9699f9390946bee6a4bba113f3cc036a838", + "protoc_bridge": "a5beafaa7d49822d1412cce675c226304c6499ff65ec6e8cff7e65ae537076b5", + "scalapbc": "32b7340a545b282c513d3c91e0ebf906e2ad1de45c0875e7e7bbaaa0909f5e60", + "scalapb_runtime": "d5b597f637a6f99560d674715647fc5bb199ebf4ca6e263ed1614ea4eb63baad", + "scalapb_runtime_grpc": "d7ce3059cc63b3e1bcc4f710cff55facb92a478cc2225e4c6830ab7ba0fd4fe8", + "scalapb_lenses": "1e9fa3830dfcee99ba20bb55468757bb35762b5ee243ddb8c4d238e749a95cd7", + "scalapb_fastparse": "9e07298f20ee37e828f2699b71b447008ebf122cc86cab1d1fcd8d00fad4837b", + }, + "2.12": { + "scalapb_plugin": "8fec3566010ffbd61b1b44e23bd344790533f5648d918b42ab683d79bdee9ddf", + "protoc_bridge": "bb53dacf3dcd588ea8039b44abc9d816f3150f01916d07a76e1e248389b35d71", + "scalapbc": "d2d3a7477f7c89b70476627c1eb44781ccb1c99f36ed208fca69849e5d8dd692", + "scalapb_runtime": "26a8446755b1b11a75a5e3a1d055ef251b7a479a07bf2285ee1aaf8df92a71f5", + "scalapb_runtime_grpc": "fb2ca8ea6c66ec79e4a9ad279c143af08ec9d0c9b607fb0965cc5aee19a8679a", + "scalapb_lenses": "7cedcbc3125ad3f156466d6f3aec24b7fe6954cdc54a426ea089b4a46cd84c1c", + "scalapb_fastparse": "7bc2a3131204e737f020f94e19b1e62a1bf5359f5741c35dff9351ef36d7a80e", + }, } _scala_maven_import_external( name = "scala_proto_rules_scalapb_plugin", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:compilerplugin:0.6.5", major_version), + artifact = _scala_mvn_artifact( + "com.trueaccord.scalapb:compilerplugin:0.6.5", major_version), jar_sha256 = scala_jar_shas[major_version]["scalapb_plugin"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_plugin', @@ -74,11 +76,11 @@ def scala_proto_repositories(scala_version = _default_scala_version(), maven_ser _scala_maven_import_external( name = "scala_proto_rules_protoc_bridge", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", major_version), + artifact = _scala_mvn_artifact( + "com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", major_version), jar_sha256 = scala_jar_shas[major_version]["protoc_bridge"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/protoc_bridge', @@ -86,55 +88,55 @@ def scala_proto_repositories(scala_version = _default_scala_version(), maven_ser _scala_maven_import_external( name = "scala_proto_rules_scalapbc", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", major_version), + artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", + major_version), jar_sha256 = scala_jar_shas[major_version]["scalapbc"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapbc', actual = '@scala_proto_rules_scalapbc') _scala_maven_import_external( name = "scala_proto_rules_scalapb_runtime", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime:0.6.5", major_version), + artifact = _scala_mvn_artifact( + "com.trueaccord.scalapb:scalapb-runtime:0.6.5", major_version), jar_sha256 = scala_jar_shas[major_version]["scalapb_runtime"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime', actual = '@scala_proto_rules_scalapb_runtime') _scala_maven_import_external( name = "scala_proto_rules_scalapb_runtime_grpc", - artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", major_version), + artifact = _scala_mvn_artifact( + "com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", major_version), jar_sha256 = scala_jar_shas[major_version]["scalapb_runtime_grpc"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_runtime_grpc', actual = '@scala_proto_rules_scalapb_runtime_grpc') _scala_maven_import_external( name = "scala_proto_rules_scalapb_lenses", - artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", major_version), + artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", + major_version), jar_sha256 = scala_jar_shas[major_version]["scalapb_lenses"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_lenses', actual = '@scala_proto_rules_scalapb_lenses') _scala_maven_import_external( name = "scala_proto_rules_scalapb_fastparse", - artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", major_version), + artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", + major_version), jar_sha256 = scala_jar_shas[major_version]["scalapb_fastparse"], licenses = ["notice"], - server_urls = maven_servers - ) + server_urls = maven_servers) native.bind( name = 'io_bazel_rules_scala/dependency/proto/scalapb_fastparse', diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 22612487a..4a5026f2c 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -2,8 +2,7 @@ load( "//scala:scala_cross_version.bzl", _scala_mvn_artifact = "scala_mvn_artifact", _default_scala_version = "default_scala_version", - _extract_major_version = "extract_major_version" -) + _extract_major_version = "extract_major_version") load( "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", @@ -12,29 +11,31 @@ load( def specs2_version(): return "3.8.8" -def specs2_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): +def specs2_repositories(scala_version = _default_scala_version(), + maven_servers = ["http://central.maven.org/maven2"]): major_version = _extract_major_version(scala_version) scala_jar_shas = { - "2.11": { - "specs2_core": "692eafc052a838c0c8552afc1a15e10978979d1703c812bd16f572d77ddd07ab", - "specs2_common": "ba06a6218704cff61296e13300a87b07ac5ab5ad45fc82dce37e550101b8cdb5", - "specs2_matcher": "9c8cc2148a6692aa4e2fcd1282c28971215f501f10d532d1a3a3c33fd803fedc", - "scalaz_effect": "4d45f0d1bb6958f5c6781a5e94d9528934b6a1404346d224dda25da064b0c964", - "scalaz_core": "810504bc8d669913af830dd5d9c87f83e0570898f09be6474f0d5603bba8ba79", - }, - "2.12": { - "specs2_core": "1fc47c1199675ed60b58923c84006cc4f776818b11e0a18a47db29c03a60ee97", - "specs2_common": "c0a892fd1a5a1aaf5bb29792e39da5459f1564a721d9a6a0954fb52c395b2deb", - "specs2_matcher": "c17b8f1e4c3da6c1489c59f67e03374b358fdfbe90d9def2a7e4e1b1b10f5046", - "scalaz_effect": "eca21ba69a1532c74ea77356b59d6175a5fd54dac7f57f1d1979738c98521919", - "scalaz_core": "b53cd091daec1c8df8c4244e5b8b460b7416c2cc86aecd25dec4c93d2baf2b04", - }, + "2.11": { + "specs2_core": "692eafc052a838c0c8552afc1a15e10978979d1703c812bd16f572d77ddd07ab", + "specs2_common": "ba06a6218704cff61296e13300a87b07ac5ab5ad45fc82dce37e550101b8cdb5", + "specs2_matcher": "9c8cc2148a6692aa4e2fcd1282c28971215f501f10d532d1a3a3c33fd803fedc", + "scalaz_effect": "4d45f0d1bb6958f5c6781a5e94d9528934b6a1404346d224dda25da064b0c964", + "scalaz_core": "810504bc8d669913af830dd5d9c87f83e0570898f09be6474f0d5603bba8ba79", + }, + "2.12": { + "specs2_core": "1fc47c1199675ed60b58923c84006cc4f776818b11e0a18a47db29c03a60ee97", + "specs2_common": "c0a892fd1a5a1aaf5bb29792e39da5459f1564a721d9a6a0954fb52c395b2deb", + "specs2_matcher": "c17b8f1e4c3da6c1489c59f67e03374b358fdfbe90d9def2a7e4e1b1b10f5046", + "scalaz_effect": "eca21ba69a1532c74ea77356b59d6175a5fd54dac7f57f1d1979738c98521919", + "scalaz_core": "b53cd091daec1c8df8c4244e5b8b460b7416c2cc86aecd25dec4c93d2baf2b04", + }, } _scala_maven_import_external( name = "io_bazel_rules_scala_org_specs2_specs2_core", - artifact = _scala_mvn_artifact("org.specs2:specs2-core:" + specs2_version(), major_version), + artifact = _scala_mvn_artifact( + "org.specs2:specs2-core:" + specs2_version(), major_version), jar_sha256 = scala_jar_shas[major_version]["specs2_core"], licenses = ["notice"], server_urls = maven_servers, @@ -42,15 +43,17 @@ def specs2_repositories(scala_version = _default_scala_version(), maven_servers _scala_maven_import_external( name = "io_bazel_rules_scala_org_specs2_specs2_common", - artifact = _scala_mvn_artifact("org.specs2:specs2-common:" + specs2_version(), major_version), + artifact = _scala_mvn_artifact( + "org.specs2:specs2-common:" + specs2_version(), major_version), jar_sha256 = scala_jar_shas[major_version]["specs2_common"], licenses = ["notice"], server_urls = maven_servers, ) - + _scala_maven_import_external( name = "io_bazel_rules_scala_org_specs2_specs2_matcher", - artifact = _scala_mvn_artifact("org.specs2:specs2-matcher:" + specs2_version(), major_version), + artifact = _scala_mvn_artifact( + "org.specs2:specs2-matcher:" + specs2_version(), major_version), jar_sha256 = scala_jar_shas[major_version]["specs2_matcher"], licenses = ["notice"], server_urls = maven_servers, @@ -58,7 +61,8 @@ def specs2_repositories(scala_version = _default_scala_version(), maven_servers _scala_maven_import_external( name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", - artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", major_version), + artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", + major_version), jar_sha256 = scala_jar_shas[major_version]["scalaz_effect"], licenses = ["notice"], server_urls = maven_servers, @@ -66,7 +70,8 @@ def specs2_repositories(scala_version = _default_scala_version(), maven_servers _scala_maven_import_external( name = "io_bazel_rules_scala_org_scalaz_scalaz_core", - artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", major_version), + artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", + major_version), jar_sha256 = scala_jar_shas[major_version]["scalaz_core"], licenses = ["notice"], server_urls = maven_servers, diff --git a/specs2/specs2_junit.bzl b/specs2/specs2_junit.bzl index eb8b22882..07189e578 100644 --- a/specs2/specs2_junit.bzl +++ b/specs2/specs2_junit.bzl @@ -7,31 +7,33 @@ load( "//scala:scala_cross_version.bzl", _scala_mvn_artifact = "scala_mvn_artifact", _default_scala_version = "default_scala_version", - _extract_major_version = "extract_major_version" -) + _extract_major_version = "extract_major_version") load( "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", _scala_maven_import_external = "scala_maven_import_external") -def specs2_junit_repositories(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): +def specs2_junit_repositories( + scala_version = _default_scala_version(), + maven_servers = ["http://central.maven.org/maven2"]): major_version = _extract_major_version(scala_version) specs2_repositories(scala_version, maven_servers) junit_repositories() scala_jar_shas = { - "2.11": { - "specs2_junit": "516e1c07340878bd2d37ee764c0c0f03985a658af2d638810d8cff7bec4a89f3", - }, - "2.12": { - "specs2_junit": "4704f2e706d5df76e7993fe0d3fb10499dd623f9cef98fe4ac7f84f66823b35f", - }, + "2.11": { + "specs2_junit": "516e1c07340878bd2d37ee764c0c0f03985a658af2d638810d8cff7bec4a89f3", + }, + "2.12": { + "specs2_junit": "4704f2e706d5df76e7993fe0d3fb10499dd623f9cef98fe4ac7f84f66823b35f", + }, } # Aditional dependencies for specs2 junit runner _scala_maven_import_external( name = "io_bazel_rules_scala_org_specs2_specs2_junit", - artifact = _scala_mvn_artifact("org.specs2:specs2-junit:" + specs2_version(), major_version), + artifact = _scala_mvn_artifact( + "org.specs2:specs2-junit:" + specs2_version(), major_version), jar_sha256 = scala_jar_shas[major_version]["specs2_junit"], licenses = ["notice"], server_urls = maven_servers, diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 6ea3ef8dc..3299581b1 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -13,17 +13,18 @@ def tut_repositories(scala_version = _default_scala_version()): major_version = _extract_major_version(scala_version) scala_jar_shas = { - "2.11": { - "tut_core": "edab4e9963dd7dbab1a8bfff2ef087eb6b6882804dfb3a2641895c958a62ba89", - }, - "2.12": { - "tut_core": "767735128b6d5694d59ccb3bd1f5544a05d83146577121bcf7b6a32327adf281", - }, + "2.11": { + "tut_core": "edab4e9963dd7dbab1a8bfff2ef087eb6b6882804dfb3a2641895c958a62ba89", + }, + "2.12": { + "tut_core": "767735128b6d5694d59ccb3bd1f5544a05d83146577121bcf7b6a32327adf281", + }, } _scala_maven_import_external( name = "io_bazel_rules_scala_org_tpolecat_tut_core", - artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", major_version), + artifact = scala_mvn_artifact("org.tpolecat:tut-core:0.4.8", + major_version), jar_sha256 = scala_jar_shas[major_version]["tut_core"], licenses = ["notice"], server_urls = ["https://dl.bintray.com/tpolecat/maven/"], diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index f85312e78..ea374a511 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -24,7 +24,8 @@ load( _jar_extension = ".jar" -def twitter_scrooge(scala_version = _default_scala_version(), maven_servers = ["http://central.maven.org/maven2"]): +def twitter_scrooge(scala_version = _default_scala_version(), + maven_servers = ["http://central.maven.org/maven2"]): major_version = _extract_major_version(scala_version) native.maven_server( @@ -43,23 +44,24 @@ def twitter_scrooge(scala_version = _default_scala_version(), maven_servers = [" actual = '@libthrift//jar') scala_jar_shas = { - "2.11": { - "util_logging": "73ddd61cedabd4dab82b30e6c52c1be6c692b063b8ba310d716ead9e3b4e9267", - "scrooge_core": "00351f73b555d61cfe7320ef3b1367a9641e694cfb8dfa8a733cfcf49df872e8", - "scrooge_generator": "0f0027e815e67985895a6f3caa137f02366ceeea4966498f34fb82cabb11dee6", - "util_core": "5336da4846dfc3db8ffe5ae076be1021828cfee35aa17bda9af461e203cf265c" - }, - "2.12": { - "util_logging": "c0cba01705e9321b3444adcd4a9ce27c2acefd27e14c13b5aec2c318ce1b4fdf", - "scrooge_core": "02a6d7cf9fe8d872dfabd20298e4315d677748708e153d8b464fd5abac9a7430", - "scrooge_generator": "e7d5da1e3f0e494d3c81a26f44f3e3dc92d7efd757133de8c71758646fd5a833", - "util_core": "65bb92e70f95cbbfc640e54a5823a16154eac1a2631dc0211347e085aaa6ed0b" - }, + "2.11": { + "util_logging": "73ddd61cedabd4dab82b30e6c52c1be6c692b063b8ba310d716ead9e3b4e9267", + "scrooge_core": "00351f73b555d61cfe7320ef3b1367a9641e694cfb8dfa8a733cfcf49df872e8", + "scrooge_generator": "0f0027e815e67985895a6f3caa137f02366ceeea4966498f34fb82cabb11dee6", + "util_core": "5336da4846dfc3db8ffe5ae076be1021828cfee35aa17bda9af461e203cf265c" + }, + "2.12": { + "util_logging": "c0cba01705e9321b3444adcd4a9ce27c2acefd27e14c13b5aec2c318ce1b4fdf", + "scrooge_core": "02a6d7cf9fe8d872dfabd20298e4315d677748708e153d8b464fd5abac9a7430", + "scrooge_generator": "e7d5da1e3f0e494d3c81a26f44f3e3dc92d7efd757133de8c71758646fd5a833", + "util_core": "65bb92e70f95cbbfc640e54a5823a16154eac1a2631dc0211347e085aaa6ed0b" + }, } _scala_maven_import_external( name = "io_bazel_rules_scala_scrooge_core", - artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", major_version), + artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", + major_version), jar_sha256 = scala_jar_shas[major_version]["scrooge_core"], licenses = ["notice"], server_urls = maven_servers, @@ -71,7 +73,8 @@ def twitter_scrooge(scala_version = _default_scala_version(), maven_servers = [" #scrooge-generator related dependencies _scala_maven_import_external( name = "io_bazel_rules_scala_scrooge_generator", - artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", major_version), + artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", + major_version), jar_sha256 = scala_jar_shas[major_version]["scrooge_generator"], licenses = ["notice"], server_urls = maven_servers, @@ -82,7 +85,8 @@ def twitter_scrooge(scala_version = _default_scala_version(), maven_servers = [" _scala_maven_import_external( name = "io_bazel_rules_scala_util_core", - artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", major_version), + artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", + major_version), jar_sha256 = scala_jar_shas[major_version]["util_core"], licenses = ["notice"], server_urls = maven_servers, @@ -93,7 +97,8 @@ def twitter_scrooge(scala_version = _default_scala_version(), maven_servers = [" _scala_maven_import_external( name = "io_bazel_rules_scala_util_logging", - artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", major_version), + artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", + major_version), jar_sha256 = scala_jar_shas[major_version]["util_logging"], licenses = ["notice"], server_urls = maven_servers, From bc36a867f6abf06b409428680fd3b836e44bfbcc Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 08:29:17 -0700 Subject: [PATCH 38/63] namespace scala_default --- scala/scala.bzl | 4 ++-- twitter_scrooge/twitter_scrooge.bzl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 554e250d4..74b7d88c6 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -58,7 +58,7 @@ _implicit_deps = { "_java_runtime": attr.label( default = Label("@bazel_tools//tools/jdk:current_java_runtime")), "_scalac": attr.label( - default = Label("@scala_default"), providers = [_ScalacProvider]) + default = Label("@io_bazel_rules_scala_scala_default"), providers = [_ScalacProvider]) } # Single dep to allow IDEs to pickup all the implicit dependencies. @@ -262,7 +262,7 @@ def scala_repositories( version_underscore = scala_version.replace(".", "_") _new_scala_repository( - name = "scala_default", + name = "io_bazel_rules_scala_scala_default", scala_version = scala_version, scala_version_jar_shas = scala_version_jar_shas, maven_servers = maven_servers) diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index ea374a511..0d901fa33 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -299,7 +299,7 @@ scrooge_aspect = aspect( default = Label("//src/scala/scripts:generator"), allow_files = True), "_scalac": attr.label( - default = Label("@scala_default"), providers = [_ScalacProvider]), + default = Label("@io_bazel_rules_scala_scala_default"), providers = [_ScalacProvider]), "_implicit_compile_deps": attr.label_list( providers = [JavaInfo], default = [ From ae407ac1d8fbcc8ad2fd7c60ef960a1a24a281ff Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 08:32:43 -0700 Subject: [PATCH 39/63] Scala default version to 2.11.12 - correct spelling error --- scala/scala.bzl | 2 +- scala/scala_cross_version.bzl | 8 ++++---- test/aspect/aspect.bzl | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 74b7d88c6..1c0185faf 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -292,7 +292,7 @@ def scala_repositories( ) _scala_maven_import_external( name = "io_bazel_rules_scala_scalactic", - artifact = "org.scalactic:scalactci_{major_version}:3.0.5".format( + artifact = "org.scalactic:scalactic_{major_version}:3.0.5".format( major_version = major_version), jar_sha256 = scala_jar_shas[major_version]["scalactic"], licenses = ["notice"], diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 88598bcf0..e8d25e3fe 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -21,13 +21,13 @@ resolution.""" def default_scala_version(): """return the scala version for use in maven coordinates""" - return "2.11.11" + return "2.11.12" def default_scala_version_jar_shas(): return { - "scala_compiler": "5f929ed57c515ef9545497374eec88ffd129b8f04079dedb7e32107104325cdd", - "scala_library": "f2ba1550a39304e5d06caaddfa226cdf0a4cbccee189828fa8c1ddf1110c4872", - "scala_reflect": "73aef1a6ccabd3a3c15cc153ec846e12d0f045587a2a1d88cc1b49293f47cb20", + "scala_compiler": "3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0", + "scala_library": "0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce", + "scala_reflect": "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04", } def scala_mvn_artifact(artifact, major_scala_version): diff --git a/test/aspect/aspect.bzl b/test/aspect/aspect.bzl index 73ed5b327..dac3fff74 100644 --- a/test/aspect/aspect.bzl +++ b/test/aspect/aspect.bzl @@ -23,30 +23,30 @@ def _rule_impl(ctx): expected_deps = { "scala_library": [ "//test/aspect:scala_library", - "@io_bazel_rules_scala_scala_library_2_11_11//:io_bazel_rules_scala_scala_library_2_11_11", + "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", ], "scala_test": [ "//test/aspect:scala_test", - "@io_bazel_rules_scala_scala_library_2_11_11//:io_bazel_rules_scala_scala_library_2_11_11", + "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", "@io_bazel_rules_scala//scala/scalatest:scalatest", ], "scala_junit_test": [ "//test/aspect:scala_junit_test", - "@io_bazel_rules_scala_scala_library_2_11_11//:io_bazel_rules_scala_scala_library_2_11_11", + "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", "@io_bazel_rules_scala_junit_junit//jar:jar", "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", ], "scala_specs2_junit_test": [ "//test/aspect:scala_specs2_junit_test", - "@io_bazel_rules_scala_scala_library_2_11_11//:io_bazel_rules_scala_scala_library_2_11_11", + "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", "@io_bazel_rules_scala_junit_junit//jar:jar", "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", # From specs2/specs2.bzl:specs2_dependencies() "@io_bazel_rules_scala//specs2:specs2", "@io_bazel_rules_scala_scala_xml//:io_bazel_rules_scala_scala_xml", "@io_bazel_rules_scala_scala_parser_combinators//:io_bazel_rules_scala_scala_parser_combinators", - "@io_bazel_rules_scala_scala_library_2_11_11//:io_bazel_rules_scala_scala_library_2_11_11", - "@io_bazel_rules_scala_scala_reflect_2_11_11//:io_bazel_rules_scala_scala_reflect_2_11_11", + "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", + "@io_bazel_rules_scala_scala_reflect_2_11_12//:io_bazel_rules_scala_scala_reflect_2_11_12", # From specs2/specs2_junit.bzl:specs2_junit_dependencies() "@io_bazel_rules_scala_org_specs2_specs2_junit//:io_bazel_rules_scala_org_specs2_specs2_junit", ], From f5e5ff6a30a5ccb2097b8d0a0366afa36e8261ab Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 09:31:28 -0700 Subject: [PATCH 40/63] Lookup scala_extra_jar_shas[major_version] once, renaming --- scala/scala.bzl | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 1c0185faf..e29806af0 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -259,7 +259,6 @@ def scala_repositories( scala_version_jar_shas = _default_scala_version_jar_shas(), maven_servers = ["http://central.maven.org/maven2"]): major_version = _extract_major_version(scala_version) - version_underscore = scala_version.replace(".", "_") _new_scala_repository( name = "io_bazel_rules_scala_scala_default", @@ -267,7 +266,7 @@ def scala_repositories( scala_version_jar_shas = scala_version_jar_shas, maven_servers = maven_servers) - scala_jar_shas = { + scala_extra_jar_shas = { "2.11": { "scalatest": "2aafeb41257912cbba95f9d747df9ecdc7ff43f039d35014b4c2a8eb7ed9ba2f", "scalactic": "84723064f5716f38990fe6e65468aa39700c725484efceef015771d267341cf2", @@ -282,11 +281,13 @@ def scala_repositories( }, } + scala_version_extra_jar_shas = scala_extra_jar_shas[major_version] + _scala_maven_import_external( name = "io_bazel_rules_scala_scalatest", artifact = "org.scalatest:scalatest_{major_version}:3.0.5".format( major_version = major_version), - jar_sha256 = scala_jar_shas[major_version]["scalatest"], + jar_sha256 = scala_version_extra_jar_shas["scalatest"], licenses = ["notice"], server_urls = maven_servers, ) @@ -294,7 +295,7 @@ def scala_repositories( name = "io_bazel_rules_scala_scalactic", artifact = "org.scalactic:scalactic_{major_version}:3.0.5".format( major_version = major_version), - jar_sha256 = scala_jar_shas[major_version]["scalactic"], + jar_sha256 = scala_version_extra_jar_shas["scalactic"], licenses = ["notice"], server_urls = maven_servers, ) @@ -303,7 +304,7 @@ def scala_repositories( name = "io_bazel_rules_scala_scala_xml", artifact = "org.scala-lang.modules:scala-xml_{major_version}:1.0.5". format(major_version = major_version), - jar_sha256 = scala_jar_shas[major_version]["scala_xml"], + jar_sha256 = scala_version_extra_jar_shas["scala_xml"], licenses = ["notice"], server_urls = maven_servers, ) @@ -313,7 +314,7 @@ def scala_repositories( artifact = "org.scala-lang.modules:scala-parser-combinators_{major_version}:1.0.4". format(major_version = major_version), - jar_sha256 = scala_jar_shas[major_version]["scala_parser_combinators"], + jar_sha256 = scala_version_extra_jar_shas["scala_parser_combinators"], licenses = ["notice"], server_urls = maven_servers, ) @@ -371,17 +372,17 @@ def scala_repositories( native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_compiler", actual = "@io_bazel_rules_scala_scala_compiler_{}".format( - version_underscore)) + scala_version.replace(".", "_"))) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_library", actual = "@io_bazel_rules_scala_scala_library_{}".format( - version_underscore)) + scala_version.replace(".", "_"))) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_reflect", actual = "@io_bazel_rules_scala_scala_reflect_{}".format( - version_underscore)) + scala_version.replace(".", "_"))) native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_xml", From 5f26b2b7714e116812ee3d33a5809a1295997c45 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 09:32:34 -0700 Subject: [PATCH 41/63] tut server_urls as parameter --- tut_rule/tut.bzl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 3299581b1..4c7af1315 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -9,7 +9,7 @@ load( "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", _scala_maven_import_external = "scala_maven_import_external") -def tut_repositories(scala_version = _default_scala_version()): +def tut_repositories(scala_version = _default_scala_version(), server_urls = ["https://dl.bintray.com/tpolecat/maven/"]): major_version = _extract_major_version(scala_version) scala_jar_shas = { @@ -27,7 +27,7 @@ def tut_repositories(scala_version = _default_scala_version()): major_version), jar_sha256 = scala_jar_shas[major_version]["tut_core"], licenses = ["notice"], - server_urls = ["https://dl.bintray.com/tpolecat/maven/"], + server_urls = server_urls, ) native.bind( From 8a7b1201a14b88a559ec8124b9811d186764784e Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 09:43:12 -0700 Subject: [PATCH 42/63] Pass ScalacProvider as paramater --- scala/private/rule_impls.bzl | 5 ++--- twitter_scrooge/twitter_scrooge.bzl | 3 ++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 983653533..226df660c 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -134,7 +134,7 @@ def compile_scala(ctx, target_label, output, manifest, statsfile, sources, cjars, all_srcjars, transitive_compile_jars, plugins, resource_strip_prefix, resources, resource_jars, labels, in_scalacopts, print_compile_time, expect_java_output, - scalac_jvm_flags): + scalac_jvm_flags, scalac_provider): # look for any plugins: plugins = _collect_plugin_paths(plugins) dependency_analyzer_plugin_jars = [] @@ -225,7 +225,6 @@ StatsfileOutput: {statsfile_output} ctx.actions.write( output = argfile, content = scalac_args + optional_scalac_args) - scalac_provider = ctx.attr._scalac[_ScalacProvider] scalac_inputs, _, scalac_input_manifests = ctx.resolve_command( tools = [scalac_provider.scalac]) @@ -336,7 +335,7 @@ def _compile_or_empty(ctx, manifest, jars, srcjars, buildijar, ctx.attr.resource_strip_prefix, ctx.files.resources, ctx.files.resource_jars, jars2labels, ctx.attr.scalacopts, ctx.attr.print_compile_time, ctx.attr.expect_java_output, - ctx.attr.scalac_jvm_flags) + ctx.attr.scalac_jvm_flags, ctx.attr._scalac[_ScalacProvider]) # build ijar if needed if buildijar: diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 0d901fa33..2fe84fd03 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -213,7 +213,8 @@ def _compile_scala(ctx, label, output, scrooge_jar, deps_java_info, in_scalacopts = [], print_compile_time = False, expect_java_output = False, - scalac_jvm_flags = []) + scalac_jvm_flags = [], + scalac_provider = ctx.attr._scalac[_ScalacProvider]) return java_common.create_provider( use_ijar = False, From 7b36b2d90f854df519bf7e0e096c1adfff1dd90c Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 13:52:33 -0700 Subject: [PATCH 43/63] Replace pass classpaths instead of jars - Stop using ScalacProvider.scala_library etc. - Use ScalacProvider.default_compile_classpath etc. --- scala/private/rule_impls.bzl | 56 +++++++++++++++++++++++++++-------- scala/providers.bzl | 22 +++++++------- scala/scala_cross_version.bzl | 16 +++++++--- test/tut/BUILD | 10 +++---- 4 files changed, 72 insertions(+), 32 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 226df660c..ed1c18676 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -480,19 +480,23 @@ def is_dependency_analyzer_off(ctx): # Extract very common code out from dependency analysis into single place # automatically adds dependency on scala-library and scala-reflect # collects jars from deps, runtime jars from runtime_deps, and -def _collect_jars_from_common_ctx(ctx, extra_deps = [], +def _collect_jars_from_common_ctx(ctx, + default_compile_classpath, + default_runtime_classpath, + extra_deps = [], extra_runtime_deps = []): dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) - # Get jars from deps - scalac_provider = ctx.attr._scalac[_ScalacProvider] - auto_deps = [scalac_provider.scalalib, scalac_provider.scalareflect] - deps_jars = collect_jars(ctx.attr.deps + auto_deps + extra_deps, + default_cjars = [d[JavaInfo].compile_jars for d in default_compile_classpath] + default_transitive_rjars = [d[JavaInfo].transitive_runtime_jars for d in default_runtime_classpath] + + deps_jars = collect_jars(ctx.attr.deps + extra_deps, dependency_analyzer_is_off) + (cjars, transitive_rjars, jars2labels, - transitive_compile_jars) = (deps_jars.compile_jars, - deps_jars.transitive_runtime_jars, + transitive_compile_jars) = (depset(transitive = [deps_jars.compile_jars] + default_cjars), + depset(transitive = [deps_jars.transitive_runtime_jars] + default_transitive_rjars), deps_jars.jars2labels, deps_jars.transitive_compile_jars) @@ -506,13 +510,19 @@ def _collect_jars_from_common_ctx(ctx, extra_deps = [], jars2labels = jars2labels, transitive_compile_jars = transitive_compile_jars) -def _lib(ctx, non_macro_lib): +def _lib(ctx, + default_compile_classpath, + default_runtime_classpath, + non_macro_lib): # Build up information from dependency-like attributes # This will be used to pick up srcjars from non-scala library # targets (like thrift code generation) srcjars = collect_srcjars(ctx.attr.deps) - jars = _collect_jars_from_common_ctx(ctx) + + jars = _collect_jars_from_common_ctx(ctx, + default_compile_classpath, + default_runtime_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) write_manifest(ctx) @@ -558,10 +568,18 @@ def _lib(ctx, non_macro_lib): ) def scala_library_impl(ctx): - return _lib(ctx, True) + scalac_provider = ctx.attr._scalac[_ScalacProvider] + return _lib(ctx, + scalac_provider.default_compile_classpath, + scalac_provider.default_runtime_classpath, + True) def scala_macro_library_impl(ctx): - return _lib(ctx, False) # don't build the ijar for macros + scalac_provider = ctx.attr._scalac[_ScalacProvider] + return _lib(ctx, + scalac_provider.default_macro_classpath, + scalac_provider.default_macro_classpath, + False) # don't build the ijar for macros # Common code shared by all scala binary implementations. def _scala_binary_common(ctx, @@ -607,7 +625,10 @@ def _scala_binary_common(ctx, runfiles = runfiles) def scala_binary_impl(ctx): - jars = _collect_jars_from_common_ctx(ctx) + scalac_provider = ctx.attr._scalac[_ScalacProvider] + jars = _collect_jars_from_common_ctx(ctx, + scalac_provider.default_compile_classpath, + scalac_provider.default_runtime_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) wrapper = _write_java_wrapper(ctx, "", "") @@ -623,10 +644,13 @@ def scala_binary_impl(ctx): return out def scala_repl_impl(ctx): + scalac_provider = ctx.attr._scalac[_ScalacProvider] # need scala-compiler for MainGenericRunner below jars = _collect_jars_from_common_ctx( ctx, - extra_runtime_deps = [ctx.attr._scalac[_ScalacProvider].scalacompiler]) + scalac_provider.default_repl_classpath, + scalac_provider.default_repl_classpath, + ) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) args = " ".join(ctx.attr.scalacopts) @@ -675,8 +699,11 @@ def scala_test_impl(ctx): if len(ctx.attr.suites) != 0: print("suites attribute is deprecated. All scalatest test suites are run") + scalac_provider = ctx.attr._scalac[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, + scalac_provider.default_compile_classpath, + scalac_provider.default_runtime_classpath, extra_runtime_deps = [ ctx.attr._scalatest_reporter, ctx.attr._scalatest_runner ], @@ -738,8 +765,11 @@ def scala_junit_test_impl(ctx): fail( "Setting at least one of the attributes ('prefixes','suffixes') is required" ) + scalac_provider = ctx.attr._scalac[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, + scalac_provider.default_compile_classpath, + scalac_provider.default_runtime_classpath, extra_deps = [ ctx.attr._junit, ctx.attr._hamcrest, ctx.attr.suite_label, ctx.attr._bazel_test_runner diff --git a/scala/providers.bzl b/scala/providers.bzl index 52de8d7dd..6440258d6 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -29,18 +29,20 @@ ScalacProvider = provider( doc = "ScalaProvider", fields = [ "scalac", - "scalalib", - "scalareflect", - "scalacompiler", + "default_compile_classpath", + "default_runtime_classpath", + "default_macro_classpath", + "default_repl_classpath", ]) def _declare_scalac_provider(ctx): return [ ScalacProvider( scalac = ctx.attr.scalac, - scalalib = ctx.attr.scalalib, - scalareflect = ctx.attr.scalareflect, - scalacompiler = ctx.attr.scalacompiler, + default_compile_classpath = ctx.attr.default_compile_classpath, + default_runtime_classpath = ctx.attr.default_runtime_classpath, + default_repl_classpath = ctx.attr.default_repl_classpath, + default_macro_classpath = ctx.attr.default_macro_classpath, ) ] @@ -52,8 +54,8 @@ declare_scalac_provider = rule( cfg = "host", allow_files = True, mandatory = True), - "scalalib": attr.label(mandatory = True, allow_files = True), - "scalareflect": attr.label(mandatory = True, allow_files = True), - "scalacompiler": attr.label(mandatory = True, allow_files = True), - "scalaxml": attr.label(mandatory = True, allow_files = True) + "default_compile_classpath": attr.label_list(allow_files = True), + "default_runtime_classpath": attr.label_list(allow_files = True), + "default_repl_classpath": attr.label_list(allow_files = True), + "default_macro_classpath": attr.label_list(allow_files = True), }) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index e8d25e3fe..8bae79300 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -92,10 +92,18 @@ java_binary( _declare_scalac_provider( name = "{name}", scalac = "@{name}//:scalac_worker", - scalalib = "@io_bazel_rules_scala_scala_library_{version_underscore}", - scalareflect = "@io_bazel_rules_scala_scala_reflect_{version_underscore}", - scalaxml = "@io_bazel_rules_scala_scala_xml", - scalacompiler = "@io_bazel_rules_scala_scala_compiler_{version_underscore}", + #scalacompiler = "@io_bazel_rules_scala_scala_compiler_{version_underscore}", + default_compile_classpath = ["@io_bazel_rules_scala_scala_library_{version_underscore}"], + default_runtime_classpath = ["@io_bazel_rules_scala_scala_library_{version_underscore}"], + default_repl_classpath = [ + "@io_bazel_rules_scala_scala_library_{version_underscore}", + "@io_bazel_rules_scala_scala_reflect_{version_underscore}", + "@io_bazel_rules_scala_scala_compiler_{version_underscore}" + ], + default_macro_classpath = [ + "@io_bazel_rules_scala_scala_library_{version_underscore}", + "@io_bazel_rules_scala_scala_reflect_{version_underscore}" + ], visibility = ["//visibility:public"], ) """.format( diff --git a/test/tut/BUILD b/test/tut/BUILD index 35005cb88..f2e4c650d 100644 --- a/test/tut/BUILD +++ b/test/tut/BUILD @@ -6,8 +6,8 @@ scala_library( srcs = ["TestDep.scala"], ) -scala_tut_doc( - name = "some_example", - src = "SomeExample.md", - deps = [":test_dep"], -) +#scala_tut_doc( +# name = "some_example", +# src = "SomeExample.md", +# deps = [":test_dep"], +#) From dc9eb43dd1ed4370096779f3e34d6d4a5ac76e91 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 13:57:32 -0700 Subject: [PATCH 44/63] linting --- scala/private/rule_impls.bzl | 36 +++++++++++++---------------- scala/scala.bzl | 3 ++- tut_rule/tut.bzl | 3 ++- twitter_scrooge/twitter_scrooge.bzl | 3 ++- 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index ed1c18676..3b2f3383a 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -489,16 +489,18 @@ def _collect_jars_from_common_ctx(ctx, dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) default_cjars = [d[JavaInfo].compile_jars for d in default_compile_classpath] - default_transitive_rjars = [d[JavaInfo].transitive_runtime_jars for d in default_runtime_classpath] + default_transitive_rjars = [ + d[JavaInfo].transitive_runtime_jars for d in default_runtime_classpath + ] deps_jars = collect_jars(ctx.attr.deps + extra_deps, dependency_analyzer_is_off) - (cjars, transitive_rjars, jars2labels, - transitive_compile_jars) = (depset(transitive = [deps_jars.compile_jars] + default_cjars), - depset(transitive = [deps_jars.transitive_runtime_jars] + default_transitive_rjars), - deps_jars.jars2labels, - deps_jars.transitive_compile_jars) + (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = ( + depset(transitive = [deps_jars.compile_jars] + default_cjars), + depset(transitive = [deps_jars.transitive_runtime_jars] + + default_transitive_rjars), deps_jars.jars2labels, + deps_jars.transitive_compile_jars) transitive_rjars = depset( transitive = [transitive_rjars] + @@ -510,9 +512,7 @@ def _collect_jars_from_common_ctx(ctx, jars2labels = jars2labels, transitive_compile_jars = transitive_compile_jars) -def _lib(ctx, - default_compile_classpath, - default_runtime_classpath, +def _lib(ctx, default_compile_classpath, default_runtime_classpath, non_macro_lib): # Build up information from dependency-like attributes @@ -520,8 +520,7 @@ def _lib(ctx, # targets (like thrift code generation) srcjars = collect_srcjars(ctx.attr.deps) - jars = _collect_jars_from_common_ctx(ctx, - default_compile_classpath, + jars = _collect_jars_from_common_ctx(ctx, default_compile_classpath, default_runtime_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) @@ -569,15 +568,12 @@ def _lib(ctx, def scala_library_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - return _lib(ctx, - scalac_provider.default_compile_classpath, - scalac_provider.default_runtime_classpath, - True) + return _lib(ctx, scalac_provider.default_compile_classpath, + scalac_provider.default_runtime_classpath, True) def scala_macro_library_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - return _lib(ctx, - scalac_provider.default_macro_classpath, + return _lib(ctx, scalac_provider.default_macro_classpath, scalac_provider.default_macro_classpath, False) # don't build the ijar for macros @@ -626,9 +622,9 @@ def _scala_binary_common(ctx, def scala_binary_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - jars = _collect_jars_from_common_ctx(ctx, - scalac_provider.default_compile_classpath, - scalac_provider.default_runtime_classpath) + jars = _collect_jars_from_common_ctx( + ctx, scalac_provider.default_compile_classpath, + scalac_provider.default_runtime_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) wrapper = _write_java_wrapper(ctx, "", "") diff --git a/scala/scala.bzl b/scala/scala.bzl index e29806af0..ef7926d25 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -58,7 +58,8 @@ _implicit_deps = { "_java_runtime": attr.label( default = Label("@bazel_tools//tools/jdk:current_java_runtime")), "_scalac": attr.label( - default = Label("@io_bazel_rules_scala_scala_default"), providers = [_ScalacProvider]) + default = Label("@io_bazel_rules_scala_scala_default"), + providers = [_ScalacProvider]) } # Single dep to allow IDEs to pickup all the implicit dependencies. diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 4c7af1315..14adf390b 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -9,7 +9,8 @@ load( "@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", _scala_maven_import_external = "scala_maven_import_external") -def tut_repositories(scala_version = _default_scala_version(), server_urls = ["https://dl.bintray.com/tpolecat/maven/"]): +def tut_repositories(scala_version = _default_scala_version(), + server_urls = ["https://dl.bintray.com/tpolecat/maven/"]): major_version = _extract_major_version(scala_version) scala_jar_shas = { diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 2fe84fd03..98f8520ab 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -300,7 +300,8 @@ scrooge_aspect = aspect( default = Label("//src/scala/scripts:generator"), allow_files = True), "_scalac": attr.label( - default = Label("@io_bazel_rules_scala_scala_default"), providers = [_ScalacProvider]), + default = Label("@io_bazel_rules_scala_scala_default"), + providers = [_ScalacProvider]), "_implicit_compile_deps": attr.label_list( providers = [JavaInfo], default = [ From a72372cdfc75da8d1e4e011c7fd5beacd131adf3 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 15:09:07 -0700 Subject: [PATCH 45/63] Lookup scala_jar_shas[major_version] only once --- scala_proto/scala_proto.bzl | 16 +++++++++------- specs2/specs2.bzl | 12 +++++++----- twitter_scrooge/twitter_scrooge.bzl | 10 ++++++---- 3 files changed, 22 insertions(+), 16 deletions(-) diff --git a/scala_proto/scala_proto.bzl b/scala_proto/scala_proto.bzl index 19088f61d..25ca86c5b 100644 --- a/scala_proto/scala_proto.bzl +++ b/scala_proto/scala_proto.bzl @@ -62,11 +62,13 @@ def scala_proto_repositories( }, } + scala_version_jar_shas = scala_jar_shas[major_version] + _scala_maven_import_external( name = "scala_proto_rules_scalapb_plugin", artifact = _scala_mvn_artifact( "com.trueaccord.scalapb:compilerplugin:0.6.5", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalapb_plugin"], + jar_sha256 = scala_version_jar_shas["scalapb_plugin"], licenses = ["notice"], server_urls = maven_servers) @@ -78,7 +80,7 @@ def scala_proto_repositories( name = "scala_proto_rules_protoc_bridge", artifact = _scala_mvn_artifact( "com.trueaccord.scalapb:protoc-bridge:0.3.0-M1", major_version), - jar_sha256 = scala_jar_shas[major_version]["protoc_bridge"], + jar_sha256 = scala_version_jar_shas["protoc_bridge"], licenses = ["notice"], server_urls = maven_servers) @@ -90,7 +92,7 @@ def scala_proto_repositories( name = "scala_proto_rules_scalapbc", artifact = _scala_mvn_artifact("com.trueaccord.scalapb:scalapbc:0.6.5", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalapbc"], + jar_sha256 = scala_version_jar_shas["scalapbc"], licenses = ["notice"], server_urls = maven_servers) native.bind( @@ -101,7 +103,7 @@ def scala_proto_repositories( name = "scala_proto_rules_scalapb_runtime", artifact = _scala_mvn_artifact( "com.trueaccord.scalapb:scalapb-runtime:0.6.5", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalapb_runtime"], + jar_sha256 = scala_version_jar_shas["scalapb_runtime"], licenses = ["notice"], server_urls = maven_servers) native.bind( @@ -112,7 +114,7 @@ def scala_proto_repositories( name = "scala_proto_rules_scalapb_runtime_grpc", artifact = _scala_mvn_artifact( "com.trueaccord.scalapb:scalapb-runtime-grpc:0.6.5", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalapb_runtime_grpc"], + jar_sha256 = scala_version_jar_shas["scalapb_runtime_grpc"], licenses = ["notice"], server_urls = maven_servers) native.bind( @@ -123,7 +125,7 @@ def scala_proto_repositories( name = "scala_proto_rules_scalapb_lenses", artifact = _scala_mvn_artifact("com.trueaccord.lenses:lenses:0.4.12", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalapb_lenses"], + jar_sha256 = scala_version_jar_shas["scalapb_lenses"], licenses = ["notice"], server_urls = maven_servers) native.bind( @@ -134,7 +136,7 @@ def scala_proto_repositories( name = "scala_proto_rules_scalapb_fastparse", artifact = _scala_mvn_artifact("com.lihaoyi:fastparse:0.4.4", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalapb_fastparse"], + jar_sha256 = scala_version_jar_shas["scalapb_fastparse"], licenses = ["notice"], server_urls = maven_servers) diff --git a/specs2/specs2.bzl b/specs2/specs2.bzl index 4a5026f2c..83ee448a8 100644 --- a/specs2/specs2.bzl +++ b/specs2/specs2.bzl @@ -32,11 +32,13 @@ def specs2_repositories(scala_version = _default_scala_version(), }, } + scala_version_jar_shas = scala_jar_shas[major_version] + _scala_maven_import_external( name = "io_bazel_rules_scala_org_specs2_specs2_core", artifact = _scala_mvn_artifact( "org.specs2:specs2-core:" + specs2_version(), major_version), - jar_sha256 = scala_jar_shas[major_version]["specs2_core"], + jar_sha256 = scala_version_jar_shas["specs2_core"], licenses = ["notice"], server_urls = maven_servers, ) @@ -45,7 +47,7 @@ def specs2_repositories(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_org_specs2_specs2_common", artifact = _scala_mvn_artifact( "org.specs2:specs2-common:" + specs2_version(), major_version), - jar_sha256 = scala_jar_shas[major_version]["specs2_common"], + jar_sha256 = scala_version_jar_shas["specs2_common"], licenses = ["notice"], server_urls = maven_servers, ) @@ -54,7 +56,7 @@ def specs2_repositories(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_org_specs2_specs2_matcher", artifact = _scala_mvn_artifact( "org.specs2:specs2-matcher:" + specs2_version(), major_version), - jar_sha256 = scala_jar_shas[major_version]["specs2_matcher"], + jar_sha256 = scala_version_jar_shas["specs2_matcher"], licenses = ["notice"], server_urls = maven_servers, ) @@ -63,7 +65,7 @@ def specs2_repositories(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_org_scalaz_scalaz_effect", artifact = _scala_mvn_artifact("org.scalaz:scalaz-effect:7.2.7", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalaz_effect"], + jar_sha256 = scala_version_jar_shas["scalaz_effect"], licenses = ["notice"], server_urls = maven_servers, ) @@ -72,7 +74,7 @@ def specs2_repositories(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_org_scalaz_scalaz_core", artifact = _scala_mvn_artifact("org.scalaz:scalaz-core:7.2.7", major_version), - jar_sha256 = scala_jar_shas[major_version]["scalaz_core"], + jar_sha256 = scala_version_jar_shas["scalaz_core"], licenses = ["notice"], server_urls = maven_servers, ) diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 98f8520ab..219401876 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -58,11 +58,13 @@ def twitter_scrooge(scala_version = _default_scala_version(), }, } + scala_version_jar_shas = scala_jar_shas[major_version] + _scala_maven_import_external( name = "io_bazel_rules_scala_scrooge_core", artifact = _scala_mvn_artifact("com.twitter:scrooge-core:18.6.0", major_version), - jar_sha256 = scala_jar_shas[major_version]["scrooge_core"], + jar_sha256 = scala_version_jar_shas["scrooge_core"], licenses = ["notice"], server_urls = maven_servers, ) @@ -75,7 +77,7 @@ def twitter_scrooge(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_scrooge_generator", artifact = _scala_mvn_artifact("com.twitter:scrooge-generator:18.6.0", major_version), - jar_sha256 = scala_jar_shas[major_version]["scrooge_generator"], + jar_sha256 = scala_version_jar_shas["scrooge_generator"], licenses = ["notice"], server_urls = maven_servers, ) @@ -87,7 +89,7 @@ def twitter_scrooge(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_util_core", artifact = _scala_mvn_artifact("com.twitter:util-core:18.6.0", major_version), - jar_sha256 = scala_jar_shas[major_version]["util_core"], + jar_sha256 = scala_version_jar_shas["util_core"], licenses = ["notice"], server_urls = maven_servers, ) @@ -99,7 +101,7 @@ def twitter_scrooge(scala_version = _default_scala_version(), name = "io_bazel_rules_scala_util_logging", artifact = _scala_mvn_artifact("com.twitter:util-logging:18.6.0", major_version), - jar_sha256 = scala_jar_shas[major_version]["util_logging"], + jar_sha256 = scala_version_jar_shas["util_logging"], licenses = ["notice"], server_urls = maven_servers, ) From 829705dbaafb5bbcc8d31d322c1ebc5429354d90 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Tue, 3 Jul 2018 21:00:57 -0700 Subject: [PATCH 46/63] Run version specific tests in their own workspace - Copy version_specific_test_dir to its own folder - Add WORKSPACE file with scala version to be tested - Removed tests that don't need to be run for multiple versions --- test_version.sh | 48 ++++ test_version/WORKSPACE.template | 88 ++++++ .../version_specific_tests_dir/A.scala | 7 + test_version/version_specific_tests_dir/BUILD | 254 ++++++++++++++++++ .../version_specific_tests_dir/D.scala | 7 + .../version_specific_tests_dir/Exported.scala | 11 + .../version_specific_tests_dir/HelloLib.scala | 38 +++ .../HelloLibTest.scala | 33 +++ .../JavaBinary.java | 22 ++ .../version_specific_tests_dir/LibToBin.scala | 5 + .../LibToTest.scala | 5 + .../MacroTest.scala | 17 ++ .../OtherJavaLib.java | 22 ++ .../version_specific_tests_dir/OtherLib.scala | 20 ++ .../version_specific_tests_dir/Runtime.scala | 5 + .../ScalaBinary.scala | 22 ++ .../SuiteUsage.scala | 6 + .../TestFilterTestA.scala | 11 + .../TestFilterTestB.scala | 11 + .../TestServer.scala | 98 +++++++ .../version_specific_tests_dir/WORKSPACE | 88 ++++++ .../version_specific_tests_dir/data/BUILD | 5 + .../version_specific_tests_dir/data/foo.txt | 1 + .../version_specific_tests_dir/data/more.txt | 1 + .../version_specific_tests_dir/data/some.txt | 1 + .../example_jars/BUILD | 15 ++ .../example_jars/example_jar1.jar | Bin 0 -> 1728 bytes .../example_jars/example_jar2.jar | Bin 0 -> 1385 bytes .../expected_service_manifest.txt | 2 + .../version_specific_tests_dir/fake_sig.jar | Bin 0 -> 492 bytes .../version_specific_tests_dir/gen_src/BUILD | 25 ++ .../gen_src/SrcGenerator.scala | 11 + .../version_specific_tests_dir/jar_lister.py | 5 + .../version_specific_tests_dir/no_sigs.sh | 13 + .../version_specific_tests_dir/proto/BUILD | 62 +++++ .../proto/test2.proto | 10 + .../proto/test3.proto | 10 + .../proto/test_service.proto | 12 + .../version_specific_tests_dir/proto2/BUILD | 5 + .../proto2/test.proto | 12 + .../src/main/resources/scalarules/test/BUILD | 14 + .../src/main/resources/scalarules/test/byes | 3 + .../scalarules/test/classpath_resource1/BUILD | 1 + .../classpath_resource1/classpath-resource | 1 + .../scalarules/test/classpath_resource2/BUILD | 1 + .../classpath_resource2/classpath-resource | 1 + .../src/main/resources/scalarules/test/hellos | 3 + .../scalarules/test/hellos-and-byes.jar | Bin 0 -> 714 bytes .../main/resources/scalarules/test/more-byes | 3 + .../resources/scalarules/test/more-hellos | 2 + .../test/BinaryDependentOnJava.scala | 5 + .../test/MixJavaScalaLibBinary.scala | 22 ++ .../test/ResourcesStripScalaBinary.scala | 24 ++ .../test/ResourcesStripScalaLib.scala | 31 +++ .../scalarules/test/ScalaLibBinary.scala | 23 ++ .../scalarules/test/ScalaLibResources.scala | 29 ++ .../scalarules/test/junit/FilterTest.scala | 21 ++ .../JunitAbstractClassAndInterface.scala | 21 ++ .../test/junit/JunitCustomRunner.java | 22 ++ .../test/junit/JunitCustomRunnerTest.scala | 13 + .../test/junit/JunitIncludesRunWith.scala | 16 ++ .../junit/JunitIncludesTestHierarchies.scala | 10 + .../test/junit/JunitInnerClass.scala | 11 + .../scalarules/test/junit/JunitJavaTest.java | 8 + .../test/junit/JunitMultiplePrefixes.scala | 21 ++ .../test/junit/JunitMultipleSuffixes.scala | 21 ++ .../scalarules/test/junit/JunitNoTests.scala | 11 + .../scalarules/test/junit/JunitTests.scala | 30 +++ .../scala/scalarules/test/junit/scala.scala | 12 + .../test/junit/specs2/Specs2Tests.scala | 52 ++++ .../junit/support/JUnitCompileTimeDep.scala | 4 + .../test/junit/support/JUnitRuntimeDep.scala | 2 + .../LocationExpansionTest.scala | 14 + .../scalarules/test/mix_java_scala/Bar.scala | 3 + .../scalarules/test/mix_java_scala/Baz.java | 3 + .../scalarules/test/mix_java_scala/Baz.srcjar | Bin 0 -> 198 bytes .../test/mix_java_scala/FooBar.java | 3 + .../main/scala/scalarules/test/srcjars/BUILD | 19 ++ .../scalarules/test/srcjars/SourceJar1.scala | 5 + .../scalarules/test/srcjars/SourceJar1.srcjar | Bin 0 -> 335 bytes .../scalarules/test/srcjars/SourceJar2.scala | 5 + .../scalarules/test/srcjars_with_java/BUILD | 27 ++ .../srcjars_with_java/JavaDependent.scala | 5 + .../test/srcjars_with_java/JavaSource.java | 5 + .../srcjars_with_java/JavaSourceJar.srcjar | Bin 0 -> 241 bytes .../MixedLanguageDependent.scala | 5 + .../MixedLanguageSourceJar.srcjar | Bin 0 -> 437 bytes .../test/srcjars_with_java/ScalaSource.scala | 5 + .../scalarules/test/twitter_scrooge/BUILD | 229 ++++++++++++++++ .../test/twitter_scrooge/BareThrifts.scala | 13 + .../test/twitter_scrooge/JustScrooge1.scala | 14 + .../test/twitter_scrooge/JustScrooge2a.scala | 8 + .../test/twitter_scrooge/JustScrooge2b.scala | 12 + .../test/twitter_scrooge/JustScrooge3.scala | 7 + .../test/twitter_scrooge/Mixed.scala | 20 ++ .../test/twitter_scrooge/Scrooge2.scala | 8 + .../test/twitter_scrooge/Twodeep.scala | 15 ++ .../scalarules/test/twitter_scrooge/grep.sh | 13 + .../prefix_test/a/b/c/d/A.thrift | 5 + .../twitter_scrooge/prefix_test/a/b/c/d/BUILD | 17 ++ .../prefix_test/e/f/b/c/d/B.thrift | 7 + .../prefix_test/e/f/b/c/d/BUILD | 24 ++ .../test/twitter_scrooge/thrift/BUILD | 20 ++ .../twitter_scrooge/thrift/Thrift1.thrift | 11 + .../twitter_scrooge/thrift/ThriftMany1.thrift | 3 + .../twitter_scrooge/thrift/ThriftMany2.thrift | 3 + .../thrift/bare_jar_thrifts/BUILD | 19 ++ .../thrift/bare_jar_thrifts/BareJar.thrift | 11 + .../thrift/bare_jar_thrifts/bare-thrift.jar | Bin 0 -> 212 bytes .../thrift/bare_jar_thrifts/bare_jar_1/BUILD | 9 + .../bare_jar_1/bare-thrift-1.jar | Bin 0 -> 211 bytes .../thrift/bare_jar_thrifts/bare_jar_2/BUILD | 9 + .../bare_jar_2/bare-thrift-2.jar | Bin 0 -> 211 bytes .../test/twitter_scrooge/thrift/thrift2/BUILD | 22 ++ .../thrift/thrift2/Thrift2_A.thrift | 7 + .../thrift/thrift2/Thrift2_B.thrift | 9 + .../thrift/thrift2/thrift3/BUILD | 15 ++ .../thrift/thrift2/thrift3/Thrift3.thrift | 9 + .../thrift2/thrift3/thrift3_scrooge.jar | Bin 0 -> 47534 bytes .../thrift/thrift2/thrift4/BUILD | 20 ++ .../thrift/thrift2/thrift4/Thrift4.thrift | 7 + .../thrift/thrift2/thrift4/Thrift4a.thrift | 5 + .../version_specific_tests_dir/test_binary.sh | 4 + .../version_specific_tests_dir/tut/BUILD | 13 + .../tut/SomeExample.md | 12 + .../tut/TestDep.scala | 5 + 126 files changed, 2150 insertions(+) create mode 100755 test_version.sh create mode 100644 test_version/WORKSPACE.template create mode 100644 test_version/version_specific_tests_dir/A.scala create mode 100644 test_version/version_specific_tests_dir/BUILD create mode 100644 test_version/version_specific_tests_dir/D.scala create mode 100644 test_version/version_specific_tests_dir/Exported.scala create mode 100644 test_version/version_specific_tests_dir/HelloLib.scala create mode 100644 test_version/version_specific_tests_dir/HelloLibTest.scala create mode 100644 test_version/version_specific_tests_dir/JavaBinary.java create mode 100644 test_version/version_specific_tests_dir/LibToBin.scala create mode 100644 test_version/version_specific_tests_dir/LibToTest.scala create mode 100644 test_version/version_specific_tests_dir/MacroTest.scala create mode 100644 test_version/version_specific_tests_dir/OtherJavaLib.java create mode 100644 test_version/version_specific_tests_dir/OtherLib.scala create mode 100644 test_version/version_specific_tests_dir/Runtime.scala create mode 100644 test_version/version_specific_tests_dir/ScalaBinary.scala create mode 100644 test_version/version_specific_tests_dir/SuiteUsage.scala create mode 100644 test_version/version_specific_tests_dir/TestFilterTestA.scala create mode 100644 test_version/version_specific_tests_dir/TestFilterTestB.scala create mode 100644 test_version/version_specific_tests_dir/TestServer.scala create mode 100644 test_version/version_specific_tests_dir/WORKSPACE create mode 100644 test_version/version_specific_tests_dir/data/BUILD create mode 100644 test_version/version_specific_tests_dir/data/foo.txt create mode 100644 test_version/version_specific_tests_dir/data/more.txt create mode 100644 test_version/version_specific_tests_dir/data/some.txt create mode 100644 test_version/version_specific_tests_dir/example_jars/BUILD create mode 100755 test_version/version_specific_tests_dir/example_jars/example_jar1.jar create mode 100755 test_version/version_specific_tests_dir/example_jars/example_jar2.jar create mode 100644 test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt create mode 100644 test_version/version_specific_tests_dir/fake_sig.jar create mode 100644 test_version/version_specific_tests_dir/gen_src/BUILD create mode 100644 test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala create mode 100644 test_version/version_specific_tests_dir/jar_lister.py create mode 100755 test_version/version_specific_tests_dir/no_sigs.sh create mode 100644 test_version/version_specific_tests_dir/proto/BUILD create mode 100644 test_version/version_specific_tests_dir/proto/test2.proto create mode 100644 test_version/version_specific_tests_dir/proto/test3.proto create mode 100644 test_version/version_specific_tests_dir/proto/test_service.proto create mode 100644 test_version/version_specific_tests_dir/proto2/BUILD create mode 100644 test_version/version_specific_tests_dir/proto2/test.proto create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos-and-byes.jar create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes create mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibBinary.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitTests.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/specs2/Specs2Tests.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitCompileTimeDep.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitRuntimeDep.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Bar.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.java create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.srcjar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/FooBar.java create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/SourceJar1.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/SourceJar1.srcjar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/SourceJar2.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/JavaDependent.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/JavaSource.java create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/JavaSourceJar.srcjar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/MixedLanguageDependent.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/MixedLanguageSourceJar.srcjar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/ScalaSource.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/BareThrifts.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/JustScrooge1.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/JustScrooge2a.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/JustScrooge2b.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/JustScrooge3.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/Mixed.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/Scrooge2.scala create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/Twodeep.scala create mode 100755 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/grep.sh create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/prefix_test/a/b/c/d/A.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/prefix_test/a/b/c/d/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/prefix_test/e/f/b/c/d/B.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/prefix_test/e/f/b/c/d/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/Thrift1.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/ThriftMany1.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/ThriftMany2.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/BareJar.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare-thrift.jar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/bare-thrift-1.jar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/bare-thrift-2.jar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_A.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_B.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/Thrift3.thrift create mode 100755 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/thrift3_scrooge.jar create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/BUILD create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4.thrift create mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4a.thrift create mode 100755 test_version/version_specific_tests_dir/test_binary.sh create mode 100644 test_version/version_specific_tests_dir/tut/BUILD create mode 100644 test_version/version_specific_tests_dir/tut/SomeExample.md create mode 100644 test_version/version_specific_tests_dir/tut/TestDep.scala diff --git a/test_version.sh b/test_version.sh new file mode 100755 index 000000000..417f1ada4 --- /dev/null +++ b/test_version.sh @@ -0,0 +1,48 @@ +#!/bin/bash -e + +test_scala_version() { + SCALA_VERSION=$1 + + SCALA_VERSION_SHAS='' + SCALA_VERSION_SHAS+='"scala_compiler": "'$2'",' + SCALA_VERSION_SHAS+='"scala_library": "'$3'",' + SCALA_VERSION_SHAS+='"scala_reflect": "'$4'"' + + cd "${dir}"/test_version + + timestamp=$(date +%s) + + NEW_TEST_DIR="test_${SCALA_VERSION}_${timestamp}" + + cp -r version_specific_tests_dir/ $NEW_TEST_DIR + + sed \ + -e "s/\${scala_version}/$SCALA_VERSION/" \ + -e "s/\${scala_version_shas}/$SCALA_VERSION_SHAS/" \ + WORKSPACE.template >> $NEW_TEST_DIR/WORKSPACE + + cd $NEW_TEST_DIR + + bazel test //... + RESPONSE_CODE=$? + + cd .. + rm -rf $NEW_TEST_DIR + + exit $RESPONSE_CODE + +} + +dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +# shellcheck source=./test_runner.sh +. "${dir}"/test_runner.sh +runner=$(get_test_runner "${1:-local}") + +$runner test_scala_version "2.11.12" \ + "3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0" \ + "0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce" \ + "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04" +$runner test_scala_version "2.12.6" \ + "3023b07cc02f2b0217b2c04f8e636b396130b3a8544a8dfad498a19c3e57a863" \ + "f81d7144f0ce1b8123335b72ba39003c4be2870767aca15dd0888ba3dab65e98" \ + "ffa70d522fc9f9deec14358aa674e6dd75c9dfa39d4668ef15bb52f002ce99fa" diff --git a/test_version/WORKSPACE.template b/test_version/WORKSPACE.template new file mode 100644 index 000000000..48c38639c --- /dev/null +++ b/test_version/WORKSPACE.template @@ -0,0 +1,88 @@ +workspace(name = "io_bazel_rules_scala_test") + +local_repository( + name = "io_bazel_rules_scala", + path = "../../" +) + +load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "extract_major_version") + +scala_version = "${scala_version}" +scala_major_version = extract_major_version(scala_version) + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") + +scala_repositories(scala_version, { +${scala_version_shas} +}) + +load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library") + +twitter_scrooge(scala_version) + +load("@io_bazel_rules_scala//tut_rule:tut.bzl", "tut_repositories") + +tut_repositories(scala_version) + +load("@io_bazel_rules_scala//jmh:jmh.bzl", "jmh_repositories") + +jmh_repositories() + +load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_repositories") + +scala_proto_repositories(scala_version) + +load("@io_bazel_rules_scala//specs2:specs2_junit.bzl", "specs2_junit_repositories") + +specs2_junit_repositories(scala_version) + +load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "scala_mvn_artifact") + +maven_jar( + name = "org_apache_commons_commons_lang_3_5", + artifact = "org.apache.commons:commons-lang3:3.5", + sha1 = "6c6c702c89bfff3cd9e80b04d668c5e190d588c6", +) + +http_archive( + name = "com_google_protobuf", + sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", + strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", + urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], +) + +http_archive( + name = "com_google_protobuf_java", + sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", + strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", + urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], +) + +load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") + +scala_register_toolchains() + +load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "java_import_external") + +scala_maven_import_external( + name = "com_google_guava_guava_21_0", + artifact = "com.google.guava:guava:21.0", + jar_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480", + licenses = ["notice"], # Apache 2.0 + server_urls = ["https://mirror.bazel.build/repo1.maven.org/maven2"], +) + +# bazel's java_import_external has been altered in rules_scala to be a macro based on jvm_import_external +# in order to allow for other jvm-language imports (e.g. scala_import) +# the 3rd-party dependency below is using the java_import_external macro +# in order to make sure no regression with the original java_import_external +load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "java_import_external") + +java_import_external( + name = "org_apache_commons_commons_lang_3_5_without_file", + generated_linkable_rule_name = "linkable_org_apache_commons_commons_lang_3_5_without_file", + jar_sha256 = "8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c", + jar_urls = ["http://central.maven.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"], + licenses = ["notice"], # Apache 2.0 + neverlink = True, +) diff --git a/test_version/version_specific_tests_dir/A.scala b/test_version/version_specific_tests_dir/A.scala new file mode 100644 index 000000000..4954dd4e7 --- /dev/null +++ b/test_version/version_specific_tests_dir/A.scala @@ -0,0 +1,7 @@ +package scalarules.test + +object A { + def main(args: Array[String]) { + println("4 8 15 16 23 42") + } +} diff --git a/test_version/version_specific_tests_dir/BUILD b/test_version/version_specific_tests_dir/BUILD new file mode 100644 index 000000000..3cff5d966 --- /dev/null +++ b/test_version/version_specific_tests_dir/BUILD @@ -0,0 +1,254 @@ +package(default_testonly = 1) + +load( + "@io_bazel_rules_scala//scala:scala.bzl", + "scala_binary", + "scala_library", + "scala_test", + "scala_macro_library", + "scala_repl", + "scala_test_suite", + "scala_library_suite", + "scala_junit_test", + "scala_specs2_junit_test", +) +load( + "@io_bazel_rules_scala//scala_proto:scala_proto.bzl", + "scalapb_proto_library", +) + +# The examples below show how to combine Scala and Java rules. +# ScalaBinary is the Scala equivalent of JavaBinary. + +java_binary( + name = "JavaBinary", + srcs = ["JavaBinary.java"], + main_class = "scalarules.test.JavaBinary", + deps = [ + ":Exported", + ":HelloLib", + ":OtherLib", + ":Runtime", + ], +) + +scala_binary( + name = "ScalaBinary", + srcs = ["ScalaBinary.scala"], + main_class = "scalarules.test.ScalaBinary", + print_compile_time = True, + deps = [ + ":HelloLib", + ":MacroTest", + ], +) + +scala_library( + name = "HelloLib", + srcs = ["HelloLib.scala"], + deps = [ + "Exported", + "MacroTest", + "OtherJavaLib", + "OtherLib", + ], +) + +scala_repl( + name = "HelloLibRepl", + deps = [":HelloLib"], +) + +scala_test( + name = "HelloLibTest", + size = "small", # Not a macro, can pass test-specific attributes. + srcs = ["HelloLibTest.scala"], + deps = [ + ":HelloLib", + ], +) + +# test that a library can depend on a test: +scala_library( + name = "lib_to_test", + srcs = ["LibToTest.scala"], + deps = [":HelloLibTest"], +) + +scala_test( + name = "TestFilterTests", + size = "small", + srcs = glob(["TestFilterTest*.scala"]), +) + +scala_repl( + name = "HelloLibTestRepl", + deps = [":HelloLibTest"], +) + +scala_library( + name = "OtherLib", + srcs = ["OtherLib.scala"], + deps = ["ExportOnly"], +) + +# Test of library without src +scala_library( + name = "ExportOnly", + exports = ["Exported"], +) + +scala_library( + name = "Exported", + srcs = ["Exported.scala"], + runtime_deps = ["Runtime"], +) + +scala_macro_library( + name = "MacroTest", + srcs = ["MacroTest.scala"], +) + +scala_library( + name = "Runtime", + srcs = ["Runtime.scala"], +) + +java_library( + name = "OtherJavaLib", + srcs = ["OtherJavaLib.java"], +) + +scala_repl( + name = "ReplWithSources", + srcs = ["A.scala"], +) + +#Mix java scala +scala_library( + name = "MixJavaScalaLib", + srcs = glob(["src/main/scala/scalarules/test/mix_java_scala/*.scala"]) + glob([ + "src/main/scala/scalarules/test/mix_java_scala/*.java", + ]), + jvm_flags = [ + "-Xms1G", + "-Xmx4G", + ], +) + +#needed to test java sources are compiled +scala_binary( + name = "MixJavaScalaLibBinary", + srcs = ["src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala"], + main_class = "scalarules.test.MixJavaScalaLibBinary", + deps = ["MixJavaScalaLib"], +) + +#Mix java scala (srcjar), much like above only the java is provided via srcjar +scala_library( + name = "MixJavaScalaSrcjarLib", + srcs = glob([ + "src/main/scala/scalarules/test/mix_java_scala/*.scala", + # srcjar created with `jar -cfM Baz.srcjar Baz.java` + "src/main/scala/scalarules/test/mix_java_scala/*.srcjar", + ]), + jvm_flags = [ + "-Xms1G", + "-Xmx4G", + ], +) + +#needed to test java sources are compiled +scala_binary( + name = "MixJavaScalaSrcjarLibBinary", + srcs = ["src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala"], + main_class = "scalarules.test.MixJavaScalaLibBinary", + deps = ["MixJavaScalaSrcjarLib"], +) + +scala_library( + name = "JUnitCompileTimeDep", + srcs = ["src/main/scala/scalarules/test/junit/support/JUnitCompileTimeDep.scala"], +) + +scala_library( + name = "JUnitRuntimeDep", + srcs = ["src/main/scala/scalarules/test/junit/support/JUnitRuntimeDep.scala"], +) + +scala_junit_test( + name = "JunitTestWithDeps", + size = "small", + srcs = ["src/main/scala/scalarules/test/junit/JunitTests.scala"], + jvm_flags = ["-XX:HeapDumpPath=/some/custom/path"], + suffixes = ["Test"], + runtime_deps = [":JUnitRuntimeDep"], + deps = [":JUnitCompileTimeDep"], +) + +scala_specs2_junit_test( + name = "Specs2Tests", + size = "small", + srcs = ["src/main/scala/scalarules/test/junit/specs2/Specs2Tests.scala"], + print_discovered_classes = True, + suffixes = ["Test"], + deps = [":JUnitCompileTimeDep"], +) + +# Make sure scala_binary works in test environment +[sh_test( + name = "Run" + "".join([binary[idx] if binary[idx].isalnum() else "_" for idx in range(len(binary))]), + srcs = ["test_binary.sh"], + args = ["$(location %s)" % binary], + data = [binary if (":" in binary) else (":%s" % binary)], +) for binary in [ + "JavaBinary", + "MixJavaScalaLibBinary", + "MixJavaScalaSrcjarLibBinary", + "ScalaBinary", +]] + + +scala_junit_test( + name = "JunitCustomRunner", + size = "small", + srcs = ["src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala"], + suffixes = ["Test"], + deps = [":customJunitRunner"], +) + +scala_junit_test( + name = "JunitIncludesClassesWithRunWith", + size = "small", + srcs = ["src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala"], + print_discovered_classes = True, + suffixes = ["Test"], +) + +scala_library( + name = "customJunitRunner", + srcs = ["src/main/scala/scalarules/test/junit/JunitCustomRunner.java"], + deps = ["//external:io_bazel_rules_scala/dependency/junit/junit"], +) + +scala_library( + name = "lib_with_scala_proto_dep", + srcs = ["TestServer.scala"], + deps = ["//proto:test_proto"], +) + +scala_binary( + name = "test_scala_proto_server", + main_class = "test.proto.TestServer", + deps = [":lib_with_scala_proto_dep"], +) + +scalapb_proto_library( + name = "test_proto_scala_dep", + visibility = ["//visibility:public"], + deps = [ + ":HelloLib", + "//proto:test2", + ], +) + diff --git a/test_version/version_specific_tests_dir/D.scala b/test_version/version_specific_tests_dir/D.scala new file mode 100644 index 000000000..e53d8a220 --- /dev/null +++ b/test_version/version_specific_tests_dir/D.scala @@ -0,0 +1,7 @@ +package scalarules.test + +object D { + def main(args: Array[String]) { + A.main(args) + } +} diff --git a/test_version/version_specific_tests_dir/Exported.scala b/test_version/version_specific_tests_dir/Exported.scala new file mode 100644 index 000000000..bc0ae33da --- /dev/null +++ b/test_version/version_specific_tests_dir/Exported.scala @@ -0,0 +1,11 @@ +package scalarules.test + +object Exported { + def message: String = { + // terrible, don't do this in real code: + val msg = Class.forName("scalarules.test.Runtime") + .newInstance + .toString + "you all, everybody. " + msg + } +} diff --git a/test_version/version_specific_tests_dir/HelloLib.scala b/test_version/version_specific_tests_dir/HelloLib.scala new file mode 100644 index 000000000..a4c536fa8 --- /dev/null +++ b/test_version/version_specific_tests_dir/HelloLib.scala @@ -0,0 +1,38 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object HelloLib { + // This is to check the linter, which will recommend changing this + // to just def dumb(x: Int) = x == 3 + def dumb(x: Int) = if (x == 3) true else false + + def printMessage(arg: String) { + MacroTest.hello(arg == "yo") + println(getOtherLibMessage(arg)) + println(getOtherJavaLibMessage(arg)) + println(Exported.message) + } + + + def getOtherLibMessage(arg: String) : String = { + arg + " " + OtherLib.getMessage() + } + + def getOtherJavaLibMessage(arg: String) : String = { + arg + " " + OtherJavaLib.getMessage() + } +} + diff --git a/test_version/version_specific_tests_dir/HelloLibTest.scala b/test_version/version_specific_tests_dir/HelloLibTest.scala new file mode 100644 index 000000000..b7f54fd97 --- /dev/null +++ b/test_version/version_specific_tests_dir/HelloLibTest.scala @@ -0,0 +1,33 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +import org.scalatest._ + +object TestUtil { + def foo: String = "bar" +} + +class ScalaSuite extends FlatSpec { + "HelloLib" should "call scala" in { + assert(HelloLib.getOtherLibMessage("hello").equals("hello you all, everybody. I am Runtime")) + } +} + +class JavaSuite extends FlatSpec { + "HelloLib" should "call java" in { + assert(HelloLib.getOtherJavaLibMessage("hello").equals("hello java!")) + } +} diff --git a/test_version/version_specific_tests_dir/JavaBinary.java b/test_version/version_specific_tests_dir/JavaBinary.java new file mode 100644 index 000000000..ea316387c --- /dev/null +++ b/test_version/version_specific_tests_dir/JavaBinary.java @@ -0,0 +1,22 @@ +// Copyright 2015 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test; + +/** Example class */ +public class JavaBinary { + public static void main(String[] args) { + HelloLib.printMessage("Hello"); + } +} diff --git a/test_version/version_specific_tests_dir/LibToBin.scala b/test_version/version_specific_tests_dir/LibToBin.scala new file mode 100644 index 000000000..6c1ac1766 --- /dev/null +++ b/test_version/version_specific_tests_dir/LibToBin.scala @@ -0,0 +1,5 @@ +package scalarules.test + +object LibToBin { + def foo = ScalaLibBinary.main(Array("foo")) +} diff --git a/test_version/version_specific_tests_dir/LibToTest.scala b/test_version/version_specific_tests_dir/LibToTest.scala new file mode 100644 index 000000000..fadd58f09 --- /dev/null +++ b/test_version/version_specific_tests_dir/LibToTest.scala @@ -0,0 +1,5 @@ +package scalarules.test + +object LibToTest { + def foo = TestUtil.foo +} diff --git a/test_version/version_specific_tests_dir/MacroTest.scala b/test_version/version_specific_tests_dir/MacroTest.scala new file mode 100644 index 000000000..39155d7fa --- /dev/null +++ b/test_version/version_specific_tests_dir/MacroTest.scala @@ -0,0 +1,17 @@ +package scalarules.test + +import language.experimental.macros + +import reflect.macros.Context + +object MacroTest { + def hello(param: Any): Unit = macro hello_impl + + def hello_impl(c: Context)(param: c.Expr[Any]): c.Expr[Unit] = { + import c.universe._ + val paramRep = show(param.tree) + val paramRepTree = Literal(Constant(paramRep)) + val paramRepExpr = c.Expr[String](paramRepTree) + reify { println(paramRepExpr.splice + " = " + param.splice) } + } +} diff --git a/test_version/version_specific_tests_dir/OtherJavaLib.java b/test_version/version_specific_tests_dir/OtherJavaLib.java new file mode 100644 index 000000000..c408d7f11 --- /dev/null +++ b/test_version/version_specific_tests_dir/OtherJavaLib.java @@ -0,0 +1,22 @@ +// Copyright 2015 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test; + +/** Example class */ +public class OtherJavaLib { + public static String getMessage() { + return "java!"; + } +} diff --git a/test_version/version_specific_tests_dir/OtherLib.scala b/test_version/version_specific_tests_dir/OtherLib.scala new file mode 100644 index 000000000..5cfa1e947 --- /dev/null +++ b/test_version/version_specific_tests_dir/OtherLib.scala @@ -0,0 +1,20 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +// It is just to show how a Scala library can depend on another Scala library. +object OtherLib { + def getMessage(): String = Exported.message +} diff --git a/test_version/version_specific_tests_dir/Runtime.scala b/test_version/version_specific_tests_dir/Runtime.scala new file mode 100644 index 000000000..96e00be42 --- /dev/null +++ b/test_version/version_specific_tests_dir/Runtime.scala @@ -0,0 +1,5 @@ +package scalarules.test + +class Runtime { + override def toString = "I am Runtime" +} diff --git a/test_version/version_specific_tests_dir/ScalaBinary.scala b/test_version/version_specific_tests_dir/ScalaBinary.scala new file mode 100644 index 000000000..673abf184 --- /dev/null +++ b/test_version/version_specific_tests_dir/ScalaBinary.scala @@ -0,0 +1,22 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object ScalaBinary { + def main(args: Array[String]) { + println(MacroTest.hello(1 + 2)) + HelloLib.printMessage("Hello"); + } +} diff --git a/test_version/version_specific_tests_dir/SuiteUsage.scala b/test_version/version_specific_tests_dir/SuiteUsage.scala new file mode 100644 index 000000000..c51c66c70 --- /dev/null +++ b/test_version/version_specific_tests_dir/SuiteUsage.scala @@ -0,0 +1,6 @@ +package scalarules.test + + +object Usage { + def totV: Int = TestPointA.getV + TestPointA.getV +} diff --git a/test_version/version_specific_tests_dir/TestFilterTestA.scala b/test_version/version_specific_tests_dir/TestFilterTestA.scala new file mode 100644 index 000000000..7eab40784 --- /dev/null +++ b/test_version/version_specific_tests_dir/TestFilterTestA.scala @@ -0,0 +1,11 @@ +package scalarules.test + +import org.scalatest.FunSpec + +class TestFilterTestA extends FunSpec { + describe("A") { + it ("tests a") { + assert(true) + } + } +} diff --git a/test_version/version_specific_tests_dir/TestFilterTestB.scala b/test_version/version_specific_tests_dir/TestFilterTestB.scala new file mode 100644 index 000000000..06e9e798f --- /dev/null +++ b/test_version/version_specific_tests_dir/TestFilterTestB.scala @@ -0,0 +1,11 @@ +package scalarules.test + +import org.scalatest.FunSpec + +class TestFilterTestB extends FunSpec { + describe("B") { + it ("tests b") { + assert(true) + } + } +} diff --git a/test_version/version_specific_tests_dir/TestServer.scala b/test_version/version_specific_tests_dir/TestServer.scala new file mode 100644 index 000000000..3a44df27f --- /dev/null +++ b/test_version/version_specific_tests_dir/TestServer.scala @@ -0,0 +1,98 @@ +package test.proto + +import test.{TestRequest, TestMessage} +import test2.TestResponse1 +import test3.TestResponse2 +import test_service.TestServiceGrpc +import test_service.TestServiceGrpc.TestServiceBlockingStub + +import io.grpc.{Server, ServerBuilder, StatusRuntimeException, ManagedChannelBuilder, ManagedChannel} + +import java.util.concurrent.TimeUnit +import java.util.logging.{Level, Logger} + +import scala.concurrent.{ExecutionContext, Future} + +/** + * Adapted from https://github.com/xuwei-k/grpc-scala-sample/blob/master/grpc-scala/src/main/scala/io/grpc/examples/helloworld/HelloWorldServer.scala + */ +object TestServer { + private val logger = Logger.getLogger(classOf[TestServer].getName) + + def main(args: Array[String]): Unit = { + val server = new TestServer(ExecutionContext.global) + server.start() + val client = TestClient("localhost", 50051) + val msg = args.headOption.getOrElse("ping") + client.send(msg) + client.shutdown() + server.stop() + } + + private val port = 50051 +} + +class TestServer(executionContext: ExecutionContext) { self => + lazy val server: Server = ServerBuilder + .forPort(TestServer.port) + .addService(TestServiceGrpc.bindService(new TestServiceImpl, executionContext)) + .build + + private def start(): Unit = { + server.start() + TestServer.logger.info(s"Server started, listening on ${TestServer.port}") + sys.addShutdownHook { + System.err.println("*** shutting down gRPC server since JVM is shutting down") + self.stop() + System.err.println("*** server shut down") + } + } + + private def stop(): Unit = server.shutdown() + + private def blockUntilShutdown(): Unit = server.awaitTermination() + + private class TestServiceImpl extends TestServiceGrpc.TestService { + override def testMethod1(request: TestRequest): Future[TestResponse1] = { + val response = TestResponse1().withTestMsg(TestMessage(Some("foo"))) + Future.successful(response) + } + + override def testMethod2(request: TestRequest): Future[TestResponse2] = { + val response = TestResponse2().withTestMsg(TestMessage(Some("bar"))) + Future.successful(response) + } + } +} + +object TestClient { + def apply(host: String, port: Int): TestClient = { + val channel = ManagedChannelBuilder.forAddress(host, port).usePlaintext(true).build + val blockingStub = TestServiceGrpc.blockingStub(channel) + new TestClient(channel, blockingStub) + } +} + +class TestClient private( + private val channel: ManagedChannel, + private val blockingStub: TestServiceBlockingStub +) { + private[this] val logger = Logger.getLogger(classOf[TestClient].getName) + + def shutdown(): Unit = { + channel.shutdown.awaitTermination(5, TimeUnit.SECONDS) + } + + def send(name: String): Unit = { + logger.info("Will try to send " + name + " ...") + val request = TestRequest() + try { + val response = blockingStub.testMethod1(request) + logger.info("Response: " + response.testMsg) + } + catch { + case e: StatusRuntimeException => + logger.log(Level.WARNING, "RPC failed: {0}", e.getStatus) + } + } +} diff --git a/test_version/version_specific_tests_dir/WORKSPACE b/test_version/version_specific_tests_dir/WORKSPACE new file mode 100644 index 000000000..c63bd4835 --- /dev/null +++ b/test_version/version_specific_tests_dir/WORKSPACE @@ -0,0 +1,88 @@ +workspace(name = "io_bazel_rules_scala_test") + +local_repository( + name = "io_bazel_rules_scala", + path = "../../" +) + +load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "extract_major_version") + +scala_version = "2.11.12" +scala_major_version = extract_major_version(scala_version) + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") + +scala_repositories(scala_version, { +"scala_compiler": "3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0","scala_library": "0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce","scala_reflect": "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04" +}) + +load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library") + +twitter_scrooge(scala_version) + +load("@io_bazel_rules_scala//tut_rule:tut.bzl", "tut_repositories") + +tut_repositories(scala_version) + +load("@io_bazel_rules_scala//jmh:jmh.bzl", "jmh_repositories") + +jmh_repositories() + +load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_repositories") + +scala_proto_repositories(scala_version) + +load("@io_bazel_rules_scala//specs2:specs2_junit.bzl", "specs2_junit_repositories") + +specs2_junit_repositories(scala_version) + +load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "scala_mvn_artifact") + +maven_jar( + name = "org_apache_commons_commons_lang_3_5", + artifact = "org.apache.commons:commons-lang3:3.5", + sha1 = "6c6c702c89bfff3cd9e80b04d668c5e190d588c6", +) + +http_archive( + name = "com_google_protobuf", + sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", + strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", + urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], +) + +http_archive( + name = "com_google_protobuf_java", + sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", + strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", + urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], +) + +load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") + +scala_register_toolchains() + +load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "java_import_external") + +scala_maven_import_external( + name = "com_google_guava_guava_21_0", + artifact = "com.google.guava:guava:21.0", + jar_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480", + licenses = ["notice"], # Apache 2.0 + server_urls = ["https://mirror.bazel.build/repo1.maven.org/maven2"], +) + +# bazel's java_import_external has been altered in rules_scala to be a macro based on jvm_import_external +# in order to allow for other jvm-language imports (e.g. scala_import) +# the 3rd-party dependency below is using the java_import_external macro +# in order to make sure no regression with the original java_import_external +load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "java_import_external") + +java_import_external( + name = "org_apache_commons_commons_lang_3_5_without_file", + generated_linkable_rule_name = "linkable_org_apache_commons_commons_lang_3_5_without_file", + jar_sha256 = "8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c", + jar_urls = ["http://central.maven.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"], + licenses = ["notice"], # Apache 2.0 + neverlink = True, +) diff --git a/test_version/version_specific_tests_dir/data/BUILD b/test_version/version_specific_tests_dir/data/BUILD new file mode 100644 index 000000000..f217a0938 --- /dev/null +++ b/test_version/version_specific_tests_dir/data/BUILD @@ -0,0 +1,5 @@ +exports_files([ + "some.txt", + "more.txt", + "foo.txt", +]) diff --git a/test_version/version_specific_tests_dir/data/foo.txt b/test_version/version_specific_tests_dir/data/foo.txt new file mode 100644 index 000000000..5a07b6525 --- /dev/null +++ b/test_version/version_specific_tests_dir/data/foo.txt @@ -0,0 +1 @@ +this is a test of just random data in some path (not resources) diff --git a/test_version/version_specific_tests_dir/data/more.txt b/test_version/version_specific_tests_dir/data/more.txt new file mode 100644 index 000000000..faf5f2a79 --- /dev/null +++ b/test_version/version_specific_tests_dir/data/more.txt @@ -0,0 +1 @@ +more hellos diff --git a/test_version/version_specific_tests_dir/data/some.txt b/test_version/version_specific_tests_dir/data/some.txt new file mode 100644 index 000000000..5a07b6525 --- /dev/null +++ b/test_version/version_specific_tests_dir/data/some.txt @@ -0,0 +1 @@ +this is a test of just random data in some path (not resources) diff --git a/test_version/version_specific_tests_dir/example_jars/BUILD b/test_version/version_specific_tests_dir/example_jars/BUILD new file mode 100644 index 000000000..612e2e857 --- /dev/null +++ b/test_version/version_specific_tests_dir/example_jars/BUILD @@ -0,0 +1,15 @@ +java_import( + name = "example_jar1", + jars = [ + "example_jar1.jar", + ], + visibility = ["//visibility:public"], +) + +java_import( + name = "example_jar2", + jars = [ + "example_jar2.jar", + ], + visibility = ["//visibility:public"], +) diff --git a/test_version/version_specific_tests_dir/example_jars/example_jar1.jar b/test_version/version_specific_tests_dir/example_jars/example_jar1.jar new file mode 100755 index 0000000000000000000000000000000000000000..5e75a72e1f12fbfe189501b63ba18fe199f0a047 GIT binary patch literal 1728 zcmWIWW@Zs#;Nak32#QzqW*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5`TA zUPvC1mXg%U_#v*U_I!z!#dC4dC*rEp7_Mf2D*9N&2zG^l;4&o_pdGG2jBtfHh8GwZ z^jw1DgG=&@Qs2(7ZsK^|Ma5CyU*;4 z1Xg$K<8NDk;!Vz_H*Z)Pp0>YbC}1#hdE7BQrALZ0*HF*&*NmjTlV$sF?p+spc-_%- ziR8|QpMRAGzFCtfsMsRlWYYH5^!2viQcfNEORVH=WM3HF`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001 diff --git a/test_version/version_specific_tests_dir/example_jars/example_jar2.jar b/test_version/version_specific_tests_dir/example_jars/example_jar2.jar new file mode 100755 index 0000000000000000000000000000000000000000..67abcec19364e7141e6a4d07677537f3824abfd1 GIT binary patch literal 1385 zcmWIWW@Zs#;Nak3$c*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5`TA zUPvC1mXg%U_#v*U_I!z!#dC4dC*rEp7_Mf2D*9N&2zG^l;4&o_pdGG2jBte;niqtS zU7_a^93NbgUzGZGh9TD>2LadrM?@HB>*{{zx|bkm+bAxuxK%)aCu;ep7`d}Y{$?q# zZRvVZZ?H$nc(do`-NFoJ)_Kbsm?tPorSDNmF7e3d4*Y&Y@wnL2WoNpt@3p$IwlXqY zwjk^J`tQFF-OEvG5pe3*{_x|h-u7Bv#UtXE-tf=kD-q4DnRg*`^|6a!_8IRNQ_f|$ zS6f{OH8IzH{2?*srp3Y;i*04?ex)e>YYUu`eeOSN)$@AABmBuPYb@tKG!!VwI2RRv zyvuTWb>ewfg-&}O^@?YeK>b_vn4NeIih`nN5mRl-O`x|~Bp?C9#lQfJvH*MmQ=D2< zmYJMdtd9stboJ860SQ-+6r$FAhYSQ<(tEkRP4qPH7BJ)`xSr(P!N3~6;QK|zTY{TJ zf&x^VDkpsn>#EO`@n^X4VMlxekHW!TW4lQ=#9G#wol^vbSZ(sUk~?M6P93sF^Z8rX zl@v?QXSXU#Hi~`WWxjo5`~u~AP(?mWD;RO&7`m#2+E|W0G{hWSr%O@a<&0wQ3S9BGT~a0GAyzQ zpzMX5zChUv0S*J1a1-E31Eime0e31y=)c2=q#vHfknIPhO5{ibrAh?g0fq_Oez<-V phrmJ+6vxOR42oj}U}wf=5b-e{;LXYgGK~!gHvm1g7-${?0{}8+gL41? literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt b/test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt new file mode 100644 index 000000000..76bf29b8d --- /dev/null +++ b/test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt @@ -0,0 +1,2 @@ +org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystemRegistrar +org.apache.beam.sdk.io.LocalFileSystemRegistrar diff --git a/test_version/version_specific_tests_dir/fake_sig.jar b/test_version/version_specific_tests_dir/fake_sig.jar new file mode 100644 index 0000000000000000000000000000000000000000..b76b2261cef1a908dade50a1b08b4bae352a0de2 GIT binary patch literal 492 zcmWIWW@h1H00GvLJ6>Q0l;C8LVeoYgan$wnbJGtE;bdU$^a_cb4aB7t+zgB?Ul|z~ zSVVw|1K>uyFGe*&5ZMSfM{id>mtaS*QHelfK*r%T>K#F&f}lpl<1&hoNsbwp*Ce2x z6kvGk2x206lojGp43{B{!}KQ1I0l9#jn2r%Av_H<7UXF>#$tLI+1Ne|W5EFcG!_&9 U7{;=)fxN{GgnxnbO%R6x07d3ay8r+H literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/gen_src/BUILD b/test_version/version_specific_tests_dir/gen_src/BUILD new file mode 100644 index 000000000..d9dc8cb90 --- /dev/null +++ b/test_version/version_specific_tests_dir/gen_src/BUILD @@ -0,0 +1,25 @@ +load( + "@io_bazel_rules_scala//scala:scala.bzl", + "scala_binary", + "scala_library", +) + +scala_binary( + name = "src_generator", + srcs = ["SrcGenerator.scala"], + main_class = "build.bazel.rulesscala.test.srcgen.SrcGenerator", +) + +genrule( + name = "foo", + srcs = [], + outs = ["foo.scala"], + cmd = "./$(location src_generator) hello foo > \"$@\"", + tools = ["src_generator"], +) + +scala_binary( + name = "uses_gen_file", + srcs = ["foo.scala"], + main_class = "Foo", +) diff --git a/test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala b/test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala new file mode 100644 index 000000000..a97a699da --- /dev/null +++ b/test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala @@ -0,0 +1,11 @@ +package build.bazel.rulesscala.test.srcgen + +object SrcGenerator { + def main(args: Array[String]): Unit = { + println(s""" +object Foo { + def hello: String = "hello ${args.toList}" + def main(args: Array[String]): Unit = println(hello) +}""") + } +} diff --git a/test_version/version_specific_tests_dir/jar_lister.py b/test_version/version_specific_tests_dir/jar_lister.py new file mode 100644 index 000000000..676eb843d --- /dev/null +++ b/test_version/version_specific_tests_dir/jar_lister.py @@ -0,0 +1,5 @@ +import zipfile +import sys + +for n in zipfile.ZipFile(sys.argv[1]).namelist(): + print n diff --git a/test_version/version_specific_tests_dir/no_sigs.sh b/test_version/version_specific_tests_dir/no_sigs.sh new file mode 100755 index 000000000..756ecfd7c --- /dev/null +++ b/test_version/version_specific_tests_dir/no_sigs.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +OUTPUT1=`$1 $2 | grep DSA` +OUTPUT2=`$1 $2 | grep RSA` + +if [[ $OUTPUT1 ]]; then + echo $OUTPUT1 + exit 1 +fi +if [[ $OUTPUT2 ]]; then + echo $OUTPUT2 + exit 1 +fi diff --git a/test_version/version_specific_tests_dir/proto/BUILD b/test_version/version_specific_tests_dir/proto/BUILD new file mode 100644 index 000000000..5f4ce4e4d --- /dev/null +++ b/test_version/version_specific_tests_dir/proto/BUILD @@ -0,0 +1,62 @@ +load( + "@io_bazel_rules_scala//scala_proto:scala_proto.bzl", + "scalapb_proto_library", +) + +proto_library( + name = "test2", + srcs = ["test2.proto"], + visibility = ["//visibility:public"], + deps = ["//proto2:test"], +) + +proto_library( + name = "test3", + srcs = ["test3.proto"], + visibility = ["//visibility:public"], + deps = ["//proto2:test"], +) + +proto_library( + name = "test_service", + srcs = ["test_service.proto"], + visibility = ["//visibility:public"], + deps = [ + ":test2", + ":test3", + "//proto2:test", + ], +) + +scalapb_proto_library( + name = "test_proto_nogrpc", + visibility = ["//visibility:public"], + deps = [":test2"], +) + +java_proto_library( + name = "test_proto_java_lib", + deps = [ + ":test2", + "//proto2:test", + ], +) + +scalapb_proto_library( + name = "test_proto_java_conversions", + visibility = ["//visibility:public"], + with_flat_package = True, + with_java = True, + deps = [ + ":test2", + ":test_proto_java_lib", + "//proto2:test", + ], +) + +scalapb_proto_library( + name = "test_proto", + visibility = ["//visibility:public"], + with_grpc = True, + deps = [":test_service"], +) diff --git a/test_version/version_specific_tests_dir/proto/test2.proto b/test_version/version_specific_tests_dir/proto/test2.proto new file mode 100644 index 000000000..75d912ee0 --- /dev/null +++ b/test_version/version_specific_tests_dir/proto/test2.proto @@ -0,0 +1,10 @@ +syntax = "proto2"; + +import "proto2/test.proto"; +option java_package = "test.proto"; + +message TestResponse1 { + optional uint32 c = 1; + optional bool d = 2; + optional TestMessage testMsg = 3; +} diff --git a/test_version/version_specific_tests_dir/proto/test3.proto b/test_version/version_specific_tests_dir/proto/test3.proto new file mode 100644 index 000000000..80efe45f2 --- /dev/null +++ b/test_version/version_specific_tests_dir/proto/test3.proto @@ -0,0 +1,10 @@ +syntax = "proto2"; + +import "proto2/test.proto"; +option java_package = "test.proto"; + +message TestResponse2 { + optional uint32 e = 1; + optional bool f = 2; + optional TestMessage testMsg = 3; +} diff --git a/test_version/version_specific_tests_dir/proto/test_service.proto b/test_version/version_specific_tests_dir/proto/test_service.proto new file mode 100644 index 000000000..e4e3038c4 --- /dev/null +++ b/test_version/version_specific_tests_dir/proto/test_service.proto @@ -0,0 +1,12 @@ +syntax = "proto2"; + +import "proto2/test.proto"; +import "proto/test2.proto"; +import "proto/test3.proto"; + +option java_package = "test.proto"; + +service TestService { + rpc TestMethod1 (TestRequest) returns (TestResponse1) {} + rpc TestMethod2 (TestRequest) returns (TestResponse2) {} +} diff --git a/test_version/version_specific_tests_dir/proto2/BUILD b/test_version/version_specific_tests_dir/proto2/BUILD new file mode 100644 index 000000000..96e963557 --- /dev/null +++ b/test_version/version_specific_tests_dir/proto2/BUILD @@ -0,0 +1,5 @@ +proto_library( + name = "test", + srcs = ["test.proto"], + visibility = ["//visibility:public"], +) diff --git a/test_version/version_specific_tests_dir/proto2/test.proto b/test_version/version_specific_tests_dir/proto2/test.proto new file mode 100644 index 000000000..6a51d45b2 --- /dev/null +++ b/test_version/version_specific_tests_dir/proto2/test.proto @@ -0,0 +1,12 @@ +syntax = "proto2"; + +option java_package = "test.proto"; + +message TestRequest { + optional uint32 a = 1; + optional bool b = 2; +} + +message TestMessage { + optional string foo = 1; +} diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD new file mode 100644 index 000000000..c50f6654b --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD @@ -0,0 +1,14 @@ +exports_files([ + "byes", + "hellos", + "hellos-and-byes.jar", + "more-byes", + "more-hellos", +]) + +genrule( + name = "generated-hello", + outs = ["generated-hello.txt"], + cmd = "echo 'hello' > $@", + visibility = ["//visibility:public"], +) diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes new file mode 100644 index 000000000..94ab91103 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes @@ -0,0 +1,3 @@ +see ya +later +A hui hou diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD new file mode 100644 index 000000000..01bb3389c --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD @@ -0,0 +1 @@ +exports_files(["classpath-resource"]) diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource new file mode 100644 index 000000000..f1127e429 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource @@ -0,0 +1 @@ +classpath resource 1 diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD new file mode 100644 index 000000000..01bb3389c --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD @@ -0,0 +1 @@ +exports_files(["classpath-resource"]) diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource new file mode 100644 index 000000000..4e4333652 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource @@ -0,0 +1 @@ +classpath resource 2 diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos new file mode 100644 index 000000000..2d28d85dd --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos @@ -0,0 +1,3 @@ +Hello +Guten Tag +Bonjour diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos-and-byes.jar b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos-and-byes.jar new file mode 100644 index 0000000000000000000000000000000000000000..0c3e2c47a266fbb21c28c250541b25a482c233b2 GIT binary patch literal 714 zcmWIWW@Zs#;Nak3NNx}FVn70{3@i*zp`Jc2|4uP5c(2tsp|7Rc=YRT)r|z|mFt1fU zx?z_B15SCIJ$aISbJ6GSpwh%c349@XVUxKT0=(Hdrro-etOqpC4u}JATEYU9O{z>S z*7oxaUE%ZOl&6lT?xUiR6B=hjPMpwx$^F=TD!~*L?&r?f-o51Sz0e3B0Cp0%ddai&Aw#t~-5J-z!uD>O|I! z#X{ae-8*DN56tPgol6u1M)J&p^Qu-42XzA4qZ@0p#pfc1$d)sLk>w)O{qW=Kwd@HfgD<(5JrFv zKqkZw=z5R?0u+u2@DIp@hbp=@WdDLf2?4?xq1s^fv4Wk#%D~FN3zS+8#0(4o8+V_X literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes new file mode 100644 index 000000000..1768e93a9 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes @@ -0,0 +1,3 @@ +more see ya +more later +A more hui hou diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos new file mode 100644 index 000000000..20f51d648 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos @@ -0,0 +1,2 @@ +More Hello +More Bonjour diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala new file mode 100644 index 000000000..e6227d480 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala @@ -0,0 +1,5 @@ +package scalarules.test + +object BinaryDependentOnJava extends App { + println(classOf[Alpha]) +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala new file mode 100644 index 000000000..56cbee2d9 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala @@ -0,0 +1,22 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object MixJavaScalaLibBinary { + def main(args: Array[String]) { + val bar = new Bar() + println("created an instance of a mixed java scala code from a library") + } +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala new file mode 100644 index 000000000..0bac9b9f7 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala @@ -0,0 +1,24 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object ResourcesStripScalaBinary { + def main(args:Array[String]) { + ResourcesStripScalaLib.getGreetings foreach println + ResourcesStripScalaLib.getFarewells foreach println + ResourcesStripScalaLib.getData foreach println + ResourcesStripScalaLib.getGeneratedHello foreach println + } +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala new file mode 100644 index 000000000..976758514 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala @@ -0,0 +1,31 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object ResourcesStripScalaLib { + def getGreetings() = List("TODO")//get("/src/main/resources/scalarules/test/more-hellos") + + def getFarewells = List("TODO")//get("/src/main/resources/scalarules/test/more-byes") + + def getData = get("/data/more.txt") + + def getGeneratedHello = List("TODO")//get("/src/main/resources/scalarules/test/generated-hello.txt") + + private def get(s: String): List[String] = + scala.io.Source + .fromInputStream(getClass.getResourceAsStream(s)) + .getLines + .toList +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibBinary.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibBinary.scala new file mode 100644 index 000000000..549dc5366 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibBinary.scala @@ -0,0 +1,23 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object ScalaLibBinary { + def main(args:Array[String]) { + ScalaLibResources.getGreetings foreach println + ScalaLibResources.getFarewells foreach println + ScalaLibResources.getData foreach println + } +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala new file mode 100644 index 000000000..721ed08cd --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala @@ -0,0 +1,29 @@ +// Copyright 2016 The Bazel Authors. All rights reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package scalarules.test + +object ScalaLibResources { + def getGreetings() = get("hellos") + + def getFarewells = get("byes") + + def getData = get("/data/some.txt") + + private def get(s: String): List[String] = + scala.io.Source + .fromInputStream(getClass.getResourceAsStream(s)) + .getLines + .toList +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala new file mode 100644 index 000000000..ae2b9eed2 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala @@ -0,0 +1,21 @@ +package scalarules.test.junit + +import org.junit.Test + +class FirstFilterTest { + @Test def method1 { println(this.getClass.getName + "#method1") } + @Test def method2 { println(this.getClass.getName + "#method2") } + @Test def method3 { println(this.getClass.getName + "#method3") } +} + +class SecondFilterTest { + @Test def method1 { println(this.getClass.getName + "#method1") } + @Test def method2 { println(this.getClass.getName + "#method2") } + @Test def method3 { println(this.getClass.getName + "#method3") } +} + +class ThirdFilterTest { + @Test def method1 { println(this.getClass.getName + "#method1") } + @Test def method2 { println(this.getClass.getName + "#method2") } + @Test def method3 { println(this.getClass.getName + "#method3") } +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala new file mode 100644 index 000000000..0f97f38f2 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala @@ -0,0 +1,21 @@ +package scalarules.test.junit + +import org.junit.Test + +abstract class SomeAbstractTest { + @Test + def abstractTest: Unit = + println("abstract") +} + +trait SomeTraitTest { + @Test + def traitTest: Unit = + println("trait") +} + +class SingleTestSoTargetWillNotFailDueToNoTestsTest { + @Test + def someTest: Unit = + println("passing") +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java new file mode 100644 index 000000000..15a7b113b --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java @@ -0,0 +1,22 @@ +package scalarules.test.junit; + +import java.util.List; +import org.junit.rules.TestRule; +import org.junit.runners.BlockJUnit4ClassRunner; +import org.junit.runners.model.InitializationError; + +public class JunitCustomRunner extends BlockJUnit4ClassRunner { + + public JunitCustomRunner(Class aClass) throws InitializationError { + super(aClass); + } + + public static final String EXPECTED_MESSAGE = "Hello from getTestRules!"; + public static String message; + + @Override + protected List getTestRules(Object target) { + message = EXPECTED_MESSAGE; + return super.getTestRules(target); + } +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala new file mode 100644 index 000000000..cd91e15d4 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala @@ -0,0 +1,13 @@ +package scalarules.test.junit + +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(classOf[JunitCustomRunner]) +class JunitCustomRunnerTest { + @Test + def myTest() = { + assert(JunitCustomRunner.message == JunitCustomRunner.EXPECTED_MESSAGE, + "JunitCustomRunner did not run, check the wiring in JUnitFilteringRunnerBuilder") + } +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala new file mode 100644 index 000000000..7ee2d5706 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala @@ -0,0 +1,16 @@ +package scalarules.test.junit + +import org.junit.Test +import org.junit.runner.RunWith +import org.junit.runners.Suite +import org.junit.runners.Suite.SuiteClasses + +@RunWith(classOf[Suite]) +@SuiteClasses(Array(classOf[DeclaredInRunWith])) +class RunWithSupportedTest + +class DeclaredInRunWith { + @Test + def runWith: Unit = + println("Test Method From RunWith") +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala new file mode 100644 index 000000000..11a49c529 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala @@ -0,0 +1,10 @@ +package scalarules.test.junit + +import org.junit.Test + +abstract class ContractTest { + @Test + def abstractTest: Unit = + println("Test Method From Parent") +} +class ConcreteImplementationTest extends ContractTest diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala new file mode 100644 index 000000000..3112389cf --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala @@ -0,0 +1,11 @@ +package scalarules.test.junit + +import org.junit.Test + +class TestClass { + @Test + def someTest: Unit = + println("passing") + + class SomeHelper +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java new file mode 100644 index 000000000..4edd3f3a5 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java @@ -0,0 +1,8 @@ +package scalarules.test.junit; + +import org.junit.Test; + +public class JunitJavaTest { + @Test + public void someTest() {} +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala new file mode 100644 index 000000000..74bd30a41 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala @@ -0,0 +1,21 @@ +package scalarules.test.junit + +import org.junit.Test +import org.junit.Assert._ + +class TestJunitCustomPrefix { + + @Test + def someTest: Unit = { + assertEquals(1, 1) + } + +} +class OtherCustomPrefixJunit { + + @Test + def someTest: Unit = { + assertEquals(1, 1) + } + +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala new file mode 100644 index 000000000..5064a5dc0 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala @@ -0,0 +1,21 @@ +package scalarules.test.junit + +import org.junit.Test +import org.junit.Assert._ + +class JunitSuffixE2E { + + @Test + def someTest: Unit = { + assertEquals(1, 1) + } + +} +class JunitSuffixIT { + + @Test + def someTest: Unit = { + assertEquals(1, 1) + } + +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala new file mode 100644 index 000000000..484d4bc4b --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala @@ -0,0 +1,11 @@ +package scalarules.test.junit + +import org.junit.Test + +class SomeHelpreForTest + +class SingleTestSoTargetWillNotFailDueToNoTestsTest { + @Test + def someTest: Unit = + println("passing") +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitTests.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitTests.scala new file mode 100644 index 000000000..7ef9fa0ef --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitTests.scala @@ -0,0 +1,30 @@ +package scalarules.test.junit + +import org.junit.Test +import org.hamcrest.CoreMatchers._ +import org.hamcrest.MatcherAssert._ +import scalarules.test.junit.support.JUnitCompileTimeDep +import java.lang.management.ManagementFactory +import java.lang.management.RuntimeMXBean + +class JunitWithDepsTest { + + @Test + def hasCompileTimeDependencies: Unit = { + println(JUnitCompileTimeDep.hello) + } + + @Test + def hasRuntimeDependencies: Unit = { + Class.forName("scalarules.test.junit.support.JUnitRuntimeDep") + } + + @Test + def supportsCustomJVMArgs: Unit = { + assertThat(ManagementFactory.getRuntimeMXBean().getInputArguments(), + hasItem("-XX:HeapDumpPath=/some/custom/path")) + } + +} + +class ClassCoveringRegressionFromTakingAllClassesInArchive diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala new file mode 100644 index 000000000..3fefc0320 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala @@ -0,0 +1,12 @@ +package scalarules.test.junit + +import org.junit.Test +//Used to verify a folder doesn't match in test discovery. +//See JunitMatchesOnlyFilesEvenIfFolderMatchesPattern target +class scala { + + @Test + def atLeastOneTestIsNeeded: Unit = { + } + +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/specs2/Specs2Tests.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/specs2/Specs2Tests.scala new file mode 100644 index 000000000..d7b078f05 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/specs2/Specs2Tests.scala @@ -0,0 +1,52 @@ +package scalarules.test.junit.specs2 + +import org.specs2.mutable.SpecWithJUnit +import scalarules.test.junit.support.JUnitCompileTimeDep + +class JunitSpecs2Test extends SpecWithJUnit { + + "specs2 tests" should { + "run smoothly in bazel" in { + println(JUnitCompileTimeDep.hello) + success + } + + "not run smoothly in bazel" in { + success + } + } +} + +class JunitSpecs2AnotherTest extends SpecWithJUnit { + + "other specs2 tests" should { + "run from another test" >> { + println(JUnitCompileTimeDep.hello) + success + } + + "run from another test 2" >> { + success + } + } + + "unrelated test" should { + "not run" in { + success + } + } +} + +class JunitSpec2RegexTest extends SpecWithJUnit { + + "tests with unsafe characters" should { + "2 + 2 != 5" in { + 2 + 2 must be_!=(5) + } + + "work escaped (with regex)" in { + success + } + } +} + diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitCompileTimeDep.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitCompileTimeDep.scala new file mode 100644 index 000000000..6517163f0 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitCompileTimeDep.scala @@ -0,0 +1,4 @@ +package scalarules.test.junit.support +object JUnitCompileTimeDep { + val hello = "hello" +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitRuntimeDep.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitRuntimeDep.scala new file mode 100644 index 000000000..07746aaed --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/support/JUnitRuntimeDep.scala @@ -0,0 +1,2 @@ +package scalarules.test.junit.support +class JUnitRuntimeDep diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala new file mode 100644 index 000000000..97e4c15df --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala @@ -0,0 +1,14 @@ +package scalarules.test.location_expansion + +import org.specs2.mutable.SpecWithJUnit +class LocationExpansionTest extends SpecWithJUnit { + + "tests" should { + "support location expansion" >> { + sys.props.get("location.expanded") must beSome(contain("worker")) + + } + } + + +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Bar.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Bar.scala new file mode 100644 index 000000000..5629668d9 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Bar.scala @@ -0,0 +1,3 @@ +package scalarules.test +class Foo +class Bar extends Baz diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.java b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.java new file mode 100644 index 000000000..750484cd3 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.java @@ -0,0 +1,3 @@ +package scalarules.test; + +public class Baz extends Foo {} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.srcjar b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.srcjar new file mode 100644 index 0000000000000000000000000000000000000000..4d1c7f77613b2a7fae53ba28350d8bb59ae9e651 GIT binary patch literal 198 zcmWIWW@Zs#;Nak3IJ4lg4+9e5U|?ZzO03e$N-RtKcZz{Q+r#IapO1g2hM(UVPaUnZ zp1RkxJ$3aqK6|94;d|<&PngF!PaVCm0Ni8nXFD^>f&rQtC(=Sd=%t?fhMWs2Z#riPm zti+;X{owr4qU2Ps#3DmIu)=?*7#Kv)Y~*cr;9VIq(x?X+wz*K;B zWkSWS>4w_-=2gmS?|Q)&;LXmVm?ro+7U<|yAP(?mWD;ROcm`Pxcn&iVQHhkBgW zIk(~2BP|WzQzw1GJkELQ=!Jdo((&dwr?2bf7rNqE5ChYSoI=ke&Iw+p&v>5+p&LR2PMvR_v2<}j&^-P$&B)@bObh|u>>S^{H?NNbx*-jS1H2iTL>Lfm bLzV-%4HaNcn&iVQHhkBgW zIk(~2BP|WzQzw1GJkELQ=!Jdo((&dwr?2bf7rNqE5ChYSoI=ke&Iw+p&v>5+p&LR2PMvR_v2<}j&^-P$&B)@bObh|u>>S^{H?NNbx*-jS1K=(*Ky#TO zP&PO@F$d%{_WE5qlmHa!!z;N38jIXYqhmT+A2`?S* z5RY@`uX>+8f8E34OE3311>z}4cXa4LtBEz~MBrR?i zQ-Ec-t~f)0H#^5BVTSc?K)XDEIKZ2cNrVC624p#q8&CnNivqk^*+BA)KxhM`o4|?z DhLAQp literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/BUILD b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/BUILD new file mode 100644 index 000000000..3bd75bd7b --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/BUILD @@ -0,0 +1,9 @@ +load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library") + +thrift_library( + name = "bare_jar_1", + external_jars = [ + "bare-thrift-1.jar", + ], + visibility = ["//visibility:public"], +) diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/bare-thrift-1.jar b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_1/bare-thrift-1.jar new file mode 100644 index 0000000000000000000000000000000000000000..81ff04bc3259e5cafbab2e8c19dc281eceb1e491 GIT binary patch literal 211 zcmWIWW@Zs#;Nak3h^W2i#ef937+4sb5{vXoGKw z(Y1OSH$#9oJBM`Zwa>0Vt2}@>z?+dtgaP3MWI2!%Pywog0=!w-K=O=0Xal4h!HNO8 CY&XaN literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/BUILD b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/BUILD new file mode 100644 index 000000000..093f3d457 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/BUILD @@ -0,0 +1,9 @@ +load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library") + +thrift_library( + name = "bare_jar_2", + external_jars = [ + "bare-thrift-2.jar", + ], + visibility = ["//visibility:public"], +) diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/bare-thrift-2.jar b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/bare_jar_thrifts/bare_jar_2/bare-thrift-2.jar new file mode 100644 index 0000000000000000000000000000000000000000..14c9ca469ecbe55ec30f3aaf17339c83be1b02fe GIT binary patch literal 211 zcmWIWW@Zs#;Nak32&%p3#ef937+4sb607t|GKw z(Y1OSH$#9oJ4emySVvc&RUSYb;LXS+!hmoBvK+_>r~uVL0p6@^AbCb0v;oqMV8sB1 Cb~g+F literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/BUILD b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/BUILD new file mode 100644 index 000000000..a09690a58 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/BUILD @@ -0,0 +1,22 @@ +load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library") + +thrift_library( + name = "thrift2_a", + srcs = ["Thrift2_A.thrift"], + visibility = ["//visibility:public"], + deps = ["//src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3"], +) + +thrift_library( + name = "thrift2_b", + srcs = ["Thrift2_B.thrift"], + visibility = ["//visibility:public"], + deps = ["//src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3"], +) + +thrift_library( + name = "thrift2_b_imp", + srcs = ["Thrift2_B.thrift"], + visibility = ["//visibility:public"], + deps = ["//src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3:thrift3_import"], +) diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_A.thrift b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_A.thrift new file mode 100644 index 000000000..574ca556c --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_A.thrift @@ -0,0 +1,7 @@ +namespace java scalarules.test.twitter_scrooge.thrift.thrift2 + +include "thrift3/Thrift3.thrift" + +struct Struct2A { + 1: Thrift3.Struct3 msg +} \ No newline at end of file diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_B.thrift b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_B.thrift new file mode 100644 index 000000000..42839f3e0 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/Thrift2_B.thrift @@ -0,0 +1,9 @@ +namespace java scalarules.test.twitter_scrooge.thrift.thrift2 + +// TODO We should be able to do a full import based on the full package +// which will make refactoring targets much less fragile +include "thrift3/Thrift3.thrift" + +struct Struct2B { + 1: Thrift3.Struct3 msg +} \ No newline at end of file diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/BUILD b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/BUILD new file mode 100644 index 000000000..1e6b3c5ae --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/BUILD @@ -0,0 +1,15 @@ +load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library") +load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "scrooge_scala_import") + +thrift_library( + name = "thrift3", + srcs = ["Thrift3.thrift"], + visibility = ["//visibility:public"], +) + +scrooge_scala_import( + name = "thrift3_import", + scala_jars = ["thrift3_scrooge.jar"], + thrift_jars = ["libthrift3.jar"], + visibility = ["//visibility:public"], +) diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/Thrift3.thrift b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/Thrift3.thrift new file mode 100644 index 000000000..e3d6286ae --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/Thrift3.thrift @@ -0,0 +1,9 @@ +namespace java scalarules.test.twitter_scrooge.thrift.thrift2.thrift3 + +struct Struct3 { + 1: string msg +} + +struct Struct3Extra { + 1: string msg +} \ No newline at end of file diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/thrift3_scrooge.jar b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift3/thrift3_scrooge.jar new file mode 100755 index 0000000000000000000000000000000000000000..0e0f1c989d5459ddd066c6cd68d0b1afca882651 GIT binary patch literal 47534 zcmcG#1CS=svM$=TZQC|xx~Fa1wykOXZQHi3Y1_7K+i&*S=iK-1i+gt5_s+R1YSoI0 z%F0?%EAz{YZ)M3#fr7yR0YL%%ZNz;4IR8h31_A?;5mEk0FCi<+_%#LuB>z8&#?0Z5 z^8A(kM@ReH|A(l|Pgx035hY~?8BrMnTMJVYCue$96GtZtJ6j$iW(FpB7-4GzCntJ& z17~v{qQ6&;CI-$X#`HoSJVb^Do+j4tFz_({^Sl0IO8*#P|8^%M18W0E7i$wI#{XOp z>3-9{%<_(Z0=}b`md(I_`k2@pSoE7 z#f&)rzbpHvQr3S{iUtG)1qB5B|1t^N|NlyroE=?^oLR}p3~cReOPP^x7xRcaDK=h(G+!WP88 zhahacn6tiSPPG}N94G3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NC9t6qPN3dUYc|qgfKkW6Na@hVH@6R-I@n7Oal=`Q-e;w)1=;R-i z^gnD+^PejIKQYt)+$BGgTaEwl4pbTi;adOMq4;|T|GL9|248|4_{mNTezQM+I|%>G zyZH4K6#{kB@93Amj{oOX>py53f7qn+@6r9QhU1@C2L4zb|Az&7{ALgSx(j|zkbnJ$ zI;fQ6|9c$xZw$;o=TiTAAAlS7dz|<$N9UhYe}Da_>>BYKUHI#R@bjC=U&W=PevkOy njMG0qApLmx`G-+v{1);5#0(9(?EnKK1buu#w^sP&KYsl$qlcJf literal 0 HcmV?d00001 diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/BUILD b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/BUILD new file mode 100644 index 000000000..b3a533ba6 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/BUILD @@ -0,0 +1,20 @@ +load("@io_bazel_rules_scala//thrift:thrift.bzl", "thrift_library") + +thrift_library( + name = "thrift4", + srcs = ["Thrift4.thrift"], + visibility = ["//visibility:public"], + deps = [ + "//src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2:thrift2_a", + ], +) + +thrift_library( + name = "thrift4a", + srcs = ["Thrift4a.thrift"], + visibility = ["//visibility:public"], + deps = [ + ":thrift4", + "//src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2:thrift2_a", + ], +) diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4.thrift b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4.thrift new file mode 100644 index 000000000..5f6baad02 --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4.thrift @@ -0,0 +1,7 @@ +namespace java scalarules.test.twitter_scrooge.thrift.thrift2.thrift3 + +include "../Thrift2_A.thrift" + +struct Struct4 { + 1: Thrift2_A.Struct2A nested +} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4a.thrift b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4a.thrift new file mode 100644 index 000000000..b592f227c --- /dev/null +++ b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/twitter_scrooge/thrift/thrift2/thrift4/Thrift4a.thrift @@ -0,0 +1,5 @@ +include "./Thrift4.thrift" + +struct Struct4a { + 1: Thrift4.Struct4 nest; +} diff --git a/test_version/version_specific_tests_dir/test_binary.sh b/test_version/version_specific_tests_dir/test_binary.sh new file mode 100755 index 000000000..2590251d0 --- /dev/null +++ b/test_version/version_specific_tests_dir/test_binary.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Executing: " $@ +$@ diff --git a/test_version/version_specific_tests_dir/tut/BUILD b/test_version/version_specific_tests_dir/tut/BUILD new file mode 100644 index 000000000..012ad91a4 --- /dev/null +++ b/test_version/version_specific_tests_dir/tut/BUILD @@ -0,0 +1,13 @@ +load("@io_bazel_rules_scala//tut_rule:tut.bzl", "scala_tut_doc") +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_library") + +scala_library( + name = "test_dep", + srcs = ["TestDep.scala"], +) + +#scala_tut_doc( + #name = "some_example", + #src = "SomeExample.md", + #deps = [":test_dep"], +#) diff --git a/test_version/version_specific_tests_dir/tut/SomeExample.md b/test_version/version_specific_tests_dir/tut/SomeExample.md new file mode 100644 index 000000000..b38270ccc --- /dev/null +++ b/test_version/version_specific_tests_dir/tut/SomeExample.md @@ -0,0 +1,12 @@ +# This is markdown + +``` +With some stuff +``` + +```tut +List(1, 2, 3).sum + +import foo.Bar +Bar.values +``` diff --git a/test_version/version_specific_tests_dir/tut/TestDep.scala b/test_version/version_specific_tests_dir/tut/TestDep.scala new file mode 100644 index 000000000..15578b96e --- /dev/null +++ b/test_version/version_specific_tests_dir/tut/TestDep.scala @@ -0,0 +1,5 @@ +package foo + +object Bar { + def values: List[Int] = List(2, 3, 5, 7) +} From 8abd79f0cc5661eccae32cb41276cb7cc10c62c4 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 4 Jul 2018 13:48:34 -0700 Subject: [PATCH 47/63] remove more non version-specific tests --- test_version.sh | 4 +- .../version_specific_tests_dir/A.scala | 7 -- test_version/version_specific_tests_dir/BUILD | 56 ----------- .../version_specific_tests_dir/D.scala | 7 -- .../version_specific_tests_dir/LibToBin.scala | 5 - .../LibToTest.scala | 5 - .../SuiteUsage.scala | 6 -- .../TestFilterTestA.scala | 11 --- .../TestFilterTestB.scala | 11 --- .../version_specific_tests_dir/WORKSPACE | 88 ------------------ .../version_specific_tests_dir/data/BUILD | 5 - .../version_specific_tests_dir/data/foo.txt | 1 - .../version_specific_tests_dir/data/more.txt | 1 - .../version_specific_tests_dir/data/some.txt | 1 - .../example_jars/BUILD | 15 --- .../example_jars/example_jar1.jar | Bin 1728 -> 0 bytes .../example_jars/example_jar2.jar | Bin 1385 -> 0 bytes .../expected_service_manifest.txt | 2 - .../version_specific_tests_dir/fake_sig.jar | Bin 492 -> 0 bytes .../version_specific_tests_dir/gen_src/BUILD | 25 ----- .../gen_src/SrcGenerator.scala | 11 --- .../version_specific_tests_dir/jar_lister.py | 5 - .../version_specific_tests_dir/no_sigs.sh | 13 --- .../src/main/resources/scalarules/test/BUILD | 14 --- .../src/main/resources/scalarules/test/byes | 3 - .../scalarules/test/classpath_resource1/BUILD | 1 - .../classpath_resource1/classpath-resource | 1 - .../scalarules/test/classpath_resource2/BUILD | 1 - .../classpath_resource2/classpath-resource | 1 - .../src/main/resources/scalarules/test/hellos | 3 - .../scalarules/test/hellos-and-byes.jar | Bin 714 -> 0 bytes .../main/resources/scalarules/test/more-byes | 3 - .../resources/scalarules/test/more-hellos | 2 - .../test/BinaryDependentOnJava.scala | 5 - .../test/ResourcesStripScalaBinary.scala | 24 ----- .../test/ResourcesStripScalaLib.scala | 31 ------ .../scalarules/test/ScalaLibResources.scala | 29 ------ .../LocationExpansionTest.scala | 14 --- .../scalarules/test/mix_java_scala/Baz.srcjar | Bin 198 -> 0 bytes .../main/scala/scalarules/test/srcjars/BUILD | 19 ---- .../scalarules/test/srcjars/SourceJar1.scala | 5 - .../scalarules/test/srcjars/SourceJar1.srcjar | Bin 335 -> 0 bytes .../scalarules/test/srcjars/SourceJar2.scala | 5 - .../scalarules/test/srcjars_with_java/BUILD | 27 ------ .../srcjars_with_java/JavaDependent.scala | 5 - .../test/srcjars_with_java/JavaSource.java | 5 - .../srcjars_with_java/JavaSourceJar.srcjar | Bin 241 -> 0 bytes .../MixedLanguageDependent.scala | 5 - .../MixedLanguageSourceJar.srcjar | Bin 437 -> 0 bytes .../test/srcjars_with_java/ScalaSource.scala | 5 - .../scalarules/test/twitter_scrooge/BUILD | 2 +- 51 files changed, 4 insertions(+), 485 deletions(-) delete mode 100644 test_version/version_specific_tests_dir/A.scala delete mode 100644 test_version/version_specific_tests_dir/D.scala delete mode 100644 test_version/version_specific_tests_dir/LibToBin.scala delete mode 100644 test_version/version_specific_tests_dir/LibToTest.scala delete mode 100644 test_version/version_specific_tests_dir/SuiteUsage.scala delete mode 100644 test_version/version_specific_tests_dir/TestFilterTestA.scala delete mode 100644 test_version/version_specific_tests_dir/TestFilterTestB.scala delete mode 100644 test_version/version_specific_tests_dir/WORKSPACE delete mode 100644 test_version/version_specific_tests_dir/data/BUILD delete mode 100644 test_version/version_specific_tests_dir/data/foo.txt delete mode 100644 test_version/version_specific_tests_dir/data/more.txt delete mode 100644 test_version/version_specific_tests_dir/data/some.txt delete mode 100644 test_version/version_specific_tests_dir/example_jars/BUILD delete mode 100755 test_version/version_specific_tests_dir/example_jars/example_jar1.jar delete mode 100755 test_version/version_specific_tests_dir/example_jars/example_jar2.jar delete mode 100644 test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt delete mode 100644 test_version/version_specific_tests_dir/fake_sig.jar delete mode 100644 test_version/version_specific_tests_dir/gen_src/BUILD delete mode 100644 test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala delete mode 100644 test_version/version_specific_tests_dir/jar_lister.py delete mode 100755 test_version/version_specific_tests_dir/no_sigs.sh delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos-and-byes.jar delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes delete mode 100644 test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.srcjar delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/BUILD delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/SourceJar1.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/SourceJar1.srcjar delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars/SourceJar2.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/BUILD delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/JavaDependent.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/JavaSource.java delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/JavaSourceJar.srcjar delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/MixedLanguageDependent.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/MixedLanguageSourceJar.srcjar delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/srcjars_with_java/ScalaSource.scala diff --git a/test_version.sh b/test_version.sh index 417f1ada4..18fd24afe 100755 --- a/test_version.sh +++ b/test_version.sh @@ -1,4 +1,6 @@ -#!/bin/bash -e +#!/bin/bash + +set -e test_scala_version() { SCALA_VERSION=$1 diff --git a/test_version/version_specific_tests_dir/A.scala b/test_version/version_specific_tests_dir/A.scala deleted file mode 100644 index 4954dd4e7..000000000 --- a/test_version/version_specific_tests_dir/A.scala +++ /dev/null @@ -1,7 +0,0 @@ -package scalarules.test - -object A { - def main(args: Array[String]) { - println("4 8 15 16 23 42") - } -} diff --git a/test_version/version_specific_tests_dir/BUILD b/test_version/version_specific_tests_dir/BUILD index 3cff5d966..9d6ef278c 100644 --- a/test_version/version_specific_tests_dir/BUILD +++ b/test_version/version_specific_tests_dir/BUILD @@ -7,8 +7,6 @@ load( "scala_test", "scala_macro_library", "scala_repl", - "scala_test_suite", - "scala_library_suite", "scala_junit_test", "scala_specs2_junit_test", ) @@ -68,24 +66,6 @@ scala_test( ], ) -# test that a library can depend on a test: -scala_library( - name = "lib_to_test", - srcs = ["LibToTest.scala"], - deps = [":HelloLibTest"], -) - -scala_test( - name = "TestFilterTests", - size = "small", - srcs = glob(["TestFilterTest*.scala"]), -) - -scala_repl( - name = "HelloLibTestRepl", - deps = [":HelloLibTest"], -) - scala_library( name = "OtherLib", srcs = ["OtherLib.scala"], @@ -119,11 +99,6 @@ java_library( srcs = ["OtherJavaLib.java"], ) -scala_repl( - name = "ReplWithSources", - srcs = ["A.scala"], -) - #Mix java scala scala_library( name = "MixJavaScalaLib", @@ -144,28 +119,6 @@ scala_binary( deps = ["MixJavaScalaLib"], ) -#Mix java scala (srcjar), much like above only the java is provided via srcjar -scala_library( - name = "MixJavaScalaSrcjarLib", - srcs = glob([ - "src/main/scala/scalarules/test/mix_java_scala/*.scala", - # srcjar created with `jar -cfM Baz.srcjar Baz.java` - "src/main/scala/scalarules/test/mix_java_scala/*.srcjar", - ]), - jvm_flags = [ - "-Xms1G", - "-Xmx4G", - ], -) - -#needed to test java sources are compiled -scala_binary( - name = "MixJavaScalaSrcjarLibBinary", - srcs = ["src/main/scala/scalarules/test/MixJavaScalaLibBinary.scala"], - main_class = "scalarules.test.MixJavaScalaLibBinary", - deps = ["MixJavaScalaSrcjarLib"], -) - scala_library( name = "JUnitCompileTimeDep", srcs = ["src/main/scala/scalarules/test/junit/support/JUnitCompileTimeDep.scala"], @@ -204,7 +157,6 @@ scala_specs2_junit_test( ) for binary in [ "JavaBinary", "MixJavaScalaLibBinary", - "MixJavaScalaSrcjarLibBinary", "ScalaBinary", ]] @@ -217,14 +169,6 @@ scala_junit_test( deps = [":customJunitRunner"], ) -scala_junit_test( - name = "JunitIncludesClassesWithRunWith", - size = "small", - srcs = ["src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala"], - print_discovered_classes = True, - suffixes = ["Test"], -) - scala_library( name = "customJunitRunner", srcs = ["src/main/scala/scalarules/test/junit/JunitCustomRunner.java"], diff --git a/test_version/version_specific_tests_dir/D.scala b/test_version/version_specific_tests_dir/D.scala deleted file mode 100644 index e53d8a220..000000000 --- a/test_version/version_specific_tests_dir/D.scala +++ /dev/null @@ -1,7 +0,0 @@ -package scalarules.test - -object D { - def main(args: Array[String]) { - A.main(args) - } -} diff --git a/test_version/version_specific_tests_dir/LibToBin.scala b/test_version/version_specific_tests_dir/LibToBin.scala deleted file mode 100644 index 6c1ac1766..000000000 --- a/test_version/version_specific_tests_dir/LibToBin.scala +++ /dev/null @@ -1,5 +0,0 @@ -package scalarules.test - -object LibToBin { - def foo = ScalaLibBinary.main(Array("foo")) -} diff --git a/test_version/version_specific_tests_dir/LibToTest.scala b/test_version/version_specific_tests_dir/LibToTest.scala deleted file mode 100644 index fadd58f09..000000000 --- a/test_version/version_specific_tests_dir/LibToTest.scala +++ /dev/null @@ -1,5 +0,0 @@ -package scalarules.test - -object LibToTest { - def foo = TestUtil.foo -} diff --git a/test_version/version_specific_tests_dir/SuiteUsage.scala b/test_version/version_specific_tests_dir/SuiteUsage.scala deleted file mode 100644 index c51c66c70..000000000 --- a/test_version/version_specific_tests_dir/SuiteUsage.scala +++ /dev/null @@ -1,6 +0,0 @@ -package scalarules.test - - -object Usage { - def totV: Int = TestPointA.getV + TestPointA.getV -} diff --git a/test_version/version_specific_tests_dir/TestFilterTestA.scala b/test_version/version_specific_tests_dir/TestFilterTestA.scala deleted file mode 100644 index 7eab40784..000000000 --- a/test_version/version_specific_tests_dir/TestFilterTestA.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scalarules.test - -import org.scalatest.FunSpec - -class TestFilterTestA extends FunSpec { - describe("A") { - it ("tests a") { - assert(true) - } - } -} diff --git a/test_version/version_specific_tests_dir/TestFilterTestB.scala b/test_version/version_specific_tests_dir/TestFilterTestB.scala deleted file mode 100644 index 06e9e798f..000000000 --- a/test_version/version_specific_tests_dir/TestFilterTestB.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scalarules.test - -import org.scalatest.FunSpec - -class TestFilterTestB extends FunSpec { - describe("B") { - it ("tests b") { - assert(true) - } - } -} diff --git a/test_version/version_specific_tests_dir/WORKSPACE b/test_version/version_specific_tests_dir/WORKSPACE deleted file mode 100644 index c63bd4835..000000000 --- a/test_version/version_specific_tests_dir/WORKSPACE +++ /dev/null @@ -1,88 +0,0 @@ -workspace(name = "io_bazel_rules_scala_test") - -local_repository( - name = "io_bazel_rules_scala", - path = "../../" -) - -load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "extract_major_version") - -scala_version = "2.11.12" -scala_major_version = extract_major_version(scala_version) - -load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") - -scala_repositories(scala_version, { -"scala_compiler": "3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0","scala_library": "0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce","scala_reflect": "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04" -}) - -load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library") - -twitter_scrooge(scala_version) - -load("@io_bazel_rules_scala//tut_rule:tut.bzl", "tut_repositories") - -tut_repositories(scala_version) - -load("@io_bazel_rules_scala//jmh:jmh.bzl", "jmh_repositories") - -jmh_repositories() - -load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_repositories") - -scala_proto_repositories(scala_version) - -load("@io_bazel_rules_scala//specs2:specs2_junit.bzl", "specs2_junit_repositories") - -specs2_junit_repositories(scala_version) - -load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "scala_mvn_artifact") - -maven_jar( - name = "org_apache_commons_commons_lang_3_5", - artifact = "org.apache.commons:commons-lang3:3.5", - sha1 = "6c6c702c89bfff3cd9e80b04d668c5e190d588c6", -) - -http_archive( - name = "com_google_protobuf", - sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", - strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", - urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], -) - -http_archive( - name = "com_google_protobuf_java", - sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", - strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", - urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], -) - -load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") - -scala_register_toolchains() - -load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "java_import_external") - -scala_maven_import_external( - name = "com_google_guava_guava_21_0", - artifact = "com.google.guava:guava:21.0", - jar_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480", - licenses = ["notice"], # Apache 2.0 - server_urls = ["https://mirror.bazel.build/repo1.maven.org/maven2"], -) - -# bazel's java_import_external has been altered in rules_scala to be a macro based on jvm_import_external -# in order to allow for other jvm-language imports (e.g. scala_import) -# the 3rd-party dependency below is using the java_import_external macro -# in order to make sure no regression with the original java_import_external -load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "java_import_external") - -java_import_external( - name = "org_apache_commons_commons_lang_3_5_without_file", - generated_linkable_rule_name = "linkable_org_apache_commons_commons_lang_3_5_without_file", - jar_sha256 = "8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c", - jar_urls = ["http://central.maven.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"], - licenses = ["notice"], # Apache 2.0 - neverlink = True, -) diff --git a/test_version/version_specific_tests_dir/data/BUILD b/test_version/version_specific_tests_dir/data/BUILD deleted file mode 100644 index f217a0938..000000000 --- a/test_version/version_specific_tests_dir/data/BUILD +++ /dev/null @@ -1,5 +0,0 @@ -exports_files([ - "some.txt", - "more.txt", - "foo.txt", -]) diff --git a/test_version/version_specific_tests_dir/data/foo.txt b/test_version/version_specific_tests_dir/data/foo.txt deleted file mode 100644 index 5a07b6525..000000000 --- a/test_version/version_specific_tests_dir/data/foo.txt +++ /dev/null @@ -1 +0,0 @@ -this is a test of just random data in some path (not resources) diff --git a/test_version/version_specific_tests_dir/data/more.txt b/test_version/version_specific_tests_dir/data/more.txt deleted file mode 100644 index faf5f2a79..000000000 --- a/test_version/version_specific_tests_dir/data/more.txt +++ /dev/null @@ -1 +0,0 @@ -more hellos diff --git a/test_version/version_specific_tests_dir/data/some.txt b/test_version/version_specific_tests_dir/data/some.txt deleted file mode 100644 index 5a07b6525..000000000 --- a/test_version/version_specific_tests_dir/data/some.txt +++ /dev/null @@ -1 +0,0 @@ -this is a test of just random data in some path (not resources) diff --git a/test_version/version_specific_tests_dir/example_jars/BUILD b/test_version/version_specific_tests_dir/example_jars/BUILD deleted file mode 100644 index 612e2e857..000000000 --- a/test_version/version_specific_tests_dir/example_jars/BUILD +++ /dev/null @@ -1,15 +0,0 @@ -java_import( - name = "example_jar1", - jars = [ - "example_jar1.jar", - ], - visibility = ["//visibility:public"], -) - -java_import( - name = "example_jar2", - jars = [ - "example_jar2.jar", - ], - visibility = ["//visibility:public"], -) diff --git a/test_version/version_specific_tests_dir/example_jars/example_jar1.jar b/test_version/version_specific_tests_dir/example_jars/example_jar1.jar deleted file mode 100755 index 5e75a72e1f12fbfe189501b63ba18fe199f0a047..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1728 zcmWIWW@Zs#;Nak32#QzqW*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5`TA zUPvC1mXg%U_#v*U_I!z!#dC4dC*rEp7_Mf2D*9N&2zG^l;4&o_pdGG2jBtfHh8GwZ z^jw1DgG=&@Qs2(7ZsK^|Ma5CyU*;4 z1Xg$K<8NDk;!Vz_H*Z)Pp0>YbC}1#hdE7BQrALZ0*HF*&*NmjTlV$sF?p+spc-_%- ziR8|QpMRA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)}^@HsG04ufMB0MX(CyZ`_I diff --git a/test_version/version_specific_tests_dir/example_jars/example_jar2.jar b/test_version/version_specific_tests_dir/example_jars/example_jar2.jar deleted file mode 100755 index 67abcec19364e7141e6a4d07677537f3824abfd1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1385 zcmWIWW@Zs#;Nak3$c*(j{<{BKL=j-;__snS@Z(Y5MyxzK6=gyqp9At3C_`%a6JuhD!Pv48Bt5`TA zUPvC1mXg%U_#v*U_I!z!#dC4dC*rEp7_Mf2D*9N&2zG^l;4&o_pdGG2jBte;niqtS zU7_a^93NbgUzGZGh9TD>2LadrM?@HB>*{{zx|bkm+bAxuxK%)aCu;ep7`d}Y{$?q# zZRvVZZ?H$nc(do`-NFoJ)_Kbsm?tPorSDNmF7e3d4*Y&Y@wnL2WoNpt@3p$IwlXqY zwjk^J`tQFF-OEvG5pe3*{_x|h-u7Bv#UtXE-tf=kD-q4DnRg*`^|6a!_8IRNQ_f|$ zS6f{OH8IzH{2?*srp3Y;i*04?ex)e>YYUu`eeOSN)$@AABmBuPYb@tKG!!VwI2RRv zyvuTWb>ewfg-&}O^@?YeK>b_vn4NeIih`nN5mRl-O`x|~Bp?C9#lQfJvH*MmQ=D2< zmYJMdtd9stboJ860SQ-+6r$FAhYSQ<(tEkRP4qPH7BJ)`xSr(P!N3~6;QK|zTY{TJ zf&x^VDkpsn>#EO`@n^X4VMlxekHW!TW4lQ=#9G#wol^vbSZ(sUk~?M6P93sF^Z8rX zl@v?QXSXU#Hi~`WWxjo5`~u~AP(?mWD;RO&7`m#2+E|W0G{hWSr%O@a<&0wQ3S9BGT~a0GAyzQ zpzMX5zChUv0S*J1a1-E31Eime0e31y=)c2=q#vHfknIPhO5{ibrAh?g0fq_Oez<-V phrmJ+6vxOR42oj}U}wf=5b-e{;LXYgGK~!gHvm1g7-${?0{}8+gL41? diff --git a/test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt b/test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt deleted file mode 100644 index 76bf29b8d..000000000 --- a/test_version/version_specific_tests_dir/example_jars/expected_service_manifest.txt +++ /dev/null @@ -1,2 +0,0 @@ -org.apache.beam.sdk.extensions.gcp.storage.GcsFileSystemRegistrar -org.apache.beam.sdk.io.LocalFileSystemRegistrar diff --git a/test_version/version_specific_tests_dir/fake_sig.jar b/test_version/version_specific_tests_dir/fake_sig.jar deleted file mode 100644 index b76b2261cef1a908dade50a1b08b4bae352a0de2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 492 zcmWIWW@h1H00GvLJ6>Q0l;C8LVeoYgan$wnbJGtE;bdU$^a_cb4aB7t+zgB?Ul|z~ zSVVw|1K>uyFGe*&5ZMSfM{id>mtaS*QHelfK*r%T>K#F&f}lpl<1&hoNsbwp*Ce2x z6kvGk2x206lojGp43{B{!}KQ1I0l9#jn2r%Av_H<7UXF>#$tLI+1Ne|W5EFcG!_&9 U7{;=)fxN{GgnxnbO%R6x07d3ay8r+H diff --git a/test_version/version_specific_tests_dir/gen_src/BUILD b/test_version/version_specific_tests_dir/gen_src/BUILD deleted file mode 100644 index d9dc8cb90..000000000 --- a/test_version/version_specific_tests_dir/gen_src/BUILD +++ /dev/null @@ -1,25 +0,0 @@ -load( - "@io_bazel_rules_scala//scala:scala.bzl", - "scala_binary", - "scala_library", -) - -scala_binary( - name = "src_generator", - srcs = ["SrcGenerator.scala"], - main_class = "build.bazel.rulesscala.test.srcgen.SrcGenerator", -) - -genrule( - name = "foo", - srcs = [], - outs = ["foo.scala"], - cmd = "./$(location src_generator) hello foo > \"$@\"", - tools = ["src_generator"], -) - -scala_binary( - name = "uses_gen_file", - srcs = ["foo.scala"], - main_class = "Foo", -) diff --git a/test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala b/test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala deleted file mode 100644 index a97a699da..000000000 --- a/test_version/version_specific_tests_dir/gen_src/SrcGenerator.scala +++ /dev/null @@ -1,11 +0,0 @@ -package build.bazel.rulesscala.test.srcgen - -object SrcGenerator { - def main(args: Array[String]): Unit = { - println(s""" -object Foo { - def hello: String = "hello ${args.toList}" - def main(args: Array[String]): Unit = println(hello) -}""") - } -} diff --git a/test_version/version_specific_tests_dir/jar_lister.py b/test_version/version_specific_tests_dir/jar_lister.py deleted file mode 100644 index 676eb843d..000000000 --- a/test_version/version_specific_tests_dir/jar_lister.py +++ /dev/null @@ -1,5 +0,0 @@ -import zipfile -import sys - -for n in zipfile.ZipFile(sys.argv[1]).namelist(): - print n diff --git a/test_version/version_specific_tests_dir/no_sigs.sh b/test_version/version_specific_tests_dir/no_sigs.sh deleted file mode 100755 index 756ecfd7c..000000000 --- a/test_version/version_specific_tests_dir/no_sigs.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -OUTPUT1=`$1 $2 | grep DSA` -OUTPUT2=`$1 $2 | grep RSA` - -if [[ $OUTPUT1 ]]; then - echo $OUTPUT1 - exit 1 -fi -if [[ $OUTPUT2 ]]; then - echo $OUTPUT2 - exit 1 -fi diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD deleted file mode 100644 index c50f6654b..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/BUILD +++ /dev/null @@ -1,14 +0,0 @@ -exports_files([ - "byes", - "hellos", - "hellos-and-byes.jar", - "more-byes", - "more-hellos", -]) - -genrule( - name = "generated-hello", - outs = ["generated-hello.txt"], - cmd = "echo 'hello' > $@", - visibility = ["//visibility:public"], -) diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes deleted file mode 100644 index 94ab91103..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/byes +++ /dev/null @@ -1,3 +0,0 @@ -see ya -later -A hui hou diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD deleted file mode 100644 index 01bb3389c..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/BUILD +++ /dev/null @@ -1 +0,0 @@ -exports_files(["classpath-resource"]) diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource deleted file mode 100644 index f1127e429..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource1/classpath-resource +++ /dev/null @@ -1 +0,0 @@ -classpath resource 1 diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD deleted file mode 100644 index 01bb3389c..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/BUILD +++ /dev/null @@ -1 +0,0 @@ -exports_files(["classpath-resource"]) diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource deleted file mode 100644 index 4e4333652..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/classpath_resource2/classpath-resource +++ /dev/null @@ -1 +0,0 @@ -classpath resource 2 diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos deleted file mode 100644 index 2d28d85dd..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos +++ /dev/null @@ -1,3 +0,0 @@ -Hello -Guten Tag -Bonjour diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos-and-byes.jar b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/hellos-and-byes.jar deleted file mode 100644 index 0c3e2c47a266fbb21c28c250541b25a482c233b2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 714 zcmWIWW@Zs#;Nak3NNx}FVn70{3@i*zp`Jc2|4uP5c(2tsp|7Rc=YRT)r|z|mFt1fU zx?z_B15SCIJ$aISbJ6GSpwh%c349@XVUxKT0=(Hdrro-etOqpC4u}JATEYU9O{z>S z*7oxaUE%ZOl&6lT?xUiR6B=hjPMpwx$^F=TD!~*L?&r?f-o51Sz0e3B0Cp0%ddai&Aw#t~-5J-z!uD>O|I! z#X{ae-8*DN56tPgol6u1M)J&p^Qu-42XzA4qZ@0p#pfc1$d)sLk>w)O{qW=Kwd@HfgD<(5JrFv zKqkZw=z5R?0u+u2@DIp@hbp=@WdDLf2?4?xq1s^fv4Wk#%D~FN3zS+8#0(4o8+V_X diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes deleted file mode 100644 index 1768e93a9..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-byes +++ /dev/null @@ -1,3 +0,0 @@ -more see ya -more later -A more hui hou diff --git a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos b/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos deleted file mode 100644 index 20f51d648..000000000 --- a/test_version/version_specific_tests_dir/src/main/resources/scalarules/test/more-hellos +++ /dev/null @@ -1,2 +0,0 @@ -More Hello -More Bonjour diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala deleted file mode 100644 index e6227d480..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/BinaryDependentOnJava.scala +++ /dev/null @@ -1,5 +0,0 @@ -package scalarules.test - -object BinaryDependentOnJava extends App { - println(classOf[Alpha]) -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala deleted file mode 100644 index 0bac9b9f7..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaBinary.scala +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package scalarules.test - -object ResourcesStripScalaBinary { - def main(args:Array[String]) { - ResourcesStripScalaLib.getGreetings foreach println - ResourcesStripScalaLib.getFarewells foreach println - ResourcesStripScalaLib.getData foreach println - ResourcesStripScalaLib.getGeneratedHello foreach println - } -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala deleted file mode 100644 index 976758514..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ResourcesStripScalaLib.scala +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package scalarules.test - -object ResourcesStripScalaLib { - def getGreetings() = List("TODO")//get("/src/main/resources/scalarules/test/more-hellos") - - def getFarewells = List("TODO")//get("/src/main/resources/scalarules/test/more-byes") - - def getData = get("/data/more.txt") - - def getGeneratedHello = List("TODO")//get("/src/main/resources/scalarules/test/generated-hello.txt") - - private def get(s: String): List[String] = - scala.io.Source - .fromInputStream(getClass.getResourceAsStream(s)) - .getLines - .toList -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala deleted file mode 100644 index 721ed08cd..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/ScalaLibResources.scala +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Bazel Authors. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -package scalarules.test - -object ScalaLibResources { - def getGreetings() = get("hellos") - - def getFarewells = get("byes") - - def getData = get("/data/some.txt") - - private def get(s: String): List[String] = - scala.io.Source - .fromInputStream(getClass.getResourceAsStream(s)) - .getLines - .toList -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala deleted file mode 100644 index 97e4c15df..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/location_expansion/LocationExpansionTest.scala +++ /dev/null @@ -1,14 +0,0 @@ -package scalarules.test.location_expansion - -import org.specs2.mutable.SpecWithJUnit -class LocationExpansionTest extends SpecWithJUnit { - - "tests" should { - "support location expansion" >> { - sys.props.get("location.expanded") must beSome(contain("worker")) - - } - } - - -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.srcjar b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/mix_java_scala/Baz.srcjar deleted file mode 100644 index 4d1c7f77613b2a7fae53ba28350d8bb59ae9e651..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 198 zcmWIWW@Zs#;Nak3IJ4lg4+9e5U|?ZzO03e$N-RtKcZz{Q+r#IapO1g2hM(UVPaUnZ zp1RkxJ$3aqK6|94;d|<&PngF!PaVCm0Ni8nXFD^>f&rQtC(=Sd=%t?fhMWs2Z#riPm zti+;X{owr4qU2Ps#3DmIu)=?*7#Kv)Y~*cr;9VIq(x?X+wz*K;B zWkSWS>4w_-=2gmS?|Q)&;LXmVm?ro+7U<|yAP(?mWD;ROcm`Pxcn&iVQHhkBgW zIk(~2BP|WzQzw1GJkELQ=!Jdo((&dwr?2bf7rNqE5ChYSoI=ke&Iw+p&v>5+p&LR2PMvR_v2<}j&^-P$&B)@bObh|u>>S^{H?NNbx*-jS1H2iTL>Lfm bLzV-%4HaNcn&iVQHhkBgW zIk(~2BP|WzQzw1GJkELQ=!Jdo((&dwr?2bf7rNqE5ChYSoI=ke&Iw+p&v>5+p&LR2PMvR_v2<}j&^-P$&B)@bObh|u>>S^{H?NNbx*-jS1K=(*Ky#TO zP&PO@F$d Date: Wed, 4 Jul 2018 22:19:38 -0700 Subject: [PATCH 48/63] Remove version from scala labels fix tests - Add deps required for third_party and tut tests --- scala/scala.bzl | 9 ++---- scala/scala_cross_version.bzl | 32 ++++++++----------- test/tut/BUILD | 10 +++--- .../version_specific_tests_dir/tut/BUILD | 10 +++--- third_party/plugin/src/main/BUILD | 1 + third_party/plugin/src/test/BUILD | 1 + tut_rule/tut.bzl | 3 +- 7 files changed, 31 insertions(+), 35 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index ef7926d25..72745b3af 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -372,18 +372,15 @@ def scala_repositories( native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_compiler", - actual = "@io_bazel_rules_scala_scala_compiler_{}".format( - scala_version.replace(".", "_"))) + actual = "@io_bazel_rules_scala_scala_compiler") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_library", - actual = "@io_bazel_rules_scala_scala_library_{}".format( - scala_version.replace(".", "_"))) + actual = "@io_bazel_rules_scala_scala_library") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_reflect", - actual = "@io_bazel_rules_scala_scala_reflect_{}".format( - scala_version.replace(".", "_"))) + actual = "@io_bazel_rules_scala_scala_reflect") native.bind( name = "io_bazel_rules_scala/dependency/scala/scala_xml", diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 8bae79300..6c765bf96 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -5,7 +5,6 @@ # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 -# # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -83,26 +82,26 @@ java_binary( "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar", "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker", "@scalac_rules_commons_io//jar", - "@io_bazel_rules_scala_scala_library_{version_underscore}", - "@io_bazel_rules_scala_scala_reflect_{version_underscore}", - "@io_bazel_rules_scala_scala_compiler_{version_underscore}", + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_compiler", ], ) _declare_scalac_provider( name = "{name}", scalac = "@{name}//:scalac_worker", - #scalacompiler = "@io_bazel_rules_scala_scala_compiler_{version_underscore}", - default_compile_classpath = ["@io_bazel_rules_scala_scala_library_{version_underscore}"], - default_runtime_classpath = ["@io_bazel_rules_scala_scala_library_{version_underscore}"], + #scalacompiler = "@io_bazel_rules_scala_scala_compiler", + default_compile_classpath = ["@io_bazel_rules_scala_scala_library"], + default_runtime_classpath = ["@io_bazel_rules_scala_scala_library"], default_repl_classpath = [ - "@io_bazel_rules_scala_scala_library_{version_underscore}", - "@io_bazel_rules_scala_scala_reflect_{version_underscore}", - "@io_bazel_rules_scala_scala_compiler_{version_underscore}" + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_compiler" ], default_macro_classpath = [ - "@io_bazel_rules_scala_scala_library_{version_underscore}", - "@io_bazel_rules_scala_scala_reflect_{version_underscore}" + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect" ], visibility = ["//visibility:public"], ) @@ -123,24 +122,21 @@ def new_scala_repository(name, scala_version, scala_version_jar_shas, scala_version_underscore = scala_version.replace(".", "_") _scala_maven_import_external( - name = "io_bazel_rules_scala_scala_library_{}".format( - scala_version_underscore), + name = "io_bazel_rules_scala_scala_library", artifact = "org.scala-lang:scala-library:{}".format(scala_version), jar_sha256 = scala_version_jar_shas["scala_library"], licenses = ["notice"], server_urls = maven_servers, ) _scala_maven_import_external( - name = "io_bazel_rules_scala_scala_compiler_{}".format( - scala_version_underscore), + name = "io_bazel_rules_scala_scala_compiler", artifact = "org.scala-lang:scala-compiler:{}".format(scala_version), jar_sha256 = scala_version_jar_shas["scala_compiler"], licenses = ["notice"], server_urls = maven_servers, ) _scala_maven_import_external( - name = "io_bazel_rules_scala_scala_reflect_{}".format( - scala_version_underscore), + name = "io_bazel_rules_scala_scala_reflect", artifact = "org.scala-lang:scala-reflect:{}".format(scala_version), jar_sha256 = scala_version_jar_shas["scala_reflect"], licenses = ["notice"], diff --git a/test/tut/BUILD b/test/tut/BUILD index f2e4c650d..35005cb88 100644 --- a/test/tut/BUILD +++ b/test/tut/BUILD @@ -6,8 +6,8 @@ scala_library( srcs = ["TestDep.scala"], ) -#scala_tut_doc( -# name = "some_example", -# src = "SomeExample.md", -# deps = [":test_dep"], -#) +scala_tut_doc( + name = "some_example", + src = "SomeExample.md", + deps = [":test_dep"], +) diff --git a/test_version/version_specific_tests_dir/tut/BUILD b/test_version/version_specific_tests_dir/tut/BUILD index 012ad91a4..acacc8084 100644 --- a/test_version/version_specific_tests_dir/tut/BUILD +++ b/test_version/version_specific_tests_dir/tut/BUILD @@ -6,8 +6,8 @@ scala_library( srcs = ["TestDep.scala"], ) -#scala_tut_doc( - #name = "some_example", - #src = "SomeExample.md", - #deps = [":test_dep"], -#) +scala_tut_doc( + name = "some_example", + src = "SomeExample.md", + deps = [":test_dep"], +) diff --git a/third_party/plugin/src/main/BUILD b/third_party/plugin/src/main/BUILD index b5954ba50..40fb822a6 100644 --- a/third_party/plugin/src/main/BUILD +++ b/third_party/plugin/src/main/BUILD @@ -11,5 +11,6 @@ scala_library_for_plugin_bootstrapping( visibility = ["//visibility:public"], deps = [ "//external:io_bazel_rules_scala/dependency/scala/scala_compiler", + "//external:io_bazel_rules_scala/dependency/scala/scala_reflect", ], ) diff --git a/third_party/plugin/src/test/BUILD b/third_party/plugin/src/test/BUILD index 68dd168ba..8629d6ab4 100644 --- a/third_party/plugin/src/test/BUILD +++ b/third_party/plugin/src/test/BUILD @@ -19,6 +19,7 @@ scala_junit_test( deps = [ "//external:io_bazel_rules_scala/dependency/scala/scala_compiler", "//external:io_bazel_rules_scala/dependency/scala/scala_library", + "//external:io_bazel_rules_scala/dependency/scala/scala_reflect", "//third_party/plugin/src/main:dependency_analyzer", "@com_google_guava_guava_21_0_with_file//jar", "@org_apache_commons_commons_lang_3_5_without_file//:linkable_org_apache_commons_commons_lang_3_5_without_file", diff --git a/tut_rule/tut.bzl b/tut_rule/tut.bzl index 14adf390b..9a17ea78e 100644 --- a/tut_rule/tut.bzl +++ b/tut_rule/tut.bzl @@ -44,7 +44,8 @@ def scala_tut_doc(**kw): name = tool, main_class = "io.bazel.rules_scala.tut_support.TutCompiler", deps = deps + [ - "@io_bazel_rules_scala//src/scala/io/bazel/rules_scala/tut_support:tut_compiler_lib" + "@io_bazel_rules_scala//src/scala/io/bazel/rules_scala/tut_support:tut_compiler_lib", + "//external:io_bazel_rules_scala/dependency/scala/scala_reflect", ], ) native.genrule( From b43be396c6578cb548c76e2fe2756dff9d43df3d Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 4 Jul 2018 22:30:15 -0700 Subject: [PATCH 49/63] Use default_runtime_classpath for macros, fix aspect test --- scala/private/rule_impls.bzl | 4 ++-- scala/providers.bzl | 6 +++--- scala/scala_cross_version.bzl | 2 +- test/aspect/aspect.bzl | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 3b2f3383a..b22a46276 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -573,8 +573,8 @@ def scala_library_impl(ctx): def scala_macro_library_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - return _lib(ctx, scalac_provider.default_macro_classpath, - scalac_provider.default_macro_classpath, + return _lib(ctx, scalac_provider.default_macro_compile_classpath, + scalac_provider.default_runtime_classpath, False) # don't build the ijar for macros # Common code shared by all scala binary implementations. diff --git a/scala/providers.bzl b/scala/providers.bzl index 6440258d6..2a36a052e 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -31,7 +31,7 @@ ScalacProvider = provider( "scalac", "default_compile_classpath", "default_runtime_classpath", - "default_macro_classpath", + "default_macro_compile_classpath", "default_repl_classpath", ]) @@ -42,7 +42,7 @@ def _declare_scalac_provider(ctx): default_compile_classpath = ctx.attr.default_compile_classpath, default_runtime_classpath = ctx.attr.default_runtime_classpath, default_repl_classpath = ctx.attr.default_repl_classpath, - default_macro_classpath = ctx.attr.default_macro_classpath, + default_macro_compile_classpath = ctx.attr.default_macro_compile_classpath, ) ] @@ -57,5 +57,5 @@ declare_scalac_provider = rule( "default_compile_classpath": attr.label_list(allow_files = True), "default_runtime_classpath": attr.label_list(allow_files = True), "default_repl_classpath": attr.label_list(allow_files = True), - "default_macro_classpath": attr.label_list(allow_files = True), + "default_macro_compile_classpath": attr.label_list(allow_files = True), }) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 6c765bf96..ea184738c 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -99,7 +99,7 @@ _declare_scalac_provider( "@io_bazel_rules_scala_scala_reflect", "@io_bazel_rules_scala_scala_compiler" ], - default_macro_classpath = [ + default_macro_compile_classpath = [ "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect" ], diff --git a/test/aspect/aspect.bzl b/test/aspect/aspect.bzl index dac3fff74..70c5becc7 100644 --- a/test/aspect/aspect.bzl +++ b/test/aspect/aspect.bzl @@ -23,30 +23,30 @@ def _rule_impl(ctx): expected_deps = { "scala_library": [ "//test/aspect:scala_library", - "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", ], "scala_test": [ "//test/aspect:scala_test", - "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala//scala/scalatest:scalatest", ], "scala_junit_test": [ "//test/aspect:scala_junit_test", - "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_junit_junit//jar:jar", "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", ], "scala_specs2_junit_test": [ "//test/aspect:scala_specs2_junit_test", - "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_junit_junit//jar:jar", "@io_bazel_rules_scala_org_hamcrest_hamcrest_core//jar:jar", # From specs2/specs2.bzl:specs2_dependencies() "@io_bazel_rules_scala//specs2:specs2", "@io_bazel_rules_scala_scala_xml//:io_bazel_rules_scala_scala_xml", "@io_bazel_rules_scala_scala_parser_combinators//:io_bazel_rules_scala_scala_parser_combinators", - "@io_bazel_rules_scala_scala_library_2_11_12//:io_bazel_rules_scala_scala_library_2_11_12", - "@io_bazel_rules_scala_scala_reflect_2_11_12//:io_bazel_rules_scala_scala_reflect_2_11_12", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", # From specs2/specs2_junit.bzl:specs2_junit_dependencies() "@io_bazel_rules_scala_org_specs2_specs2_junit//:io_bazel_rules_scala_org_specs2_specs2_junit", ], From 2db2adae04fd89fcb622a717bb2b8b0f526a558a Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 09:29:32 -0700 Subject: [PATCH 50/63] Run more tests in test_version.sh --- test_version.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test_version.sh b/test_version.sh index 18fd24afe..c90e22dac 100755 --- a/test_version.sh +++ b/test_version.sh @@ -2,6 +2,13 @@ set -e +error() { + cd .. + rm -rf $2 + exit $1 +} + + test_scala_version() { SCALA_VERSION=$1 @@ -25,7 +32,17 @@ test_scala_version() { cd $NEW_TEST_DIR + trap 'error $? $NEW_TEST_DIR' ERR + bazel test //... + bazel run src/main/scala/scalarules/test/twitter_scrooge:justscrooges + bazel run :JavaBinary + bazel run :JavaBinary2 + bazel run :JavaOnlySources + bazel run :MixJavaScalaLibBinary + bazel run :MixJavaScalaSrcjarLibBinary + bazel run :ScalaBinary + bazel run :ScalaLibBinary RESPONSE_CODE=$? cd .. From f0c262ccb8e85e10d559369575efe6195b59c1a2 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 09:36:23 -0700 Subject: [PATCH 51/63] Update naming, default_compile_classpath -> base_compile_classpath --- scala/private/rule_impls.bzl | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index b22a46276..1208a18e4 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -481,25 +481,25 @@ def is_dependency_analyzer_off(ctx): # automatically adds dependency on scala-library and scala-reflect # collects jars from deps, runtime jars from runtime_deps, and def _collect_jars_from_common_ctx(ctx, - default_compile_classpath, - default_runtime_classpath, + base_compile_classpath, + base_runtime_classpath, extra_deps = [], extra_runtime_deps = []): dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) - default_cjars = [d[JavaInfo].compile_jars for d in default_compile_classpath] - default_transitive_rjars = [ - d[JavaInfo].transitive_runtime_jars for d in default_runtime_classpath + base_cjars = [d[JavaInfo].compile_jars for d in base_compile_classpath] + base_transitive_rjars = [ + d[JavaInfo].transitive_runtime_jars for d in base_runtime_classpath ] deps_jars = collect_jars(ctx.attr.deps + extra_deps, dependency_analyzer_is_off) (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = ( - depset(transitive = [deps_jars.compile_jars] + default_cjars), + depset(transitive = [deps_jars.compile_jars] + base_cjars), depset(transitive = [deps_jars.transitive_runtime_jars] + - default_transitive_rjars), deps_jars.jars2labels, + base_transitive_rjars), deps_jars.jars2labels, deps_jars.transitive_compile_jars) transitive_rjars = depset( @@ -512,7 +512,7 @@ def _collect_jars_from_common_ctx(ctx, jars2labels = jars2labels, transitive_compile_jars = transitive_compile_jars) -def _lib(ctx, default_compile_classpath, default_runtime_classpath, +def _lib(ctx, base_compile_classpath, base_runtime_classpath, non_macro_lib): # Build up information from dependency-like attributes @@ -520,8 +520,8 @@ def _lib(ctx, default_compile_classpath, default_runtime_classpath, # targets (like thrift code generation) srcjars = collect_srcjars(ctx.attr.deps) - jars = _collect_jars_from_common_ctx(ctx, default_compile_classpath, - default_runtime_classpath) + jars = _collect_jars_from_common_ctx(ctx, base_compile_classpath, + base_runtime_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) write_manifest(ctx) From 78cb80e8e8bf8118523f73e0c759b213194ea335 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 10:43:30 -0700 Subject: [PATCH 52/63] Use base_classpath instead of base_compile.. + base_runtime... Using different base classpaths for compile/runtime requires changes in common.bzl: collect_jars() Use the same base_classpath for both to limit the scope of this PR --- scala/private/rule_impls.bzl | 43 ++++++++++++----------------------- scala/providers.bzl | 15 +++++------- scala/scala_cross_version.bzl | 6 ++--- 3 files changed, 22 insertions(+), 42 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 1208a18e4..98327b119 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -481,26 +481,20 @@ def is_dependency_analyzer_off(ctx): # automatically adds dependency on scala-library and scala-reflect # collects jars from deps, runtime jars from runtime_deps, and def _collect_jars_from_common_ctx(ctx, - base_compile_classpath, - base_runtime_classpath, + base_classpath, extra_deps = [], extra_runtime_deps = []): dependency_analyzer_is_off = is_dependency_analyzer_off(ctx) - base_cjars = [d[JavaInfo].compile_jars for d in base_compile_classpath] - base_transitive_rjars = [ - d[JavaInfo].transitive_runtime_jars for d in base_runtime_classpath - ] - - deps_jars = collect_jars(ctx.attr.deps + extra_deps, + deps_jars = collect_jars(ctx.attr.deps + extra_deps + base_classpath, dependency_analyzer_is_off) - (cjars, transitive_rjars, jars2labels, transitive_compile_jars) = ( - depset(transitive = [deps_jars.compile_jars] + base_cjars), - depset(transitive = [deps_jars.transitive_runtime_jars] + - base_transitive_rjars), deps_jars.jars2labels, - deps_jars.transitive_compile_jars) + (cjars, transitive_rjars, jars2labels, + transitive_compile_jars) = (deps_jars.compile_jars, + deps_jars.transitive_runtime_jars, + deps_jars.jars2labels, + deps_jars.transitive_compile_jars) transitive_rjars = depset( transitive = [transitive_rjars] + @@ -512,16 +506,14 @@ def _collect_jars_from_common_ctx(ctx, jars2labels = jars2labels, transitive_compile_jars = transitive_compile_jars) -def _lib(ctx, base_compile_classpath, base_runtime_classpath, - non_macro_lib): +def _lib(ctx, base_classpath, non_macro_lib): # Build up information from dependency-like attributes # This will be used to pick up srcjars from non-scala library # targets (like thrift code generation) srcjars = collect_srcjars(ctx.attr.deps) - jars = _collect_jars_from_common_ctx(ctx, base_compile_classpath, - base_runtime_classpath) + jars = _collect_jars_from_common_ctx(ctx, base_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) write_manifest(ctx) @@ -568,13 +560,11 @@ def _lib(ctx, base_compile_classpath, base_runtime_classpath, def scala_library_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - return _lib(ctx, scalac_provider.default_compile_classpath, - scalac_provider.default_runtime_classpath, True) + return _lib(ctx, scalac_provider.default_classpath, True) def scala_macro_library_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - return _lib(ctx, scalac_provider.default_macro_compile_classpath, - scalac_provider.default_runtime_classpath, + return _lib(ctx, scalac_provider.default_macro_classpath, False) # don't build the ijar for macros # Common code shared by all scala binary implementations. @@ -622,9 +612,7 @@ def _scala_binary_common(ctx, def scala_binary_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] - jars = _collect_jars_from_common_ctx( - ctx, scalac_provider.default_compile_classpath, - scalac_provider.default_runtime_classpath) + jars = _collect_jars_from_common_ctx(ctx, scalac_provider.default_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) wrapper = _write_java_wrapper(ctx, "", "") @@ -645,7 +633,6 @@ def scala_repl_impl(ctx): jars = _collect_jars_from_common_ctx( ctx, scalac_provider.default_repl_classpath, - scalac_provider.default_repl_classpath, ) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) @@ -698,8 +685,7 @@ def scala_test_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, - scalac_provider.default_compile_classpath, - scalac_provider.default_runtime_classpath, + scalac_provider.default_classpath, extra_runtime_deps = [ ctx.attr._scalatest_reporter, ctx.attr._scalatest_runner ], @@ -764,8 +750,7 @@ def scala_junit_test_impl(ctx): scalac_provider = ctx.attr._scalac[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, - scalac_provider.default_compile_classpath, - scalac_provider.default_runtime_classpath, + scalac_provider.default_classpath, extra_deps = [ ctx.attr._junit, ctx.attr._hamcrest, ctx.attr.suite_label, ctx.attr._bazel_test_runner diff --git a/scala/providers.bzl b/scala/providers.bzl index 2a36a052e..4f271a16d 100644 --- a/scala/providers.bzl +++ b/scala/providers.bzl @@ -29,9 +29,8 @@ ScalacProvider = provider( doc = "ScalaProvider", fields = [ "scalac", - "default_compile_classpath", - "default_runtime_classpath", - "default_macro_compile_classpath", + "default_classpath", + "default_macro_classpath", "default_repl_classpath", ]) @@ -39,10 +38,9 @@ def _declare_scalac_provider(ctx): return [ ScalacProvider( scalac = ctx.attr.scalac, - default_compile_classpath = ctx.attr.default_compile_classpath, - default_runtime_classpath = ctx.attr.default_runtime_classpath, + default_classpath = ctx.attr.default_classpath, default_repl_classpath = ctx.attr.default_repl_classpath, - default_macro_compile_classpath = ctx.attr.default_macro_compile_classpath, + default_macro_classpath = ctx.attr.default_macro_classpath, ) ] @@ -54,8 +52,7 @@ declare_scalac_provider = rule( cfg = "host", allow_files = True, mandatory = True), - "default_compile_classpath": attr.label_list(allow_files = True), - "default_runtime_classpath": attr.label_list(allow_files = True), + "default_classpath": attr.label_list(allow_files = True), "default_repl_classpath": attr.label_list(allow_files = True), - "default_macro_compile_classpath": attr.label_list(allow_files = True), + "default_macro_classpath": attr.label_list(allow_files = True), }) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index ea184738c..40db21967 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -91,15 +91,13 @@ java_binary( _declare_scalac_provider( name = "{name}", scalac = "@{name}//:scalac_worker", - #scalacompiler = "@io_bazel_rules_scala_scala_compiler", - default_compile_classpath = ["@io_bazel_rules_scala_scala_library"], - default_runtime_classpath = ["@io_bazel_rules_scala_scala_library"], + default_classpath = ["@io_bazel_rules_scala_scala_library"], default_repl_classpath = [ "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect", "@io_bazel_rules_scala_scala_compiler" ], - default_macro_compile_classpath = [ + default_macro_classpath = [ "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect" ], From 6c05916076d6a706c8246ee2a1cb58d3ed8c6ba2 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 11:30:04 -0700 Subject: [PATCH 53/63] Add scala_reflect to default_classpath --- scala/scala_cross_version.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 40db21967..9c18d9c0c 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -91,7 +91,10 @@ java_binary( _declare_scalac_provider( name = "{name}", scalac = "@{name}//:scalac_worker", - default_classpath = ["@io_bazel_rules_scala_scala_library"], + default_classpath = [ + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect" + ], default_repl_classpath = [ "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect", From 50cbd5453740a93e33ba5b621267c73cc10fe301 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 11:36:23 -0700 Subject: [PATCH 54/63] scala_version and shas as on tuple paramter - Combine two parameters into one tuple to force the user the specify shas --- scala/scala.bzl | 4 ++-- test_version/WORKSPACE.template | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index 72745b3af..f189011cd 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -256,9 +256,9 @@ scala_repl = rule( ) def scala_repositories( - scala_version = _default_scala_version(), - scala_version_jar_shas = _default_scala_version_jar_shas(), + scala_version_shas = (_default_scala_version(), _default_scala_version_jar_shas()), maven_servers = ["http://central.maven.org/maven2"]): + (scala_version, scala_version_jar_shas) = scala_version_shas major_version = _extract_major_version(scala_version) _new_scala_repository( diff --git a/test_version/WORKSPACE.template b/test_version/WORKSPACE.template index 48c38639c..34904c4dd 100644 --- a/test_version/WORKSPACE.template +++ b/test_version/WORKSPACE.template @@ -12,9 +12,9 @@ scala_major_version = extract_major_version(scala_version) load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") -scala_repositories(scala_version, { +scala_repositories((scala_version, { ${scala_version_shas} -}) +})) load("@io_bazel_rules_scala//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library") From e1b12ba9f5a8acc4bb97922d4b6d626a54933785 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 13:27:18 -0700 Subject: [PATCH 55/63] Reduce amount of version specific junit tests --- test_version.sh | 17 -------------- test_version/version_specific_tests_dir/BUILD | 15 ------------- .../scalarules/test/junit/FilterTest.scala | 21 ------------------ .../JunitAbstractClassAndInterface.scala | 21 ------------------ .../test/junit/JunitCustomRunner.java | 22 ------------------- .../test/junit/JunitCustomRunnerTest.scala | 13 ----------- .../test/junit/JunitIncludesRunWith.scala | 16 -------------- .../junit/JunitIncludesTestHierarchies.scala | 10 --------- .../test/junit/JunitInnerClass.scala | 11 ---------- .../scalarules/test/junit/JunitJavaTest.java | 8 ------- .../test/junit/JunitMultiplePrefixes.scala | 21 ------------------ .../test/junit/JunitMultipleSuffixes.scala | 21 ------------------ .../scalarules/test/junit/JunitNoTests.scala | 11 ---------- .../scala/scalarules/test/junit/scala.scala | 12 ---------- 14 files changed, 219 deletions(-) delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala delete mode 100644 test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala diff --git a/test_version.sh b/test_version.sh index c90e22dac..f6315d79e 100755 --- a/test_version.sh +++ b/test_version.sh @@ -2,13 +2,6 @@ set -e -error() { - cd .. - rm -rf $2 - exit $1 -} - - test_scala_version() { SCALA_VERSION=$1 @@ -31,18 +24,8 @@ test_scala_version() { WORKSPACE.template >> $NEW_TEST_DIR/WORKSPACE cd $NEW_TEST_DIR - - trap 'error $? $NEW_TEST_DIR' ERR bazel test //... - bazel run src/main/scala/scalarules/test/twitter_scrooge:justscrooges - bazel run :JavaBinary - bazel run :JavaBinary2 - bazel run :JavaOnlySources - bazel run :MixJavaScalaLibBinary - bazel run :MixJavaScalaSrcjarLibBinary - bazel run :ScalaBinary - bazel run :ScalaLibBinary RESPONSE_CODE=$? cd .. diff --git a/test_version/version_specific_tests_dir/BUILD b/test_version/version_specific_tests_dir/BUILD index 9d6ef278c..347003586 100644 --- a/test_version/version_specific_tests_dir/BUILD +++ b/test_version/version_specific_tests_dir/BUILD @@ -160,21 +160,6 @@ scala_specs2_junit_test( "ScalaBinary", ]] - -scala_junit_test( - name = "JunitCustomRunner", - size = "small", - srcs = ["src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala"], - suffixes = ["Test"], - deps = [":customJunitRunner"], -) - -scala_library( - name = "customJunitRunner", - srcs = ["src/main/scala/scalarules/test/junit/JunitCustomRunner.java"], - deps = ["//external:io_bazel_rules_scala/dependency/junit/junit"], -) - scala_library( name = "lib_with_scala_proto_dep", srcs = ["TestServer.scala"], diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala deleted file mode 100644 index ae2b9eed2..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/FilterTest.scala +++ /dev/null @@ -1,21 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test - -class FirstFilterTest { - @Test def method1 { println(this.getClass.getName + "#method1") } - @Test def method2 { println(this.getClass.getName + "#method2") } - @Test def method3 { println(this.getClass.getName + "#method3") } -} - -class SecondFilterTest { - @Test def method1 { println(this.getClass.getName + "#method1") } - @Test def method2 { println(this.getClass.getName + "#method2") } - @Test def method3 { println(this.getClass.getName + "#method3") } -} - -class ThirdFilterTest { - @Test def method1 { println(this.getClass.getName + "#method1") } - @Test def method2 { println(this.getClass.getName + "#method2") } - @Test def method3 { println(this.getClass.getName + "#method3") } -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala deleted file mode 100644 index 0f97f38f2..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitAbstractClassAndInterface.scala +++ /dev/null @@ -1,21 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test - -abstract class SomeAbstractTest { - @Test - def abstractTest: Unit = - println("abstract") -} - -trait SomeTraitTest { - @Test - def traitTest: Unit = - println("trait") -} - -class SingleTestSoTargetWillNotFailDueToNoTestsTest { - @Test - def someTest: Unit = - println("passing") -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java deleted file mode 100644 index 15a7b113b..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunner.java +++ /dev/null @@ -1,22 +0,0 @@ -package scalarules.test.junit; - -import java.util.List; -import org.junit.rules.TestRule; -import org.junit.runners.BlockJUnit4ClassRunner; -import org.junit.runners.model.InitializationError; - -public class JunitCustomRunner extends BlockJUnit4ClassRunner { - - public JunitCustomRunner(Class aClass) throws InitializationError { - super(aClass); - } - - public static final String EXPECTED_MESSAGE = "Hello from getTestRules!"; - public static String message; - - @Override - protected List getTestRules(Object target) { - message = EXPECTED_MESSAGE; - return super.getTestRules(target); - } -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala deleted file mode 100644 index cd91e15d4..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitCustomRunnerTest.scala +++ /dev/null @@ -1,13 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test -import org.junit.runner.RunWith - -@RunWith(classOf[JunitCustomRunner]) -class JunitCustomRunnerTest { - @Test - def myTest() = { - assert(JunitCustomRunner.message == JunitCustomRunner.EXPECTED_MESSAGE, - "JunitCustomRunner did not run, check the wiring in JUnitFilteringRunnerBuilder") - } -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala deleted file mode 100644 index 7ee2d5706..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesRunWith.scala +++ /dev/null @@ -1,16 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test -import org.junit.runner.RunWith -import org.junit.runners.Suite -import org.junit.runners.Suite.SuiteClasses - -@RunWith(classOf[Suite]) -@SuiteClasses(Array(classOf[DeclaredInRunWith])) -class RunWithSupportedTest - -class DeclaredInRunWith { - @Test - def runWith: Unit = - println("Test Method From RunWith") -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala deleted file mode 100644 index 11a49c529..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitIncludesTestHierarchies.scala +++ /dev/null @@ -1,10 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test - -abstract class ContractTest { - @Test - def abstractTest: Unit = - println("Test Method From Parent") -} -class ConcreteImplementationTest extends ContractTest diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala deleted file mode 100644 index 3112389cf..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitInnerClass.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test - -class TestClass { - @Test - def someTest: Unit = - println("passing") - - class SomeHelper -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java deleted file mode 100644 index 4edd3f3a5..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitJavaTest.java +++ /dev/null @@ -1,8 +0,0 @@ -package scalarules.test.junit; - -import org.junit.Test; - -public class JunitJavaTest { - @Test - public void someTest() {} -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala deleted file mode 100644 index 74bd30a41..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultiplePrefixes.scala +++ /dev/null @@ -1,21 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test -import org.junit.Assert._ - -class TestJunitCustomPrefix { - - @Test - def someTest: Unit = { - assertEquals(1, 1) - } - -} -class OtherCustomPrefixJunit { - - @Test - def someTest: Unit = { - assertEquals(1, 1) - } - -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala deleted file mode 100644 index 5064a5dc0..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitMultipleSuffixes.scala +++ /dev/null @@ -1,21 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test -import org.junit.Assert._ - -class JunitSuffixE2E { - - @Test - def someTest: Unit = { - assertEquals(1, 1) - } - -} -class JunitSuffixIT { - - @Test - def someTest: Unit = { - assertEquals(1, 1) - } - -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala deleted file mode 100644 index 484d4bc4b..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/JunitNoTests.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test - -class SomeHelpreForTest - -class SingleTestSoTargetWillNotFailDueToNoTestsTest { - @Test - def someTest: Unit = - println("passing") -} diff --git a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala b/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala deleted file mode 100644 index 3fefc0320..000000000 --- a/test_version/version_specific_tests_dir/src/main/scala/scalarules/test/junit/scala.scala +++ /dev/null @@ -1,12 +0,0 @@ -package scalarules.test.junit - -import org.junit.Test -//Used to verify a folder doesn't match in test discovery. -//See JunitMatchesOnlyFilesEvenIfFolderMatchesPattern target -class scala { - - @Test - def atLeastOneTestIsNeeded: Unit = { - } - -} From 4774178890a9d5beea3d7e251c0999ca31bad0fb Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 13:28:22 -0700 Subject: [PATCH 56/63] Run version specific tests --- test_all.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/test_all.sh b/test_all.sh index c869cba1c..7990e3ad5 100755 --- a/test_all.sh +++ b/test_all.sh @@ -4,5 +4,6 @@ set -euo pipefail dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) "${dir}"/test_rules_scala.sh +"${dir}"/test_version.sh "${dir}"/test_reproducibility.sh "${dir}"/test_intellij_aspect.sh From 4661265dd698ab0274d6b2da2228fce7a059c392 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Thu, 5 Jul 2018 13:28:59 -0700 Subject: [PATCH 57/63] Run linter --- scala/scala.bzl | 3 ++- test_version/version_specific_tests_dir/BUILD | 1 - 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scala/scala.bzl b/scala/scala.bzl index f189011cd..da8687d87 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -256,7 +256,8 @@ scala_repl = rule( ) def scala_repositories( - scala_version_shas = (_default_scala_version(), _default_scala_version_jar_shas()), + scala_version_shas = (_default_scala_version(), + _default_scala_version_jar_shas()), maven_servers = ["http://central.maven.org/maven2"]): (scala_version, scala_version_jar_shas) = scala_version_shas major_version = _extract_major_version(scala_version) diff --git a/test_version/version_specific_tests_dir/BUILD b/test_version/version_specific_tests_dir/BUILD index 347003586..26267b8cf 100644 --- a/test_version/version_specific_tests_dir/BUILD +++ b/test_version/version_specific_tests_dir/BUILD @@ -180,4 +180,3 @@ scalapb_proto_library( "//proto:test2", ], ) - From a834ba554b8571c04d0fbd3beb4bf875380090fd Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Wed, 11 Jul 2018 09:44:17 -0700 Subject: [PATCH 58/63] Remove dynamic creation of scala_default ScalacProvider - Avoid having to symlink java sources for scalac_worker - Allows us to only have one scala version at a time --- scala/BUILD | 23 +++++++ scala/scala.bzl | 7 +- scala/scala_cross_version.bzl | 79 +---------------------- src/java/io/bazel/rulesscala/scalac/BUILD | 22 +++++++ twitter_scrooge/twitter_scrooge.bzl | 2 +- 5 files changed, 51 insertions(+), 82 deletions(-) diff --git a/scala/BUILD b/scala/BUILD index b2eefcd35..a0a686b5b 100644 --- a/scala/BUILD +++ b/scala/BUILD @@ -1,3 +1,7 @@ +load( + "@io_bazel_rules_scala//scala:providers.bzl", + _declare_scalac_provider = "declare_scalac_provider", +) load("//scala:scala_toolchain.bzl", "scala_toolchain") toolchain_type( @@ -23,3 +27,22 @@ java_import( jars = ["@bazel_tools//tools/jdk:TestRunner_deploy.jar"], visibility = ["//visibility:public"], ) + +_declare_scalac_provider( + name = "scala_default", + default_classpath = [ + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + ], + default_macro_classpath = [ + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + ], + default_repl_classpath = [ + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_compiler", + ], + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_worker", + visibility = ["//visibility:public"], +) diff --git a/scala/scala.bzl b/scala/scala.bzl index da8687d87..38e59f8ca 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -21,7 +21,7 @@ load( load( "@io_bazel_rules_scala//scala:scala_cross_version.bzl", - _new_scala_repository = "new_scala_repository", + _new_scala_default_repository = "new_scala_default_repository", _extract_major_version = "extract_major_version", _default_scala_version = "default_scala_version", _default_scala_version_jar_shas = "default_scala_version_jar_shas") @@ -58,7 +58,7 @@ _implicit_deps = { "_java_runtime": attr.label( default = Label("@bazel_tools//tools/jdk:current_java_runtime")), "_scalac": attr.label( - default = Label("@io_bazel_rules_scala_scala_default"), + default = Label("@io_bazel_rules_scala//scala:scala_default"), providers = [_ScalacProvider]) } @@ -262,8 +262,7 @@ def scala_repositories( (scala_version, scala_version_jar_shas) = scala_version_shas major_version = _extract_major_version(scala_version) - _new_scala_repository( - name = "io_bazel_rules_scala_scala_default", + _new_scala_default_repository( scala_version = scala_version, scala_version_jar_shas = scala_version_jar_shas, maven_servers = maven_servers) diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 9c18d9c0c..cf437d8a2 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -49,78 +49,8 @@ def extract_major_version_underscore(scala_version): def default_scala_major_version(): return extract_major_version(default_scala_version()) -def _generate_scalac_build_file_impl(repository_ctx): - scalac_worker_srcs = [ - "CompileOptions.java", - "ScalaCInvoker.java", - "ScalacProcessor.java", - "Resource.java", - ] - - for src in scalac_worker_srcs: - path = Label( - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:{}".format( - src)) - repository_ctx.symlink(path, "scalac_worker_srcs_symlinked/{}".format(src)) - - contents = """ -load("@io_bazel_rules_scala//scala:providers.bzl", - _declare_scalac_provider = "declare_scalac_provider", -) - -java_binary( - name = "scalac_worker", - srcs = glob(["scalac_worker_srcs_symlinked/*.java"]), - javacopts = [ - "-source 1.8", - "-target 1.8" - ], - main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", - visibility = ["//visibility:public"], - deps = [ - "@io_bazel_rules_scala//src/java/com/google/devtools/build/lib:worker", - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar", - "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker", - "@scalac_rules_commons_io//jar", - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect", - "@io_bazel_rules_scala_scala_compiler", - ], -) - -_declare_scalac_provider( - name = "{name}", - scalac = "@{name}//:scalac_worker", - default_classpath = [ - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect" - ], - default_repl_classpath = [ - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect", - "@io_bazel_rules_scala_scala_compiler" - ], - default_macro_classpath = [ - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect" - ], - visibility = ["//visibility:public"], -) - """.format( - name = repository_ctx.attr.name, - version_underscore = repository_ctx.attr.version_underscore) - - repository_ctx.file("BUILD", contents, False) - -_generate_scalac_build_file = repository_rule( - implementation = _generate_scalac_build_file_impl, - attrs = { - "version_underscore": attr.string(), - }) - -def new_scala_repository(name, scala_version, scala_version_jar_shas, - maven_servers): - scala_version_underscore = scala_version.replace(".", "_") +def new_scala_default_repository(scala_version, scala_version_jar_shas, + maven_servers): _scala_maven_import_external( name = "io_bazel_rules_scala_scala_library", @@ -143,8 +73,3 @@ def new_scala_repository(name, scala_version, scala_version_jar_shas, licenses = ["notice"], server_urls = maven_servers, ) - - _generate_scalac_build_file( - name = name, - version_underscore = scala_version_underscore, - visibility = ["//visibility:public"]) diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index bd5335a05..f6b7dec90 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -1,3 +1,25 @@ +java_binary( + name = "scalac_worker", + srcs = [ + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_files", + ], + javacopts = [ + "-source 1.8", + "-target 1.8", + ], + main_class = "io.bazel.rulesscala.scalac.ScalaCInvoker", + visibility = ["//visibility:public"], + deps = [ + "@io_bazel_rules_scala//src/java/com/google/devtools/build/lib:worker", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/jar", + "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/worker", + "@io_bazel_rules_scala_scala_compiler", + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + "@scalac_rules_commons_io//jar", + ], +) + filegroup( name = "scalac_files", srcs = [ diff --git a/twitter_scrooge/twitter_scrooge.bzl b/twitter_scrooge/twitter_scrooge.bzl index 219401876..0adf7c6db 100644 --- a/twitter_scrooge/twitter_scrooge.bzl +++ b/twitter_scrooge/twitter_scrooge.bzl @@ -302,7 +302,7 @@ scrooge_aspect = aspect( default = Label("//src/scala/scripts:generator"), allow_files = True), "_scalac": attr.label( - default = Label("@io_bazel_rules_scala_scala_default"), + default = Label("@io_bazel_rules_scala//scala:scala_default"), providers = [_ScalacProvider]), "_implicit_compile_deps": attr.label_list( providers = [JavaInfo], From e518edc55be30b7354a8423b27075a8bb79c1e71 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 16 Jul 2018 10:30:18 -0700 Subject: [PATCH 59/63] PR comments, clearer naming --- scala/BUILD | 16 ++++++++-------- scala/private/rule_impls.bzl | 14 +++++++------- scala/scala.bzl | 2 +- scala/scala_cross_version.bzl | 16 ++++++++-------- specs2/BUILD | 10 +++++----- src/java/io/bazel/rulesscala/scalac/BUILD | 2 +- 6 files changed, 30 insertions(+), 30 deletions(-) diff --git a/scala/BUILD b/scala/BUILD index a0a686b5b..0bce7c729 100644 --- a/scala/BUILD +++ b/scala/BUILD @@ -31,18 +31,18 @@ java_import( _declare_scalac_provider( name = "scala_default", default_classpath = [ - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", ], default_macro_classpath = [ - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", ], default_repl_classpath = [ - "@io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect", - "@io_bazel_rules_scala_scala_compiler", + "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_compiler//:io_bazel_rules_scala_scala_compiler", ], - scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_worker", + scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac", visibility = ["//visibility:public"], ) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index 98327b119..533b4b9ee 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -335,7 +335,7 @@ def _compile_or_empty(ctx, manifest, jars, srcjars, buildijar, ctx.attr.resource_strip_prefix, ctx.files.resources, ctx.files.resource_jars, jars2labels, ctx.attr.scalacopts, ctx.attr.print_compile_time, ctx.attr.expect_java_output, - ctx.attr.scalac_jvm_flags, ctx.attr._scalac[_ScalacProvider]) + ctx.attr.scalac_jvm_flags, ctx.attr._scala_provider[_ScalacProvider]) # build ijar if needed if buildijar: @@ -559,11 +559,11 @@ def _lib(ctx, base_classpath, non_macro_lib): ) def scala_library_impl(ctx): - scalac_provider = ctx.attr._scalac[_ScalacProvider] + scalac_provider = ctx.attr._scala_provider[_ScalacProvider] return _lib(ctx, scalac_provider.default_classpath, True) def scala_macro_library_impl(ctx): - scalac_provider = ctx.attr._scalac[_ScalacProvider] + scalac_provider = ctx.attr._scala_provider[_ScalacProvider] return _lib(ctx, scalac_provider.default_macro_classpath, False) # don't build the ijar for macros @@ -611,7 +611,7 @@ def _scala_binary_common(ctx, runfiles = runfiles) def scala_binary_impl(ctx): - scalac_provider = ctx.attr._scalac[_ScalacProvider] + scalac_provider = ctx.attr._scala_provider[_ScalacProvider] jars = _collect_jars_from_common_ctx(ctx, scalac_provider.default_classpath) (cjars, transitive_rjars) = (jars.compile_jars, jars.transitive_runtime_jars) @@ -628,7 +628,7 @@ def scala_binary_impl(ctx): return out def scala_repl_impl(ctx): - scalac_provider = ctx.attr._scalac[_ScalacProvider] + scalac_provider = ctx.attr._scala_provider[_ScalacProvider] # need scala-compiler for MainGenericRunner below jars = _collect_jars_from_common_ctx( ctx, @@ -682,7 +682,7 @@ def scala_test_impl(ctx): if len(ctx.attr.suites) != 0: print("suites attribute is deprecated. All scalatest test suites are run") - scalac_provider = ctx.attr._scalac[_ScalacProvider] + scalac_provider = ctx.attr._scala_provider[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, scalac_provider.default_classpath, @@ -747,7 +747,7 @@ def scala_junit_test_impl(ctx): fail( "Setting at least one of the attributes ('prefixes','suffixes') is required" ) - scalac_provider = ctx.attr._scalac[_ScalacProvider] + scalac_provider = ctx.attr._scala_provider[_ScalacProvider] jars = _collect_jars_from_common_ctx( ctx, scalac_provider.default_classpath, diff --git a/scala/scala.bzl b/scala/scala.bzl index 38e59f8ca..41e99e3ca 100644 --- a/scala/scala.bzl +++ b/scala/scala.bzl @@ -57,7 +57,7 @@ _implicit_deps = { cfg = "host"), "_java_runtime": attr.label( default = Label("@bazel_tools//tools/jdk:current_java_runtime")), - "_scalac": attr.label( + "_scala_provider": attr.label( default = Label("@io_bazel_rules_scala//scala:scala_default"), providers = [_ScalacProvider]) } diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index cf437d8a2..578f3ecb6 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -29,14 +29,6 @@ def default_scala_version_jar_shas(): "scala_reflect": "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04", } -def scala_mvn_artifact(artifact, major_scala_version): - """Add scala version to maven artifact""" - gav = artifact.split(":") - groupid = gav[0] - artifactid = gav[1] - version = gav[2] - return "%s:%s_%s:%s" % (groupid, artifactid, major_scala_version, version) - def extract_major_version(scala_version): """Return major Scala version given a full version, e.g. "2.11.11" -> "2.11" """ return scala_version[:scala_version.find(".", 2)] @@ -49,6 +41,14 @@ def extract_major_version_underscore(scala_version): def default_scala_major_version(): return extract_major_version(default_scala_version()) +def scala_mvn_artifact(artifact, major_scala_version = default_scala_major_version()): + """Add scala version to maven artifact""" + gav = artifact.split(":") + groupid = gav[0] + artifactid = gav[1] + version = gav[2] + return "%s:%s_%s:%s" % (groupid, artifactid, major_scala_version, version) + def new_scala_default_repository(scala_version, scala_version_jar_shas, maven_servers): diff --git a/specs2/BUILD b/specs2/BUILD index 8106d7c6a..2b4d2b0a0 100644 --- a/specs2/BUILD +++ b/specs2/BUILD @@ -4,11 +4,11 @@ java_import( name = "specs2", jars = [], exports = [ - "@io_bazel_rules_scala_org_scalaz_scalaz_core", - "@io_bazel_rules_scala_org_scalaz_scalaz_effect", - "@io_bazel_rules_scala_org_specs2_specs2_common", - "@io_bazel_rules_scala_org_specs2_specs2_core", - "@io_bazel_rules_scala_org_specs2_specs2_matcher", + "@io_bazel_rules_scala_org_scalaz_scalaz_core//:io_bazel_rules_scala_org_scalaz_scalaz_core", + "@io_bazel_rules_scala_org_scalaz_scalaz_effect//:io_bazel_rules_scala_org_scalaz_scalaz_effect", + "@io_bazel_rules_scala_org_specs2_specs2_common//:io_bazel_rules_scala_org_specs2_specs2_common", + "@io_bazel_rules_scala_org_specs2_specs2_core//:io_bazel_rules_scala_org_specs2_specs2_core", + "@io_bazel_rules_scala_org_specs2_specs2_matcher//:io_bazel_rules_scala_org_specs2_specs2_matcher", ], deps = [ "//external:io_bazel_rules_scala/dependency/scala/parser_combinators", diff --git a/src/java/io/bazel/rulesscala/scalac/BUILD b/src/java/io/bazel/rulesscala/scalac/BUILD index f6b7dec90..d7da9c54a 100644 --- a/src/java/io/bazel/rulesscala/scalac/BUILD +++ b/src/java/io/bazel/rulesscala/scalac/BUILD @@ -1,5 +1,5 @@ java_binary( - name = "scalac_worker", + name = "scalac", srcs = [ "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac:scalac_files", ], From 25db5f620f92191b02db30942a837348fb2b1155 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 16 Jul 2018 10:42:49 -0700 Subject: [PATCH 60/63] Use ctx.attr._scala_provider instead of ..attr.scalalib, run linter --- scala/private/rule_impls.bzl | 17 +++++++++-------- scala/scala_cross_version.bzl | 3 ++- specs2/BUILD | 10 +++++----- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index a6015319e..7f75ef0bf 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -271,7 +271,8 @@ def try_to_compile_java_jar(ctx, scala_output, all_srcjars, java_srcs, providers_of_dependencies = collect_java_providers_of(ctx.attr.deps) providers_of_dependencies += collect_java_providers_of( implicit_junit_deps_needed_for_java_compilation) - providers_of_dependencies += collect_java_providers_of([ctx.attr._scalalib]) + providers_of_dependencies += collect_java_providers_of( + ctx.attr._scala_provider[_ScalacProvider].default_classpath) scala_sources_java_provider = _interim_java_provider_for_java_compilation( scala_output) providers_of_dependencies += [scala_sources_java_provider] @@ -331,13 +332,13 @@ def _compile_or_empty(ctx, manifest, jars, srcjars, buildijar, sources = [ f for f in ctx.files.srcs if f.basename.endswith(_scala_extension) ] + java_srcs - compile_scala(ctx, ctx.label, ctx.outputs.jar, manifest, - ctx.outputs.statsfile, sources, jars, all_srcjars, - transitive_compile_jars, ctx.attr.plugins, - ctx.attr.resource_strip_prefix, ctx.files.resources, - ctx.files.resource_jars, jars2labels, ctx.attr.scalacopts, - ctx.attr.print_compile_time, ctx.attr.expect_java_output, - ctx.attr.scalac_jvm_flags, ctx.attr._scala_provider[_ScalacProvider]) + compile_scala( + ctx, ctx.label, ctx.outputs.jar, manifest, ctx.outputs.statsfile, + sources, jars, all_srcjars, transitive_compile_jars, ctx.attr.plugins, + ctx.attr.resource_strip_prefix, ctx.files.resources, + ctx.files.resource_jars, jars2labels, ctx.attr.scalacopts, + ctx.attr.print_compile_time, ctx.attr.expect_java_output, + ctx.attr.scalac_jvm_flags, ctx.attr._scala_provider[_ScalacProvider]) # build ijar if needed if buildijar: diff --git a/scala/scala_cross_version.bzl b/scala/scala_cross_version.bzl index 578f3ecb6..3b9c7c1b8 100644 --- a/scala/scala_cross_version.bzl +++ b/scala/scala_cross_version.bzl @@ -41,7 +41,8 @@ def extract_major_version_underscore(scala_version): def default_scala_major_version(): return extract_major_version(default_scala_version()) -def scala_mvn_artifact(artifact, major_scala_version = default_scala_major_version()): +def scala_mvn_artifact(artifact, + major_scala_version = default_scala_major_version()): """Add scala version to maven artifact""" gav = artifact.split(":") groupid = gav[0] diff --git a/specs2/BUILD b/specs2/BUILD index 2b4d2b0a0..8106d7c6a 100644 --- a/specs2/BUILD +++ b/specs2/BUILD @@ -4,11 +4,11 @@ java_import( name = "specs2", jars = [], exports = [ - "@io_bazel_rules_scala_org_scalaz_scalaz_core//:io_bazel_rules_scala_org_scalaz_scalaz_core", - "@io_bazel_rules_scala_org_scalaz_scalaz_effect//:io_bazel_rules_scala_org_scalaz_scalaz_effect", - "@io_bazel_rules_scala_org_specs2_specs2_common//:io_bazel_rules_scala_org_specs2_specs2_common", - "@io_bazel_rules_scala_org_specs2_specs2_core//:io_bazel_rules_scala_org_specs2_specs2_core", - "@io_bazel_rules_scala_org_specs2_specs2_matcher//:io_bazel_rules_scala_org_specs2_specs2_matcher", + "@io_bazel_rules_scala_org_scalaz_scalaz_core", + "@io_bazel_rules_scala_org_scalaz_scalaz_effect", + "@io_bazel_rules_scala_org_specs2_specs2_common", + "@io_bazel_rules_scala_org_specs2_specs2_core", + "@io_bazel_rules_scala_org_specs2_specs2_matcher", ], deps = [ "//external:io_bazel_rules_scala/dependency/scala/parser_combinators", From 20ee54459b3b7d4059a6eba05e6548ce0e5dc864 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 16 Jul 2018 15:27:35 -0700 Subject: [PATCH 61/63] Address comments, clean up WORKSPACE.template --- scala/BUILD | 14 +++++----- test_version/WORKSPACE.template | 48 ++------------------------------- 2 files changed, 9 insertions(+), 53 deletions(-) diff --git a/scala/BUILD b/scala/BUILD index 0bce7c729..c76b2defb 100644 --- a/scala/BUILD +++ b/scala/BUILD @@ -31,17 +31,17 @@ java_import( _declare_scalac_provider( name = "scala_default", default_classpath = [ - "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", ], default_macro_classpath = [ - "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", ], default_repl_classpath = [ - "@io_bazel_rules_scala_scala_library//:io_bazel_rules_scala_scala_library", - "@io_bazel_rules_scala_scala_reflect//:io_bazel_rules_scala_scala_reflect", - "@io_bazel_rules_scala_scala_compiler//:io_bazel_rules_scala_scala_compiler", + "@io_bazel_rules_scala_scala_library", + "@io_bazel_rules_scala_scala_reflect", + "@io_bazel_rules_scala_scala_compiler", ], scalac = "@io_bazel_rules_scala//src/java/io/bazel/rulesscala/scalac", visibility = ["//visibility:public"], diff --git a/test_version/WORKSPACE.template b/test_version/WORKSPACE.template index 34904c4dd..08cb573e0 100644 --- a/test_version/WORKSPACE.template +++ b/test_version/WORKSPACE.template @@ -24,10 +24,6 @@ load("@io_bazel_rules_scala//tut_rule:tut.bzl", "tut_repositories") tut_repositories(scala_version) -load("@io_bazel_rules_scala//jmh:jmh.bzl", "jmh_repositories") - -jmh_repositories() - load("@io_bazel_rules_scala//scala_proto:scala_proto.bzl", "scala_proto_repositories") scala_proto_repositories(scala_version) @@ -36,13 +32,9 @@ load("@io_bazel_rules_scala//specs2:specs2_junit.bzl", "specs2_junit_repositorie specs2_junit_repositories(scala_version) -load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "scala_mvn_artifact") +load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") -maven_jar( - name = "org_apache_commons_commons_lang_3_5", - artifact = "org.apache.commons:commons-lang3:3.5", - sha1 = "6c6c702c89bfff3cd9e80b04d668c5e190d588c6", -) +scala_register_toolchains() http_archive( name = "com_google_protobuf", @@ -50,39 +42,3 @@ http_archive( strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], ) - -http_archive( - name = "com_google_protobuf_java", - sha256 = "118ac276be0db540ff2a89cecc5dfb9606d4d16e91cc4ea8883ae8160acb5163", - strip_prefix = "protobuf-0456e269ee6505766474aa8d7b8bba7ac047f457", - urls = ["https://github.com/google/protobuf/archive/0456e269ee6505766474aa8d7b8bba7ac047f457.zip"], -) - -load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") - -scala_register_toolchains() - -load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "scala_maven_import_external", "java_import_external") - -scala_maven_import_external( - name = "com_google_guava_guava_21_0", - artifact = "com.google.guava:guava:21.0", - jar_sha256 = "972139718abc8a4893fa78cba8cf7b2c903f35c97aaf44fa3031b0669948b480", - licenses = ["notice"], # Apache 2.0 - server_urls = ["https://mirror.bazel.build/repo1.maven.org/maven2"], -) - -# bazel's java_import_external has been altered in rules_scala to be a macro based on jvm_import_external -# in order to allow for other jvm-language imports (e.g. scala_import) -# the 3rd-party dependency below is using the java_import_external macro -# in order to make sure no regression with the original java_import_external -load("@io_bazel_rules_scala//scala:scala_maven_import_external.bzl", "java_import_external") - -java_import_external( - name = "org_apache_commons_commons_lang_3_5_without_file", - generated_linkable_rule_name = "linkable_org_apache_commons_commons_lang_3_5_without_file", - jar_sha256 = "8ac96fc686512d777fca85e144f196cd7cfe0c0aec23127229497d1a38ff651c", - jar_urls = ["http://central.maven.org/maven2/org/apache/commons/commons-lang3/3.5/commons-lang3-3.5.jar"], - licenses = ["notice"], # Apache 2.0 - neverlink = True, -) From c9dffbf1333f48c4627afbdf48c399218b4d3996 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 16 Jul 2018 15:48:01 -0700 Subject: [PATCH 62/63] Remove unused code --- test_version/WORKSPACE.template | 1 - 1 file changed, 1 deletion(-) diff --git a/test_version/WORKSPACE.template b/test_version/WORKSPACE.template index 08cb573e0..f01bcf151 100644 --- a/test_version/WORKSPACE.template +++ b/test_version/WORKSPACE.template @@ -8,7 +8,6 @@ local_repository( load("@io_bazel_rules_scala//scala:scala_cross_version.bzl", "extract_major_version") scala_version = "${scala_version}" -scala_major_version = extract_major_version(scala_version) load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") From b131900e7befeab6cc372e38d8c2c4c794a6b3d5 Mon Sep 17 00:00:00 2001 From: Johan Jern Date: Mon, 16 Jul 2018 16:30:32 -0700 Subject: [PATCH 63/63] Add section about different scala versions to the readme --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index d7495a5d7..8802ed390 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,25 @@ test --strategy=Scalac=worker ``` to your command line, or to enable by default for building/testing add it to your .bazelrc. +## Selecting Scala version + +Rules scala supports all minor versions of Scala 2.11/2.12. By default `Scala 2.11.12` is used and to use another +version you need to +specify it when calling `scala_repositories`. `scala_repositories` takes a tuple `(scala_version, scala_version_jar_shas)` +as a parameter where `scala_version` is the scala version and `scala_version_jar_shas` is a `dict` with +`sha256` hashes for the maven artifacts `scala_library`, `scala_reflect` and `scala_compiler`: +```python +scala_repositories(("2.12.6", { + "scala_compiler": "3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0", + "scala_library": "0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce", + "scala_reflect": "6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04" +})) +``` +If you're using any of the rules `twitter_scrooge`, `tut_repositories`, `scala_proto_repositories` +or `specs2_junit_repositories` you also need to specify `scala_version` for them. See `./test_version/WORKSPACE.template` +for an example workspace using another scala version. + + ## Bazel compatible versions | bazel | rules_scala gitsha |