From 264dd8f1ea66c65772f8648023ca9298122084fe Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 5 Nov 2020 11:01:30 +1000 Subject: [PATCH] fix external consumption of ts rules, and simplify import path --- WORKSPACE | 2 +- defs.bzl | 17 +++++------------ docs/windows.md | 11 ++++++++++- ts/congrats/CongratsPage.svelte | 6 +++--- ts/congrats/bootstrap.ts | 6 +++--- ts/congrats/lib.ts | 8 ++++---- ts/graphs/AddedGraph.svelte | 4 ++-- ts/graphs/ButtonsGraph.svelte | 4 ++-- ts/graphs/CalendarGraph.svelte | 4 ++-- ts/graphs/CardCounts.svelte | 4 ++-- ts/graphs/EaseGraph.svelte | 4 ++-- ts/graphs/FutureDue.svelte | 4 ++-- ts/graphs/GraphRangeRadios.svelte | 4 ++-- ts/graphs/GraphsPage.svelte | 4 ++-- ts/graphs/HistogramGraph.svelte | 2 +- ts/graphs/HourGraph.svelte | 4 ++-- ts/graphs/IntervalsGraph.svelte | 6 +++--- ts/graphs/NoDataOverlay.svelte | 2 +- ts/graphs/ReviewsGraph.svelte | 4 ++-- ts/graphs/TableData.svelte | 2 +- ts/graphs/TodayStats.svelte | 4 ++-- ts/graphs/added.ts | 6 +++--- ts/graphs/bootstrap.ts | 6 +++--- ts/graphs/buttons.ts | 4 ++-- ts/graphs/calendar.ts | 4 ++-- ts/graphs/card-counts.ts | 6 +++--- ts/graphs/ease.ts | 6 +++--- ts/graphs/future-due.ts | 8 ++++---- ts/graphs/graph-helpers.ts | 4 ++-- ts/graphs/hours.ts | 4 ++-- ts/graphs/intervals.ts | 8 ++++---- ts/graphs/reviews.ts | 6 +++--- ts/graphs/today.ts | 6 +++--- ts/lib/BUILD.bazel | 1 + 34 files changed, 89 insertions(+), 86 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index e36a6fb71..436273099 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -1,5 +1,5 @@ workspace( - name = "anki", + name = "net_ankiweb_anki", managed_directories = {"@npm": [ "ts/node_modules", ]}, diff --git a/defs.bzl b/defs.bzl index e8a7d2273..d8e53854a 100644 --- a/defs.bzl +++ b/defs.bzl @@ -1,7 +1,7 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") load("@io_bazel_rules_rust//rust:repositories.bzl", "rust_repositories") load("@io_bazel_rules_rust//:workspace.bzl", "bazel_version") -load("@anki//cargo:crates.bzl", "raze_fetch_remote_crates") +load("@net_ankiweb_anki//cargo:crates.bzl", "raze_fetch_remote_crates") load(":python.bzl", "setup_local_python") load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories", "yarn_install") load("@io_bazel_rules_sass//:defs.bzl", "sass_repositories") @@ -29,15 +29,9 @@ def setup_deps(): native.register_toolchains("@python//:python3_toolchain") - # pip_install( - # name = "py_deps", - # python_interpreter_target = "@python//:python", - # requirements = "@anki//pip:requirements.txt", - # ) - pip_import( name = "py_deps", - requirements = "@anki//pip:requirements.txt", + requirements = "@net_ankiweb_anki//pip:requirements.txt", python_runtime = "@python//:python", ) @@ -46,13 +40,12 @@ def setup_deps(): python_runtime = "@python//:python", ) - node_repositories(package_json = ["@anki//ts:package.json"]) + node_repositories(package_json = ["@net_ankiweb_anki//ts:package.json"]) yarn_install( name = "npm", - package_json = "@anki//ts:package.json", - # strict_visibility = True, - yarn_lock = "@anki//ts:yarn.lock", + package_json = "@net_ankiweb_anki//ts:package.json", + yarn_lock = "@net_ankiweb_anki//ts:yarn.lock", ) sass_repositories() diff --git a/docs/windows.md b/docs/windows.md index 7e4c1b1c5..f3ad9a1bc 100644 --- a/docs/windows.md +++ b/docs/windows.md @@ -79,9 +79,18 @@ not being installed. ## More -For info on running tests, building wheels and so on, please see [Development](./development.md). +For info on running tests, building wheels and so on, please see +[Development](./development.md). Note that where the instructions on that page say "bazel", please use ".\bazel" instead. This runs bazel.bat inside the Anki source folder, instead of calling Bazel directly. This takes care of setting up the path and output folder correctly, which avoids issues with long path names. + +## Cleaning notes + +Unlike the old Make system, a "clean build" should almost never be required +unless you are debugging issues with the build system. But if you need to run +"bazel clean --expunge", make sure you remove the ts/node_modules folder +afterwards, or it will cause a "no such file or directory node_modules/anki" +error on the subsequent build on Windows. diff --git a/ts/congrats/CongratsPage.svelte b/ts/congrats/CongratsPage.svelte index 9e5d55626..829dfeebb 100644 --- a/ts/congrats/CongratsPage.svelte +++ b/ts/congrats/CongratsPage.svelte @@ -1,8 +1,8 @@