1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

Everywhere: Rename WrapperGenerator to BindingsGenerator

This code generator no longer creates JS wrappers for platform objects
in the old sense, instead they're JS objects internally themselves.
Most of what we generate now are prototypes - which can be seen as
bindings for the internal C++ methods implementing getters, setters, and
methods - as well as object constructors, i.e. bindings for the internal
create_with_global_object() method.

Also tweak the naming of various CMake glue code existing around this.
This commit is contained in:
Linus Groh 2022-09-21 18:22:16 +01:00
parent 4270ede7c4
commit edfef8e2f5
14 changed files with 219 additions and 219 deletions

View file

@ -90,7 +90,7 @@ function (generate_css_implementation)
endfunction()
function (generate_js_wrappers target)
function (generate_js_bindings target)
if (CMAKE_CURRENT_BINARY_DIR MATCHES ".*/LibWeb")
# Serenity build
@ -104,8 +104,8 @@ function (generate_js_wrappers target)
SET(LIBWEB_META_PREFIX "Lagom")
endif()
function(libweb_js_wrapper class)
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_WRAPPER "ITERABLE" "" "")
function(libweb_js_bindings class)
cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_BINDINGS "ITERABLE" "" "")
get_filename_component(basename "${class}" NAME)
set(BINDINGS_SOURCES
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}Constructor.h"
@ -120,8 +120,8 @@ function (generate_js_wrappers target)
prototype-implementation
)
# FIXME: Instead of requiring a manual declaration of iterable wrappers, we should ask WrapperGenerator if it's iterable
if(LIBWEB_WRAPPER_ITERABLE)
# FIXME: Instead of requiring a manual declaration of iterable bindings, we should ask BindingsGenerator if it's iterable
if(LIBWEB_BINDINGS_ITERABLE)
list(APPEND BINDINGS_SOURCES
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}IteratorPrototype.h"
"${LIBWEB_OUTPUT_FOLDER}Bindings/${basename}IteratorPrototype.cpp"
@ -142,11 +142,11 @@ function (generate_js_wrappers target)
list(TRANSFORM include_paths PREPEND -i)
add_custom_command(
OUTPUT "${bindings_src}"
COMMAND "$<TARGET_FILE:Lagom::WrapperGenerator>" "--${bindings_type}" ${include_paths} "${LIBWEB_INPUT_FOLDER}/${class}.idl" "${LIBWEB_INPUT_FOLDER}" > "${bindings_src}.tmp"
COMMAND "$<TARGET_FILE:Lagom::BindingsGenerator>" "--${bindings_type}" ${include_paths} "${LIBWEB_INPUT_FOLDER}/${class}.idl" "${LIBWEB_INPUT_FOLDER}" > "${bindings_src}.tmp"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${bindings_src}.tmp" "${bindings_src}"
COMMAND "${CMAKE_COMMAND}" -E remove "${bindings_src}.tmp"
VERBATIM
DEPENDS Lagom::WrapperGenerator
DEPENDS Lagom::BindingsGenerator
MAIN_DEPENDENCY ${LIBWEB_INPUT_FOLDER}/${class}.idl
)
endforeach()