Intellij: Import project include ts lang will have Bazel run , causing `Cannot run target //:tsconfig: Not executable.`

Created on 3 Jul 2018  路  7Comments  路  Source: bazelbuild/intellij

I use this repo https://github.com/mrmeku/api_schemas_with_bazel as a base.

I try to import this project in Intelli, the .bazelproject looks like this:

directories:
  .
  -node_modules
  -dist
  -bazel-out
  -.idea

targets:
  //...

additional_languages:
  typescript

ts_config_rules:
  //:tsconfig

the typescript settings needs to have ts_config_rules settings at the same time. So I add ts_config in //BUILD.bazel. It looks like this:

...

load("@build_bazel_rules_typescript//:defs.bzl", "ts_config")

ts_config(
    name = "tsconfig",
    src = "tsconfig.json",
    deps = []
)

When I sync project , the log in Bazel console is like this:

Command: /usr/local/bin/bazel run --tool_tag=ijwb:IDEA:ultimate --curses=no --color=yes --experimental_ui=no --progress_in_terminal_title=no -- //:tsconfig


ERROR: Cannot run target //:tsconfig: Not executable.

INFO: Elapsed time: 0.293s
INFO: 0 processes.
ERROR: Build failed. Not running target.

Need help:

  1. Is this correct to add a ts_config in //BUILD.bazel, and write the ts_config_rules in .bazelproject?
  2. If 1 is correct, how to solve the sync error issue?

Thanks.

Most helpful comment

Yes, sorry. This is fixed upstream, and should be available in this repo soon.

All 7 comments

deps = []

You need to add your typescript rules to the tsconfig deps.

Thank you for the response.

What's typescript rules to add? The deps=[] is additional tsconfig.json via extends, according to the docs: http://tsetse.info/api/ts_config.html#ts_config.

I forked the repo to reproduce the issue. Please check https://github.com/shane13hsi/api_schemas_with_bazel.

image

What's typescript rules to add?

Any rule that contains typescript sources (e.g., ts_library) needs to be a dependency of tsconfig.

I forked the repo to reproduce the issue. Please check
https://github.com/shane13hsi/api_schemas_with_bazel.

For that repo you will need to add deps = ["//app"].

@chaoren can you elaborate on your answers above? I had a look at the code and as far as I can tell, and something seems out of date. The ts_config rule is not executable, but judging by this code it perhaps used to be.

Also, ts_config depending on //app in the repro repo doesn't click with me. The documentation says it's used for extending configs, which I assume are consumed by e.g. ts_library?

Oh. ts_config in bazel works differently than what we have internally. I'll take a look at this. Sorry.

Any news ? It is still impossible to use typescript in additional_languages on IntelliJ without running an error telling to add something in ts_config_rules, and adding the tsconfig still drops that it cannot run it

Yes, sorry. This is fixed upstream, and should be available in this repo soon.

Was this page helpful?
0 / 5 - 0 ratings