diff --git a/CMakeLists.txt b/CMakeLists.txt index d6f71adfd4..5006e82eb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1285,11 +1285,6 @@ else(RESINSIGHT_USE_EXTERNAL_OCTAVE_PLUGINS) endif(OCTAVE_MKOCTFILE) endif(RESINSIGHT_USE_EXTERNAL_OCTAVE_PLUGINS) -add_subdirectory(ThirdParty/extract-projectfile-versions) -install(TARGETS extract-projectfile-versions - DESTINATION ${RESINSIGHT_INSTALL_FOLDER} -) - # ############################################################################## # Visual Studio : Create the ruleset file to be used by Static Code Analysis # https://stackoverflow.com/questions/75031903/how-to-enable-static-analysis-with-custom-ruleset-in-msvc-via-cmakelists-txt diff --git a/ThirdParty/extract-projectfile-versions/.clang-format b/ThirdParty/extract-projectfile-versions/.clang-format deleted file mode 100644 index 241093fc3e..0000000000 --- a/ThirdParty/extract-projectfile-versions/.clang-format +++ /dev/null @@ -1,78 +0,0 @@ ---- -Language: Cpp -# BasedOnStyle: LLVM -AccessModifierOffset: -4 -AlignAfterOpenBracket: Align -AlignConsecutiveAssignments: true -AlignConsecutiveDeclarations: true -AlignEscapedNewlinesLeft: true -AlignOperands: true -AlignTrailingComments: false -AllowAllParametersOfDeclarationOnNextLine: false -AllowShortBlocksOnASingleLine: false -AllowShortCaseLabelsOnASingleLine: false -AllowShortIfStatementsOnASingleLine: true -AllowShortFunctionsOnASingleLine: InlineOnly -AllowShortLoopsOnASingleLine: false -AlwaysBreakAfterDefinitionReturnType: None -AlwaysBreakAfterReturnType: None -AlwaysBreakBeforeMultilineStrings: false -AlwaysBreakTemplateDeclarations: true -BinPackArguments: false -BinPackParameters: false -BreakBeforeBinaryOperators: None -BreakBeforeBraces: Allman -BreakBeforeTernaryOperators: true -BreakConstructorInitializersBeforeComma: true -BreakAfterJavaFieldAnnotations: false -BreakStringLiterals: true -ColumnLimit: 140 -CommentPragmas: "^ IWYU pragma:" -ConstructorInitializerAllOnOneLineOrOnePerLine: false -ConstructorInitializerIndentWidth: 4 -ContinuationIndentWidth: 4 -Cpp11BracedListStyle: true -DerivePointerAlignment: false -DisableFormat: false -ForEachMacros: [foreach, Q_FOREACH, BOOST_FOREACH] -IncludeCategories: - - Regex: '^"(llvm|llvm-c|clang|clang-c)/' - Priority: 2 - - Regex: '^(<|"(gtest|isl|json)/)' - Priority: 3 - - Regex: ".*" - Priority: 1 -IncludeIsMainRegex: "$" -IndentCaseLabels: true -IndentWidth: 4 -IndentWrappedFunctionNames: true -JavaScriptQuotes: Leave -KeepEmptyLinesAtTheStartOfBlocks: false -MacroBlockBegin: "" -MacroBlockEnd: "" -MaxEmptyLinesToKeep: 1 -NamespaceIndentation: Inner -PenaltyBreakAssignment: 13 -PenaltyBreakBeforeFirstCallParameter: 10000 -PenaltyBreakComment: 20 -PenaltyBreakFirstLessLess: 12 -PenaltyBreakString: 100 -PenaltyExcessCharacter: 5 -PenaltyReturnTypeOnItsOwnLine: 30 -PointerAlignment: Left -ReflowComments: true -SortIncludes: true -SpaceAfterCStyleCast: false -SpaceAfterTemplateKeyword: true -SpaceBeforeAssignmentOperators: true -SpaceBeforeParens: ControlStatements -SpaceInEmptyParentheses: false -SpacesBeforeTrailingComments: 1 -SpacesInAngles: false -SpacesInContainerLiterals: false -SpacesInCStyleCastParentheses: false -SpacesInParentheses: true -SpacesInSquareBrackets: false -Standard: c++20 -TabWidth: 4 -UseTab: Never diff --git a/ThirdParty/extract-projectfile-versions/CMakeLists.txt b/ThirdParty/extract-projectfile-versions/CMakeLists.txt deleted file mode 100644 index 09eb3dd584..0000000000 --- a/ThirdParty/extract-projectfile-versions/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(extract-projectfile-versions) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTORCC ON) -set(CMAKE_AUTOUIC ON) - -find_package(Qt6 COMPONENTS Core Sql REQUIRED) - -add_executable(extract-projectfile-versions main.cpp) - -target_link_libraries(extract-projectfile-versions Qt6::Core Qt6::Sql) - -# This standalone developer tool must not share the output directory with the -# application. The POST_BUILD step below copies Qt6Core.dll and Qt6Sql.dll next -# to the executable, and the build root has ResInsight.exe running out of it -# during Python code generation with those same DLLs loaded. Overwriting a -# mapped DLL is a sharing violation on Windows, and nothing orders the two build -# edges relative to each other. -set_target_properties( - extract-projectfile-versions - PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) - -if(MSVC) - add_custom_command( - TARGET extract-projectfile-versions - POST_BUILD - COMMAND - ${CMAKE_COMMAND} -E copy_if_different - $ - $ - COMMAND_EXPAND_LISTS - ) -endif(MSVC) diff --git a/ThirdParty/extract-projectfile-versions/main.cpp b/ThirdParty/extract-projectfile-versions/main.cpp deleted file mode 100644 index 88d5b56ed5..0000000000 --- a/ThirdParty/extract-projectfile-versions/main.cpp +++ /dev/null @@ -1,135 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -std::vector> getAllContent() -{ - std::vector> content; - - QSqlQuery query; - - query.prepare( "SELECT timestamp, content FROM file_versions" ); - if ( !query.exec() ) - { - qDebug() << "Error retrieving content:" << query.lastError().text(); - return content; - } - - while ( query.next() ) - { - QDateTime timestamp = query.value( 0 ).toDateTime(); - QString projectContent = query.value( 1 ).toString(); - content.push_back( std::make_pair( timestamp, projectContent ) ); - } - - return content; -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void extractVersionsToFolder( const QString& destinationFolder ) -{ - auto allContent = getAllContent(); - - for ( const auto& [timestamp, content] : allContent ) - { - const QString dateFormat = "yyyy-MM-dd_hh-mm-ss"; - QString filename = destinationFolder + "/" + timestamp.toString( dateFormat ) + ".rsp"; - QFile file( filename ); - if ( !file.open( QIODevice::WriteOnly | QIODevice::Text ) ) - { - qCritical() << "Error opening file for writing:" << filename; - return; - } - - QTextStream out( &file ); - out << content; - file.close(); - } -} - -int main( int argc, char* argv[] ) -{ - QCoreApplication app( argc, argv ); - QCoreApplication::setApplicationName( "extract-projectfile-versions" ); - QCoreApplication::setApplicationVersion( "1.0" ); - - QCommandLineParser parser; - parser.setApplicationDescription( - "extract-projectfile-versions is used to restore previous revisions of a ResInsight project from a project file database." ); - parser.addHelpOption(); - parser.addVersionOption(); - - parser.addPositionalArgument( "file", "ResInsight project file database (*.rspdb)" ); - parser.addPositionalArgument( "outputfolder", "Output folder all project files" ); - - parser.process( app ); - - const QStringList args = parser.positionalArguments(); - if ( args.size() != 2 ) - { - qCritical() << "Failed to detect two input arguments."; - parser.showHelp( 1 ); - return 1; - } - - QString databaseFilePath = args.front(); - if ( !QFile::exists( databaseFilePath ) ) - { - qCritical() << "Database file does not exist:" << databaseFilePath; - return 1; - } - - QString destinationDir = args[1]; - QDir dir; - if ( !dir.mkpath( destinationDir ) ) - { - qCritical() << "Not able to create destination folder : " << destinationDir; - return 1; - } - - const QString databaseType = "QSQLITE"; - - if ( !QSqlDatabase::isDriverAvailable( databaseType ) ) - { - qInfo() << "sqlite database is not available."; - return 1; - } - - // Try to open the SQLITE database - QSqlDatabase db = QSqlDatabase::database(); - if ( !db.isValid() || !db.open() ) - { - qInfo() << "Adding database"; - - // Add the SQLITE database, and it it required to do this once per session. The database will be available during the lifetime - // of the application, and can be accessed using QSqlDatabase::database() - db = QSqlDatabase::addDatabase( databaseType ); - } - - QFileInfo fileInfo( databaseFilePath ); - auto dbPath = fileInfo.absoluteFilePath(); - db.setDatabaseName( dbPath ); - - if ( !db.open() ) - { - QString txt = "Error opening database:" + db.lastError().text(); - qCritical() << txt; - return 1; - } - - extractVersionsToFolder( destinationDir ); - - return 1; -} diff --git a/docs/agents/build.md b/docs/agents/build.md index 0ed18c1ae5..1693330bb0 100644 --- a/docs/agents/build.md +++ b/docs/agents/build.md @@ -74,7 +74,6 @@ ninja -C build # Build specific targets ninja -C build ResInsight -ninja -C build extract-projectfile-versions ``` ### Windows (Visual Studio 2022) @@ -96,7 +95,6 @@ cmake --build --preset x64-relwithdebinfo # Build specific targets cmake --build --preset x64-relwithdebinfo --target ResInsight -cmake --build --preset x64-relwithdebinfo --target extract-projectfile-versions ``` **Important — use `cmake --build`, not `ninja` directly, when sharing `build/` with Visual Studio:**