Skip to content

Commit

Permalink
fix: disable workers on Windows due to #228 (#245)
Browse files Browse the repository at this point in the history
  • Loading branch information
gregmagolan authored Nov 16, 2022
1 parent 3212673 commit b424e54
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 72 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ rules_ts is just a part of what Aspect provides:
Known issues:

- Does not work with `--worker_sandboxing`. See https://github.com/aspect-build/rules_ts/issues/127#issuecomment-1312041592
- Workers are disabled and not currently supported on Windows hosts. See https://github.com/aspect-build/rules_ts/issues/228.

## Installation

Expand Down
10 changes: 5 additions & 5 deletions ts/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ bzl_library(
srcs = ["defs.bzl"],
visibility = ["//visibility:public"],
deps = [
"//ts/private:ts_config",
"//ts/private:ts_project",
"//ts/private/docs:ts_config",
"//ts/private/docs:ts_project",
"@aspect_rules_js//js:defs",
"@bazel_skylib//lib:partial",
"@bazel_skylib//rules:build_test",
Expand All @@ -23,9 +23,9 @@ bzl_library(
srcs = ["repositories.bzl"],
visibility = ["//visibility:public"],
deps = [
"//ts/private:maybe",
"//ts/private:npm_repositories",
"//ts/private:versions",
"//ts/private/docs:maybe",
"//ts/private/docs:npm_repositories",
"//ts/private/docs:versions",
"@bazel_tools//tools/build_defs/repo:http.bzl",
"@bazel_tools//tools/build_defs/repo:utils.bzl",
],
Expand Down
70 changes: 4 additions & 66 deletions ts/private/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,68 +1,6 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

exports_files([
"ts_project.bzl",
"ts_project_options_validator.js",
"ts_project_worker.js",
])

bzl_library(
name = "npm_repositories",
srcs = ["npm_repositories.bzl"],
visibility = ["//:__subpackages__"],
deps = [
":versions",
"@bazel_tools//tools/build_defs/repo:http.bzl",
exports_files(
glob(["*.bzl"]) + [
"ts_project_options_validator.js",
"ts_project_worker.js",
],
)

bzl_library(
name = "ts_project",
srcs = ["ts_project.bzl"],
visibility = ["//:__subpackages__"],
deps = [
":ts_validate_options",
"@aspect_bazel_lib//lib:copy_to_bin",
"@aspect_bazel_lib//lib:utils",
"@aspect_rules_js//js:libs",
"@aspect_rules_js//js:providers",
"@bazel_skylib//lib:dicts",
],
)

bzl_library(
name = "ts_config",
srcs = ["ts_config.bzl"],
visibility = ["//ts:__subpackages__"],
deps = [":ts_lib"],
)

bzl_library(
name = "ts_lib",
srcs = ["ts_lib.bzl"],
visibility = ["//ts:__subpackages__"],
deps = ["@aspect_rules_js//js:providers"],
)

bzl_library(
name = "ts_validate_options",
srcs = ["ts_validate_options.bzl"],
visibility = ["//ts:__subpackages__"],
deps = [
":ts_config",
":ts_lib",
"@aspect_bazel_lib//lib:copy_to_bin",
],
)

bzl_library(
name = "versions",
srcs = ["versions.bzl"],
visibility = ["//ts:__subpackages__"],
)

bzl_library(
name = "maybe",
srcs = ["maybe.bzl"],
visibility = ["//ts:__subpackages__"],
)
58 changes: 58 additions & 0 deletions ts/private/docs/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")

package(default_visibility = ["//ts:__pkg__"])

bzl_library(
name = "npm_repositories",
srcs = ["//ts/private:npm_repositories.bzl"],
deps = [
":versions",
"@bazel_tools//tools/build_defs/repo:http.bzl",
],
)

bzl_library(
name = "ts_project",
srcs = ["//ts/private:ts_project.bzl"],
deps = [
":ts_validate_options",
"@aspect_bazel_lib//lib:copy_to_bin",
"@aspect_bazel_lib//lib:platform_utils",
"@aspect_bazel_lib//lib:utils",
"@aspect_rules_js//js:libs",
"@aspect_rules_js//js:providers",
"@bazel_skylib//lib:dicts",
],
)

bzl_library(
name = "ts_config",
srcs = ["//ts/private:ts_config.bzl"],
deps = [":ts_lib"],
)

bzl_library(
name = "ts_lib",
srcs = ["//ts/private:ts_lib.bzl"],
deps = ["@aspect_rules_js//js:providers"],
)

bzl_library(
name = "ts_validate_options",
srcs = ["//ts/private:ts_validate_options.bzl"],
deps = [
":ts_config",
":ts_lib",
"@aspect_bazel_lib//lib:copy_to_bin",
],
)

bzl_library(
name = "versions",
srcs = ["//ts/private:versions.bzl"],
)

bzl_library(
name = "maybe",
srcs = ["//ts/private:maybe.bzl"],
)
14 changes: 13 additions & 1 deletion ts/private/ts_project.bzl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"ts_project rule"

load("@aspect_bazel_lib//lib:copy_to_bin.bzl", "copy_files_to_bin_actions")
load("@aspect_bazel_lib//lib:platform_utils.bzl", "platform_utils")
load("@bazel_skylib//lib:dicts.bzl", "dicts")
load("@aspect_rules_js//js:providers.bzl", "js_info")
load("@aspect_rules_js//js:libs.bzl", "js_lib_helpers")
Expand Down Expand Up @@ -40,7 +41,18 @@ def _ts_project_impl(ctx):
execution_requirements = {}
executable = ctx.executable.tsc

if ctx.attr.supports_workers:
supports_workers = ctx.attr.supports_workers
host_is_windows = platform_utils.host_platform_is_windows()
if host_is_windows and supports_workers:
supports_workers = False

# buildifier: disable=print
print("""
WARNING: disabling ts_project workers which are not currently support on Windows hosts.
See https://github.com/aspect-build/rules_ts/issues/228 for more details.
""")

if supports_workers:
# Set to use a multiline param-file for worker mode
arguments.use_param_file("@%s", use_always = True)
arguments.set_param_file_format("multiline")
Expand Down

0 comments on commit b424e54

Please sign in to comment.