diff options
author | Sam Atkins <atkinssj@serenityos.org> | 2022-03-10 11:55:06 +0000 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2022-03-10 09:49:13 -0500 |
commit | eb6e4e67758b874707099423f3013878cb9d0635 (patch) | |
tree | cf6e1e1309f38b9710ab2ddc7d07f959d8cea6ba /Meta/Lagom | |
parent | a850465a4ba0e9f8bb2c3a6e5b07dbc49c9a791f (diff) | |
download | serenity-eb6e4e67758b874707099423f3013878cb9d0635.zip |
Meta: Port Generate_CSS_PropertyID_cpp to LibMain/Core::Stream
Diffstat (limited to 'Meta/Lagom')
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp | 18 |
2 files changed, 8 insertions, 12 deletions
diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/CMakeLists.txt b/Meta/Lagom/Tools/CodeGenerators/LibWeb/CMakeLists.txt index fcb758fcac..9887bc4d98 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/CMakeLists.txt +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/CMakeLists.txt @@ -3,7 +3,7 @@ set(SOURCES "") # avoid pulling SOURCES from parent scope lagom_tool(Generate_CSS_MediaFeatureID_h SOURCES Generate_CSS_MediaFeatureID_h.cpp LIBS LagomMain) lagom_tool(Generate_CSS_MediaFeatureID_cpp SOURCES Generate_CSS_MediaFeatureID_cpp.cpp LIBS LagomMain) lagom_tool(Generate_CSS_PropertyID_h SOURCES Generate_CSS_PropertyID_h.cpp LIBS LagomMain) -lagom_tool(Generate_CSS_PropertyID_cpp SOURCES Generate_CSS_PropertyID_cpp.cpp) +lagom_tool(Generate_CSS_PropertyID_cpp SOURCES Generate_CSS_PropertyID_cpp.cpp LIBS LagomMain) lagom_tool(Generate_CSS_ValueID_h SOURCES Generate_CSS_ValueID_h.cpp LIBS LagomMain) lagom_tool(Generate_CSS_ValueID_cpp SOURCES Generate_CSS_ValueID_cpp.cpp LIBS LagomMain) diff --git a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp index 25e7eb68d8..c0da7e33f4 100644 --- a/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp +++ b/Meta/Lagom/Tools/CodeGenerators/LibWeb/Generate_CSS_PropertyID_cpp.cpp @@ -1,28 +1,23 @@ /* * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org> - * Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org> + * Copyright (c) 2021-2022, Sam Atkins <atkinssj@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause */ #include "GeneratorUtil.h" -#include <AK/ByteBuffer.h> -#include <AK/JsonObject.h> #include <AK/SourceGenerator.h> #include <AK/StringBuilder.h> -#include <LibCore/File.h> +#include <LibMain/Main.h> -int main(int argc, char** argv) +ErrorOr<int> serenity_main(Main::Arguments arguments) { - if (argc != 2) { - warnln("usage: {} <path/to/CSS/Properties.json>", argv[0]); + if (arguments.argc != 2) { + warnln("usage: {} <path/to/CSS/Properties.json>", arguments.strings[0]); return 1; } - auto file = Core::File::construct(argv[1]); - if (!file->open(Core::OpenMode::ReadOnly)) - return 1; - auto json = JsonValue::from_string(file->read_all()).release_value_but_fixme_should_propagate_errors(); + auto json = TRY(read_entire_file_as_json(arguments.strings[1])); VERIFY(json.is_object()); auto& properties = json.as_object(); @@ -416,4 +411,5 @@ size_t property_maximum_value_count(PropertyID property_id) )~~~"); outln("{}", generator.as_string_view()); + return 0; } |