mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:28:11 +00:00
Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte string. As the null state has already been removed, there are no other particularly hairy blockers in repurposing this type as a byte string (what it _really_ is). This commit is auto-generated: $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \ Meta Ports Ladybird Tests Kernel) $ perl -pie 's/\bDeprecatedString\b/ByteString/g; s/deprecated_string/byte_string/g' $xs $ clang-format --style=file -i \ $(git diff --name-only | grep \.cpp\|\.h) $ gn format $(git ls-files '*.gn' '*.gni')
This commit is contained in:
parent
38d62563b3
commit
5e1499d104
1615 changed files with 10257 additions and 10257 deletions
|
@ -35,7 +35,7 @@ ErrorOr<void> ProjectBuilder::build(StringView active_file)
|
|||
return Error::from_string_literal("no active file");
|
||||
|
||||
if (active_file.ends_with(".js"sv)) {
|
||||
TRY(m_terminal->run_command(DeprecatedString::formatted("js -A {}", active_file)));
|
||||
TRY(m_terminal->run_command(ByteString::formatted("js -A {}", active_file)));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ ErrorOr<void> ProjectBuilder::run(StringView active_file)
|
|||
return Error::from_string_literal("no active file");
|
||||
|
||||
if (active_file.ends_with(".js"sv)) {
|
||||
TRY(m_terminal->run_command(DeprecatedString::formatted("js {}", active_file)));
|
||||
TRY(m_terminal->run_command(ByteString::formatted("js {}", active_file)));
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -105,11 +105,11 @@ ErrorOr<void> ProjectBuilder::update_active_file(StringView active_file)
|
|||
ErrorOr<void> ProjectBuilder::build_serenity_component()
|
||||
{
|
||||
TRY(verify_make_is_installed());
|
||||
TRY(m_terminal->run_command(DeprecatedString::formatted("make {}", m_serenity_component_name), build_directory(), TerminalWrapper::WaitForExit::Yes, "Make failed"sv));
|
||||
TRY(m_terminal->run_command(ByteString::formatted("make {}", m_serenity_component_name), build_directory(), TerminalWrapper::WaitForExit::Yes, "Make failed"sv));
|
||||
return {};
|
||||
}
|
||||
|
||||
ErrorOr<DeprecatedString> ProjectBuilder::component_name(StringView cmake_file_path)
|
||||
ErrorOr<ByteString> ProjectBuilder::component_name(StringView cmake_file_path)
|
||||
{
|
||||
auto file = TRY(Core::File::open(cmake_file_path, Core::File::OpenMode::Read));
|
||||
auto content = TRY(file->read_until_eof());
|
||||
|
@ -119,7 +119,7 @@ ErrorOr<DeprecatedString> ProjectBuilder::component_name(StringView cmake_file_p
|
|||
if (!component_name.search(StringView { content }, result))
|
||||
return Error::from_string_literal("component not found");
|
||||
|
||||
return DeprecatedString { result.capture_group_matches.at(0).at(0).view.string_view() };
|
||||
return ByteString { result.capture_group_matches.at(0).at(0).view.string_view() };
|
||||
}
|
||||
|
||||
ErrorOr<void> ProjectBuilder::initialize_build_directory()
|
||||
|
@ -137,15 +137,15 @@ ErrorOr<void> ProjectBuilder::initialize_build_directory()
|
|||
auto cmake_file = TRY(Core::File::open(cmake_file_path, Core::File::OpenMode::Write));
|
||||
TRY(cmake_file->write_until_depleted(generate_cmake_file_content().bytes()));
|
||||
|
||||
TRY(m_terminal->run_command(DeprecatedString::formatted("cmake -S {} -DHACKSTUDIO_BUILD=ON -DHACKSTUDIO_BUILD_CMAKE_FILE={}"
|
||||
" -DENABLE_UNICODE_DATABASE_DOWNLOAD=OFF",
|
||||
TRY(m_terminal->run_command(ByteString::formatted("cmake -S {} -DHACKSTUDIO_BUILD=ON -DHACKSTUDIO_BUILD_CMAKE_FILE={}"
|
||||
" -DENABLE_UNICODE_DATABASE_DOWNLOAD=OFF",
|
||||
m_project_root, cmake_file_path),
|
||||
build_directory(), TerminalWrapper::WaitForExit::Yes, "CMake error"sv));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
Optional<DeprecatedString> ProjectBuilder::find_cmake_file_for(StringView file_path) const
|
||||
Optional<ByteString> ProjectBuilder::find_cmake_file_for(StringView file_path) const
|
||||
{
|
||||
auto directory = LexicalPath::dirname(file_path);
|
||||
while (!directory.is_empty()) {
|
||||
|
@ -157,7 +157,7 @@ Optional<DeprecatedString> ProjectBuilder::find_cmake_file_for(StringView file_p
|
|||
return {};
|
||||
}
|
||||
|
||||
DeprecatedString ProjectBuilder::generate_cmake_file_content() const
|
||||
ByteString ProjectBuilder::generate_cmake_file_content() const
|
||||
{
|
||||
StringBuilder builder;
|
||||
builder.appendff("add_subdirectory({})\n", LexicalPath::dirname(m_serenity_component_cmake_file));
|
||||
|
@ -174,20 +174,20 @@ DeprecatedString ProjectBuilder::generate_cmake_file_content() const
|
|||
// all of their direct dependencies in the CMakeLists file.
|
||||
// For example, a target may directly use LibGFX but only specify LibGUI as a dependency (which in turn depends on LibGFX).
|
||||
// In this example, if we don't specify the dependencies of LibGUI in the CMake file, linking will fail because of undefined LibGFX symbols.
|
||||
builder.appendff("target_link_libraries({} INTERFACE {})\n", library.key, DeprecatedString::join(' ', library.value->dependencies));
|
||||
builder.appendff("target_link_libraries({} INTERFACE {})\n", library.key, ByteString::join(' ', library.value->dependencies));
|
||||
}
|
||||
|
||||
return builder.to_deprecated_string();
|
||||
return builder.to_byte_string();
|
||||
}
|
||||
|
||||
HashMap<DeprecatedString, NonnullOwnPtr<ProjectBuilder::LibraryInfo>> ProjectBuilder::get_defined_libraries()
|
||||
HashMap<ByteString, NonnullOwnPtr<ProjectBuilder::LibraryInfo>> ProjectBuilder::get_defined_libraries()
|
||||
{
|
||||
HashMap<DeprecatedString, NonnullOwnPtr<ProjectBuilder::LibraryInfo>> libraries;
|
||||
HashMap<ByteString, NonnullOwnPtr<ProjectBuilder::LibraryInfo>> libraries;
|
||||
|
||||
for_each_library_definition([&libraries](DeprecatedString name, DeprecatedString path) {
|
||||
for_each_library_definition([&libraries](ByteString name, ByteString path) {
|
||||
libraries.set(name, make<ProjectBuilder::LibraryInfo>(move(path)));
|
||||
});
|
||||
for_each_library_dependencies([&libraries](DeprecatedString name, Vector<StringView> const& dependencies) {
|
||||
for_each_library_dependencies([&libraries](ByteString name, Vector<StringView> const& dependencies) {
|
||||
auto library = libraries.get(name);
|
||||
if (!library.has_value())
|
||||
return;
|
||||
|
@ -199,9 +199,9 @@ HashMap<DeprecatedString, NonnullOwnPtr<ProjectBuilder::LibraryInfo>> ProjectBui
|
|||
return libraries;
|
||||
}
|
||||
|
||||
void ProjectBuilder::for_each_library_definition(Function<void(DeprecatedString, DeprecatedString)> func)
|
||||
void ProjectBuilder::for_each_library_definition(Function<void(ByteString, ByteString)> func)
|
||||
{
|
||||
Vector<DeprecatedString> arguments = { "-c", "find Userland -name CMakeLists.txt | xargs grep serenity_lib" };
|
||||
Vector<ByteString> arguments = { "-c", "find Userland -name CMakeLists.txt | xargs grep serenity_lib" };
|
||||
auto res = Core::command("/bin/sh", arguments, {});
|
||||
if (res.is_error()) {
|
||||
warnln("{}", res.error());
|
||||
|
@ -218,7 +218,7 @@ void ProjectBuilder::for_each_library_definition(Function<void(DeprecatedString,
|
|||
|
||||
auto library_name = result.capture_group_matches.at(0).at(0).view.string_view();
|
||||
auto library_obj_name = result.capture_group_matches.at(0).at(1).view.string_view();
|
||||
auto so_path = DeprecatedString::formatted("{}.so", LexicalPath::join("/usr/lib"sv, DeprecatedString::formatted("lib{}", library_obj_name)).string());
|
||||
auto so_path = ByteString::formatted("{}.so", LexicalPath::join("/usr/lib"sv, ByteString::formatted("lib{}", library_obj_name)).string());
|
||||
func(library_name, so_path);
|
||||
}
|
||||
|
||||
|
@ -226,9 +226,9 @@ void ProjectBuilder::for_each_library_definition(Function<void(DeprecatedString,
|
|||
func("ssp", "/usr/lib/libssp.a");
|
||||
}
|
||||
|
||||
void ProjectBuilder::for_each_library_dependencies(Function<void(DeprecatedString, Vector<StringView>)> func)
|
||||
void ProjectBuilder::for_each_library_dependencies(Function<void(ByteString, Vector<StringView>)> func)
|
||||
{
|
||||
Vector<DeprecatedString> arguments = { "-c", "find Userland/Libraries -name CMakeLists.txt | xargs grep target_link_libraries" };
|
||||
Vector<ByteString> arguments = { "-c", "find Userland/Libraries -name CMakeLists.txt | xargs grep target_link_libraries" };
|
||||
auto res = Core::command("/bin/sh", arguments, {});
|
||||
if (res.is_error()) {
|
||||
warnln("{}", res.error());
|
||||
|
@ -267,7 +267,7 @@ ErrorOr<void> ProjectBuilder::verify_make_is_installed()
|
|||
return Error::from_string_literal("Make port is not installed");
|
||||
}
|
||||
|
||||
DeprecatedString ProjectBuilder::build_directory() const
|
||||
ByteString ProjectBuilder::build_directory() const
|
||||
{
|
||||
return LexicalPath::join(m_project_root, "Build"sv).string();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue