From d464739a0f918407865994cb9e76c0301df510a1 Mon Sep 17 00:00:00 2001 From: Maxim Pimenov Date: Mon, 31 Jul 2017 13:49:39 +0300 Subject: [PATCH] Review fixes --- generator/mwm_diff/diff.cpp | 4 +-- generator/mwm_diff/diff.hpp | 4 +-- generator/mwm_diff/mwm_diff.pro | 21 +++++++++++++ .../mwm_diff/mwm_diff_tests/CMakeLists.txt | 31 ------------------- .../mwm_diff_tests/mwm_diff_tests.pro | 28 +++++++++++++++++ generator/mwm_diff/pymwm_diff/CMakeLists.txt | 23 -------------- omim.pro | 7 +++++ 7 files changed, 59 insertions(+), 59 deletions(-) create mode 100644 generator/mwm_diff/mwm_diff.pro create mode 100644 generator/mwm_diff/mwm_diff_tests/mwm_diff_tests.pro diff --git a/generator/mwm_diff/diff.cpp b/generator/mwm_diff/diff.cpp index 975bc27bad..5c7c3d12af 100644 --- a/generator/mwm_diff/diff.cpp +++ b/generator/mwm_diff/diff.cpp @@ -14,15 +14,13 @@ namespace // We could use my::CopyFileX but it fails if the file at |srcFile| is empty. bool CopyFile(string const & srcFile, string const & dstFile) { - size_t constexpr kBufferSize = 1024 * 1024; - try { FileReader reader(srcFile, true /* withExceptions */); ReaderSource src(reader); FileWriter writer(dstFile); - rw::ReadAndWrite(src, writer, kBufferSize); + rw::ReadAndWrite(src, writer); } catch (Reader::Exception const & e) { diff --git a/generator/mwm_diff/diff.hpp b/generator/mwm_diff/diff.hpp index 28ceebf544..3cfaf99384 100644 --- a/generator/mwm_diff/diff.hpp +++ b/generator/mwm_diff/diff.hpp @@ -10,7 +10,7 @@ namespace mwm_diff // result in the mwm at |newMwmPath|. The diff is stored at |diffPath|. // It is assumed that the files at |oldMwmPath| and |newMwmPath| are valid mwms. // Returns true on success and false on failure. -bool MakeDiff(std::string const & /* oldMwmPath */, std::string const & newMwmPath, +bool MakeDiff(std::string const & oldMwmPath, std::string const & newMwmPath, std::string const & diffPath); // Applies the diff at |diffPath| to the mwm at |oldMwmPath|. The resulting @@ -18,7 +18,7 @@ bool MakeDiff(std::string const & /* oldMwmPath */, std::string const & newMwmPa // It is assumed that the file at |oldMwmPath| is a valid mwm and the file // at |diffPath| is a valid mwmdiff. // Returns true on success and false on failure. -bool ApplyDiff(std::string const & /* oldMwmPath */, std::string const & newMwmPath, +bool ApplyDiff(std::string const & oldMwmPath, std::string const & newMwmPath, std::string const & diffPath); } // namespace mwm_diff } // namespace generator diff --git a/generator/mwm_diff/mwm_diff.pro b/generator/mwm_diff/mwm_diff.pro new file mode 100644 index 0000000000..f6a07002e0 --- /dev/null +++ b/generator/mwm_diff/mwm_diff.pro @@ -0,0 +1,21 @@ +# Library for compact mwm diffs + +TARGET = mwm_diff +TEMPLATE = lib +CONFIG += staticlib warn_on + +ROOT_DIR = ../.. + +include($$ROOT_DIR/common.pri) + +INCLUDEPATH *= $$ROOT_DIR/3party/gflags/src \ + $$ROOT_DIR/3party/osrm/osrm-backend/include \ + $$ROOT_DIR/3party/jansson/src + +QT *= core + +SOURCES += \ + diff.cpp \ + +HEADERS += \ + diff.hpp \ diff --git a/generator/mwm_diff/mwm_diff_tests/CMakeLists.txt b/generator/mwm_diff/mwm_diff_tests/CMakeLists.txt index e030344251..64a85350e0 100644 --- a/generator/mwm_diff/mwm_diff_tests/CMakeLists.txt +++ b/generator/mwm_diff/mwm_diff_tests/CMakeLists.txt @@ -9,42 +9,11 @@ omim_add_test(${PROJECT_NAME} ${SRC}) omim_link_libraries( ${PROJECT_NAME} - generator_tests_support - platform_tests_support mwm_diff - generator - drape_frontend - map - routing - search - storage - indexer - drape - traffic - routing_common - editor platform - geometry coding base - freetype - expat - icu - jansson - protobuf - osrm stats_client - minizip - succinct - pugixml - tess2 - gflags - oauthcpp - opening_hours - stb_image - sdf_image - # TODO(syershov): Use FindPackage. - sqlite3 ${LIBZ} ) diff --git a/generator/mwm_diff/mwm_diff_tests/mwm_diff_tests.pro b/generator/mwm_diff/mwm_diff_tests/mwm_diff_tests.pro new file mode 100644 index 0000000000..b8bc5589a9 --- /dev/null +++ b/generator/mwm_diff/mwm_diff_tests/mwm_diff_tests.pro @@ -0,0 +1,28 @@ +TARGET = mwm_diff_tests +CONFIG += console warn_on +CONFIG -= app_bundle +TEMPLATE = app + +ROOT_DIR = ../../.. +DEPENDENCIES = mwm_diff platform coding base stats_client + + +include($$ROOT_DIR/common.pri) + +LIBS *= -lsqlite3 + +QT *= core + +macx-* { + QT *= gui widgets # needed for QApplication with event loop, to test async events (downloader, etc.) + LIBS *= "-framework IOKit" "-framework QuartzCore" "-framework Cocoa" "-framework SystemConfiguration" +} +win32*|linux* { + QT *= network +} + +HEADERS += \ + +SOURCES += \ + ../../../testing/testingmain.cpp \ + diff_test.cpp \ diff --git a/generator/mwm_diff/pymwm_diff/CMakeLists.txt b/generator/mwm_diff/pymwm_diff/CMakeLists.txt index 65bc82f8c3..ffaa43f5da 100644 --- a/generator/mwm_diff/pymwm_diff/CMakeLists.txt +++ b/generator/mwm_diff/pymwm_diff/CMakeLists.txt @@ -7,36 +7,13 @@ set( add_library(${PROJECT_NAME} MODULE ${SRC}) -if (PLATFORM_MAC) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Widgets_LIBRARIES} - ) -endif() - -if (PLATFORM_WIN OR PLATFORM_LINUX) - omim_link_libraries( - ${PROJECT_NAME} - ${Qt5Widgets_LIBRARIES} - ) -endif() - omim_link_libraries( ${PROJECT_NAME} mwm_diff - indexer - editor platform - geometry coding base stats_client - jansson - oauthcpp - protobuf - pugixml - opening_hours - icu ${PYTHON_LIBRARIES} ${Boost_LIBRARIES} ${LIBZ} diff --git a/omim.pro b/omim.pro index cb22118286..5025b6f2fa 100644 --- a/omim.pro +++ b/omim.pro @@ -32,6 +32,9 @@ SUBDIRS = 3party base coding geometry editor ugc indexer routing routing_common !CONFIG(osrm) { SUBDIRS *= platform stats storage map + mwm_diff.subdir = generator/mwm_diff + SUBDIRS *= mwm_diff + CONFIG(desktop) { SUBDIRS *= traffic generator @@ -280,5 +283,9 @@ SUBDIRS = 3party base coding geometry editor ugc indexer routing routing_common ugc_tests.subdir = ugc/ugc_tests ugc_tests.depends = ugc indexer platform coding geometry base SUBDIRS *= ugc_tests + + mwm_diff_tests.subdir = generator/mwm_diff/mwm_diff_tests + mwm_diff_tests.depends = mwm_diff generator platform coding base + SUBDIRS *= mwm_diff_tests } # !no-tests } # !gtool