Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: ts_project validation fails on Windows for paths with special characters #666

Open
willjschmitt opened this issue Aug 6, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@willjschmitt
Copy link

willjschmitt commented Aug 6, 2024

What happened?

When building a library ts_project within a Next.js app that has special characters (e.g. for route grouping), the ts_project validation fails with a bash syntax error from the unescaped special characters in the file path (in my case (marketing)

ERROR: C:/users/willschmitt/documents/achillea/achillea/www/achillearesearch_com/app/(marketing)/BUILD.bazel:3:11: TsValidateOptions www/achillearesearch_com/app/(marketing)/(marketing).optionsvalid.d.ts failed: (Exit 2): validator.bat failed: error executing TsValidateOptions command (from target //www/achillearesearch_com/app/(marketing):(marketing))
  cd /d C:/_bzl/execroot/_main
  SET BAZEL_BINDIR=bazel-out/x64_windows-fastbuild/bin
  bazel-out\x64_windows-opt-exec-ST-13d3ddad9198\bin\external\aspect_rules_ts~~ext~npm_typescript\validator.bat www/achillearesearch_com/app/(marketing)/tsconfig_(marketing).json www/achillearesearch_com/app/(marketing)/(marketing).optionsvalid.d.ts @@//www/achillearesearch_com/app/(marketing):(marketing) www/achillearesearch_com/app/(marketing) {"allow_js":false,"composite":true,"declaration":true,"declaration_map":false,"emit_declaration_only":false,"incremental":true,"preserve_jsx":false,"resolve_json_module":true,"source_map":false,"ts_build_info_file":""}
# Configuration: 21d0e975c9b4032915c05f5c2f059dd025b6cc6feb8901ed4ba494dc16c40af5
# Execution platform: @@local_config_platform//:host
'DOSKEY' is not recognized as an internal or external command,
operable program or batch file.
/usr/bin/bash: -c: line 1: syntax error near unexpected token `('
/usr/bin/bash: -c: line 1: `C:/_bzl/execroot/_main/bazel-out/x64_windows-opt-exec-ST-13d3ddad9198/bin/external/aspect_rules_ts~~ext~npm_typescript/validator.sh www/achillearesearch_com/app/(marketing)/tsconfig_(marketing).json www/achillearesearch_com/app/(marketing)/(marketing).optionsvalid.d.ts @@//www/achillearesearch_com/app/(marketing):(marketing) www/achillearesearch_com/app/(marketing) "{\\"allow_js\\":false,\\"composite\\":true,\\"declaration\\":true,\\"declaration_map\\":false,\\"emit_declaration_only\\":false,\\"incremental\\":true,\\"preserve_jsx\\":false,\\"resolve_json_module\\":true,\\"source_map\\":false,\\"ts_build_info_file\\":\\"\\"}"'

Version

Development (host) and target OS/architectures: Windows 10 64bit

Output of bazel --version: 7.1.1

Version of the Aspect rules, or other relevant rules from your
WORKSPACE or MODULE.bazel file:

  • aspect_rules_ts - 2.4.2
  • aspect_bazel_lib - 2.7.9 (upgraded after having other path escaping issues from file copying in earlier v1.x releases)

Language(s) and/or frameworks involved: Typescript and Next.js

How to reproduce

Build a `ts_project` within a Bazel package with parentheses in the path on Windows with `validate` set to `True`

Any other information?

For now, I'm disabling validation on ts_project targets under directories with special characters on Windows with a select statement, and getting coverage of validation via Linux CI, but it would be better to have immediate feedback during development:

ts_project(
    ...
    validate = select({
        "@platforms//os:windows": False,
        "//conditions:default": True,
    }),
)

I also started with a similar issue of unrecognized programs when I was on v1 of the Aspect bazel-lib, but the rules since moved from .bat execution to coreutils execution of CopyFile. I wonder if there is a generalized issue for path normalization on Windows for the bazel-lib

@willjschmitt willjschmitt added the bug Something isn't working label Aug 6, 2024
@willjschmitt
Copy link
Author

Pushing a little further, this might be a general issue, with also the transpilation step

@willjschmitt
Copy link
Author

Both of the executed targets that are failing are js_binary targets, so this might end up being a rules_js bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant