mirror of
https://github.com/ankitects/anki.git
synced 2025-12-15 15:50:59 -05:00
rename workspace
I'd forgotten that Bazel "helpfully" adds __init__.py files into folders that match the workspace name, breaking imports.
This commit is contained in:
parent
185e9acd22
commit
372a28be29
9 changed files with 26 additions and 26 deletions
|
|
@ -1,5 +1,5 @@
|
|||
workspace(
|
||||
name = "anki",
|
||||
name = "ankidesktop",
|
||||
managed_directories = {"@npm": [
|
||||
"ts/node_modules",
|
||||
]},
|
||||
|
|
|
|||
10
defs.bzl
10
defs.bzl
|
|
@ -1,7 +1,7 @@
|
|||
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
|
||||
load("@bazel_skylib//lib:versions.bzl", "versions")
|
||||
load("@rules_rust//rust:repositories.bzl", "rust_repositories")
|
||||
load("@anki//cargo:crates.bzl", "raze_fetch_remote_crates")
|
||||
load("@ankidesktop//cargo:crates.bzl", "raze_fetch_remote_crates")
|
||||
load(":python.bzl", "setup_local_python")
|
||||
load("//proto:protobuf.bzl", "setup_protobuf_binary")
|
||||
load("//proto:format.bzl", "setup_clang_format")
|
||||
|
|
@ -35,7 +35,7 @@ def setup_deps():
|
|||
|
||||
pip_import(
|
||||
name = "py_deps",
|
||||
requirements = "@anki//pip:requirements.txt",
|
||||
requirements = "@ankidesktop//pip:requirements.txt",
|
||||
python_runtime = "@python//:python",
|
||||
)
|
||||
|
||||
|
|
@ -44,12 +44,12 @@ def setup_deps():
|
|||
python_runtime = "@python//:python",
|
||||
)
|
||||
|
||||
node_repositories(package_json = ["@anki//ts:package.json"])
|
||||
node_repositories(package_json = ["@ankidesktop//ts:package.json"])
|
||||
|
||||
yarn_install(
|
||||
name = "npm",
|
||||
package_json = "@anki//ts:package.json",
|
||||
yarn_lock = "@anki//ts:yarn.lock",
|
||||
package_json = "@ankidesktop//ts:package.json",
|
||||
yarn_lock = "@ankidesktop//ts:yarn.lock",
|
||||
)
|
||||
|
||||
sass_repositories()
|
||||
|
|
|
|||
|
|
@ -74,14 +74,14 @@ index eff3d9df2..fb2e9f7fe 100644
|
|||
python_runtime = "@python//:python",
|
||||
)
|
||||
|
||||
- node_repositories(package_json = ["@anki//ts:package.json"])
|
||||
- node_repositories(package_json = ["@ankidesktop//ts:package.json"])
|
||||
+ native.local_repository(
|
||||
+ name = "local_node",
|
||||
+ path = "local_node",
|
||||
+ )
|
||||
+
|
||||
+ node_repositories(
|
||||
+ package_json = ["@anki//ts:package.json"],
|
||||
+ package_json = ["@ankidesktop//ts:package.json"],
|
||||
+ vendored_node = "@local_node//:node",
|
||||
+ )
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ def _impl(rctx):
|
|||
alias(
|
||||
name = "clang_format",
|
||||
actual = select({
|
||||
"@anki//platforms:windows_x86_64": "@clang_format_windows_x86_64//:clang-format.exe",
|
||||
"@anki//platforms:macos_x86_64": "@clang_format_macos_x86_64//:clang-format",
|
||||
"@anki//platforms:linux_x86_64": "@clang_format_linux_x86_64//:clang-format",
|
||||
"@ankidesktop//platforms:windows_x86_64": "@clang_format_windows_x86_64//:clang-format.exe",
|
||||
"@ankidesktop//platforms:macos_x86_64": "@clang_format_macos_x86_64//:clang-format",
|
||||
"@ankidesktop//platforms:linux_x86_64": "@clang_format_linux_x86_64//:clang-format",
|
||||
}),
|
||||
visibility = ["//visibility:public"]
|
||||
)
|
||||
|
|
@ -68,7 +68,7 @@ def proto_format(name, srcs, **kwargs):
|
|||
py_test(
|
||||
name = name,
|
||||
srcs = [
|
||||
"@anki//proto:format.py",
|
||||
"@ankidesktop//proto:format.py",
|
||||
],
|
||||
data = ["@clang_format//:clang_format"] + srcs,
|
||||
args = ["$(location @clang_format//:clang_format)"] + [native.package_name() + "/" + f for f in srcs],
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ def _impl(rctx):
|
|||
alias(
|
||||
name = "clang_format",
|
||||
actual = select({
|
||||
"@anki//platforms:windows_x86_64": "@clang_format_windows_x86_64//:clang-format.exe",
|
||||
"@anki//platforms:macos_x86_64": "@clang_format_macos_x86_64//:clang-format",
|
||||
"@anki//platforms:linux_x86_64": "@clang_format_linux_x86_64//:clang-format",
|
||||
"@ankidesktop//platforms:windows_x86_64": "@clang_format_windows_x86_64//:clang-format.exe",
|
||||
"@ankidesktop//platforms:macos_x86_64": "@clang_format_macos_x86_64//:clang-format",
|
||||
"@ankidesktop//platforms:linux_x86_64": "@clang_format_linux_x86_64//:clang-format",
|
||||
}),
|
||||
visibility = ["//visibility:public"]
|
||||
)
|
||||
|
|
@ -68,7 +68,7 @@ def proto_format(name, srcs, **kwargs):
|
|||
py_test(
|
||||
name = name,
|
||||
srcs = [
|
||||
"@anki//format.py",
|
||||
"@ankidesktop//format.py",
|
||||
],
|
||||
data = ["@clang_format//:clang_format"] + srcs,
|
||||
args = ["$(location @clang_format//:clang_format)"] + [native.package_name() + "/" + f for f in srcs],
|
||||
|
|
|
|||
|
|
@ -12,10 +12,10 @@ def _impl(rctx):
|
|||
alias(
|
||||
name = "protoc",
|
||||
actual = select({
|
||||
"@anki//platforms:windows_x86_64": "@protoc_bin_windows//:bin/protoc.exe",
|
||||
"@anki//platforms:macos_x86_64": "@protoc_bin_macos//:bin/protoc",
|
||||
"@anki//platforms:linux_x86_64": "@protoc_bin_linux_x86_64//:bin/protoc",
|
||||
"@anki//platforms:linux_arm64": "@protoc_bin_linux_arm64//:bin/protoc"
|
||||
"@ankidesktop//platforms:windows_x86_64": "@protoc_bin_windows//:bin/protoc.exe",
|
||||
"@ankidesktop//platforms:macos_x86_64": "@protoc_bin_macos//:bin/protoc",
|
||||
"@ankidesktop//platforms:linux_x86_64": "@protoc_bin_linux_x86_64//:bin/protoc",
|
||||
"@ankidesktop//platforms:linux_arm64": "@protoc_bin_linux_arm64//:bin/protoc"
|
||||
}),
|
||||
visibility = ["//visibility:public"]
|
||||
)
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import sys
|
|||
(protoc, mypy_protobuf, outdir, *protos) = sys.argv[1:]
|
||||
|
||||
if protos[0].startswith("external"):
|
||||
prefix = "external/anki/proto/"
|
||||
prefix = "external/ankidesktop/proto/"
|
||||
else:
|
||||
prefix = "proto/"
|
||||
|
||||
|
|
@ -25,7 +25,7 @@ subprocess.run(
|
|||
"--python_out=.",
|
||||
"--mypy_out=.",
|
||||
"-I" + prefix,
|
||||
"-Iexternal/anki/" + prefix,
|
||||
"-Iexternal/ankidesktop/" + prefix,
|
||||
*protos,
|
||||
],
|
||||
# mypy prints to stderr on success :-(
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ def compile_sass(group, srcs, deps = [], visibility = ["//visibility:private"]):
|
|||
sourcemap = False,
|
||||
deps = deps,
|
||||
visibility = visibility,
|
||||
include_paths = ["external/anki"],
|
||||
include_paths = ["external/ankidesktop"],
|
||||
)
|
||||
|
||||
native.filegroup(
|
||||
|
|
|
|||
|
|
@ -157,9 +157,9 @@ async function writeJs(
|
|||
genDir,
|
||||
// a nasty hack to ensure ts/sass/... resolves correctly
|
||||
// when invoked from an external workspace
|
||||
binDir + "/external/anki",
|
||||
genDir + "/external/anki",
|
||||
binDir + "/../../../external/anki",
|
||||
binDir + "/external/ankidesktop",
|
||||
genDir + "/external/ankidesktop",
|
||||
binDir + "/../../../external/ankidesktop",
|
||||
],
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue