Skip to content

fix(build): Adjust pointers to bazel-built directory #1793

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

Merged
merged 2 commits into from
Nov 8, 2022
Merged
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
16 changes: 8 additions & 8 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"--extensionDevelopmentPath=${workspaceFolder}"
],
"outFiles": [
"${workspaceFolder}/dist/client/src/*.js"
"${workspaceFolder}/bazel-bin/client/src/*.js"
],
"preLaunchTask": {
"type": "npm",
Expand All @@ -25,7 +25,7 @@
"name": "Launch Prod Client",
"runtimeExecutable": "${execPath}",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/dist/npm"
"--extensionDevelopmentPath=${workspaceFolder}/bazel-bin/npm"
],
"sourceMaps": false,
"preLaunchTask": "build vsix"
Expand All @@ -37,7 +37,7 @@
"port": 6009,
"restart": true,
"outFiles": [
"${workspaceFolder}/dist/server/src/*.js"
"${workspaceFolder}/bazel-bin/server/src/*.js"
]
},
{
Expand All @@ -47,7 +47,7 @@
"port": 9229,
"restart": true,
"outFiles": [
"${workspaceFolder}/dist/**/*.js"
"${workspaceFolder}/bazel-bin/**/*.js"
],
},
{
Expand All @@ -58,7 +58,7 @@
"<node_internals>/**"
],
"outFiles": [
"${workspaceFolder}/dist/integration/lsp/*.js"
"${workspaceFolder}/bazel-bin/integration/lsp/*.js"
],
"type": "node"
},
Expand All @@ -69,12 +69,12 @@
"runtimeExecutable": "${execPath}",
"args": [
"--disable-extensions",
"--extensionDevelopmentPath=${workspaceFolder}/dist/npm",
"--extensionTestsPath=${workspaceFolder}/dist/integration/e2e/jasmine",
"--extensionDevelopmentPath=${workspaceFolder}/bazel-bin/npm",
"--extensionTestsPath=${workspaceFolder}/bazel-bin/integration/e2e/jasmine",
"${workspaceFolder}/integration/project"
],
"outFiles": [
"${workspaceFolder}/dist/integration/e2e/*.js"
"${workspaceFolder}/bazel-bin/integration/e2e/*.js"
],
"preLaunchTask": {
"type": "npm",
Expand Down
11 changes: 8 additions & 3 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@
"panel": "dedicated",
"reveal": "never"
},
"problemMatcher": [
"$tsc-watch"
]
"problemMatcher": {
"base": "$tsc-watch",
"background": {
"activeOnStart": true,
"beginsPattern": "^iBazel \\[\\d{1,2}:\\d{1,2}(?:AM|PM)\\]: Querying for files to watch.*",
"endsPattern": "^INFO: Build completed successfully, \\d total action(s)?"
}
}
},
{
"type": "shell",
Expand Down
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ expand_template(
"0.0.0-PLACEHOLDER": "{{BUILD_SCM_VERSION}}",
},
substitutions = {
"./dist/client/src/extension": "./index",
"./bazel-bin/client/src/extension": "./index",
},
template = "package.json",
)
Expand Down
4 changes: 3 additions & 1 deletion DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Monorepo setup

This repository is a monorepo. All build outputs are created in the `dist` directory.
This repository is a monorepo. All build outputs are created in the `bazel-bin` directory.

The `dependencies` in root [`package.json`](package.json) must include all production dependencies
of the client **and** and the server.
Expand Down Expand Up @@ -97,6 +97,8 @@ attach the debugger in a single step. To do so,

1. Go to Run on the sidebar, select `Client + Server` from the task list

Note: Because we are building with bazel, any breakpoints need to be set on the files in `bazel-bin/...` or by adding a `debugger;` statement before compilation.

### Install Local `@angular/language-service`

If changes are made to the upstream language service package, they can also be
Expand Down
2 changes: 1 addition & 1 deletion client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ function getServerOptions(ctx: vscode.ExtensionContext, debug: boolean): lsp.Nod
// Node module for the language server
const args = constructArgs(ctx, viewEngine, vscode.workspace.isTrusted);
const prodBundle = ctx.asAbsolutePath('server');
const devBundle = ctx.asAbsolutePath(path.join('dist', 'server', 'src', 'server.js'));
const devBundle = ctx.asAbsolutePath(path.join('bazel-bin', 'server', 'src', 'server.js'));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is surprising? needed for debugging or for some other reason?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is when running the extension how locally. We don't copy anything from bazel-bin to dist so this is definitely necessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

// VS Code Insider launches extensions in debug mode by default but users
// install prod bundle so we have to check whether dev bundle exists.
const latestServerModule = debug && fs.existsSync(devBundle) ? devBundle : prodBundle;
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -198,16 +198,17 @@
"onLanguage:html",
"onLanguage:typescript"
],
"main": "./dist/client/src/extension",
"main": "./bazel-bin/client/src/extension",
"scripts": {
"ng-dev": "cross-env TS_NODE_PROJECT=$PWD/.ng-dev/tsconfig.json TS_NODE_TRANSPILE_ONLY=1 node --no-warnings --loader ts-node/esm node_modules/@angular/dev-infra-private/ng-dev/bundles/cli.mjs",
"compile": "tsc -b && yarn bazel build :npm",
"compile:client-server": "yarn bazel build //client:index.js //server:index.js",
"compile:test": "tsc -b test.tsconfig.json",
"compile:integration": "tsc -b integration && yarn --cwd integration/project build",
"compile:syntaxes-test": "tsc -b syntaxes/test",
"build:syntaxes": "tsc -b syntaxes && node dist/syntaxes/build.js",
"format": "scripts/format.sh",
"watch": "tsc -b -w",
"watch": "yarn ibazel build //client:index.js //server:index.js",
"package": "scripts/build.sh package.json",
"test": "yarn bazel test --test_tag_filters=unit_test //...",
"test:watch": "yarn ibazel test --test_tag_filters=unit_test //...",
Expand Down