core: rename mbgl namespace to mln (#4487)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Bart Louwers
2026-08-14 23:25:20 +02:00
committed by GitHub
parent 836b862984
commit 550f64be22
1970 changed files with 8931 additions and 8967 deletions

View File

@@ -4,8 +4,8 @@
#include <unistd.h>
#include <thread>
using namespace mbgl;
using namespace mbgl::android;
using namespace mln;
using namespace mln::android;
bool running = false;
bool done = false;
@@ -22,15 +22,15 @@ void runner() {
}
argv.push_back(nullptr);
mbgl::Log::Info(mbgl::Event::General, "Start BenchmarkRunner");
int status = mbgl::runBenchmark(argv.size(), argv.data());
mbgl::Log::Info(mbgl::Event::General, "BenchmarkRunner finished with status: '%d'", status);
mln::Log::Info(mln::Event::General, "Start BenchmarkRunner");
int status = mln::runBenchmark(argv.size(), argv.data());
mln::Log::Info(mln::Event::General, "BenchmarkRunner finished with status: '%d'", status);
running = false;
ALooper_wake(looper);
}
void android_main(struct android_app* app) {
mbgl::android::theJVM = app->activity->vm;
mln::android::theJVM = app->activity->vm;
JNIEnv* env = nullptr;
std::thread benchmarkThread;
app->activity->vm->AttachCurrentThread(&env, NULL);
@@ -41,7 +41,7 @@ void android_main(struct android_app* app) {
if (copyFile(env, app->activity->assetManager, zipFile, storagePath, "data.zip")) {
if (chdir("/sdcard")) {
mbgl::Log::Error(mbgl::Event::General, "Failed to change the directory to /sdcard");
mln::Log::Error(mln::Event::General, "Failed to change the directory to /sdcard");
done = true;
changeState(env, app, false);
} else {
@@ -50,7 +50,7 @@ void android_main(struct android_app* app) {
benchmarkThread = std::thread(runner);
}
} else {
mbgl::Log::Error(mbgl::Event::General, "Failed to copy zip file '%s' to external storage", zipFile.c_str());
mln::Log::Error(mln::Event::General, "Failed to copy zip file '%s' to external storage", zipFile.c_str());
done = true;
changeState(env, app, false);
}
@@ -65,7 +65,7 @@ void android_main(struct android_app* app) {
}
if (!running && !done) {
mbgl::Log::Info(mbgl::Event::General, "BenchmarkRunner done");
mln::Log::Info(mln::Event::General, "BenchmarkRunner done");
done = true;
benchmarkThread.join();
changeState(env, app, true);
@@ -73,7 +73,7 @@ void android_main(struct android_app* app) {
if (app->destroyRequested != 0) {
app->activity->vm->DetachCurrentThread();
mbgl::Log::Info(mbgl::Event::General, "Close the App!");
mln::Log::Info(mln::Event::General, "Close the App!");
return;
}
}

View File

@@ -2,7 +2,7 @@
#include <memory>
namespace mbgl {
namespace mln {
namespace platform {
class Collator::Impl {
@@ -32,4 +32,4 @@ std::string Collator::resolvedLocale() const {
}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -1,6 +1,6 @@
#include <mbgl/i18n/number_format.hpp>
namespace mbgl {
namespace mln {
namespace platform {
std::string formatNumber(double /*number*/,
@@ -13,4 +13,4 @@ std::string formatNumber(double /*number*/,
}
} // namespace platform
} // namespace mbgl
} // namespace mln

View File

@@ -1,8 +1,8 @@
#include <mbgl/render_test.hpp>
#include "test_runner_common.hpp"
using namespace mbgl;
using namespace mbgl::android;
using namespace mln;
using namespace mln::android;
void updateProgress(JNIEnv* env, struct android_app* app, int completed, int total) {
jobject nativeActivity = app->activity->clazz;
@@ -20,7 +20,7 @@ void updateProgress(JNIEnv* env, struct android_app* app, int completed, int tot
}
void android_main(struct android_app* app) {
mbgl::android::theJVM = app->activity->vm;
mln::android::theJVM = app->activity->vm;
JNIEnv* env = nullptr;
app->activity->vm->AttachCurrentThread(&env, NULL);
@@ -31,8 +31,8 @@ void android_main(struct android_app* app) {
int outFd, outEvents;
struct android_poll_source* source = nullptr;
if (!copyFile(env, app->activity->assetManager, zipFile, storagePath, "data.zip")) {
mbgl::Log::Error(mbgl::Event::General,
"Failed to copy zip File '" + zipFile + "' to external storage for upzipping");
mln::Log::Error(mln::Event::General,
"Failed to copy zip File '" + zipFile + "' to external storage for upzipping");
} else {
unZipFile(env, zipFile, storagePath);
@@ -46,7 +46,7 @@ void android_main(struct android_app* app) {
}
argv.push_back(nullptr);
std::function<void(mbgl::TestStatus)> testStatus = [&](mbgl::TestStatus status) {
std::function<void(mln::TestStatus)> testStatus = [&](mln::TestStatus status) {
auto result = ALooper_pollOnce(0, &outFd, &outEvents, reinterpret_cast<void**>(&source));
if (result == ALOOPER_POLL_ERROR) {
throw std::runtime_error("ALooper_pollOnce returned an error");
@@ -56,14 +56,14 @@ void android_main(struct android_app* app) {
source->process(app, source);
}
mbgl::Log::Info(mbgl::Event::General,
"Current finished tests number is '" + std::to_string(status.completed) + "/" +
std::to_string(status.total) + "'");
mln::Log::Info(mln::Event::General,
"Current finished tests number is '" + std::to_string(status.completed) + "/" +
std::to_string(status.total) + "'");
updateProgress(env, app, static_cast<int>(status.completed), static_cast<int>(status.total));
};
mbgl::Log::Info(mbgl::Event::General, "Start running RenderTestRunner with manifest: '" + manifest + "'");
bool result = mbgl::runRenderTests(argv.size() - 1, argv.data(), testStatus) == 0;
mbgl::Log::Info(mbgl::Event::General, "End running RenderTestRunner with manifest: '" + manifest + "'");
mln::Log::Info(mln::Event::General, "Start running RenderTestRunner with manifest: '" + manifest + "'");
bool result = mln::runRenderTests(argv.size() - 1, argv.data(), testStatus) == 0;
mln::Log::Info(mln::Event::General, "End running RenderTestRunner with manifest: '" + manifest + "'");
return result;
};
@@ -74,7 +74,7 @@ void android_main(struct android_app* app) {
auto result = runTestWithManifest("/metrics/android-render-test-runner-metrics.json");
result = runTestWithManifest("/metrics/android-render-test-runner-style.json") && result;
#endif
mbgl::Log::Info(mbgl::Event::General, "All tests are finished!");
mln::Log::Info(mln::Event::General, "All tests are finished!");
changeState(env, app, result);
}
while (true) {
@@ -88,7 +88,7 @@ void android_main(struct android_app* app) {
}
if (app->destroyRequested != 0) {
app->activity->vm->DetachCurrentThread();
mbgl::Log::Info(mbgl::Event::General, "Close the App!");
mln::Log::Info(mln::Event::General, "Close the App!");
return;
}
}

View File

@@ -19,7 +19,7 @@ const std::string kClassPath{"-Djava.class.path="};
const std::string kDefaultDex{"/data/local/tmp/core-tests/classes.dex"};
} // namespace
namespace mbgl {
namespace mln {
namespace android {
bool initRuntime(int argc, char* argv[]) {
@@ -67,9 +67,9 @@ bool initRuntime(int argc, char* argv[]) {
return false;
}
mbgl::android::registerNatives(vm);
mln::android::registerNatives(vm);
return true;
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -1,9 +1,9 @@
#pragma once
namespace mbgl {
namespace mln {
namespace android {
bool initRuntime(int argc, char *argv[]);
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -7,8 +7,8 @@
#include <gtest/gtest.h>
#include <android/log.h>
using namespace mbgl;
using namespace mbgl::android;
using namespace mln;
using namespace mln::android;
std::string testResultToStr(const ::testing::TestResult* testResult) {
if (testResult->Passed()) return " (PASSED)";
@@ -69,16 +69,16 @@ void runner(const std::string& gtestOutput) {
}
argv.push_back(nullptr);
mbgl::Log::Info(mbgl::Event::General, "Start TestRunner");
int status = mbgl::runTests(argv.size(), argv.data());
mbgl::Log::Info(mbgl::Event::General, "TestRunner finished with status: '" + std::to_string(status) + "'");
mln::Log::Info(mln::Event::General, "Start TestRunner");
int status = mln::runTests(argv.size(), argv.data());
mln::Log::Info(mln::Event::General, "TestRunner finished with status: '" + std::to_string(status) + "'");
running = false;
success = (status == 0);
ALooper_wake(looper);
}
void android_main(struct android_app* app) {
mbgl::android::theJVM = app->activity->vm;
mln::android::theJVM = app->activity->vm;
JNIEnv* env = nullptr;
std::thread runnerThread;
app->activity->vm->AttachCurrentThread(&env, NULL);
@@ -90,14 +90,14 @@ void android_main(struct android_app* app) {
if (copyFile(env, app->activity->assetManager, zipFile, storagePath, "data.zip")) {
if (chdir(storagePath.c_str())) {
mbgl::Log::Error(mbgl::Event::General, "Failed to change the directory to storage dir");
mln::Log::Error(mln::Event::General, "Failed to change the directory to storage dir");
changeState(env, app, success);
} else {
unZipFile(env, zipFile, storagePath);
runnerThread = std::thread(runner, gtestOutput);
}
} else {
mbgl::Log::Error(mbgl::Event::General, "Failed to copy zip file '" + zipFile + "' to external storage");
mln::Log::Error(mln::Event::General, "Failed to copy zip file '" + zipFile + "' to external storage");
changeState(env, app, success);
}
@@ -112,7 +112,7 @@ void android_main(struct android_app* app) {
if (!running) {
std::call_once(done, [&] {
mbgl::Log::Info(mbgl::Event::General, "TestRunner done");
mln::Log::Info(mln::Event::General, "TestRunner done");
runnerThread.join();
changeState(env, app, success);
});
@@ -120,7 +120,7 @@ void android_main(struct android_app* app) {
if (app->destroyRequested != 0) {
app->activity->vm->DetachCurrentThread();
mbgl::Log::Info(mbgl::Event::General, "Close the App!");
mln::Log::Info(mln::Event::General, "Close the App!");
return;
}
}

View File

@@ -3,7 +3,7 @@
#include <functional>
namespace mbgl {
namespace mln {
void Log::platformRecord(EventSeverity severity, const std::string& msg) {
__android_log_print(android::severityToPriority(severity), "mbgl", "%s", msg.c_str());
@@ -98,13 +98,13 @@ bool copyFile(JNIEnv* env,
bool stateOk = true;
if (env->CallBooleanMethod(fileToCopy.get(), fileExists)) {
mbgl::Log::Warning(mbgl::Event::General, "File '" + filePath + "' already exists");
mln::Log::Warning(mln::Event::General, "File '" + filePath + "' already exists");
} else {
std::unique_ptr<AAsset, std::function<void(AAsset*)>> fileAsset(
AAssetManager_open(assetManager, fileName.c_str(), AASSET_MODE_BUFFER),
[](AAsset* asset) { AAsset_close(asset); });
if (fileAsset == nullptr) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to open asset file " + fileName);
mln::Log::Warning(mln::Event::General, "Failed to open asset file " + fileName);
return false;
}
const void* fileData = AAsset_getBuffer(fileAsset.get());
@@ -115,11 +115,11 @@ bool copyFile(JNIEnv* env,
stateOk = newFile != nullptr;
if (!stateOk) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to create new file entry " + fileName);
mln::Log::Warning(mln::Event::General, "Failed to create new file entry " + fileName);
} else {
auto res = static_cast<off_t>(std::fwrite(fileData, sizeof(char), fileLen, newFile.get()));
if (fileLen != res) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to generate file entry" + fileName + "from assets");
mln::Log::Warning(mln::Event::General, "Failed to generate file entry" + fileName + "from assets");
}
}
}
@@ -186,8 +186,8 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d
env, static_cast<jstring>(env->CallObjectMethod(f, fileGetName)));
if (!success) {
mbgl::Log::Warning(mbgl::Event::General,
"Failed to create folder entry " + fileNameStr + " from zip");
mln::Log::Warning(mln::Event::General,
"Failed to create folder entry " + fileNameStr + " from zip");
}
}
} else if (!(env->CallBooleanMethod(f, fileExists))) {
@@ -196,7 +196,7 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d
static_cast<jstring>(env->CallObjectMethod(f, fileGetName)));
if (!success) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to create folder entry" + fileNameStr + "from zip");
mln::Log::Warning(mln::Event::General, "Failed to create folder entry" + fileNameStr + "from zip");
continue;
}
@@ -217,10 +217,10 @@ void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& d
if (env->CallBooleanMethod(fileToDelete.get(), fileExists)) {
jboolean success = (env->CallBooleanMethod(fileToDelete.get(), deleteFile));
if (!success) {
mbgl::Log::Warning(mbgl::Event::General, "Failed to delete file entry " + zipFilePath);
mln::Log::Warning(mln::Event::General, "Failed to delete file entry " + zipFilePath);
}
}
}
} // namespace android
} // namespace mbgl
} // namespace mln

View File

@@ -6,7 +6,7 @@
#include "jni.hpp"
namespace mbgl {
namespace mln {
namespace android {
int severityToPriority(EventSeverity severity);
@@ -20,4 +20,4 @@ bool copyFile(JNIEnv* env,
void unZipFile(JNIEnv* env, const std::string& zipFilePath, const std::string& destinationPath);
} // namespace android
} // namespace mbgl
} // namespace mln