mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-25 17:25:08 +02:00
Meta: Move python code generators to a subdirectory
Let's have a bit of organization here, rather than an ever-growing Meta folder.
This commit is contained in:
Notes:
github-actions[bot]
2026-04-23 11:32:46 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/5c34c7f5548 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/9045
@@ -6,7 +6,7 @@
|
||||
|
||||
//! Build script that generates Rust bytecode instruction types from Bytecode.def.
|
||||
//!
|
||||
//! This mirrors Meta/generate-libjs-bytecode-def-derived.py but generates Rust
|
||||
//! This mirrors Meta/Generators/generate_libjs_bytecode_def_derived.py but generates Rust
|
||||
//! code instead of C++. The generated code lives in $OUT_DIR/instruction_generated.rs
|
||||
//! and is included! from src/bytecode/instruction.rs.
|
||||
|
||||
|
||||
@@ -11,11 +11,11 @@ function(embed_as_string name source_file output source_variable_name)
|
||||
find_package(Python3 REQUIRED COMPONENTS Interpreter)
|
||||
add_custom_command(
|
||||
OUTPUT "${output}"
|
||||
COMMAND "${Python3_EXECUTABLE}" "${LADYBIRD_SOURCE_DIR}/Meta/embed_as_string.py" "${source_file}" -o "${output}.tmp" -n "${source_variable_name}" ${namespace_arg}
|
||||
COMMAND "${Python3_EXECUTABLE}" "${LADYBIRD_SOURCE_DIR}/Meta/Generators/embed_as_string.py" "${source_file}" -o "${output}.tmp" -n "${source_variable_name}" ${namespace_arg}
|
||||
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${output}.tmp" "${output}"
|
||||
COMMAND "${CMAKE_COMMAND}" -E remove "${output}.tmp"
|
||||
VERBATIM
|
||||
DEPENDS "${LADYBIRD_SOURCE_DIR}/Meta/embed_as_string.py"
|
||||
DEPENDS "${LADYBIRD_SOURCE_DIR}/Meta/Generators/embed_as_string.py"
|
||||
MAIN_DEPENDENCY "${source_file}"
|
||||
)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ function(generate_bytecode_def_derived)
|
||||
set(LIBJS_INPUT_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
invoke_py_generator(
|
||||
"Op.cpp"
|
||||
"generate-libjs-bytecode-def-derived.py"
|
||||
"generate_libjs_bytecode_def_derived.py"
|
||||
"${LIBJS_INPUT_FOLDER}/Bytecode/Bytecode.def"
|
||||
"Bytecode/Op.h"
|
||||
"Bytecode/Op.cpp"
|
||||
|
||||
@@ -200,7 +200,7 @@ function (generate_html_implementation)
|
||||
|
||||
invoke_py_generator(
|
||||
"MediaControlsDOM.cpp"
|
||||
"generate-dom-tree.py"
|
||||
"generate_dom_tree.py"
|
||||
"${LIBWEB_INPUT_FOLDER}/HTML/MediaControls.html"
|
||||
"HTML/MediaControlsDOM.h"
|
||||
"HTML/MediaControlsDOM.cpp"
|
||||
|
||||
@@ -102,7 +102,7 @@ function(invoke_py_generator name script primary_source header implementation)
|
||||
|
||||
invoke_generator_impl(
|
||||
${name}
|
||||
"${LADYBIRD_SOURCE_DIR}/Meta/${script}"
|
||||
"${LADYBIRD_SOURCE_DIR}/Meta/Generators/${script}"
|
||||
${primary_source}
|
||||
${header}
|
||||
${implementation}
|
||||
|
||||
@@ -30,7 +30,7 @@ if(INCLUDE_WASM_SPEC_TESTS)
|
||||
get_filename_component(NAME ${PATH} NAME_WLE)
|
||||
message(STATUS "Generating test cases for WebAssembly test ${NAME}...")
|
||||
execute_process(
|
||||
COMMAND env SKIP_PRETTIER=${SKIP_PRETTIER} bash ${LADYBIRD_SOURCE_DIR}/Meta/generate-libwasm-spec-test.sh "${PATH}" "${CMAKE_CURRENT_BINARY_DIR}/Tests/Spec" "${NAME}" "${WASM_SPEC_TEST_PATH}")
|
||||
COMMAND env SKIP_PRETTIER=${SKIP_PRETTIER} bash ${LADYBIRD_SOURCE_DIR}/Meta/Generators/generate_libwasm_spec_test.sh "${PATH}" "${CMAKE_CURRENT_BINARY_DIR}/Tests/Spec" "${NAME}" "${WASM_SPEC_TEST_PATH}")
|
||||
endforeach()
|
||||
file(REMOVE testsuite-${WASM_SPEC_TEST_COMMIT})
|
||||
endif()
|
||||
|
||||
@@ -13,7 +13,7 @@ MODULE_OUTPUT_PATH="$4"
|
||||
mkdir -p "$OUTPUT_PATH"
|
||||
mkdir -p "$MODULE_OUTPUT_PATH"
|
||||
|
||||
python3 "$(dirname "$0")/generate-libwasm-spec-test.py" "$INPUT_FILE" "$NAME" "$MODULE_OUTPUT_PATH" |\
|
||||
python3 "$(dirname "$0")/generate_libwasm_spec_test.py" "$INPUT_FILE" "$NAME" "$MODULE_OUTPUT_PATH" |\
|
||||
if $SKIP_PRETTIER; then
|
||||
cat
|
||||
else
|
||||
Reference in New Issue
Block a user