mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-22 12:35:14 +00:00
LibJSGCVerifier: Support building & running with the Lagom build
This commit is contained in:
parent
2d4964b945
commit
1fd6673f87
Notes:
sideshowbarker
2024-07-16 18:03:21 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/1fd6673f87 Pull-request: https://github.com/SerenityOS/serenity/pull/23858 Issue: https://github.com/SerenityOS/serenity/issues/23832
3 changed files with 48 additions and 11 deletions
|
@ -2,7 +2,13 @@ cmake_minimum_required(VERSION 3.24)
|
|||
|
||||
project(LibJSGCVerifier C CXX)
|
||||
|
||||
find_package(Clang CONFIG REQUIRED HINTS "../../../../Toolchain/Local/clang")
|
||||
set(LAGOM_BUILD OFF CACHE BOOL "Build without the serenity toolchain Clang")
|
||||
|
||||
if (LAGOM_BUILD)
|
||||
find_package(Clang 16 CONFIG REQUIRED)
|
||||
else()
|
||||
find_package(Clang CONFIG REQUIRED HINTS "../../../../Toolchain/Local/clang")
|
||||
endif()
|
||||
|
||||
add_executable(LibJSGCVerifier src/main.cpp src/CellsHandler.cpp)
|
||||
|
||||
|
|
|
@ -7,12 +7,15 @@ two things:
|
|||
- For all types not wrapped by `GCPtr` or `NonnullGCPtr`, that the wrapped type does not inherit from `Cell`
|
||||
(otherwise it should be wrapped).
|
||||
|
||||
This tool currently requires having first built Serenity with the Clang toolchain for x86_64:
|
||||
This tool currently support being built with the Serenity Clang toolchain or the lagom Clang toolchain (in which case it won't be able to verify Serenity-only applications)
|
||||
|
||||
#### Building & Running with the Serenity toolchain
|
||||
First build Serenity with the Clang toolchain for x86_64:
|
||||
```bash
|
||||
./Meta/serenity.sh build x86_64 Clang
|
||||
```
|
||||
|
||||
Once Serenity is built, this tool can be built with:
|
||||
Then build the tool with:
|
||||
```bash
|
||||
cmake -GNinja -B build
|
||||
cmake --build build
|
||||
|
@ -22,3 +25,20 @@ Then run the tool with:
|
|||
```bash
|
||||
src/main.py -b <path to serenity>/Build
|
||||
```
|
||||
|
||||
#### Building & Running with the Lagom toolchain
|
||||
First build the Serenity lagom applications with:
|
||||
```bash
|
||||
./Meta/serenity.sh build lagom
|
||||
```
|
||||
|
||||
Then build the tool with:
|
||||
```bash
|
||||
cmake -GNinja -DLAGOM_BUILD=ON -B build
|
||||
cmake --build build
|
||||
```
|
||||
|
||||
Then run the tool with:
|
||||
```bash
|
||||
src/main.py -l -b <path to serenity>/Build
|
||||
```
|
||||
|
|
|
@ -9,26 +9,33 @@ import subprocess
|
|||
import sys
|
||||
|
||||
# Relative to Userland directory
|
||||
PATHS_TO_SEARCH = [
|
||||
COMMON_PATHS_TO_SEARCH = [
|
||||
'Libraries/LibJS',
|
||||
'Libraries/LibMarkdown',
|
||||
'Libraries/LibWeb',
|
||||
'Services/WebContent',
|
||||
'Services/WebWorker',
|
||||
]
|
||||
SERENITY_PATHS_TO_SEARCH = COMMON_PATHS_TO_SEARCH + [
|
||||
'Applications/Assistant',
|
||||
'Applications/Browser',
|
||||
'Applications/Spreadsheet',
|
||||
'Applications/TextEditor',
|
||||
'DevTools/HackStudio',
|
||||
'Libraries/LibJS',
|
||||
'Libraries/LibMarkdown',
|
||||
'Libraries/LibWeb',
|
||||
'Services/WebContent',
|
||||
]
|
||||
|
||||
parser = argparse.ArgumentParser('LibJSGCVerifier', description='A Clang tool to validate usage of the LibJS GC')
|
||||
parser.add_argument('-b', '--build-path', required=True, help='Path to the project Build folder')
|
||||
parser.add_argument('-l', '--lagom', action='store_true', required=False,
|
||||
help='Use the lagom build instead of the serenity build')
|
||||
args = parser.parse_args()
|
||||
|
||||
build_path = Path(args.build_path).resolve()
|
||||
userland_path = build_path / '..' / 'Userland'
|
||||
include_path = build_path / 'x86_64clang' / 'Root' / 'usr' / 'include'
|
||||
compile_commands_path = build_path / 'x86_64clang' / 'compile_commands.json'
|
||||
if args.lagom:
|
||||
compile_commands_path = build_path / 'lagom' / 'compile_commands.json'
|
||||
else:
|
||||
compile_commands_path = build_path / 'x86_64clang' / 'compile_commands.json'
|
||||
|
||||
if not compile_commands_path.exists():
|
||||
print(f'Could not find compile_commands.json in {compile_commands_path.parent}')
|
||||
|
@ -36,7 +43,11 @@ if not compile_commands_path.exists():
|
|||
|
||||
paths = []
|
||||
|
||||
for containing_path in PATHS_TO_SEARCH:
|
||||
if args.lagom:
|
||||
paths_to_search = COMMON_PATHS_TO_SEARCH
|
||||
else:
|
||||
paths_to_search = SERENITY_PATHS_TO_SEARCH
|
||||
for containing_path in paths_to_search:
|
||||
for root, dirs, files in os.walk(userland_path / containing_path):
|
||||
for file in files:
|
||||
if file.endswith('.cpp'):
|
||||
|
|
Loading…
Add table
Reference in a new issue