Commit graph

88 commits

Author SHA1 Message Date
Damien Elmes
d6b72645c8 updates to the build process and binary bundles
All platforms:

- rename scripts/ to tools/: Bazelisk expects to find its wrapper script
(used by the Mac changes below) in tools/. Rather than have a separate
scripts/ and tools/, it's simpler to just move everything into tools/.
- wheel outputs and binary bundles now go into .bazel/out/dist. While
not technically Bazel build products, doing it this way ensures they get
cleaned up when 'bazel clean' is run, and it keeps them out of the source
folder.
- update to the latest Bazel

Windows changes:

- bazel.bat has been removed, and tools\setup-env.bat has been added.
Other scripts like .\run.bat will automatically call it to set up the
environment.
- because Bazel is now on the path, you can 'bazel test ...' from any
folder, instead of having to do \anki\bazel.
- the bat files can handle being called from any working directory,
so things like running "\anki\tools\python" from c:\ will work.
- build installer as part of bundling process

Mac changes:

- `arch -arch x86_64 bazel ...` will now automatically use a different
build root, so that it is cheap to switch back and forth between archs
on a new Mac.
- tools/run-qt* will now automatically use Rosetta
- disable jemalloc in Mac x86 build for now, as it won't build under
Rosetta (perhaps due to its build scripts using $host_cpu instead of
$target_cpu)
- create app bundle as part of bundling process

Linux changes:

- remove arm64 orjson workaround in Linux bundle, as without a
readily-available, relatively distro-agonstic PyQt/Qt build
we can use, the arm64 Linux bundle is of very limited usefulness.
- update Docker files for release build
- include fcitx5 in both the qt5 and qt6 bundles
- create tarballs as part of the bundling process
2022-02-10 19:23:07 +10:00
Damien Elmes
6cb9c83182 add file layout visualization from aracelix
https://github.com/ankitects/anki/issues/1010#issuecomment-1032248683
2022-02-09 13:24:07 +10:00
Damien Elmes
b8d4febdb0 split IDE docs into separate file; recommend VS Code 2022-01-24 19:46:09 +10:00
Damien Elmes
05842acb0b clarify wheel building and mention how to free up space 2022-01-24 16:51:29 +10:00
Damien Elmes
2c9d202c5c fix formatting in docs/ 2022-01-21 21:50:20 +10:00
roxgib
f12a2116aa Remove outdated info about VS Code (#1614)
Pylance is now the default for Python on VS Code, so it should no longer be necessary to suggest switching to it.
2022-01-21 21:31:23 +10:00
Damien Elmes
b839a893f7 tweaks to development.md 2021-12-24 14:12:36 +10:00
Damien Elmes
f9b22725c1 update Visual Studio instructions 2021-11-29 12:32:39 +10:00
Damien Elmes
a96fcc8c85 Python 3.10 not usable on Windows
No winrt wheel is available yet

https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703
2021-11-08 19:23:00 +10:00
Damien Elmes
cf831587e1 mention glibc requirements
https://forums.ankiweb.net/t/wheel-not-supported-on-the-platform-which-built-it/14432
2021-10-26 18:08:08 +10:00
Damien Elmes
45d8b81279 add dockerfiles for amd64 and arm64 builds 2021-10-23 20:42:16 +10:00
Damien Elmes
e28f03c65a //ts:format now runs on current working directory, instead of entire repo 2021-10-23 15:48:33 +10:00
Damien Elmes
1f736cea99 minor tweak to new-platforms.md, and run prettier on docs 2021-10-23 15:40:45 +10:00
Damien Elmes
7971472c65 fixes and documentation for Linux ARM64
+ add qt6 dep to wheel install docs
+ remove x86_64 constraint on orjson
2021-10-23 15:22:24 +10:00
Damien Elmes
b798fa819e docs: the old TS flakiness should be gone, but renames are a problem 2021-10-18 22:24:06 +10:00
Damien Elmes
57ee53d41e get PyQt working directly with ./run on macOS
It's no longer necessary to copy everything into bazel-copy, and you
can safely remove that folder.
2021-10-16 18:07:29 +10:00
Damien Elmes
f01b52a244 default to a vendored copy of Python
Brings Python in line with our other dependencies, and means users
no longer need to install it prior to building, or deal with
issues caused by having the wrong version available.
2021-10-15 22:14:05 +10:00
Jakub Kaczmarzyk
8afa54630b replace dockerfile (#1410)
* replaces Dockerfile using bazel-based build system

This commit updates the Dockerfile to work with anki's bazel-based build
system.

The anki Dockerfile was originally added in
https://github.com/ankitects/anki/pull/753 back in September 2020. The
file was moved to `docs/Dockerfile` in
e4ba941cf1, with a note that the file had
to be updated to work with anki's updated build system. The file
`docs/Dockerfile` was removed in
f2e2ef6fc0.

* install setuptools and wheel + xkb libraries

* install anki virtual env in fresh base image

* move Dockerfile out of root directory

* add readme file for dockerized anki
2021-10-15 10:41:15 +10:00
Gesa Stupperich
a4a0e79dc5 Mac bazelrc build tip (#1418)
* Copy build tip from Linux to Mac instructions

* Update build tip

* Accept BSD 3 clause license
2021-10-12 16:58:42 +10:00
Damien Elmes
b9032d9165 mention missing libs in linux.md 2021-10-12 16:19:27 +10:00
Damien Elmes
f209a72b7c move node_modules into root folder [action required]
Recommend removing ts/node_modules folder before attempting to
build after this update.

This moves ts/node_modules into the root of the project to work around
https://github.com/ankitects/anki/pull/1405#issuecomment-936213861

Also fixes the sass errors shown when running scripts/svelte-check
2021-10-07 11:42:27 +10:00
Damien Elmes
fb6e1a73f5 bump minimum Python to 3.9 2021-10-04 15:05:15 +10:00
Damien Elmes
79aa52c082 update Rust deps 2021-10-02 20:42:03 +10:00
blue-putty
2d64c89c51 Typo correction
test changed to tense
2021-09-29 20:59:57 -04:00
Damien Elmes
e40004b450 tweak linux.md and add forum link 2021-09-02 20:52:55 +10:00
RumovZ
d9f039e75c Update proto format call in docs 2021-07-22 10:08:50 +02:00
Damien Elmes
457664f534 public API comment 2021-07-20 12:07:01 +10:00
Damien Elmes
5631c48451 add a brief architecture file 2021-07-20 11:59:39 +10:00
Damien Elmes
4388ca0a2e drop Rust Analyzer Bazel rule
With proper excludes set up, starting it outside of Bazel is similarly
fast, and unit tests work correctly. It also makes initial Bazel startup
faster, as the Rust sources no longer need to be fetched.
2021-07-19 23:27:11 +10:00
Damien Elmes
f0ce1cfc9d rename workspace
I'd forgotten that Bazel "helpfully" adds __init__.py files into folders
that match the workspace name, breaking imports.
2021-07-10 23:58:53 +10:00
Damien Elmes
5255409093 refactor protobuf handling for split/import
In order to split backend.proto into a more manageable size, the protobuf
handling needed to be updated. This took more time than I would have
liked, as each language handles protobuf differently:

- The Python Protobuf code ignores "package" directives, and relies
solely on how the files are laid out on disk. While it would have been
nice to keep the generated files in a private subpackage, Protobuf gets
confused if the files are located in a location that does not match
their original .proto layout, so the old approach of storing them in
_backend/ will not work. They now clutter up pylib/anki instead. I'm
rather annoyed by that, but alternatives seem to be having to add an extra
level to the Protobuf path, making the other languages suffer, or trying
to hack around the issue by munging sys.modules.
- Protobufjs fails to expose packages if they don't start with a capital
letter, despite the fact that lowercase packages are the norm in most
languages :-( This required a patch to fix.
- Rust was the easiest, as Prost is relatively straightforward compared
to Google's tools.

The Protobuf files are now stored in /proto/anki, with a separate package
for each file. I've split backend.proto into a few files as a test, but
the majority of that work is still to come.

The Python Protobuf building is a bit of a hack at the moment, hard-coding
"proto" as the top level folder, but it seems to get the job done for now.

Also changed the workspace name, as there seems to be a number of Bazel
repos moving away from the more awkward reverse DNS naming style.
2021-07-10 19:17:05 +10:00
Damien Elmes
659df3957b mention JS flakiness in Mac/Linux instructions 2021-06-21 13:23:03 +10:00
Damien Elmes
171e2c4b46 update to latest rules_rust
- bumps rust version to 1.53
- drops support for incremental building, which is currently
disabled in stable Rust releases due to bugs. 'cargo check' can still
be used to quickly check things compile
2021-06-21 13:09:36 +10:00
cherryblossom
462da55fd5 fix documentation links 2021-06-03 16:51:03 +10:00
Damien Elmes
e35b2f68ac add an updated script to run mypy as a daemon
Sadly doesn't work on Windows
2021-04-14 18:10:38 +10:00
Damien Elmes
cf623731a2 update to latest rules_rust incremental compilation 2021-04-09 12:48:24 +10:00
Damien Elmes
8770eb74f5 update rules_rust with worker refactor
If you were using the optional Rust worker support, please see the
change to development.md
2021-03-30 17:24:51 +10:00
Damien Elmes
2338998304 update to the latest rules_rust + security framework update 2021-03-27 19:28:19 +10:00
Damien Elmes
833763df2e contributing.md update 2021-02-03 16:06:34 +10:00
Damien Elmes
a4e6949a45 doc tweaks 2021-01-31 20:54:43 +10:00
Damien Elmes
026debe308 clarify test running in docs 2021-01-19 10:26:00 +10:00
Damien Elmes
6cc58451b1 add local sync server frontend 2021-01-13 11:42:00 +10:00
Damien Elmes
1b6f5318e3 document extra formatter 2021-01-09 17:42:26 +10:00
Damien Elmes
b43515ceff add .sql file formatter
Uses the logic from the sqltools VSCode add-on, with a workaround
for the use of 'type' in some table columns.

By detecting the presence of 'BUILD_WORKSPACE_DIRECTORY' we can tell
if the rule is running in test mode or was run directly, avoiding the
need for separate check and fix rules. It might be nice to extend this
to other formatting rules in the future as well.
2021-01-09 14:22:49 +10:00
Damien Elmes
f333c3332a Make orjson optional again
While 32 bit platform support is probably not going to come back,
this allows Anki to run on other architectures orjson doesn't support.
2021-01-07 09:44:40 +10:00
Damien Elmes
792a2240fc docs: musl and local node 2021-01-02 09:49:41 +10:00
Damien Elmes
e147dfa17f add some Python source deps 2021-01-01 08:49:29 +10:00
Damien Elmes
1db4d0290f add some porting notes 2020-12-31 14:03:38 +10:00
Damien Elmes
03dc6ac8fd fix typo in docs
Thanks to Gustavo for the report

Closes #876
2020-12-30 13:54:27 +10:00
Damien Elmes
f33a001859 Merge pull request #868 from Arthur-Milchior/contributing_sh
Contributing shell code in backtick
2020-12-28 10:46:34 +10:00