1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00
Commit graph

43 commits

Author SHA1 Message Date
Nicolas Danelon
f6f7c69023 Meta: Add missing 'args' argument to install command parser
The install command was failing with 'Namespace object has no
attribute args' error because the argument parser for the
install command was missing the 'args' parameter that allows
passing additional arguments to the build system.

This fix adds the missing argument to match the behavior of
other commands like build, run, and debug.
2025-06-04 17:34:21 -04:00
Timothy Flynn
667a568526 Meta: Add compiler arguments to the debug build mode 2025-05-30 20:06:15 -04:00
Timothy Flynn
3786d56814 Meta: Remove msbuild presets
Let's just support ninja for simplicity. The msbuild presets are
significantly slower anyhow.
2025-05-30 13:52:51 -04:00
Timothy Flynn
0958c5f508 Meta: Provide compiler jobs as a command line argument
On my Linux machine with 32 cores, ninja actually defaults to 34 jobs.
By defaulting ourselves to multiprocessing.cpu_count(), we actually
decrease the number of jobs used.
2025-05-30 12:03:38 -04:00
Timothy Flynn
e6938e11b0 Meta: Inspect the host compiler only when needed
We don't need to pick a host compiler every time ladybird.py is invoked.
We only need to do so when configuring the Build directory.

This shaves about 10ms off an invocation of `ladybird.py build` on my
machine, going from ~170ms to ~160ms.
2025-05-30 12:03:38 -04:00
Timothy Flynn
16743ee9d9 Meta: Invoke ninja directly instead of cmake --build
This shaves about 10ms off an invocation of `ladybird.py build` on my
machine, going from ~180ms to ~170ms.
2025-05-30 12:03:38 -04:00
Timothy Flynn
877687d1f6 Meta: Make the ladybird.py test pattern argument positional
Restores API compatibility with the old ladybird.sh.
2025-05-30 06:40:56 -04:00
Timothy Flynn
6345ebb78c Meta: Don't assume all build commands have a target
For example, the "test" and "vcpkg" build commands do not.
2025-05-30 06:40:56 -04:00
Timothy Flynn
f46f9b0f02 Meta: Restore default "build everything" behavior in ladybird.py
By default, we want `ladybird.py build` to build everything. We were
previously defaulting to only building the Ladybird target.

We now only fall back to the Ladybird target for commands that run a
program. So `ladybird.py run` will build and run Ladybird.
2025-05-29 16:24:17 -04:00
Timothy Flynn
aa0fcc67b3 Meta: Tentatively support BSD distributions in ladybird.py
Support was unknowingly dropped when porting ladybird.sh to ladybird.py.
This tentatively restores this support, but is untested on a BSD system.
2025-05-29 16:24:17 -04:00
Timothy Flynn
f2eaf1e57b Meta: Use new run_command utility to invoke subprocesses
As opposed to just running subprocess.check_call, our `run_command`
utility handles e.g. ctrl+c to avoid spamming the terminal with
KeyboardInterrupt stack traces.
2025-05-29 16:24:17 -04:00
Timothy Flynn
a5bfb686f4 Meta: Integrate find_compiler.py into ladybird.py 2025-05-29 16:24:17 -04:00
Timothy Flynn
8e792cd094 Meta: Support python 3.9 in ladybird.py
This is the default python version on macOS, so let's support it since
it is trivial for now. Using "str | None" as a type annotation is only
supported in python 3.10 or later.
2025-05-29 16:24:17 -04:00
Timothy Flynn
a76e880dfe Meta: Extract platform detection utilities to their own file
This will be needed by other scripts.

To do so, this patch gives up on the importlib method of importing
packages. I tried extracting this helper to e.g. __init__.py, but the
python runtime was unable to find the imported symbols.
2025-05-29 16:24:17 -04:00
Timothy Flynn
872a112cad Meta: Add SPDX license identifier to ladybird.py and BuildVcpkg.py 2025-05-29 16:24:17 -04:00
Timothy Flynn
24da7b006e Meta: Change the ladybird.py target to be a positional argument
This affords us some API symmetry with ladybird.sh.
2025-05-27 20:02:37 +02:00
Timothy Flynn
25666390f6 Meta: Alias the "ladybird" target to "Ladybird" in ladybird.py
We do the same thing in ladybird.sh for convenience.
2025-05-27 20:02:37 +02:00
Timothy Flynn
e7fe2d3dab Meta: Do not pass non-existing extra arguments to addr2line build step
The variadic nature of the addr2line command is currently taken by the
`addresses` option.
2025-05-27 20:02:37 +02:00
Callum Law
9dfce6d14c Meta: Avoid doublequote strings nested in fstrings in ladybird.py
Double quote strings nested within double quoted-fstrings are invalid
syntax prior to Python 3.12 and was causing an error when running
ladybird.py
2025-05-23 10:27:34 -04:00
ayeteadoe
fdd3f35b61 Meta: Localize resource module import to fix ladybird.py on Windows 2025-05-22 17:48:03 -04:00
Timothy Flynn
d00d49ba2f Meta+Toolchain: Extract BuildVcpkg to an importable function
This lets ladybird.py import it properly, instead of invoking BuildVcpkg
main().
2025-05-22 12:21:24 -04:00
Timothy Flynn
8d4ac42205 Meta: Always invoke BuildVcpkg from ladybird.py's build command
We were previously only invoking it if the Build directory didn't exist.
We need to always invoke it to handle vcpkg baseline updates.
2025-05-22 12:21:24 -04:00
Timothy Flynn
9ae85e5c68 Meta: Avoid manual formation of user-variables.cmake path
We're using python specifically to be platform-independent.
2025-05-21 16:55:27 -06:00
Timothy Flynn
5b830b4c05 Meta: Be a bit less aggressive with newlines in list extensions 2025-05-21 16:55:27 -06:00
Timothy Flynn
bac61926b2 Meta: Use fewer abbreviated variable names in ladybird.py 2025-05-21 16:55:27 -06:00
Timothy Flynn
b54f273770 Meta: Ignore pyright warning for dynamic BuildVcpkg import
There are now zero pyright warnings.
2025-05-21 16:55:27 -06:00
Timothy Flynn
6a1b3f740c Meta: Avoid double-access of LADYBIRD_SOURCE_DIR environment variable
The `ensure_ladybird_source_dir` function returns the source directory.
Let's just use it. This silences a pyright warning.
2025-05-21 16:55:27 -06:00
Timothy Flynn
23a95cfb9a Meta: Add missing type hints to ladybird.py
This enables significantly better LSP integration.
2025-05-21 16:55:27 -06:00
Timothy Flynn
9d3d0c4874 Meta: Sprinkle some newlines into ladybird.py
Long functions without newlines between logical blocks of code get hard
to read for me after a while.
2025-05-21 16:55:27 -06:00
Timothy Flynn
6862985b08 Meta: Do not conflate build and run arguments
The previous commit preserved existing behavior from `master`, but made
it clear that the script was trying to use the `run` arguments in the
build step. We currently cannot specify both build-time and run-time
arguments, so only pass the positional arguments to the run step.
2025-05-21 16:55:27 -06:00
Timothy Flynn
620a2b7598 Meta: Do not pass arguments around as kwargs in ladybird.py
Use proper function arguments instead.
2025-05-21 16:55:27 -06:00
Timothy Flynn
16feb0b979 Meta: Move ladybird.py imports to the top of the file
There's no measurable benefit to hiding these in functions, even if they
are only used once (or not at all). Only the BuildVcpkg import is left
alone, as that function does some sys.path manipulation first.
2025-05-21 16:55:27 -06:00
Timothy Flynn
f87a90b67b Meta: Remove underscore prefix from functions in ladybird.py
These are meant to indicate private functions by convention, and while
we can argue these functions are "private" to this file, let's err on
the side of readablilty over every single function being prefixed.
2025-05-21 16:55:27 -06:00
Timothy Flynn
ec863a6d8b Meta: Format ladybird.py with black
We require pep8 conformance via flake8 in CI, and flake8 seems happy
with this patch. In the future, we should enforce use of black in CI
as well.

Formatted with:

    black --line-length 120 ./Meta/ladybird.py
2025-05-21 16:55:27 -06:00
Ashton
fc204c8732 Meta: Add addr2line command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
061a7f766c Meta: Add rebuild command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
56fd109252 Meta: Add clean command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
bfc0715455 Meta: Add vcpkg command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
08d11b9fba Meta: Add debug command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
5602d3cdf1 Meta: Add install command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
73159fe2ce Meta: Add run command to ladybird.py 2025-05-21 11:35:20 -06:00
Ashton
c51abfb2ca Meta: Add test command to ladybird.py 2025-05-21 11:35:20 -06:00
ayeteadoe
c9624d5118 Meta: Add build command to ladybird.py 2025-05-21 11:35:20 -06:00