From d8c2f8202f35cc52659d0dfa83cc5979bd7f8c30 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Tue, 27 Sep 2022 10:20:32 +0800 Subject: [PATCH] strip binaries to reduce dist size (#433) strip binaries to reduce dist size --- Makefile | 1 + core/CMakeLists.txt | 15 ++-- core/aggregator/CMakeLists.txt | 2 +- core/app_config/CMakeLists.txt | 2 +- core/checkpoint/CMakeLists.txt | 2 +- core/common/CMakeLists.txt | 2 +- core/config/CMakeLists.txt | 2 +- core/config_manager/CMakeLists.txt | 2 +- core/controller/CMakeLists.txt | 2 +- core/event/CMakeLists.txt | 2 +- core/event_handler/CMakeLists.txt | 2 +- core/event_listener/CMakeLists.txt | 2 +- core/fuse/CMakeLists.txt | 2 +- core/helper/CMakeLists.txt | 2 +- core/log_pb/CMakeLists.txt | 2 +- core/logger/CMakeLists.txt | 2 +- core/monitor/CMakeLists.txt | 2 +- core/observer/CMakeLists.txt | 2 +- core/observer/network/CMakeLists.txt | 2 +- .../observer/network/protocols/CMakeLists.txt | 2 +- .../network/protocols/dns/CMakeLists.txt | 2 +- .../network/protocols/http/CMakeLists.txt | 2 +- .../network/protocols/mysql/CMakeLists.txt | 2 +- .../network/protocols/pgsql/CMakeLists.txt | 2 +- .../network/protocols/redis/CMakeLists.txt | 2 +- core/parser/CMakeLists.txt | 2 +- core/plugin/CMakeLists.txt | 2 +- core/polling/CMakeLists.txt | 2 +- core/processor/CMakeLists.txt | 2 +- core/profile_sender/CMakeLists.txt | 2 +- core/profiler/CMakeLists.txt | 2 +- core/reader/CMakeLists.txt | 2 +- core/sdk/CMakeLists.txt | 2 +- core/sender/CMakeLists.txt | 2 +- core/shennong/CMakeLists.txt | 2 +- core/sls_control/CMakeLists.txt | 2 +- core/streamlog/CMakeLists.txt | 2 +- core/unittest/CMakeLists.txt | 2 +- core/unittest/app_config/CMakeLists.txt | 2 +- core/unittest/checkpoint/CMakeLists.txt | 2 +- core/unittest/common/CMakeLists.txt | 2 +- core/unittest/config/CMakeLists.txt | 2 +- core/unittest/config_sdk/CMakeLists.txt | 2 +- core/unittest/controller/CMakeLists.txt | 2 +- core/unittest/event/CMakeLists.txt | 2 +- core/unittest/event_handler/CMakeLists.txt | 2 +- core/unittest/log_pb/CMakeLists.txt | 2 +- core/unittest/logger/CMakeLists.txt | 2 +- core/unittest/observer/CMakeLists.txt | 2 +- core/unittest/parser/CMakeLists.txt | 2 +- core/unittest/polling/CMakeLists.txt | 2 +- core/unittest/processor/CMakeLists.txt | 2 +- core/unittest/profiler/CMakeLists.txt | 2 +- core/unittest/sdk/CMakeLists.txt | 2 +- core/unittest/sender/CMakeLists.txt | 2 +- scripts/dist.sh | 6 ++ scripts/gen_build_scripts.sh | 2 +- upload_release_assets.sh | 79 +++++++++++++++++++ 58 files changed, 147 insertions(+), 62 deletions(-) create mode 100755 upload_release_assets.sh diff --git a/Makefile b/Makefile index 74118ee3c3..889ba0326a 100644 --- a/Makefile +++ b/Makefile @@ -64,6 +64,7 @@ clean: rm -rf $(GENERATED_HOME) rm -rf .testCoverage.txt rm -rf .coretestCoverage.txt + rm -rf core/build rm -rf plugin_main/*.dll rm -rf plugin_main/*.so diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 8fb7da9eac..dcba643f3d 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(logtail) # Options. @@ -46,13 +46,12 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/common/Version.cpp.in ${VERSION_CPP_F # Default C/CXX flags. if (UNIX) - set(CMAKE_CXX_FLAGS "-Wno-error=deprecated-declarations -Wno-deprecated-declarations ") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -ggdb -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -ggdb -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE") - set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g -ggdb -O0 -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11 -g -ggdb -O0 -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE") - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2 -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11 -O2 -Wall -fpic -fPIC -D_LARGEFILE64_SOURCE") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -ggdb -fpic -fPIC -D_LARGEFILE64_SOURCE") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -g -ggdb -fpic -fPIC -D_LARGEFILE64_SOURCE") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O2") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2") string(REPLACE "-O3" "" CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}") string(REPLACE "-O3" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") elseif (MSVC) diff --git a/core/aggregator/CMakeLists.txt b/core/aggregator/CMakeLists.txt index 7167cc86af..07e5bae272 100644 --- a/core/aggregator/CMakeLists.txt +++ b/core/aggregator/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(aggregator) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/app_config/CMakeLists.txt b/core/app_config/CMakeLists.txt index 5d9fb5f413..55428b7f13 100644 --- a/core/app_config/CMakeLists.txt +++ b/core/app_config/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(app_config) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/checkpoint/CMakeLists.txt b/core/checkpoint/CMakeLists.txt index 909cabcc3e..b72b525a07 100644 --- a/core/checkpoint/CMakeLists.txt +++ b/core/checkpoint/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(checkpoint) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/common/CMakeLists.txt b/core/common/CMakeLists.txt index a6ef81bc77..95b35c743b 100644 --- a/core/common/CMakeLists.txt +++ b/core/common/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(common) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/config/CMakeLists.txt b/core/config/CMakeLists.txt index 0eea69e07a..246ad0a10e 100644 --- a/core/config/CMakeLists.txt +++ b/core/config/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(config) if (MSVC) diff --git a/core/config_manager/CMakeLists.txt b/core/config_manager/CMakeLists.txt index ab12daa67f..8fe1e0ffe3 100644 --- a/core/config_manager/CMakeLists.txt +++ b/core/config_manager/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(config_manager) if (MSVC) diff --git a/core/controller/CMakeLists.txt b/core/controller/CMakeLists.txt index 186536b985..9dddfdbdb4 100644 --- a/core/controller/CMakeLists.txt +++ b/core/controller/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(controller) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/event/CMakeLists.txt b/core/event/CMakeLists.txt index 8a515804af..c1b608c231 100644 --- a/core/event/CMakeLists.txt +++ b/core/event/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(event) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/event_handler/CMakeLists.txt b/core/event_handler/CMakeLists.txt index e4324718b9..cdbdc0dba4 100644 --- a/core/event_handler/CMakeLists.txt +++ b/core/event_handler/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(event_handler) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/event_listener/CMakeLists.txt b/core/event_listener/CMakeLists.txt index b7731d590f..5b95fd9dca 100644 --- a/core/event_listener/CMakeLists.txt +++ b/core/event_listener/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(event_listener) if (UNIX) diff --git a/core/fuse/CMakeLists.txt b/core/fuse/CMakeLists.txt index 16bb9c0808..2ab10e4ecb 100644 --- a/core/fuse/CMakeLists.txt +++ b/core/fuse/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(fuse) file(GLOB LIB_SOURCE_FILES *.cpp *.h .c) diff --git a/core/helper/CMakeLists.txt b/core/helper/CMakeLists.txt index 95f7891400..763452c901 100644 --- a/core/helper/CMakeLists.txt +++ b/core/helper/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(helper) if (UNIX) diff --git a/core/log_pb/CMakeLists.txt b/core/log_pb/CMakeLists.txt index daa1eaa341..caeb0e4712 100644 --- a/core/log_pb/CMakeLists.txt +++ b/core/log_pb/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(log_pb) file(GLOB LIB_SOURCE_FILES *.cc *.h *.cpp) diff --git a/core/logger/CMakeLists.txt b/core/logger/CMakeLists.txt index bd81eb9302..edd743ea33 100644 --- a/core/logger/CMakeLists.txt +++ b/core/logger/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(logger) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/monitor/CMakeLists.txt b/core/monitor/CMakeLists.txt index a491ab7d18..5170cea98e 100644 --- a/core/monitor/CMakeLists.txt +++ b/core/monitor/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(monitor) if (MSVC) diff --git a/core/observer/CMakeLists.txt b/core/observer/CMakeLists.txt index e18eec3441..71ed8b47f8 100644 --- a/core/observer/CMakeLists.txt +++ b/core/observer/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(observer) file(GLOB_RECURSE LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/observer/network/CMakeLists.txt b/core/observer/network/CMakeLists.txt index a47e4308ae..ce5506de06 100644 --- a/core/observer/network/CMakeLists.txt +++ b/core/observer/network/CMakeLists.txt @@ -1,3 +1,3 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) add_subdirectory(protocols) diff --git a/core/observer/network/protocols/CMakeLists.txt b/core/observer/network/protocols/CMakeLists.txt index de1fad79ae..5e24eeeebf 100644 --- a/core/observer/network/protocols/CMakeLists.txt +++ b/core/observer/network/protocols/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) add_subdirectory(dns) add_subdirectory(http) diff --git a/core/observer/network/protocols/dns/CMakeLists.txt b/core/observer/network/protocols/dns/CMakeLists.txt index 2869e0a519..ec8eb0e496 100644 --- a/core/observer/network/protocols/dns/CMakeLists.txt +++ b/core/observer/network/protocols/dns/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) #set(CMAKE_CXX_STANDARD 11) #set(CMAKE_CXX_FLAGS "-g") diff --git a/core/observer/network/protocols/http/CMakeLists.txt b/core/observer/network/protocols/http/CMakeLists.txt index cd2a94f2fb..a5b7611fb8 100644 --- a/core/observer/network/protocols/http/CMakeLists.txt +++ b/core/observer/network/protocols/http/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) #set(CMAKE_CXX_STANDARD 11) #set(CMAKE_CXX_FLAGS "-g") diff --git a/core/observer/network/protocols/mysql/CMakeLists.txt b/core/observer/network/protocols/mysql/CMakeLists.txt index f8d6315cb5..7dcdb1b1e9 100644 --- a/core/observer/network/protocols/mysql/CMakeLists.txt +++ b/core/observer/network/protocols/mysql/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) #set(CMAKE_CXX_STANDARD 11) #set(CMAKE_CXX_FLAGS "-g") diff --git a/core/observer/network/protocols/pgsql/CMakeLists.txt b/core/observer/network/protocols/pgsql/CMakeLists.txt index 17d15d5023..8a319b2705 100644 --- a/core/observer/network/protocols/pgsql/CMakeLists.txt +++ b/core/observer/network/protocols/pgsql/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) #set(CMAKE_CXX_STANDARD 11) #set(CMAKE_CXX_FLAGS "-g") diff --git a/core/observer/network/protocols/redis/CMakeLists.txt b/core/observer/network/protocols/redis/CMakeLists.txt index 601da8931a..e11e73eb5c 100644 --- a/core/observer/network/protocols/redis/CMakeLists.txt +++ b/core/observer/network/protocols/redis/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) #set(CMAKE_CXX_STANDARD 11) #set(CMAKE_CXX_FLAGS "-g") diff --git a/core/parser/CMakeLists.txt b/core/parser/CMakeLists.txt index d22a08c562..035da778a1 100644 --- a/core/parser/CMakeLists.txt +++ b/core/parser/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(parser) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/plugin/CMakeLists.txt b/core/plugin/CMakeLists.txt index da4a930285..54dc0e7c10 100644 --- a/core/plugin/CMakeLists.txt +++ b/core/plugin/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(plugin) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/polling/CMakeLists.txt b/core/polling/CMakeLists.txt index 910b646ac0..4411e7d0fc 100644 --- a/core/polling/CMakeLists.txt +++ b/core/polling/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(polling) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/processor/CMakeLists.txt b/core/processor/CMakeLists.txt index cc1bf1d06a..a4ba6e1fed 100644 --- a/core/processor/CMakeLists.txt +++ b/core/processor/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(processor) if (MSVC) diff --git a/core/profile_sender/CMakeLists.txt b/core/profile_sender/CMakeLists.txt index 143d77ed2c..b0bd5c9b4a 100644 --- a/core/profile_sender/CMakeLists.txt +++ b/core/profile_sender/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(profile_sender) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/profiler/CMakeLists.txt b/core/profiler/CMakeLists.txt index 310751b7a9..1f95152065 100644 --- a/core/profiler/CMakeLists.txt +++ b/core/profiler/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(profiler) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/reader/CMakeLists.txt b/core/reader/CMakeLists.txt index f5c29880c7..c9c9bcb398 100644 --- a/core/reader/CMakeLists.txt +++ b/core/reader/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(reader) if (MSVC) diff --git a/core/sdk/CMakeLists.txt b/core/sdk/CMakeLists.txt index 36ae3e9a87..3fe7cf8ada 100644 --- a/core/sdk/CMakeLists.txt +++ b/core/sdk/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(sdk) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/sender/CMakeLists.txt b/core/sender/CMakeLists.txt index 310c81ac0f..d38ab90c63 100644 --- a/core/sender/CMakeLists.txt +++ b/core/sender/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(sender) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/shennong/CMakeLists.txt b/core/shennong/CMakeLists.txt index bc1e5376b3..f2f0f24955 100644 --- a/core/shennong/CMakeLists.txt +++ b/core/shennong/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(shennong) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/sls_control/CMakeLists.txt b/core/sls_control/CMakeLists.txt index f3110a2b2f..0fde7563d8 100644 --- a/core/sls_control/CMakeLists.txt +++ b/core/sls_control/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(sls_control) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/streamlog/CMakeLists.txt b/core/streamlog/CMakeLists.txt index 996ad36341..09afa55a2f 100644 --- a/core/streamlog/CMakeLists.txt +++ b/core/streamlog/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(streamlog) file(GLOB LIB_SOURCE_FILES *.cpp *.h) diff --git a/core/unittest/CMakeLists.txt b/core/unittest/CMakeLists.txt index 6c08706d37..e5764fe37b 100644 --- a/core/unittest/CMakeLists.txt +++ b/core/unittest/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(unittest_base) add_definitions(-DAPSARA_UNIT_TEST_MAIN) diff --git a/core/unittest/app_config/CMakeLists.txt b/core/unittest/app_config/CMakeLists.txt index 1591edbb57..c34cb1f0a5 100644 --- a/core/unittest/app_config/CMakeLists.txt +++ b/core/unittest/app_config/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(app_config_unittest) add_executable(app_config_unittest AppConfigUnittest.cpp) diff --git a/core/unittest/checkpoint/CMakeLists.txt b/core/unittest/checkpoint/CMakeLists.txt index c52c1fa99c..ab451359bf 100644 --- a/core/unittest/checkpoint/CMakeLists.txt +++ b/core/unittest/checkpoint/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(checkpoint_unittest) add_executable(checkpoint_manager_unittest CheckpointManagerUnittest.cpp) diff --git a/core/unittest/common/CMakeLists.txt b/core/unittest/common/CMakeLists.txt index 8017c09d4e..b52c1f6618 100644 --- a/core/unittest/common/CMakeLists.txt +++ b/core/unittest/common/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(common_unittest) add_executable(common_simple_utils_unittest SimpleUtilsUnittest.cpp diff --git a/core/unittest/config/CMakeLists.txt b/core/unittest/config/CMakeLists.txt index e9952f5876..ab74f712c6 100644 --- a/core/unittest/config/CMakeLists.txt +++ b/core/unittest/config/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(config_unittest) add_executable(config_match_unittest ConfigMatchUnittest.cpp) diff --git a/core/unittest/config_sdk/CMakeLists.txt b/core/unittest/config_sdk/CMakeLists.txt index 5e381c4064..02bc6b680f 100644 --- a/core/unittest/config_sdk/CMakeLists.txt +++ b/core/unittest/config_sdk/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(config_sdk_unittest) add_executable(config_sdk_unittest config_sdk_unittest.cpp) diff --git a/core/unittest/controller/CMakeLists.txt b/core/unittest/controller/CMakeLists.txt index c53908f9a2..904b7f9e5a 100644 --- a/core/unittest/controller/CMakeLists.txt +++ b/core/unittest/controller/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(controller_unittest) add_executable(event_dispatcher_dir_unittest EventDispatcherDirUnittest.cpp) diff --git a/core/unittest/event/CMakeLists.txt b/core/unittest/event/CMakeLists.txt index d00f093259..0f34011bee 100644 --- a/core/unittest/event/CMakeLists.txt +++ b/core/unittest/event/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(event_unittest) add_executable(event_unittest EventUnittest.cpp) diff --git a/core/unittest/event_handler/CMakeLists.txt b/core/unittest/event_handler/CMakeLists.txt index 78779b8ac7..c7aee32ba1 100644 --- a/core/unittest/event_handler/CMakeLists.txt +++ b/core/unittest/event_handler/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(event_handler_unittest) add_executable(create_modify_handler_unittest CreateModifyHandlerUnittest.cpp) diff --git a/core/unittest/log_pb/CMakeLists.txt b/core/unittest/log_pb/CMakeLists.txt index 610c05a3df..6e14df2c05 100644 --- a/core/unittest/log_pb/CMakeLists.txt +++ b/core/unittest/log_pb/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(log_pb_unittest) add_executable(log_pb_unittest PBUnittest.cpp) diff --git a/core/unittest/logger/CMakeLists.txt b/core/unittest/logger/CMakeLists.txt index b7ec6946fc..c1b5b84bd6 100644 --- a/core/unittest/logger/CMakeLists.txt +++ b/core/unittest/logger/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(logger_unittest) add_executable(${PROJECT_NAME} logger_unittest.cpp) diff --git a/core/unittest/observer/CMakeLists.txt b/core/unittest/observer/CMakeLists.txt index d61db04ffc..56ecb5c721 100644 --- a/core/unittest/observer/CMakeLists.txt +++ b/core/unittest/observer/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(observer_unittest) add_executable(observer_config_unittest ObserverConfigUnittest.cpp) diff --git a/core/unittest/parser/CMakeLists.txt b/core/unittest/parser/CMakeLists.txt index 358838925e..f642f7ae9b 100644 --- a/core/unittest/parser/CMakeLists.txt +++ b/core/unittest/parser/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(parser_unittest) add_executable(parser_unittest LogParserUnittest.cpp) diff --git a/core/unittest/polling/CMakeLists.txt b/core/unittest/polling/CMakeLists.txt index fffaea6d4a..cffb44f441 100644 --- a/core/unittest/polling/CMakeLists.txt +++ b/core/unittest/polling/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(polling_unittest) add_executable(polling_unittest PollingUnittest.cpp) diff --git a/core/unittest/processor/CMakeLists.txt b/core/unittest/processor/CMakeLists.txt index 2bb03dee3c..b2e9bcc005 100644 --- a/core/unittest/processor/CMakeLists.txt +++ b/core/unittest/processor/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(processor_unittest) add_executable(processor_filter_unittest LogFilterUnittest.cpp) diff --git a/core/unittest/profiler/CMakeLists.txt b/core/unittest/profiler/CMakeLists.txt index 9ad03cf3b6..c2cf855388 100644 --- a/core/unittest/profiler/CMakeLists.txt +++ b/core/unittest/profiler/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(profiler_unittest) add_executable(profiler_data_integrity_unittest DataIntegrityUnittest.cpp) diff --git a/core/unittest/sdk/CMakeLists.txt b/core/unittest/sdk/CMakeLists.txt index e7ffc5663a..2324545de8 100644 --- a/core/unittest/sdk/CMakeLists.txt +++ b/core/unittest/sdk/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(sdk_unittest) add_executable(sdk_common_unittest SDKCommonUnittest.cpp) diff --git a/core/unittest/sender/CMakeLists.txt b/core/unittest/sender/CMakeLists.txt index 3b46b45b77..a033487ead 100644 --- a/core/unittest/sender/CMakeLists.txt +++ b/core/unittest/sender/CMakeLists.txt @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 2.9) project(sender_unittest) add_executable(sender_unittest SenderUnittest.cpp) diff --git a/scripts/dist.sh b/scripts/dist.sh index a0f2e7eac3..087006a434 100755 --- a/scripts/dist.sh +++ b/scripts/dist.sh @@ -32,6 +32,12 @@ cp "${ROOTDIR}/${OUT_DIR}/ilogtail_config.json" "${ROOTDIR}/${DIST_DIR}" cp -a "${ROOTDIR}/${OUT_DIR}/user_yaml_config.d" "${ROOTDIR}/${DIST_DIR}" if file "${ROOTDIR}/${DIST_DIR}/ilogtail" | grep x86-64; then ./scripts/download_ebpflib.sh "${ROOTDIR}/${DIST_DIR}"; fi +# Splitting debug info at build time with -gsplit-dwarf does not work with current gcc version +# Strip binary to reduce size here +strip "${ROOTDIR}/${DIST_DIR}/ilogtail" +strip "${ROOTDIR}/${DIST_DIR}/libPluginAdapter.so" +strip "${ROOTDIR}/${DIST_DIR}/libPluginBase.so" + # pack dist dir cd "${ROOTDIR}" tar -cvzf "${DIST_DIR}.tar.gz" "${DIST_DIR}" diff --git a/scripts/gen_build_scripts.sh b/scripts/gen_build_scripts.sh index a8f9c25565..e56bf63815 100755 --- a/scripts/gen_build_scripts.sh +++ b/scripts/gen_build_scripts.sh @@ -57,7 +57,7 @@ ram_limit_nproc=\$((ram_size / 1024 / 768)) EOF chmod 755 $BUILD_SCRIPT_FILE if [ $CATEGORY = "plugin" ]; then - echo "mkdir -p core/build && cd core/build && cmake -D CMAKE_BUILD_TYPE=Release -D LOGTAIL_VERSION=${VERSION} .. && cd plugin && make -s PluginAdapter && cd ../../.. && ./scripts/plugin_build.sh vendor c-shared ${OUT_DIR}" >> $BUILD_SCRIPT_FILE; + echo "mkdir -p core/build && cd core/build && cmake -DCMAKE_BUILD_TYPE=Release -DLOGTAIL_VERSION=${VERSION} .. && cd plugin && make -s PluginAdapter && cd ../../.. && ./scripts/plugin_build.sh vendor c-shared ${OUT_DIR}" >> $BUILD_SCRIPT_FILE; elif [ $CATEGORY = "core" ]; then echo "mkdir -p core/build && cd core/build && cmake -DCMAKE_BUILD_TYPE=Release -DLOGTAIL_VERSION=${VERSION} -DBUILD_LOGTAIL_UT=${BUILD_LOGTAIL_UT} -DENABLE_COMPATIBLE_MODE=${ENABLE_COMPATIBLE_MODE} -DENABLE_STATIC_LINK_CRT=${ENABLE_STATIC_LINK_CRT} .. && make -sj\$nproc" >> $BUILD_SCRIPT_FILE; elif [ $CATEGORY = "all" ]; then diff --git a/upload_release_assets.sh b/upload_release_assets.sh new file mode 100755 index 0000000000..43437cd31f --- /dev/null +++ b/upload_release_assets.sh @@ -0,0 +1,79 @@ +#!/usr/bin/env bash + +# Copyright 2022 iLogtail Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set -ue +set -o pipefail + +usage() { + echo "Upload current package/image to OSS/Repository" + echo 'Before run this script make sure you have `make dist` or `make docker`' + echo '' + echo "Usage: $0 artifact_type local_version [remote_version]" + echo '' + echo 'artifact_type package|image' + echo 'local_version example: 1.1.0, edge' + echo 'remote_version same as local_version if omited. example: 1.1.0, edge, latest' + exit 1 +} + +[[ $# -ne 2 && $# -ne 3 ]] && { + usage +} || : + +SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]}) +VERSION=$2 +SPECIAL_TAG= +[[ $# -eq 3 ]] && { + SPECIAL_TAG=$3 +} + +upload_package() { + # upgrade version to latest|edge + [[ ! -z $SPECIAL_TAG ]] && { + ossutil64 cp oss://ilogtail-community-edition/$VERSION/ilogtail-$VERSION.linux-amd64.tar.gz \ + oss://ilogtail-community-edition/${SPECIAL_TAG}/ilogtail-${SPECIAL_TAG}.linux-amd64.tar.gz + ossutil64 cp oss://ilogtail-community-edition/$VERSION/ilogtail-$VERSION.linux-amd64.tar.gz.sha256 \ + oss://ilogtail-community-edition/${SPECIAL_TAG}/ilogtail-${SPECIAL_TAG}.linux-amd64.tar.gz.sha256 + exit + } || : + + sha256sum ilogtail-$VERSION.tar.gz > ilogtail-$VERSION.tar.gz.sha256 + ossutil64 cp ilogtail-$VERSION.tar.gz oss://ilogtail-community-edition/$VERSION/ilogtail-$VERSION.linux-amd64.tar.gz + ossutil64 cp ilogtail-$VERSION.tar.gz.sha256 oss://ilogtail-community-edition/$VERSION/ilogtail-$VERSION.linux-amd64.tar.gz.sha256 +} + +upload_image() { + # upgrade version to latest|edge + [[ ! -z $SPECIAL_TAG ]] && { + docker tag sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail:$VERSION \ + sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail:${SPECIAL_TAG} + [[ $SPECIAL_TAG == "edge" ]] && $SCRIPT_DIR/rm_ilogtail_edge_image || : + docker push sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail:${SPECIAL_TAG} + exit + } || : + + docker tag aliyun/ilogtail:$VERSION sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail:$VERSION + [[ $VERSION == "edge" ]] && $SCRIPT_DIR/rm_ilogtail_edge_image || : + docker push sls-opensource-registry.cn-shanghai.cr.aliyuncs.com/ilogtail-community-edition/ilogtail:$VERSION +} + +if [[ $1 == "package" ]]; then + upload_package +elif [[ $1 == "image" ]]; then + upload_image +else + usage +fi