Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .bazelignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
5 changes: 5 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
build --@aspect_rules_ts//ts:skipLibCheck=always
fetch --@aspect_rules_ts//ts:skipLibCheck=always
query --@aspect_rules_ts//ts:skipLibCheck=always

startup --host_jvm_args=-DBAZEL_TRACK_SOURCE_DIRECTORIES=1
1 change: 1 addition & 0 deletions .bazelversion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
8.0.1
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@ out
node_modules
.vscode-test
*.vsix
/bazel-*

# Ignore the generated .d.ts and .js files for protos that end up in the src/
# tree.
src/protos/protos.d.ts
src/protos/protos.js
src/protos/protos.js
4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": ["--extensionDevelopmentPath=${workspaceRoot}"],
"args": ["--extensionDevelopmentPath=${workspaceRoot}/bazel-bin"],
"stopOnEntry": false,
"sourceMaps": true,
"outFiles": ["${workspaceRoot}/out/src/**/*.js"],
"preLaunchTask": "npm"
"preLaunchTask": "build"
},
{
"name": "Launch Debug Server",
Expand Down
3 changes: 1 addition & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"files.exclude": {
"node_modules": true,
"out": true
"node_modules": true
},
"[typescript]": {
"editor.tabSize": 2,
Expand Down
14 changes: 6 additions & 8 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"version": "2.0.0",

// we want to run npm
"command": "npm",
"command": "bazel",

// we run the custom script "compile" as defined in package.json
"args": ["run", "compile", "--loglevel", "silent"],
"args": ["build", "//..."],

// The tsc compiler is started in watching mode
"isBackground": true,
Expand All @@ -23,14 +23,12 @@
"problemMatcher": "$tsc-watch",
"tasks": [
{
"label": "npm",
"label": "build",
"type": "shell",
"command": "npm",
"command": "bazel",
"args": [
"run",
"compile",
"--loglevel",
"silent"
"build",
"//...",
],
"isBackground": true,
"problemMatcher": "$tsc-watch",
Expand Down
3 changes: 3 additions & 0 deletions .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,6 @@ AUTHORS
CODEOWNERS
CONTRIBUTORS
tsconfig.json

package__js_binary_node_bin
package__js_binary.sh
81 changes: 81 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
load("@aspect_rules_ts//ts:defs.bzl", "ts_project")
load("@aspect_rules_ts//ts:proto.bzl", "ts_proto_library")
load("@npm//:@vscode/vsce/package_json.bzl", vsce_bin = "bin")
load("@npm//:defs.bzl", "npm_link_all_packages")

npm_link_all_packages(name = "node_modules")

ts_proto_library(
name = "starlark_debugging_ts_proto",
copy_files = False,
node_modules = ":node_modules",
proto = "//third_party/bazel/src/main/java/com/google/devtools/build/lib/starlarkdebug/proto:starlark_debugging_proto",
)

ts_proto_library(
name = "build_event_stream_ts_proto",
copy_files = False,
node_modules = ":node_modules",
proto = "//third_party/bazel/src/main/java/com/google/devtools/build/lib/buildeventstream/proto:build_event_stream_proto",
)

ts_project(
name = "ts",
srcs = glob(["src/**/*.ts"]),
declaration = True,
out_dir = "out",
source_map = True,
transpiler = "tsc",
deps = [
":build_event_stream_ts_proto",
"//:node_modules/@types/long",
"//:node_modules/@types/node",
"//:node_modules/@types/vscode",
"//:node_modules/@types/which",
"//:node_modules/vscode-debugadapter",
"//:node_modules/vscode-debugprotocol",
"//:node_modules/vscode-languageclient",
"//:node_modules/vscode-uri",
"//:node_modules/which",
],
)

filegroup(
name = "package_srcs",
srcs = [
".vscodeignore",
"CHANGELOG.md",
"LICENSE",
"README.md",
"package.json",
":ts",
] + glob([
"media/**/*",
"icons/**/*",
"syntaxes/**/*",
]),
)

vsce_bin.vsce(
name = "package",
srcs = [":package_srcs"],
outs = [
"vscode-bazel-0.8.1.vsix",
],
args = [
"package",
"--no-dependencies",
],
chdir = package_name(),
log_level = "debug",
)

sh_binary(
name = "update_protos",
srcs = ["scripts/update_protos.sh"],
data = [
"@bazel_tar//file:bazel.tar",
"@buildozer",
],
deps = ["@bazel_tools//tools/bash/runfiles"],
)
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The best place to start is probably their
[guide](https://code.visualstudio.com/api/get-started/your-first-extension).

Once somewhat familiar with the process, you just need to check out this
project, do an `npm install` to get the required packages into the local
project, do an `pnpm install` to get the required packages into the local
checkout's _node_modules_ and then open the directory in VS Code. There are
already tasks configured to build/debug the extension. Note: having the released
version of this extension install what trying to work on it can some times
Expand Down
42 changes: 42 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
bazel_dep(name = "aspect_rules_ts", version = "3.4.0")

# local_path_override(module_name = "aspect_rules_ts", path = "/home/cameron/Repos/rules_ts")

rules_ts_ext = use_extension(
"@aspect_rules_ts//ts:extensions.bzl",
"ext",
dev_dependency = True,
)

rules_ts_ext.deps()

use_repo(rules_ts_ext, "npm_typescript")

bazel_dep(name = "aspect_rules_js", version = "2.1.3")

bazel_dep(name = "rules_nodejs", version = "6.3.3")
node = use_extension("@rules_nodejs//nodejs:extensions.bzl", "node")
node.toolchain(node_version = "22.13.0")

npm = use_extension("@aspect_rules_js//npm:extensions.bzl", "npm", dev_dependency = True)

npm.npm_translate_lock(
name = "npm",
pnpm_lock = "//:pnpm-lock.yaml",
verify_node_modules_ignored = "//:.bazelignore",
)

use_repo(npm, "npm")

http_file = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")
http_file(
name = "bazel_tar",
integrity = "sha256-1RkOrSf1u0LkcI0rr9R4NWU5VzYSlR+AiGMmW/9xBOQ=",
downloaded_file_path = "bazel.tar",
# strip_prefix = "bazel-8.0.1",
urls = ["https://github.com/bazelbuild/bazel/archive/refs/tags/8.0.1.tar.gz"],
)

bazel_dep(name = "buildozer", version = "8.0.1")
bazel_dep(name = "protobuf", version = "29.3")
bazel_dep(name = "googleapis", version = "0.0.0-20240819-fe8ba054a")
Loading
Loading