1
0
mirror of synced 2024-11-12 02:00:52 +01:00

fix: Various .NET and plugin loading fixes

This commit is contained in:
WerWolv 2023-07-19 21:40:24 +02:00
parent 2d4f971d10
commit f930b6e17d
3 changed files with 7 additions and 5 deletions

View File

@ -77,7 +77,7 @@ namespace hex::init {
status = false; status = false;
auto endTime = std::chrono::high_resolution_clock::now(); auto endTime = std::chrono::high_resolution_clock::now();
log::info("Task '{}' finished in {} ms", name, std::chrono::duration_cast<std::chrono::milliseconds>(endTime-startTime).count()); log::info("Task '{}' finished in {} ms", name, std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count());
{ {
std::lock_guard guard(this->m_progressMutex); std::lock_guard guard(this->m_progressMutex);
@ -86,12 +86,14 @@ namespace hex::init {
} catch (std::exception &e) { } catch (std::exception &e) {
log::error("Init task '{}' threw an exception: {}", name, e.what()); log::error("Init task '{}' threw an exception: {}", name, e.what());
status = false; status = false;
} catch (...) {
status = false;
} }
}; };
if (async) { if (async) {
TaskManager::createBackgroundTask(name, [runTask](auto&){ runTask(); }); std::thread([runTask]{ runTask(); }).detach();
} else { } else {
runTask(); runTask();
} }

View File

@ -7,7 +7,7 @@ function(add_dotnet_assembly name)
file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cs) file(GLOB_RECURSE sources ${CMAKE_CURRENT_SOURCE_DIR}/${name}/*.cs)
add_custom_command( add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../../${name}.dll OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/../../${name}.dll
COMMAND ${DOTNET_EXECUTABLE} build ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj --nologo -c Release -o ${CMAKE_CURRENT_BINARY_DIR}/../.. && ${CMAKE_COMMAND} -DOUTPUT_RUNTIMECONFIG="${OUTPUT_RUNTIMECONFIG}" -P ${CMAKE_CURRENT_SOURCE_DIR}/post_process_runtimeconfig.cmake COMMAND ${DOTNET_EXECUTABLE} build ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj --nologo -c Release -o ${CMAKE_CURRENT_BINARY_DIR}/../.. && ${CMAKE_COMMAND} -DOUTPUT_RUNTIMECONFIG="\"${OUTPUT_RUNTIMECONFIG}\"" -P ${CMAKE_CURRENT_SOURCE_DIR}/post_process_runtimeconfig.cmake
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj ${sources} DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${name}/${name}.csproj ${sources}
COMMENT "Building ${name}.dll" COMMENT "Building ${name}.dll"
) )

View File

@ -1,7 +1,7 @@
file(READ ${OUTPUT_RUNTIMECONFIG} FILE_CONTENTS) file(READ "${OUTPUT_RUNTIMECONFIG}" FILE_CONTENTS)
set(VERSION_REGEX [["version": "([0-9]+\.[0-9]+\.[0-9]+)"]]) set(VERSION_REGEX [["version": "([0-9]+\.[0-9]+\.[0-9]+)"]])
set(REPLACE_VALUE [["version": "7.0.0"]]) set(REPLACE_VALUE [["version": "7.0.0"]])
string(REGEX REPLACE "${VERSION_REGEX}" ${REPLACE_VALUE} FILE_CONTENTS_OUT "${FILE_CONTENTS}") string(REGEX REPLACE "${VERSION_REGEX}" ${REPLACE_VALUE} FILE_CONTENTS_OUT "${FILE_CONTENTS}")
file(WRITE ${OUTPUT_RUNTIMECONFIG} "${FILE_CONTENTS_OUT}") file(WRITE "${OUTPUT_RUNTIMECONFIG}" "${FILE_CONTENTS_OUT}")