diff --git a/.bazelrc b/.bazelrc index 17b9d55..2396a7d 100644 --- a/.bazelrc +++ b/.bazelrc @@ -2,8 +2,6 @@ startup --expand_configs_in_place common:ci --color=yes -common --experimental_output_paths=off - build --strategy=worker,sandboxed,local build --verbose_failures diff --git a/WORKSPACE b/WORKSPACE index de38b7a..0b76e22 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -2,6 +2,7 @@ workspace(name = "rules_play_routes") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") +# rules_java http_archive( name = "rules_java", sha256 = "6f3ce0e9fba979a844faba2d60467843fbf5191d8ca61fa3d2ea17655b56bb8c", @@ -17,11 +18,11 @@ rules_java_dependencies() register_toolchains("//:repository_default_toolchain_21_definition") # rules_jvm_external -rules_jvm_external_version = "6.2" +rules_jvm_external_version = "6.4" http_archive( name = "rules_jvm_external", - sha256 = "aa39ecd47e16d5870eba817fe71476802bc371fe2724a2ddee565992df55f4af", + sha256 = "8c92f7c7a57273c692da459f70bd72464c87442e86b9e0b495950a7c554c254f", strip_prefix = "rules_jvm_external-{}".format(rules_jvm_external_version), type = "zip", url = "https://github.com/bazelbuild/rules_jvm_external/archive/{}.zip".format(rules_jvm_external_version), diff --git a/play-routes-compiler-cli/CommandLinePlayRoutesCompiler.scala b/play-routes-compiler-cli/CommandLinePlayRoutesCompiler.scala index 8fae971..2cfa6c5 100644 --- a/play-routes-compiler-cli/CommandLinePlayRoutesCompiler.scala +++ b/play-routes-compiler-cli/CommandLinePlayRoutesCompiler.scala @@ -2,6 +2,7 @@ package rulesplayroutes.routes import com.google.devtools.build.buildjar.jarhelper.JarCreator import higherkindness.rules_scala.common.error.AnnexWorkerError +import higherkindness.rules_scala.common.interrupt.InterruptUtil import higherkindness.rules_scala.common.worker.WorkerMain import higherkindness.rules_scala.common.sandbox.SandboxUtil import java.io.{File, PrintStream} @@ -121,6 +122,7 @@ object CommandLinePlayRoutesCompiler extends WorkerMain[Unit] { config.outputDirectory.toFile(), ) match { case Right(generatedFiles) => + InterruptUtil.throwIfInterrupted() generatedFiles.foreach { f => stripHeader(f.getPath) } @@ -159,9 +161,12 @@ object CommandLinePlayRoutesCompiler extends WorkerMain[Unit] { val config = parser(workDir).parse( readArgsFromArgFiles(args), Config() ).getOrElse(throw new AnnexWorkerError(1)) + InterruptUtil.throwIfInterrupted() compilePlayRoutes(config, out) match { - case Success(_) => generateJar(config) + case Success(_) => + InterruptUtil.throwIfInterrupted() + generateJar(config) case Failure(e) => throw new AnnexWorkerError(1, "Failed to compile play routes", e) } } diff --git a/play-routes-compiler-cli/play-routes-compiler-cli.bzl b/play-routes-compiler-cli/play-routes-compiler-cli.bzl index 4afc158..2c2a6d4 100644 --- a/play-routes-compiler-cli/play-routes-compiler-cli.bzl +++ b/play-routes-compiler-cli/play-routes-compiler-cli.bzl @@ -31,6 +31,7 @@ def generate_play_routes_compiler_targets(scala_version): "@play_routes_compiler_cli_{}//:com_google_protobuf_protobuf_java".format(scala_version_underscore), "@play_routes_compiler_cli_{}//:org_playframework_play_routes_compiler_{}".format(scala_version_underscore, scala_version_underscore), "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/error", + "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/interrupt", "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/sandbox", "@rules_scala_annex//src/main/scala/higherkindness/rules_scala/common/worker", ], diff --git a/play-routes/play-routes.bzl b/play-routes/play-routes.bzl index e88a887..fd9ab60 100644 --- a/play-routes/play-routes.bzl +++ b/play-routes/play-routes.bzl @@ -1,4 +1,3 @@ -load("@rules_java//java/common:java_info.bzl", "JavaInfo") load("//play-routes-toolchain:transitions.bzl", "play_routes_toolchain_transition", "reset_play_routes_toolchain_transition") """Play Routes rules @@ -28,11 +27,10 @@ def _format_import_arg(import_arg): def _impl(ctx): output_dir = ctx.actions.declare_directory("play_routes_{}".format(_sanitize_string_for_usage(ctx.attr.name))) - paths = [f.path for f in ctx.files.srcs] args = ctx.actions.args() - args.add(output_dir.path) + args.add_all([output_dir], expand_directories = False) args.add(ctx.outputs.srcjar) - args.add_all([",".join(paths)]) + args.add_joined(ctx.files.srcs, join_with = ",") if ctx.attr.include_play_imports: args.add_all(play_imports, map_each = _format_import_arg) @@ -64,6 +62,7 @@ def _impl(ctx): "supports-multiplex-workers": "1", "supports-multiplex-sandboxing": "1", "supports-worker-cancellation": "1", + "supports-path-mapping": "1", }, progress_message = "Compiling play routes %{label}", use_default_shell_env = True,