[PATCH 1/2] Move 'uri' lib to src/lib/

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Feb 25 23:56:46 MSK 2019


URI and core libraries are going to be used by SWIM, stored in
src/lib. But src/lib can not depend on src/. This patch pushes
core library down to src/lib - the lowest level of source
dependencies.

Needed for #3234
---
 src/CMakeLists.txt         | 11 -----------
 src/box/applier.h          |  2 +-
 src/evio.c                 |  1 -
 src/evio.h                 |  2 +-
 src/lib/CMakeLists.txt     |  1 +
 src/lib/uri/CMakeLists.txt | 10 ++++++++++
 src/{ => lib/uri}/uri.c    |  0
 src/{ => lib/uri}/uri.h    |  0
 src/{ => lib/uri}/uri.rl   |  0
 src/sio.c                  |  2 +-
 test/unit/uri.c            |  2 +-
 11 files changed, 15 insertions(+), 16 deletions(-)
 create mode 100644 src/lib/uri/CMakeLists.txt
 rename src/{ => lib/uri}/uri.c (100%)
 rename src/{ => lib/uri}/uri.h (100%)
 rename src/{ => lib/uri}/uri.rl (100%)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 0a8fabae6..1abde73b3 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -64,10 +64,6 @@ add_custom_target(generate_lua_sources
     DEPENDS ${lua_sources})
 set_property(DIRECTORY PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${lua_sources})
 
-add_custom_target(ragel
-    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
-    COMMAND ragel -G2 src/uri.rl -o src/uri.c)
-
 # There is no libdl.so on FreeBSD prior to 11.2.
 #
 # Always links pthread and dl dynamically.
@@ -134,13 +130,6 @@ if (ENABLE_BACKTRACE AND NOT TARGET_OS_DARWIN)
     target_link_libraries(core gcc_s ${UNWIND_LIBRARIES})
 endif()
 
-if (CC_HAS_WNO_IMPLICIT_FALLTHROUGH)
-    # Suppress noise warnings for autogenerated Ragel code
-    set_source_files_properties(uri.c PROPERTIES COMPILE_FLAGS
-        -Wno-implicit-fallthrough)
-endif()
-add_library(uri STATIC uri.c)
-
 add_library(uuid STATIC tt_uuid.c)
 target_link_libraries(uuid core bit)
 
diff --git a/src/box/applier.h b/src/box/applier.h
index 5a9c40fc8..25a795fe5 100644
--- a/src/box/applier.h
+++ b/src/box/applier.h
@@ -41,7 +41,7 @@
 #include "trigger.h"
 #include "trivia/util.h"
 #include "tt_uuid.h"
-#include "uri.h"
+#include "uri/uri.h"
 
 #include "xrow.h"
 
diff --git a/src/evio.c b/src/evio.c
index 8610dbbe7..2152c15e6 100644
--- a/src/evio.c
+++ b/src/evio.c
@@ -29,7 +29,6 @@
  * SUCH DAMAGE.
  */
 #include "evio.h"
-#include "uri.h"
 #include <stdio.h>
 #include <sys/socket.h>
 #include <sys/un.h>
diff --git a/src/evio.h b/src/evio.h
index 872a21ab6..fc7e19989 100644
--- a/src/evio.h
+++ b/src/evio.h
@@ -37,7 +37,7 @@
 #include <stdbool.h>
 #include "tarantool_ev.h"
 #include "sio.h"
-#include "uri.h"
+#include "uri/uri.h"
 
 #if defined(__cplusplus)
 extern "C" {
diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt
index 98ff19b60..e06934486 100644
--- a/src/lib/CMakeLists.txt
+++ b/src/lib/CMakeLists.txt
@@ -5,6 +5,7 @@ add_subdirectory(small)
 add_subdirectory(salad)
 add_subdirectory(csv)
 add_subdirectory(json)
+add_subdirectory(uri)
 if(ENABLE_BUNDLED_MSGPUCK)
     add_subdirectory(msgpuck EXCLUDE_FROM_ALL)
 endif()
diff --git a/src/lib/uri/CMakeLists.txt b/src/lib/uri/CMakeLists.txt
new file mode 100644
index 000000000..f0913b7b4
--- /dev/null
+++ b/src/lib/uri/CMakeLists.txt
@@ -0,0 +1,10 @@
+add_custom_target(ragel
+    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+    COMMAND ragel -G2 src/uri.rl -o src/uri.c)
+
+if (CC_HAS_WNO_IMPLICIT_FALLTHROUGH)
+    # Suppress noise warnings for autogenerated Ragel code
+    set_source_files_properties(uri.c PROPERTIES COMPILE_FLAGS
+        -Wno-implicit-fallthrough)
+endif()
+add_library(uri STATIC uri.c)
diff --git a/src/uri.c b/src/lib/uri/uri.c
similarity index 100%
rename from src/uri.c
rename to src/lib/uri/uri.c
diff --git a/src/uri.h b/src/lib/uri/uri.h
similarity index 100%
rename from src/uri.h
rename to src/lib/uri/uri.h
diff --git a/src/uri.rl b/src/lib/uri/uri.rl
similarity index 100%
rename from src/uri.rl
rename to src/lib/uri/uri.rl
diff --git a/src/sio.c b/src/sio.c
index 419f4e0f4..7ea13f736 100644
--- a/src/sio.c
+++ b/src/sio.c
@@ -40,7 +40,7 @@
 #include "say.h"
 #include "trivia/util.h"
 #include "exception.h"
-#include "uri.h"
+#include "uri/uri.h"
 
 const char *
 sio_socketname(int fd)
diff --git a/test/unit/uri.c b/test/unit/uri.c
index b69f92726..a10f61e2e 100644
--- a/test/unit/uri.c
+++ b/test/unit/uri.c
@@ -1,5 +1,5 @@
 #include "unit.h"
-#include <uri.h>
+#include "uri/uri.h"
 #include <string.h>
 
 int
-- 
2.17.2 (Apple Git-113)




More information about the Tarantool-patches mailing list