Commit graph

151 commits

Author SHA1 Message Date
Damien Elmes
c398baca7a Bundling got broken in the revert to Qt 6.6 2025-01-26 19:32:01 +11:00
Damien Elmes
7884edfd3a
Yarn 4 (#3772)
* Update to yarn 4, and pin the version

* Use yarn to invoke prettier, as yarn 4 is not setting +x

* Fix a few peer dependency warnings
2025-01-26 14:40:17 +11:00
Damien Elmes
c253d40d1d Use prettier's cache
Approximately halves runtime on my system
2025-01-25 22:52:25 +11:00
Damien Elmes
3d13d259bb Use Qt 6.8 on ARM Linux; add tools/run-qt6.8
Prior to this change, ./run fails out of the box on ARM systems, as Qt
wasn't available on PyPI until the 6.8 release.

Also added a script in tools/ for testing Qt6.8 issues on other platforms.
2025-01-25 21:59:31 +11:00
Damien Elmes
cd1824165f Revert "Qt 6.8.1"
This reverts commit 04228de666.

Anki 25.01 Beta 1 revealed a bunch of regressions with the latest
Qt, and zero reports of improvements from it, so we'll be better off
holding off on it for now, and perhaps reporting the deadkeys issue
to Qt once we've got a proper reproduction process.
2025-01-25 21:41:33 +11:00
Damien Elmes
455677a5c0 Ensure sveltekit gets built before congrats page
Fixes race condition in build
2025-01-24 18:32:19 +11:00
Damien Elmes
774d57cdc8 Restore the missing external congrats page 2025-01-24 16:21:36 +11:00
Damien Elmes
06ef25755b Ensure pyoxidizer rebuilt on arch change
Fixes broken builds when switching between ARM and AMD on a Mac.
2025-01-24 12:50:00 +11:00
Abdo
2c1a4895ba Switch back to Prettier for Svelte formatting
Closes #3649
Closes #3713
2025-01-13 15:53:55 +11:00
Damien Elmes
6966da14c2 Start installing PyQt6 into the Linux ARM64 venv by default
Now that an ARM wheel is on PyPI, we no longer need to rely on a
system PyQt to build on ARM. The install is skipped when PYTHONPATH
is set, so older distros with glibc <2.39 can continue to use the
system packages instead.
2025-01-10 22:26:30 +11:00
Damien Elmes
256822bbb1 Improve error when n2/ninja missing 2025-01-10 22:26:30 +11:00
Damien Elmes
3bdf61e2fd Improve error when git not installed 2025-01-10 22:26:30 +11:00
Damien Elmes
5d150c74a4
Qt 6.8.1 (#3633)
* Qt 6.8.1

Bumps minimum glibc to 2.35, and minimum macOS to 12

* Drop generation of Qt5 packaged build

Closes #3615

* Include qt6 requirements in aqt wheel; drop extra deps

* Fix aqt wheels growing over time
2025-01-09 20:07:12 +11:00
Damien Elmes
9c3f89466d Fix glibc tag for AMD build 2024-12-09 19:40:16 +11:00
a.r
d9969a9f4f
lazy_static → once_cell → stabilized versions (#3447)
* Anki: Replace lazy_static with once_cell

Unify to once_cell, lazy_static's replacement. The latter in unmaintained.

* Anki: Replace once_cell with stabilized LazyCell / LazyLock as far as possible

Since 1.80: https://github.com/rust-lang/rust/issues/109736 and https://github.com/rust-lang/rust/pull/98165

Non-Thread-Safe Lazy → std::cell::LazyCell https://doc.rust-lang.org/nightly/std/cell/struct.LazyCell.html

Thread-safe SyncLazy → std::sync::LazyLock https://doc.rust-lang.org/nightly/std/sync/struct.LazyLock.html

The compiler accepted LazyCell only in minilints.

The final use in rslib/src/log.rs couldn't be replaced since get_or_try_init has not yet been standardized: https://github.com/rust-lang/rust/issues/109737

* Declare correct MSRV (dae)

Some of our deps require newer Rust versions, so this was misleading.

Updating the MSRV also allows us to use .inspect() on Option now
2024-09-30 23:35:06 +10:00
Damien Elmes
5335d748cf Bump Rust to 1.81 for latest CVE 2024-09-05 12:39:59 +07:00
Damien Elmes
ca4393142e Update to Rust 1.80
https://github.com/ankitects/anki/pull/3329#issuecomment-2254538270
2024-08-05 15:37:59 +07:00
Abdo
d108bff862
Fix remaining accessibility warnings (#3241)
* Remove unused build var

* Fix accessibility warnings in CollapseLabel

* Fix accessibility warnings in PlainTextBadge

* Add ARIA role to Autocompleteitem

* Fix accessibility warnings in HandleBackground

* Fix accessibility warnings in HandleControl

* Fix accessibility warnings in EditorField

* Fix accessibility warnings in RichTextBadge

* Fix accessibility warnings in StickyBadge

* Remove ignored a11y warnings
2024-07-10 19:55:08 +07:00
Damien Elmes
a739d6257c Fix check:svelte/vitest running indiscriminately 2024-07-06 18:40:36 +07:00
antecrescent
60b25535ef
Make SvelteCheck and ViteTest respect YARN_BINARY (#3231) 2024-06-28 18:00:38 +07:00
Alexander Bocken
4fb2efb8aa
fix sveltekit respecting yarn env var (#3226)
* fix sveltekit respecting yarn env var

* adding myself to CONTRIBUTORS
2024-06-07 23:01:40 +01:00
Mani
477f932f35
fix select all and change ordinal in edit mode in io (#3109)
* fix select all and change ordinal in edit mode in io

* make ordinal undefined for all shapes in group/ungroup

* fix group shapes and some ui fixes

* Don't add node_modules/* to dprint deps

* use minimum ordinal when shape merged, use max ordinal++ when ungrouped, in add mode no ordinal preset so NaN

* use state for ungroup shape

* maintain existing ordinal in editing mode

* fix order of ordinal in ungroup shape

* refactor: remove for loop, use forEach
2024-04-11 08:08:07 +01:00
Damien Elmes
bdc9be2bbb Ensure ankihelper is rebuilt on arch change
https://forums.ankiweb.net/t/24-04-breaks-dark-mode-on-mac/43048
2024-04-03 15:07:50 +07:00
Damien Elmes
7121cb5132 Fix arm64 node checksum 2024-04-01 17:17:44 +07:00
Damien Elmes
9f55cf26fc
Switch to SvelteKit (#3077)
* Update to latest Node LTS

* Add sveltekit

* Split tslib into separate @generated and @tslib components

SvelteKit's path aliases don't support multiple locations, so our old
approach of using @tslib to refer to both ts/lib and out/ts/lib will no
longer work. Instead, all generated sources and their includes are
placed in a separate out/ts/generated folder, and imported via @generated
instead. This also allows us to generate .ts files, instead of needing
to output separate .d.ts and .js files.

* Switch package.json to module type

* Avoid usage of baseUrl

Incompatible with SvelteKit

* Move sass into ts; use relative links

SvelteKit's default sass support doesn't allow overriding loadPaths

* jest->vitest, graphs example working with yarn dev

* most pages working in dev mode

* Some fixes after rebasing

* Fix/silence some svelte-check errors

* Get image-occlusion working with Fabric types

* Post-rebase lock changes

* Editor is now checked

* SvelteKit build integrated into ninja

* Use the new SvelteKit entrypoint for pages like congrats/deck options/etc

* Run eslint once for ts/**; fix some tests

* Fix a bunch of issues introduced when rebasing over latest main

* Run eslint fix

* Fix remaining eslint+pylint issues; tests now all pass

* Fix some issues with a clean build

* Latest bufbuild no longer requires @__PURE__ hack

* Add a few missed dependencies

* Add yarn.bat to fix Windows build

* Fix pages failing to show when ANKI_API_PORT not defined

* Fix svelte-check and vitest on Windows

* Set node path in ./yarn

* Move svelte-kit output to ts/.svelte-kit

Sadly, I couldn't figure out a way to store it in out/ if out/ is
a symlink, as it breaks module resolution when SvelteKit is run.

* Allow HMR inside Anki

* Skip SvelteKit build when HMR is defined

* Fix some post-rebase issues

I should have done a normal merge instead.
2024-03-31 09:16:31 +01:00
antecrescent
58ce29f461
Refactor offline build process and add offline generation of Sphinx docs (#3082)
* Simplify the offline build

The two environment variables OFFLINE_BUILD and NO_VENV jointly provide
the ability to build Anki fully offline. This commit boils them down
into just one, namely OFFLINE_BUILD.

The rationale being that first, OFFLINE_BUILD implies the use of
a custom non-networked Python environment.
Second, building Anki with a custom Python environment in a networked
setting is a use case, that we currently do not support.
Developers in need of such a solution may want to give containerized
development environments a try. Users could also look into building
Anki fully offline instead.

* Add documentation for offline builds.

* Add support for offline generation of Sphinx documentation.

Control installation of Sphinx dependencies via the network through the
OFFLINE_BUILD environment variable.

* Add documentation for offline generation of Sphinx documentation.
2024-03-27 13:51:09 +00:00
Damien Elmes
cadbb6ad8d Ensure rsbridge gets rebuilt when buildhash changes
Hopefully fixes https://forums.ankiweb.net/t/anki-24-04-beta/41792/2
2024-03-01 13:25:56 +07:00
Damien Elmes
bfaa28feda Mac Qt bundle rebuilt without .dSYM files 2024-02-29 13:33:12 +07:00
Damien Elmes
8ab18d276a Update Qt bundle to 6.6.2 2024-02-28 15:34:09 +07:00
Damien Elmes
151dd0fb34 Hard-code SDK root when building
PyOxidizer's detection seems to be failing on the machine I'm running
from.
2024-02-28 15:34:09 +07:00
Damien Elmes
09f032b2e8 Ensure PyOxidizer checked out when bundling 2024-02-13 10:56:53 +10:00
Damien Elmes
efa9c5a39a Remove inverted print statement from recent PR 2024-02-13 10:54:39 +10:00
Kai Knoblich
54b1cc5689
Honor NINJA_STATUS if already set (#2984)
* Honor NINJA_STATUS if already set

Allow build environments at downstream to use their own configured
NINJA_STATUS if set.

* Update CONTRIBUTORS
2024-02-01 14:56:14 +10:00
Kai Knoblich
42cc2c913c
Add support for offline builds (#2963)
* CONTRIBUTORS: Add myself to the contributors list

* Add support for offline builds

Downloading files during build time is a non-starter for FreeBSD ports
(and presumably for other *BSD ports and some Linux distros as well).

In order to still be able to build Anki successfully, two new
environment variables have been added that can be set accordingly:

* NO_VENV: If set, the Python system environment is used instead of
  a venv. This is necessary if there are no usable Python wheels for a
  platform, e.g. PyQt6.

* OFFLINE_BUILD: If set, the git repository synchronization (translation
  files, build hash, etc.) is skipped.

To successfully build Anki offline, following conditions must be met:

1. All required dependencies (node, Python, rust, yarn, etc.) must be
   present in the build environment.

2. The offline repositories for the translation files must be
   copied/linked to ftl/qt-repo and ftl/core-repo.

3. The Python pseudo venv needs to be setup:

   $ mkdir out/pyenv/bin
   $ ln -s /path/to/python out/pyenv/bin/python
   $ ln -s /path/to/protoc-gen-mypy out/pyenv/bin/protoc-gen-mypy

4. Create the offline cache for yarn and use its own environment
   variable YARN_CACHE_FOLDER to it:

   YARN_CACHE_FOLDER=/path/to/the/yarn/cache
   $ /path/to/yarn install --ignore-scripts

5. Build Anki:

   $ /path/to/cargo build --package runner --release --verbose --verbose
   $ OFFLINE_BUILD=1 \
     NO_VENV=1 \
     ${WRKSRC}/out/rust/release/runner build wheels
2024-01-31 09:13:46 +10:00
Damien Elmes
d6549623af Update Python
Closes #2923
2024-01-19 15:11:17 +10:00
Damien Elmes
20dc281558 Revert "Update to Qt 6.6.1 on Mac"
This reverts commit cbab96ec75.

This moves the bundle back to Qt 5.3 due to
https://forums.ankiweb.net/t/anki-23-12-mac-apple-qt6-dmg-crashing-on-browser/38783

We'll move back up when 6.6.2 comes out in mid-late Jan.
2023-12-28 18:17:50 +10:00
Abdo
3e5458b3db
Skip tests failing around rollover hour (#2909)
* Skip tests failing around rollover hour

* Set ANKI_TEST_MODE for Rust tests instead
2023-12-28 18:06:19 +10:00
Damien Elmes
425d9e3fe1 Fix mpv not working out of the box in win32 source build
Regressed in 711c28e1a5
2023-12-06 11:34:56 +10:00
Damien Elmes
cbab96ec75 Update to Qt 6.6.1 on Mac
This also fixes the Mac bundle using an old Qt version.

Linux held back due to ABI breakage; should be fixed in about a week
when PyQt 6.6.1 comes out. Windows build also fails to run - not sure
if it's the same issue or not.
2023-12-04 16:15:52 +10:00
Abdo
dc3bd3efde
Replace css_browser_selector with our own implementation (#2854)
* Replace css_browser_selector

* Add classes to root element instead of body

* Export addBrowserClasses() in reviewer_extras for mobile clients (dae)

* Avoid setting .mac on iOS devices (dae)
2023-11-30 10:57:33 +10:00
Abdo
e88dfb68a5
Load MathJax's text-chtml-full component in reviewer/previewer (#2836)
* Load MathJax's text-chtml-full in review screens

* Remove no longer needed MathJax extensions
2023-11-20 16:50:55 +10:00
Damien Elmes
a5cd3f32f4 Fix broken bundling on Windows 11
When Windows notices "install" in the filename it triggers a UAC elevation,
causing 'cargo run' to fail.
2023-11-20 12:01:34 +10:00
Damien Elmes
f9d5f422e4 Fix Android backend failing to build on Windows with n2 2023-11-08 13:31:35 +10:00
Damien Elmes
afa39e7d96 Give users a hint when they try to build from a source tarball 2023-11-04 08:35:44 +10:00
Damien Elmes
b4c9e54347 Jemalloc no longer seems to fail in cross-compile builds 2023-11-02 19:56:08 +10:00
Damien Elmes
373a63f610 Work around Xcode 15 breaking older macOS versions 2023-11-02 19:54:44 +10:00
Damien Elmes
9600f033f7 Add reviewer_extras.css
Will help with https://github.com/ankidroid/Anki-Android-Backend/issues/313
2023-10-27 03:07:31 +10:00
Damien Elmes
b2d515c8bb Update to Qt 6.5.3 on Windows/Mac
+ Fix incorrect version selection on Mac

Closes #2733 (except for Linux users)
2023-10-15 09:48:36 +10:00
Gulshan Singh
a230c754b9
Add Sphinx documentation generation functionality (#2720)
* Add Sphinx documentation generation functionality

* sphinx-docs -> python/sphinx

* Use ninja instead of make

* Update copyright info in sphinx docs

* Run sphinx-apidoc before building Sphinx docs

* Cleanup Sphinx path insertion

* Don't write build outputs into source; use autoapi

* aqt -> _aqt

* Mention sphinx in development.md

---------

Co-authored-by: Damien Elmes <gpg@ankiweb.net>
2023-10-13 13:03:54 +10:00
Damien Elmes
d7ff99780e Improve Python Protobuf speed
upb was being included in the bundle, but not found at run time due
to src files being embedded in the binary.
2023-10-04 13:36:47 +10:00