switch convenience symlinks to .bazel/

Unfortunately 5efaf5a4be broke the Svelte
language tools - presumably having paths outside of the repo is confusing
them.

As a plan B, the symlinks have been shifted to a single subdir. Along
with some exclusions in the VS Code config, this should allow VS Code
to continue to work out of the box, but the docs will need updating
to reflect the extra work required for PyCharm/IntelliJ.

+ fix svelte-check execution on a system without node installed. It
still throws up some errors that are presumably caused by our multiple
rootDirs - not sure if there's an easy way to work around that.
This commit is contained in:
Damien Elmes 2022-01-24 11:06:02 +10:00
parent e986304592
commit f842ab7c9d
8 changed files with 25 additions and 14 deletions

View file

@ -29,9 +29,8 @@ build:opt -c opt
# still running, so shut them down at the end of the build. # still running, so shut them down at the end of the build.
build:windows --worker_quit_after_build build:windows --worker_quit_after_build
# place convenience symlinks outside of the source folder, so IDEs don't try to # place convenience symlinks inside a single folder for easier exclusion in IDEs
# monitor Bazel's large symlink tree for changes build --symlink_prefix=.bazel/
build --symlink_prefix=../bazel/anki/
build --experimental_no_product_name_out_symlink build --experimental_no_product_name_out_symlink
# allow extra user customizations in a separate file # allow extra user customizations in a separate file

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ user.bazelrc
rust-project.json rust-project.json
node_modules node_modules
.idea/ .idea/
.bazel

14
.vscode/settings.json vendored
View file

@ -1,12 +1,22 @@
{ {
"editor.formatOnSave": true, "editor.formatOnSave": true,
"files.watcherExclude": {
"**/.git/objects/**": true,
"**/.git/subtree-cache/**": true,
"**/node_modules/*/**": true,
".bazel/**": true
},
"python.analysis.extraPaths": ["./pylib"], "python.analysis.extraPaths": ["./pylib"],
"python.formatting.provider": "black", "python.formatting.provider": "black",
"rust-analyzer.cargo.runBuildScripts": true, "rust-analyzer.cargo.runBuildScripts": true,
"rust-analyzer.checkOnSave.allTargets": false, "rust-analyzer.checkOnSave.allTargets": false,
"rust-analyzer.files.excludeDirs": ["node_modules"], "rust-analyzer.files.excludeDirs": [".bazel", "node_modules"],
"rust-analyzer.procMacro.enable": true, "rust-analyzer.procMacro.enable": true,
// this formats 'use' blocks in a nicer way, but requires you to run // this formats 'use' blocks in a nicer way, but requires you to run
// 'rustup install nightly'. // 'rustup install nightly'.
"rust-analyzer.rustfmt.extraArgs": ["+nightly"] "rust-analyzer.rustfmt.extraArgs": ["+nightly"],
"search.exclude": {
"**/node_modules": true,
".bazel/**": true
}
} }

View file

@ -13,7 +13,7 @@ import time
from pathlib import Path from pathlib import Path
workspace = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"]) workspace = Path(os.environ["BUILD_WORKSPACE_DIRECTORY"])
binroot = workspace / "../bazel/anki/bin" binroot = workspace / ".bazel/bin"
dmypy_bin = binroot / "external/py_deps_mypy/rules_python_wheel_entry_point_dmypy" dmypy_bin = binroot / "external/py_deps_mypy/rules_python_wheel_entry_point_dmypy"
if sys.platform.startswith("win32"): if sys.platform.startswith("win32"):
@ -30,13 +30,13 @@ if subprocess.run(
"--", "--",
"--config-file", "--config-file",
"qt/mypy.ini", "qt/mypy.ini",
"../bazel/anki/bin/qt/dmypy.runfiles/ankidesktop/pylib/anki", ".bazel/bin/qt/dmypy.runfiles/ankidesktop/pylib/anki",
"../bazel/anki/bin/qt/dmypy.runfiles/ankidesktop/qt/aqt", ".bazel/bin/qt/dmypy.runfiles/ankidesktop/qt/aqt",
"--python-executable", "--python-executable",
os.path.abspath("python/stubs/extendsitepkgs"), os.path.abspath("python/stubs/extendsitepkgs"),
], ],
env={ env={
"MYPYPATH": "../bazel/anki/bin/qt/dmypy.runfiles/pyqt6", "MYPYPATH": ".bazel/bin/qt/dmypy.runfiles/pyqt6",
"EXTRA_SITE_PACKAGES": os.path.abspath(os.getenv("EXTRA_SITE_PACKAGES")), "EXTRA_SITE_PACKAGES": os.path.abspath(os.getenv("EXTRA_SITE_PACKAGES")),
}, },
cwd=workspace, cwd=workspace,

View file

@ -9,4 +9,4 @@ test -e WORKSPACE || (
rm -rf bazel-dist rm -rf bazel-dist
bazel build --config opt dist bazel build --config opt dist
tar xvf ../bazel/anki/bin/dist.tar tar xvf .bazel/bin/dist.tar

View file

@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
SASS_PATH=ts/sass:$(pwd)/../bazel/anki/bin/ts/sass \ . scripts/node-env
SASS_PATH=ts/sass:$(pwd)/.bazel/bin/ts/sass \
node_modules/.bin/svelte-check \ node_modules/.bin/svelte-check \
--workspace ts --workspace ts

View file

@ -6,6 +6,6 @@
# The pages can be accessed by, eg surfing to # The pages can be accessed by, eg surfing to
# http://localhost:40000/_anki/pages/deckconfig.html # http://localhost:40000/_anki/pages/deckconfig.html
ANKI_DATA_FOLDER=$(pwd)/../bazel/anki/bin/qt/aqt \ ANKI_DATA_FOLDER=$(pwd)/.bazel/bin/qt/aqt \
QTWEBENGINE_REMOTE_DEBUGGING=8080 \ QTWEBENGINE_REMOTE_DEBUGGING=8080 \
ANKI_API_PORT=40000 ANKIDEV=1 ./run $* ANKI_API_PORT=40000 ANKIDEV=1 ./run $*

View file

@ -35,8 +35,8 @@
"rootDir": "..", "rootDir": "..",
"rootDirs": [ "rootDirs": [
".", ".",
// for VS code // for VS code and svelte-check
"../../bazel/anki/bin/ts" "../.bazel/bin/ts"
], ],
"baseUrl": ".", "baseUrl": ".",
"paths": {}, "paths": {},