From 2b8696130d60f594c7029293ec7a2f58d113ddab Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 10 Jun 2022 14:57:39 +0200 Subject: [PATCH 01/34] Added CLANGUML_GIT_TOPLEVEL_DIR env var for adjusting diagram link paths --- src/util/util.cc | 15 +++++++++++++++ src/util/util.h | 2 ++ 2 files changed, 17 insertions(+) diff --git a/src/util/util.cc b/src/util/util.cc index 7a4c2165..bd163c80 100644 --- a/src/util/util.cc +++ b/src/util/util.cc @@ -56,6 +56,16 @@ std::string get_process_output(const std::string &command) return result; } +std::string get_env(const std::string &name) +{ + const char *value = std::getenv(name.c_str()); + + if (value == nullptr) + return {}; + + return std::string{value}; +} + bool is_git_repository() { #if defined(_WIN32) || defined(_WIN64) @@ -84,6 +94,11 @@ std::string get_git_commit() std::string get_git_toplevel_dir() { + const auto env_toplevel_dir = get_env("CLANGUML_GIT_TOPLEVEL_DIR"); + + if (!env_toplevel_dir.empty()) + return env_toplevel_dir; + return trim(get_process_output("git rev-parse --show-toplevel")); } diff --git a/src/util/util.h b/src/util/util.h index abf1a84e..b01e17f8 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -62,6 +62,8 @@ void setup_logging(bool verbose); std::string get_process_output(const std::string &command); +std::string get_env(const std::string &name); + bool is_git_repository(); std::string get_git_branch(); From 84c48e96d15cb38b99eb3409b78883f4862dd9a8 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 10 Jun 2022 15:40:01 +0200 Subject: [PATCH 02/34] Added GNU install dir rules to CMakeLists --- CMakeLists.txt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9f1ee78..d8acf6d4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -75,9 +75,7 @@ target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppa target_compile_features(clang-uml PRIVATE cxx_std_17) install( - FILES - # add include after DESTINATION, then it works - DESTINATION include ${CMAKE_INSTALL_INCLUDEDIR} + TARGETS clang-uml DESTINATION ${CMAKE_INSTALL_BINDIR} ) # Enable testing via CTest From 9c59af8302cc648b574ae759b4bda28711601ed4 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 10 Jun 2022 18:20:49 +0200 Subject: [PATCH 03/34] Added automatic executable version updates --- .gitignore | 2 +- CMakeLists.txt | 9 +++++++++ Makefile | 4 ++++ src/main.cc | 20 +++++++++++++++++++- src/version.h.in | 23 +++++++++++++++++++++++ 5 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 src/version.h.in diff --git a/.gitignore b/.gitignore index 25b55aa4..c615ae18 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,7 @@ bin/ docs/diagrams coverage*.info - +packaging/_BUILD # CLion diff --git a/CMakeLists.txt b/CMakeLists.txt index d8acf6d4..58c64b2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 17) +set(CMAKE_VERBOSE_MAKEFILE ON) + set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") @@ -16,6 +18,7 @@ set(CLANG_UML_INSTALL_BIN_DIR ${PROJECT_SOURCE_DIR}/bin) set(UML_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/uml) option(LLVM_CONFIG_PATH "Path to custom llvm-config executable") +option(GIT_VERSION "clang-uml version" "0.1.0") if(LLVM_CONFIG_PATH) message(STATUS "Using llvm-config from ${LLVM_CONFIG_PATH}") @@ -45,6 +48,10 @@ find_package(LLVM REQUIRED CONFIG) set(CLANG_INCLUDE_DIRS "llvm/clang/include") set(CLANG_LIBS clang) +# Configure executable version +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/src/version) +configure_file(src/version.h.in ${PROJECT_BINARY_DIR}/src/version/version.h) + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") execute_process(COMMAND gcc --print-file-name=include OUTPUT_STRIP_TRAILING_WHITESPACE @@ -61,6 +68,8 @@ include_directories(${THIRDPARTY_HEADERS_DIR}/cppast/include) include_directories(${THIRDPARTY_HEADERS_DIR}/cppast/external/type_safe/include) include_directories(${THIRDPARTY_HEADERS_DIR}/cppast/external/type_safe/external/debug_assert) include_directories(${PROJECT_SOURCE_DIR}/src/) +include_directories(${PROJECT_BINARY_DIR}/src/version) + file(GLOB_RECURSE SOURCES src/*.cc include/*.h) set(MAIN_SOURCE_FILE ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cc) diff --git a/Makefile b/Makefile index 6aaeb204..37a42714 100644 --- a/Makefile +++ b/Makefile @@ -26,12 +26,15 @@ LLVM_CONFIG_PATH ?= CMAKE_CXX_FLAGS ?= CMAKE_EXE_LINKER_FLAGS ?= +GIT_VERSION ?= $(shell git describe --tags --always --abbrev=7) + .PHONY: clean clean: rm -rf debug release debug/CMakeLists.txt: cmake -S . -B debug \ + -DGIT_VERSION=$(GIT_VERSION) \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_CXX_FLAGS="$(CMAKE_CXX_FLAGS)" \ @@ -40,6 +43,7 @@ debug/CMakeLists.txt: release/CMakeLists.txt: cmake -S . -B release \ + -DGIT_VERSION=$(GIT_VERSION) \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_CXX_FLAGS="$(CMAKE_CXX_FLAGS)" \ diff --git a/src/main.cc b/src/main.cc index 8ffe930b..0c6431c5 100644 --- a/src/main.cc +++ b/src/main.cc @@ -21,8 +21,8 @@ #include "include_diagram/generators/plantuml/include_diagram_generator.h" #include "package_diagram/generators/plantuml/package_diagram_generator.h" #include "sequence_diagram/generators/plantuml/sequence_diagram_generator.h" - #include "util/util.h" +#include "version.h" #include #include @@ -38,6 +38,8 @@ using namespace clanguml; using config::config; +void print_version(); + void print_diagrams_list(const clanguml::config::config &cfg); bool check_output_directory(const std::string &dir); @@ -55,6 +57,7 @@ int main(int argc, const char *argv[]) std::vector diagram_names{}; std::optional output_directory; unsigned int thread_count{0}; + bool show_version{false}; bool verbose{false}; bool list_diagrams{false}; @@ -68,12 +71,18 @@ int main(int argc, const char *argv[]) "Override output directory specified in config file"); app.add_option("-t,--thread-count", thread_count, "Thread pool size (0 = hardware concurrency)"); + app.add_flag("-V,--version", show_version, "Print version and exit"); app.add_flag("-v,--verbose", verbose, "Verbose logging"); app.add_flag("-l,--list-diagrams", list_diagrams, "Print list of diagrams defined in the config file"); CLI11_PARSE(app, argc, argv); + if (show_version) { + print_version(); + return 0; + } + clanguml::util::setup_logging(verbose); clanguml::config::config config; @@ -223,6 +232,15 @@ bool check_output_directory(const std::string &dir) return true; } +void print_version() +{ + std::cout << "clang-uml " << clanguml::version::CLANG_UML_VERSION << '\n'; + std::cout << "Copyright (C) 2021-2022 Bartek Kryza " + << '\n'; + std::cout << "Built with libclang: " + << clanguml::version::CLANG_UML_LIBCLANG_VERSION << std::endl; +} + void print_diagrams_list(const clanguml::config::config &cfg) { using std::cout; diff --git a/src/version.h.in b/src/version.h.in new file mode 100644 index 00000000..fb0a72a7 --- /dev/null +++ b/src/version.h.in @@ -0,0 +1,23 @@ +/** + * src/version.h + * + * Copyright (c) 2021-2022 Bartek Kryza + * + * 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. + */ +#pragma once + +namespace clanguml::version { +static constexpr auto CLANG_UML_VERSION = "@GIT_VERSION@"; +static constexpr auto CLANG_UML_LIBCLANG_VERSION = "@LIBCLANG_VERSION_STRING@"; +} // namespace clanguml::version \ No newline at end of file From 31398b7bc35a35e061a7c3263c66e69156e4a315 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 10 Jun 2022 18:30:16 +0200 Subject: [PATCH 04/34] Fixed CMakeLists install rules --- CMakeLists.txt | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 58c64b2b..292e9c65 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,8 +8,6 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_VERBOSE_MAKEFILE ON) -set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") set(CLANG_UML_INSTALL_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include) @@ -78,14 +76,15 @@ list(REMOVE_ITEM SOURCES ${MAIN_SOURCE_FILE}) add_library(clang-umllib OBJECT ${SOURCES}) add_executable(clang-uml ${MAIN_SOURCE_FILE}) -install(TARGETS clang-uml DESTINATION ${CLANG_UML_INSTALL_BIN_DIR}) target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib) target_compile_features(clang-uml PRIVATE cxx_std_17) -install( - TARGETS clang-uml DESTINATION ${CMAKE_INSTALL_BINDIR} -) +include(GNUInstallDirs) + +install(TARGETS clang-uml DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(FILES LICENSE.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) +install(FILES README.md DESTINATION ${CMAKE_INSTALL_DOCDIR}) # Enable testing via CTest enable_testing() From bef9e9b87bebfaa23fd7dd0dcb2e15b1f6bf7300 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Fri, 10 Jun 2022 19:31:11 +0200 Subject: [PATCH 05/34] Added deb packaging scripts --- packaging/Makefile | 69 ++++++++++++++++++++++++++++++++++ packaging/debian/changelog | 5 +++ packaging/debian/compat | 1 + packaging/debian/control | 19 ++++++++++ packaging/debian/copyright | 16 ++++++++ packaging/debian/rules | 12 ++++++ packaging/debian/source/format | 1 + packaging/debian/watch | 3 ++ 8 files changed, 126 insertions(+) create mode 100644 packaging/Makefile create mode 100644 packaging/debian/changelog create mode 100644 packaging/debian/compat create mode 100644 packaging/debian/control create mode 100644 packaging/debian/copyright create mode 100755 packaging/debian/rules create mode 100644 packaging/debian/source/format create mode 100644 packaging/debian/watch diff --git a/packaging/Makefile b/packaging/Makefile new file mode 100644 index 00000000..3902c77b --- /dev/null +++ b/packaging/Makefile @@ -0,0 +1,69 @@ +# Makefile +# +# Copyright (c) 2021-2022 Bartek Kryza +# +# 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. + +SHELL := /bin/bash +.ONESHELL: + +.PHONY: download deb clean + +NAME ?= clang-uml +REBUILD ?= 1 +MAINTAINER_NAME ?= Bartek Kryza +MAINTAINER_EMAIL ?= bkryza@gmail.com +GPG_KEY ?= 702014E322FE5CA9B5D920F66CDA4566635E93B1 +OS ?= ubuntu +DIST ?= focal +TAR_EXT ?= gz + +build_dir = _BUILD/$(NAME)/$(OS)/$(DIST) + +VERSION ?= $(shell git describe --tags --always --abbrev=7) + +# +# Replace mustache template variable in all files in directory recursively, +# e.g.: +# $(call subst_template,VERSION,${VERSION},debian) +# +define subst_template_dir + find $(3) -type f -exec sed -i "s/{{$(1)}}/$(2)/g" {} \; +endef + + +deb: + rm -rf $(build_dir) + mkdir -p $(build_dir) + git-archive-all --prefix=clang-uml-$(VERSION)/ $(build_dir)/clang-uml-$(VERSION).tar.$(TAR_EXT) + cd $(build_dir) + echo "Creating archive from current source" + echo "Creating directory: ", $(NAME)-$(VERSION) + mkdir $(NAME)-$(VERSION) + echo "Extracting source archive..." + tar xf $(NAME)-$(VERSION).tar.$(TAR_EXT) -C $(NAME)-$(VERSION) --strip-components 1 + cp -R ../../../../debian $(NAME)-$(VERSION)/debian + cd $(NAME)-$(VERSION) + $(call subst_template_dir,DATETIME,$(shell date -R),debian) + $(call subst_template_dir,OS,${OS},debian) + $(call subst_template_dir,NAME,${NAME},debian) + $(call subst_template_dir,VERSION,${VERSION},debian) + $(call subst_template_dir,REBUILD,${REBUILD},debian) + $(call subst_template_dir,DISTRIBUTION,${DIST},debian) + $(call subst_template_dir,MAINTAINER_NAME,${MAINTAINER_NAME},debian) + $(call subst_template_dir,MAINTAINER_EMAIL,${MAINTAINER_EMAIL},debian) + mk-origtargz ../$(NAME)-$(VERSION).tar.$(TAR_EXT) + # BUILD SOURCE PACKAGE FOR LAUNCHPAD + debuild -S -sa -us -d -k$(GPG_KEY) #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession + # BUILD LOCALLY BINARY PACKAGE + #debuild -us -uc #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession diff --git a/packaging/debian/changelog b/packaging/debian/changelog new file mode 100644 index 00000000..d13b69e1 --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +clang-uml ({{VERSION}}-0{{OS}}{{REBUILD}}~{{DISTRIBUTION}}) {{DISTRIBUTION}}; urgency=low + + * Initial release + + -- Bartek Kryza {{DATETIME}} diff --git a/packaging/debian/compat b/packaging/debian/compat new file mode 100644 index 00000000..f599e28b --- /dev/null +++ b/packaging/debian/compat @@ -0,0 +1 @@ +10 diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 00000000..7191fe6b --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,19 @@ +Source: clang-uml +Maintainer: Bartek Kryza +Section: devel +Priority: optional +Build-Depends: debhelper, make, gcc, g++, cmake, libyaml-cpp-dev, clang, libclang-dev, libclang-cpp-dev +Standards-Version: 4.3.0 +Vcs-Browser: https://github.com/bkryza/clang-uml +Vcs-Git: https://github.com/bkryza/clang-uml.git +Homepage: https://github.com/bkryza/clang-uml + +Package: clang-uml +Architecture: any +#Multi-Arch: same +Section: libs +Depends: ${misc:Depends}, ${shlibs:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Automatic C++ UML diagram generator based on Clang. + . + This package provides the clang-uml binary. diff --git a/packaging/debian/copyright b/packaging/debian/copyright new file mode 100644 index 00000000..bd54f076 --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,16 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: clang-uml +Source: https://github.com/bkryza/clang-uml + +Files: * +Copyright: 2021-2022 Bartek Kryza +License: apache + 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. diff --git a/packaging/debian/rules b/packaging/debian/rules new file mode 100755 index 00000000..29280a77 --- /dev/null +++ b/packaging/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +export DH_VERBOSE=1 +export CLANGUML_GIT_TOPLEVEL_DIR=$(CURDIR) + + +override_dh_auto_configure: + dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr + + +%: + dh $@ diff --git a/packaging/debian/source/format b/packaging/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/packaging/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/packaging/debian/watch b/packaging/debian/watch new file mode 100644 index 00000000..1f8c2b0a --- /dev/null +++ b/packaging/debian/watch @@ -0,0 +1,3 @@ +version=4 + +https://github.com/bkryza/clang-uml/releases .*/[relasymcp.-]*(\d\S*)\.tar\.gz From b90250768a06b8824180c00121ad877ce959a804 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 11:57:49 +0200 Subject: [PATCH 06/34] Updated llvm version range --- cmake/FindLibClang.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/FindLibClang.cmake b/cmake/FindLibClang.cmake index 20d6e153..5299afe9 100644 --- a/cmake/FindLibClang.cmake +++ b/cmake/FindLibClang.cmake @@ -57,7 +57,7 @@ if (NOT LIBCLANG_LLVM_CONFIG_EXECUTABLE) find_program(LIBCLANG_LLVM_CONFIG_EXECUTABLE NAMES llvm-config PATHS "${BREW_LLVM_PATH}/bin") else () set(llvm_config_names llvm-config) - foreach(major RANGE 13 3) + foreach(major RANGE 15 3) list(APPEND llvm_config_names "llvm-config${major}" "llvm-config-${major}") foreach(minor RANGE 9 0) list(APPEND llvm_config_names "llvm-config${major}${minor}" "llvm-config-${major}.${minor}" "llvm-config-mp-${major}.${minor}") From 212b5c952f772943033d46a56c42311fc20e5866 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 13:14:01 +0200 Subject: [PATCH 07/34] Added missing test case header --- tests/t00012/t00012.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/t00012/t00012.cc b/tests/t00012/t00012.cc index c2a79d73..82f292a0 100644 --- a/tests/t00012/t00012.cc +++ b/tests/t00012/t00012.cc @@ -1,6 +1,6 @@ #include +#include #include -#include #include #include #include From bcd6c06003dfd2fdf91139774a2f282cdb09c10f Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 17:13:29 +0200 Subject: [PATCH 08/34] Updated cppast ref --- thirdparty/cppast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/cppast b/thirdparty/cppast index 7fe5f2be..8f8b81d6 160000 --- a/thirdparty/cppast +++ b/thirdparty/cppast @@ -1 +1 @@ -Subproject commit 7fe5f2be3f8ae2b90e857bbea54df47b45eb64b9 +Subproject commit 8f8b81d6eb05122b6e3d33960d6ba9923a55dcbd From 0dec595d20811486b2a69ff65cb22ec784081838 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 18:30:02 +0200 Subject: [PATCH 09/34] Fixed warnings on GCC 12 --- src/class_diagram/model/class_method.h | 2 ++ src/class_diagram/model/enum.h | 4 ++-- src/common/model/diagram_filter.h | 22 ++++++++++++++++++- .../plantuml/include_diagram_generator.cc | 4 ++-- src/include_diagram/model/diagram.h | 2 +- src/package_diagram/model/diagram.h | 2 +- src/sequence_diagram/model/diagram.h | 2 +- 7 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/class_diagram/model/class_method.h b/src/class_diagram/model/class_method.h index f35ad492..277cd3c2 100644 --- a/src/class_diagram/model/class_method.h +++ b/src/class_diagram/model/class_method.h @@ -30,6 +30,8 @@ public: class_method(common::model::access_t access, const std::string &name, const std::string &type); + virtual ~class_method() = default; + bool is_pure_virtual() const; void is_pure_virtual(bool is_pure_virtual); diff --git a/src/class_diagram/model/enum.h b/src/class_diagram/model/enum.h index ef6025ce..e6d93a7b 100644 --- a/src/class_diagram/model/enum.h +++ b/src/class_diagram/model/enum.h @@ -30,9 +30,9 @@ public: enum_(const common::model::namespace_ &using_namespaces); enum_(const enum_ &) = delete; - enum_(enum_ &&) = default; + enum_(enum_ &&) = delete; enum_ &operator=(const enum_ &) = delete; - enum_ &operator=(enum_ &&) = default; + enum_ &operator=(enum_ &&) = delete; // TODO: Do we need this? friend bool operator==(const enum_ &l, const enum_ &r); diff --git a/src/common/model/diagram_filter.h b/src/common/model/diagram_filter.h index 9fa73c42..2e27815f 100644 --- a/src/common/model/diagram_filter.h +++ b/src/common/model/diagram_filter.h @@ -58,6 +58,8 @@ class filter_visitor { public: filter_visitor(filter_t type); + virtual ~filter_visitor() = default; + virtual tvl::value_t match( const diagram &d, const common::model::element &e) const; @@ -86,6 +88,8 @@ struct anyof_filter : public filter_visitor { anyof_filter( filter_t type, std::vector> filters); + virtual ~anyof_filter() = default; + tvl::value_t match( const diagram &d, const common::model::element &e) const override; @@ -99,6 +103,8 @@ private: struct namespace_filter : public filter_visitor { namespace_filter(filter_t type, std::vector namespaces); + virtual ~namespace_filter() = default; + tvl::value_t match(const diagram &d, const namespace_ &ns) const override; tvl::value_t match(const diagram &d, const element &e) const override; @@ -110,6 +116,8 @@ private: struct element_filter : public filter_visitor { element_filter(filter_t type, std::vector elements); + virtual ~element_filter() = default; + tvl::value_t match(const diagram &d, const element &e) const override; private: @@ -119,6 +127,8 @@ private: struct subclass_filter : public filter_visitor { subclass_filter(filter_t type, std::vector roots); + virtual ~subclass_filter() = default; + tvl::value_t match(const diagram &d, const element &e) const override; private: @@ -137,6 +147,8 @@ struct edge_traversal_filter : public filter_visitor { { } + virtual ~edge_traversal_filter() = default; + tvl::value_t match(const diagram &d, const MatchOverrideT &e) const override { // This filter should only be run on the completely generated diagram @@ -203,7 +215,7 @@ private: decltype(matching_elements_) parents; util::for_each( - matching_elements_, [this, &cd, &parents](const auto &element) { + matching_elements_, [&cd, &parents](const auto &element) { auto parent = detail::get( cd, element.get().path().to_string()); @@ -269,6 +281,8 @@ struct relationship_filter : public filter_visitor { relationship_filter( filter_t type, std::vector relationships); + virtual ~relationship_filter() = default; + tvl::value_t match( const diagram &d, const relationship_t &r) const override; @@ -279,6 +293,8 @@ private: struct access_filter : public filter_visitor { access_filter(filter_t type, std::vector access); + virtual ~access_filter() = default; + tvl::value_t match(const diagram &d, const access_t &a) const override; private: @@ -288,6 +304,8 @@ private: struct context_filter : public filter_visitor { context_filter(filter_t type, std::vector context); + virtual ~context_filter() = default; + tvl::value_t match(const diagram &d, const element &r) const override; private: @@ -298,6 +316,8 @@ struct paths_filter : public filter_visitor { paths_filter(filter_t type, const std::filesystem::path &root, std::vector p); + virtual ~paths_filter() = default; + tvl::value_t match( const diagram &d, const common::model::source_file &r) const override; diff --git a/src/include_diagram/generators/plantuml/include_diagram_generator.cc b/src/include_diagram/generators/plantuml/include_diagram_generator.cc index 3dddb099..b670a55b 100644 --- a/src/include_diagram/generators/plantuml/include_diagram_generator.cc +++ b/src/include_diagram/generators/plantuml/include_diagram_generator.cc @@ -46,11 +46,11 @@ void generator::generate_relationships( else { util::for_each_if( f.relationships(), - [this, &f](const auto &r) { + [this](const auto &r) { return m_model.should_include(r.type()) && util::contains(m_generated_aliases, r.destination()); }, - [this, &f, &ostr](const auto &r) { + [&f, &ostr](const auto &r) { ostr << f.alias() << " " << plantuml_common::to_plantuml(r.type(), r.style()) << " " << r.destination() << '\n'; diff --git a/src/include_diagram/model/diagram.h b/src/include_diagram/model/diagram.h index 81082e9c..a9a1268b 100644 --- a/src/include_diagram/model/diagram.h +++ b/src/include_diagram/model/diagram.h @@ -43,7 +43,7 @@ public: common::model::diagram_t type() const override; type_safe::optional_ref get( - const std::string &full_name) const; + const std::string &full_name) const override; void add_file(std::unique_ptr &&f); diff --git a/src/package_diagram/model/diagram.h b/src/package_diagram/model/diagram.h index 0511141d..253d8f45 100644 --- a/src/package_diagram/model/diagram.h +++ b/src/package_diagram/model/diagram.h @@ -45,7 +45,7 @@ public: packages() const; type_safe::optional_ref get( - const std::string &full_name) const; + const std::string &full_name) const override; void add_package(std::unique_ptr &&p); diff --git a/src/sequence_diagram/model/diagram.h b/src/sequence_diagram/model/diagram.h index cf15c3de..552f0f79 100644 --- a/src/sequence_diagram/model/diagram.h +++ b/src/sequence_diagram/model/diagram.h @@ -37,7 +37,7 @@ public: common::model::diagram_t type() const override; type_safe::optional_ref get( - const std::string &full_name) const; + const std::string &full_name) const override; std::string to_alias(const std::string &full_name) const; From 60f8fbb3e83610c8a015ef696ca04a3ebe883826 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 21:17:09 +0200 Subject: [PATCH 10/34] Added environment variables for overriding Git variables --- src/util/util.cc | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/util/util.cc b/src/util/util.cc index bd163c80..cefa989f 100644 --- a/src/util/util.cc +++ b/src/util/util.cc @@ -68,6 +68,11 @@ std::string get_env(const std::string &name) bool is_git_repository() { + const auto env = get_env("CLANGUML_GIT_COMMIT"); + + if (!env.empty()) + return true; + #if defined(_WIN32) || defined(_WIN64) return false; #else @@ -79,25 +84,40 @@ bool is_git_repository() std::string get_git_branch() { + const auto env = get_env("CLANGUML_GIT_BRANCH"); + + if (!env.empty()) + return env; + return trim(get_process_output("git rev-parse --abbrev-ref HEAD")); } std::string get_git_revision() { + const auto env = get_env("CLANGUML_GIT_REVISION"); + + if (!env.empty()) + return env; + return trim(get_process_output("git describe --tags --always")); } std::string get_git_commit() { + const auto env = get_env("CLANGUML_GIT_COMMIT"); + + if (!env.empty()) + return env; + return trim(get_process_output("git rev-parse HEAD")); } std::string get_git_toplevel_dir() { - const auto env_toplevel_dir = get_env("CLANGUML_GIT_TOPLEVEL_DIR"); + const auto env = get_env("CLANGUML_GIT_TOPLEVEL_DIR"); - if (!env_toplevel_dir.empty()) - return env_toplevel_dir; + if (!env.empty()) + return env; return trim(get_process_output("git rev-parse --show-toplevel")); } From 8405a8c12bc6189586f576d300c62c5d8e800156 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 23:53:49 +0200 Subject: [PATCH 11/34] Added initial changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 CHANGELOG.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..e563e6ef --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,4 @@ +# CHANGELOG + +### 0.1.0 + * Initial release \ No newline at end of file From 4724928c470555f8b9d259c214419b83c28db050 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 23:54:07 +0200 Subject: [PATCH 12/34] Added packaging readme --- packaging/README.md | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 packaging/README.md diff --git a/packaging/README.md b/packaging/README.md new file mode 100644 index 00000000..8d2adf74 --- /dev/null +++ b/packaging/README.md @@ -0,0 +1,32 @@ +# Building releases + +* Update CHANGELOG.md +* Tag the release commit, e.g. ```git tag 0.1.0``` + +## Ubuntu + +```bash +cd packaging +make DIST=bionic REBUILD=1 deb +make DIST=focal REBUILD=1 deb +make DIST=jammy REBUILD=1 deb + +cd _BUILD/ubuntu/bionic +dput ppa:bkryza/clang-uml *.changes + +cd _BUILD/ubuntu/focal +dput ppa:bkryza/clang-uml *.changes + +cd _BUILD/ubuntu/jammy +dput ppa:bkryza/clang-uml *.changes + +``` + +## Anaconda + +```bash +docker run --rm -v $PWD:$PWD continuum/miniconda3 bash +conda install conda-build +cd packaging +make conda +``` \ No newline at end of file From 4b1903e923f5958d892c60dd344dc89cd9e9f026 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sat, 11 Jun 2022 23:54:46 +0200 Subject: [PATCH 13/34] Added conda packaging script --- .gitignore | 2 ++ packaging/Makefile | 17 +++++++++++++- packaging/conda/build.sh | 23 ++++++++++++++++++ packaging/conda/meta.yaml.in | 45 ++++++++++++++++++++++++++++++++++++ 4 files changed, 86 insertions(+), 1 deletion(-) create mode 100644 packaging/conda/build.sh create mode 100644 packaging/conda/meta.yaml.in diff --git a/.gitignore b/.gitignore index c615ae18..26a06f93 100644 --- a/.gitignore +++ b/.gitignore @@ -21,7 +21,9 @@ bin/ docs/diagrams coverage*.info + packaging/_BUILD +packaging/conda/meta.yaml # CLion diff --git a/packaging/Makefile b/packaging/Makefile index 3902c77b..a400e67d 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -17,7 +17,7 @@ SHELL := /bin/bash .ONESHELL: -.PHONY: download deb clean +.PHONY: download deb clean conda NAME ?= clang-uml REBUILD ?= 1 @@ -31,6 +31,8 @@ TAR_EXT ?= gz build_dir = _BUILD/$(NAME)/$(OS)/$(DIST) VERSION ?= $(shell git describe --tags --always --abbrev=7) +COMMIT ?= $(shell git rev-parse HEAD) +BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) # # Replace mustache template variable in all files in directory recursively, @@ -41,6 +43,9 @@ define subst_template_dir find $(3) -type f -exec sed -i "s/{{$(1)}}/$(2)/g" {} \; endef +define subst_conda_meta_yaml + find $(3) -name meta.yaml -exec sed -i "s/{{$(1)}}/$(2)/g" {} \; +endef deb: rm -rf $(build_dir) @@ -67,3 +72,13 @@ deb: debuild -S -sa -us -d -k$(GPG_KEY) #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession # BUILD LOCALLY BINARY PACKAGE #debuild -us -uc #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession + +conda: + mkdir -p _BUILD/conda + git-archive-all --prefix=clang-uml-$(VERSION)/ _BUILD/conda/clang-uml-$(VERSION).tar.$(TAR_EXT) + cp conda/meta.yaml.in conda/meta.yaml + $(call subst_conda_meta_yaml,PKG_VERSION,${VERSION},conda) + $(call subst_conda_meta_yaml,PKG_SOURCE,..\/_BUILD\/conda\/clang-uml-$(VERSION).tar.$(TAR_EXT),conda) + $(call subst_conda_meta_yaml,GIT_COMMIT,${COMMIT},conda) + $(call subst_conda_meta_yaml,GIT_BRANCH,${BRANCH},conda) + conda build conda diff --git a/packaging/conda/build.sh b/packaging/conda/build.sh new file mode 100644 index 00000000..3819ba95 --- /dev/null +++ b/packaging/conda/build.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +mkdir build && cd build + +export PKG_CONFIG_PATH="$BUILD_PREFIX/lib/pkgconfig:$PKG_CONFIG_PATH" + +export CLANGUML_GIT_TOPLEVEL_DIR=${SRC_DIR} + +cmake -DCMAKE_BUILD_TYPE=Release \ + -DGIT_VERSION=${GIT_VERSION} \ + -DCODE_COVERAGE=OFF \ + -DWITH_TESTS=ON \ + -DLLVM_CONFIG_PATH=${BUILD_PREFIX}/bin/llvm-config \ + -DCONDA_BUILD_PREFIX=${BUILD_PREFIX} \ + -DCMAKE_INSTALL_PREFIX=${PREFIX} \ + -DCMAKE_EXE_LINKER_FLAGS="-lyaml-cpp" \ + .. + +CTEST_OUTPUT_ON_FAILURE=1 make -j${CPU_COUNT} + +CTEST_OUTPUT_ON_FAILURE=1 ctest -j${CPU_COUNT} + +make install \ No newline at end of file diff --git a/packaging/conda/meta.yaml.in b/packaging/conda/meta.yaml.in new file mode 100644 index 00000000..ed65b924 --- /dev/null +++ b/packaging/conda/meta.yaml.in @@ -0,0 +1,45 @@ +{% set name = "clang-uml" %} +{% set version = "{{PKG_VERSION}}" %} + +package: + name: {{ name|lower }} + version: {{ version|replace('-', '.') }} + +source: + url: "{{PKG_SOURCE}}" + +build: + binary_relocation: true + script_env: + - PKG_VERSION + - CLANGUML_GIT_REVISION={{PKG_VERSION}} + - CLANGUML_GIT_BRANCH={{GIT_BRANCH}} + - CLANGUML_GIT_COMMIT={{GIT_COMMIT}} + +requirements: + build: + - {{ compiler('c') }} + - {{ compiler('cxx') }} + - conda-forge::pkg-config + - conda-forge::yaml-cpp 0.7.0 + - conda-forge::clangdev 14.0.4 + - conda-forge::libclang 14.0.4 + - conda-forge::cmake + - conda-forge::git + - conda-forge::make # [unix] + run: + - conda-forge::yaml-cpp 0.7.0 + - conda-forge::libclang 14.0.4 + +test: + commands: + - $PREFIX/bin/clang-uml --version + +about: + home: https://github.com/bkryza/clang-uml + license: Apache 2.0 + summary: clang-uml is an automatic C++ UML diagram generator based on Clang. + +extra: + recipe-maintainers: + - bkryza \ No newline at end of file From ce87d9bf4362dc6f3cc30adbdaf1ffba5e03e5d2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 12:44:05 +0200 Subject: [PATCH 14/34] Added specific control files for different Ubuntu versions --- packaging/Makefile | 5 +++-- packaging/debian/{control => control.bionic} | 5 ++--- packaging/debian/control.focal | 18 ++++++++++++++++++ packaging/debian/control.jammy | 18 ++++++++++++++++++ 4 files changed, 41 insertions(+), 5 deletions(-) rename packaging/debian/{control => control.bionic} (78%) create mode 100644 packaging/debian/control.focal create mode 100644 packaging/debian/control.jammy diff --git a/packaging/Makefile b/packaging/Makefile index a400e67d..e8269f6e 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -28,7 +28,7 @@ OS ?= ubuntu DIST ?= focal TAR_EXT ?= gz -build_dir = _BUILD/$(NAME)/$(OS)/$(DIST) +build_dir = _BUILD/$(OS)/$(DIST) VERSION ?= $(shell git describe --tags --always --abbrev=7) COMMIT ?= $(shell git rev-parse HEAD) @@ -57,7 +57,7 @@ deb: mkdir $(NAME)-$(VERSION) echo "Extracting source archive..." tar xf $(NAME)-$(VERSION).tar.$(TAR_EXT) -C $(NAME)-$(VERSION) --strip-components 1 - cp -R ../../../../debian $(NAME)-$(VERSION)/debian + cp -R ../../../debian $(NAME)-$(VERSION)/debian cd $(NAME)-$(VERSION) $(call subst_template_dir,DATETIME,$(shell date -R),debian) $(call subst_template_dir,OS,${OS},debian) @@ -68,6 +68,7 @@ deb: $(call subst_template_dir,MAINTAINER_NAME,${MAINTAINER_NAME},debian) $(call subst_template_dir,MAINTAINER_EMAIL,${MAINTAINER_EMAIL},debian) mk-origtargz ../$(NAME)-$(VERSION).tar.$(TAR_EXT) + cp debian/control.$(DIST) debian/control # BUILD SOURCE PACKAGE FOR LAUNCHPAD debuild -S -sa -us -d -k$(GPG_KEY) #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession # BUILD LOCALLY BINARY PACKAGE diff --git a/packaging/debian/control b/packaging/debian/control.bionic similarity index 78% rename from packaging/debian/control rename to packaging/debian/control.bionic index 7191fe6b..63aa8d3b 100644 --- a/packaging/debian/control +++ b/packaging/debian/control.bionic @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc, g++, cmake, libyaml-cpp-dev, clang, libclang-dev, libclang-cpp-dev +Build-Depends: debhelper, make, gcc-8, g++-8, cmake, libyaml-cpp-dev, clang-10, libclang-10-dev, libclang-cpp10-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git @@ -10,8 +10,7 @@ Homepage: https://github.com/bkryza/clang-uml Package: clang-uml Architecture: any -#Multi-Arch: same -Section: libs +Section: utils Depends: ${misc:Depends}, ${shlibs:Depends} Pre-Depends: ${misc:Pre-Depends} Description: Automatic C++ UML diagram generator based on Clang. diff --git a/packaging/debian/control.focal b/packaging/debian/control.focal new file mode 100644 index 00000000..aaf0af76 --- /dev/null +++ b/packaging/debian/control.focal @@ -0,0 +1,18 @@ +Source: clang-uml +Maintainer: Bartek Kryza +Section: devel +Priority: optional +Build-Depends: debhelper, make, gcc-10, g++-10, cmake, libyaml-cpp-dev, clang-12, libclang-12-dev, libclang-cpp12-dev +Standards-Version: 4.3.0 +Vcs-Browser: https://github.com/bkryza/clang-uml +Vcs-Git: https://github.com/bkryza/clang-uml.git +Homepage: https://github.com/bkryza/clang-uml + +Package: clang-uml +Architecture: any +Section: utils +Depends: ${misc:Depends}, ${shlibs:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Automatic C++ UML diagram generator based on Clang. + . + This package provides the clang-uml binary. diff --git a/packaging/debian/control.jammy b/packaging/debian/control.jammy new file mode 100644 index 00000000..cf35fe46 --- /dev/null +++ b/packaging/debian/control.jammy @@ -0,0 +1,18 @@ +Source: clang-uml +Maintainer: Bartek Kryza +Section: devel +Priority: optional +Build-Depends: debhelper, make, gcc-12, g++-12, cmake, libyaml-cpp-dev, clang-14, libclang-14-dev, libclang-cpp14-dev +Standards-Version: 4.3.0 +Vcs-Browser: https://github.com/bkryza/clang-uml +Vcs-Git: https://github.com/bkryza/clang-uml.git +Homepage: https://github.com/bkryza/clang-uml + +Package: clang-uml +Architecture: any +Section: utils +Depends: ${misc:Depends}, ${shlibs:Depends} +Pre-Depends: ${misc:Pre-Depends} +Description: Automatic C++ UML diagram generator based on Clang. + . + This package provides the clang-uml binary. From 4d7d8055d638149d36048c30a70c006ff08f9b2d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 13:17:34 +0200 Subject: [PATCH 15/34] Updated debian control files --- CMakeLists.txt | 2 ++ packaging/debian/changelog | 2 +- packaging/debian/control.bionic | 2 +- packaging/debian/control.focal | 2 +- packaging/debian/control.jammy | 2 +- packaging/debian/rules | 1 - 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 292e9c65..8abb2a13 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,8 @@ if(LLVM_CONFIG_PATH) set(LLVM_CONFIG_BINARY ${LLVM_CONFIG_PATH}) endif(LLVM_CONFIG_PATH) +find_package(Threads REQUIRED) + message(STATUS "Checking for yaml-cpp...") find_package(yaml-cpp REQUIRED) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index d13b69e1..a8ec7ad3 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,4 +1,4 @@ -clang-uml ({{VERSION}}-0{{OS}}{{REBUILD}}~{{DISTRIBUTION}}) {{DISTRIBUTION}}; urgency=low +clang-uml ({{VERSION}}-0{{OS}}{{REBUILD}}ppa1~{{DISTRIBUTION}}1) {{DISTRIBUTION}}; urgency=low * Initial release diff --git a/packaging/debian/control.bionic b/packaging/debian/control.bionic index 63aa8d3b..436d762f 100644 --- a/packaging/debian/control.bionic +++ b/packaging/debian/control.bionic @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-8, g++-8, cmake, libyaml-cpp-dev, clang-10, libclang-10-dev, libclang-cpp10-dev +Build-Depends: debhelper, make, gcc-8, g++-8, cmake (>= 3.10), libyaml-cpp-dev, clang-10, libclang-10-dev, libclang-cpp10-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git diff --git a/packaging/debian/control.focal b/packaging/debian/control.focal index aaf0af76..36d82ad6 100644 --- a/packaging/debian/control.focal +++ b/packaging/debian/control.focal @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-10, g++-10, cmake, libyaml-cpp-dev, clang-12, libclang-12-dev, libclang-cpp12-dev +Build-Depends: debhelper, make, gcc-10, g++-10, cmake (>= 3.10), libyaml-cpp-dev, clang-12, libclang-12-dev, libclang-cpp12-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git diff --git a/packaging/debian/control.jammy b/packaging/debian/control.jammy index cf35fe46..1efcb688 100644 --- a/packaging/debian/control.jammy +++ b/packaging/debian/control.jammy @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-12, g++-12, cmake, libyaml-cpp-dev, clang-14, libclang-14-dev, libclang-cpp14-dev +Build-Depends: debhelper, make, gcc-12, g++-12, cmake (>= 3.10), libyaml-cpp-dev, clang-14, libclang-14-dev, libclang-cpp14-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git diff --git a/packaging/debian/rules b/packaging/debian/rules index 29280a77..785bf144 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -3,7 +3,6 @@ export DH_VERBOSE=1 export CLANGUML_GIT_TOPLEVEL_DIR=$(CURDIR) - override_dh_auto_configure: dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr From dde96abe454297d91f3721fc2006e4a24f2e8e14 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 13:21:39 +0200 Subject: [PATCH 16/34] Updated debian control files --- packaging/debian/rules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/rules b/packaging/debian/rules index 785bf144..758e58b2 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -4,7 +4,7 @@ export DH_VERBOSE=1 export CLANGUML_GIT_TOPLEVEL_DIR=$(CURDIR) override_dh_auto_configure: - dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr + dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_REQUIRED_LIBRARIES="pthread" %: From c6ca403f2f85df1fede372f8696218755bdc7259 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 15:19:42 +0200 Subject: [PATCH 17/34] Fix compilation on GCC 9 --- packaging/debian/control.bionic | 18 ------------------ src/common/model/path.h | 4 ++-- 2 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 packaging/debian/control.bionic diff --git a/packaging/debian/control.bionic b/packaging/debian/control.bionic deleted file mode 100644 index 436d762f..00000000 --- a/packaging/debian/control.bionic +++ /dev/null @@ -1,18 +0,0 @@ -Source: clang-uml -Maintainer: Bartek Kryza -Section: devel -Priority: optional -Build-Depends: debhelper, make, gcc-8, g++-8, cmake (>= 3.10), libyaml-cpp-dev, clang-10, libclang-10-dev, libclang-cpp10-dev -Standards-Version: 4.3.0 -Vcs-Browser: https://github.com/bkryza/clang-uml -Vcs-Git: https://github.com/bkryza/clang-uml.git -Homepage: https://github.com/bkryza/clang-uml - -Package: clang-uml -Architecture: any -Section: utils -Depends: ${misc:Depends}, ${shlibs:Depends} -Pre-Depends: ${misc:Pre-Depends} -Description: Automatic C++ UML diagram generator based on Clang. - . - This package provides the clang-uml binary. diff --git a/src/common/model/path.h b/src/common/model/path.h index 44571bb3..c447f384 100644 --- a/src/common/model/path.h +++ b/src/common/model/path.h @@ -41,11 +41,11 @@ public: path(const path &right) { path_ = right.path_; } - path &operator=(const path &right) noexcept = default; + path &operator=(const path &right) = default; path(path &&right) noexcept = default; - path &operator=(path &&right) noexcept = default; + path &operator=(path &&right) = default; path(std::initializer_list ns) { From 3c96ee681cac9400c082839d6c180deb7dfb8c9c Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 16:13:32 +0200 Subject: [PATCH 18/34] Updated debian control files --- packaging/debian/control.focal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/control.focal b/packaging/debian/control.focal index 36d82ad6..59da38a5 100644 --- a/packaging/debian/control.focal +++ b/packaging/debian/control.focal @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-10, g++-10, cmake (>= 3.10), libyaml-cpp-dev, clang-12, libclang-12-dev, libclang-cpp12-dev +Build-Depends: debhelper, make, gcc-10, g++-10, cmake (>= 3.16), libyaml-cpp-dev, llvm-12, clang-12, libclang-12-dev, libclang-cpp12-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git From 491520a946bd2468751c0d938a0c07cc0a4c9a1d Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 16:15:55 +0200 Subject: [PATCH 19/34] Updated debian control files --- packaging/debian/control.jammy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/control.jammy b/packaging/debian/control.jammy index 1efcb688..742228a4 100644 --- a/packaging/debian/control.jammy +++ b/packaging/debian/control.jammy @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-12, g++-12, cmake (>= 3.10), libyaml-cpp-dev, clang-14, libclang-14-dev, libclang-cpp14-dev +Build-Depends: debhelper, make, gcc-12, g++-12, cmake (>= 3.16), libyaml-cpp-dev, llvm-14, clang-14, libclang-14-dev, libclang-cpp14-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git From dc581c26547d2ceb68ac7ff3229683b872d90221 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 16:42:04 +0200 Subject: [PATCH 20/34] Updated debian control files --- packaging/debian/control.focal | 2 +- packaging/debian/control.jammy | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packaging/debian/control.focal b/packaging/debian/control.focal index 59da38a5..0cf376d8 100644 --- a/packaging/debian/control.focal +++ b/packaging/debian/control.focal @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-10, g++-10, cmake (>= 3.16), libyaml-cpp-dev, llvm-12, clang-12, libclang-12-dev, libclang-cpp12-dev +Build-Depends: debhelper, make, gcc-10, g++-10, cmake (>= 3.16), libyaml-cpp-dev, llvm-12, llvm-12-dev, clang-12, libclang-12-dev, libclang-cpp12-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git diff --git a/packaging/debian/control.jammy b/packaging/debian/control.jammy index 742228a4..89ac8adf 100644 --- a/packaging/debian/control.jammy +++ b/packaging/debian/control.jammy @@ -2,7 +2,7 @@ Source: clang-uml Maintainer: Bartek Kryza Section: devel Priority: optional -Build-Depends: debhelper, make, gcc-12, g++-12, cmake (>= 3.16), libyaml-cpp-dev, llvm-14, clang-14, libclang-14-dev, libclang-cpp14-dev +Build-Depends: debhelper, make, gcc-12, g++-12, cmake (>= 3.16), libyaml-cpp-dev, llvm-14, llvm-14-dev, clang-14, libclang-14-dev, libclang-cpp14-dev Standards-Version: 4.3.0 Vcs-Browser: https://github.com/bkryza/clang-uml Vcs-Git: https://github.com/bkryza/clang-uml.git From abba53694ba43b2a9471161ee713f450242cd6c6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 20:35:32 +0200 Subject: [PATCH 21/34] Added explicit threads link dependency --- CMakeLists.txt | 2 +- tests/CMakeLists.txt | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8abb2a13..8fc93008 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,7 +78,7 @@ list(REMOVE_ITEM SOURCES ${MAIN_SOURCE_FILE}) add_library(clang-umllib OBJECT ${SOURCES}) add_executable(clang-uml ${MAIN_SOURCE_FILE}) -target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib) +target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib Threads::Threads) target_compile_features(clang-uml PRIVATE cxx_std_17) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 506fb9fb..81e9ede3 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -73,7 +73,7 @@ target_link_libraries(test_util PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) add_executable(test_model ${CLANG_UML_TEST_MODEL_SRC} @@ -83,7 +83,7 @@ target_link_libraries(test_model PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) add_executable(test_decorator_parser ${CLANG_UML_TEST_DECORATOR_PARSER_SRC} @@ -93,7 +93,7 @@ target_link_libraries(test_decorator_parser PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) add_executable(test_config ${CLANG_UML_TEST_CONFIG_SRC} @@ -103,7 +103,7 @@ target_link_libraries(test_config PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) add_executable(test_filters ${CLANG_UML_TEST_FILTERS_SRC} @@ -113,7 +113,7 @@ target_link_libraries(test_filters PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) add_executable(test_thread_pool_executor ${CLANG_UML_TEST_THREAD_POOL_EXECUTOR_SRC} @@ -123,7 +123,7 @@ target_link_libraries(test_thread_pool_executor PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) add_executable(test_cases ${CLANG_UML_TEST_CASES_SRC} @@ -133,7 +133,7 @@ target_link_libraries(test_cases PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast) + clang-umllib cppast Threads::Threads) foreach(TEST_CASE_CONFIG ${TEST_CASE_CONFIGS}) file(RELATIVE_PATH From 58b7b8a32f516db0838feb017412ca8c15be5327 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 22:37:05 +0200 Subject: [PATCH 22/34] Added explicit threads link dependency --- CMakeLists.txt | 3 ++- tests/CMakeLists.txt | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fc93008..14720ab6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,7 @@ if(LLVM_CONFIG_PATH) set(LLVM_CONFIG_BINARY ${LLVM_CONFIG_PATH}) endif(LLVM_CONFIG_PATH) +#set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) message(STATUS "Checking for yaml-cpp...") @@ -78,7 +79,7 @@ list(REMOVE_ITEM SOURCES ${MAIN_SOURCE_FILE}) add_library(clang-umllib OBJECT ${SOURCES}) add_executable(clang-uml ${MAIN_SOURCE_FILE}) -target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib Threads::Threads) +target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib ${CMAKE_THREAD_LIBS_INIT}) target_compile_features(clang-uml PRIVATE cxx_std_17) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 81e9ede3..e8165f01 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -73,7 +73,7 @@ target_link_libraries(test_util PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) add_executable(test_model ${CLANG_UML_TEST_MODEL_SRC} @@ -83,7 +83,7 @@ target_link_libraries(test_model PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) add_executable(test_decorator_parser ${CLANG_UML_TEST_DECORATOR_PARSER_SRC} @@ -93,7 +93,7 @@ target_link_libraries(test_decorator_parser PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) add_executable(test_config ${CLANG_UML_TEST_CONFIG_SRC} @@ -103,7 +103,7 @@ target_link_libraries(test_config PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) add_executable(test_filters ${CLANG_UML_TEST_FILTERS_SRC} @@ -113,7 +113,7 @@ target_link_libraries(test_filters PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) add_executable(test_thread_pool_executor ${CLANG_UML_TEST_THREAD_POOL_EXECUTOR_SRC} @@ -123,7 +123,7 @@ target_link_libraries(test_thread_pool_executor PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) add_executable(test_cases ${CLANG_UML_TEST_CASES_SRC} @@ -133,7 +133,7 @@ target_link_libraries(test_cases PRIVATE ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} - clang-umllib cppast Threads::Threads) + clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) foreach(TEST_CASE_CONFIG ${TEST_CASE_CONFIGS}) file(RELATIVE_PATH From 0ae98ae2ac4a30674359455c017afbb510ff5628 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 23:03:52 +0200 Subject: [PATCH 23/34] Added explicit threads link dependency --- CMakeLists.txt | 2 +- packaging/debian/rules | 2 +- tests/CMakeLists.txt | 144 ++++++++++------------------------------- 3 files changed, 36 insertions(+), 112 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 14720ab6..e085e1b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -79,7 +79,7 @@ list(REMOVE_ITEM SOURCES ${MAIN_SOURCE_FILE}) add_library(clang-umllib OBJECT ${SOURCES}) add_executable(clang-uml ${MAIN_SOURCE_FILE}) -target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib ${CMAKE_THREAD_LIBS_INIT}) +target_link_libraries(clang-uml ${LIBCLANG_LIBRARIES} ${YAML_CPP_LIBRARIES} cppast clang-umllib Threads::Threads) target_compile_features(clang-uml PRIVATE cxx_std_17) diff --git a/packaging/debian/rules b/packaging/debian/rules index 758e58b2..785bf144 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -4,7 +4,7 @@ export DH_VERBOSE=1 export CLANGUML_GIT_TOPLEVEL_DIR=$(CURDIR) override_dh_auto_configure: - dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_REQUIRED_LIBRARIES="pthread" + dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr %: diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e8165f01..0a9031ed 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -10,130 +10,54 @@ file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc) file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml) file(GLOB_RECURSE TEST_CONFIG_YMLS test_config_data/*.yml) -set(CLANG_UML_TEST_UTIL_SRC - test_util.cc - ${TEST_UTIL_SOURCES} -) -set(CLANG_UML_TEST_UTIL_HEADER - catch.h -) +set(CLANG_UML_TEST_LIBRARIES + ${LIBCLANG_LIBRARIES} + ${YAML_CPP_LIBRARIES} + clang-umllib + cppast + Threads::Threads) -set(CLANG_UML_TEST_MODEL_SRC - test_model.cc - ${TEST_MODEL_SOURCES} - ) -set(CLANG_UML_TEST_MODEL_HEADER - catch.h - ) +set(CLANG_UML_TEST_UTIL_SRC test_util.cc ${TEST_UTIL_SOURCES}) +set(CLANG_UML_TEST_UTIL_HEADER catch.h) -set(CLANG_UML_TEST_CASES_SRC - test_cases.cc - ${TEST_CASE_SOURCES} -) -set(CLANG_UML_TEST_CASES_HEADER - catch.h -) +set(CLANG_UML_TEST_MODEL_SRC test_model.cc ${TEST_MODEL_SOURCES}) +set(CLANG_UML_TEST_MODEL_HEADER catch.h) -set(CLANG_UML_TEST_DECORATOR_PARSER_SRC - test_decorator_parser.cc - ${TEST_UTIL_SOURCES} -) -set(CLANG_UML_TEST_DECORATOR_PARSER_HEADER - catch.h -) +set(CLANG_UML_TEST_CASES_SRC test_cases.cc ${TEST_CASE_SOURCES}) +set(CLANG_UML_TEST_CASES_HEADER catch.h) -set(CLANG_UML_TEST_CONFIG_SRC - test_config.cc - ${TEST_UTIL_SOURCES} - ) -set(CLANG_UML_TEST_CONFIG_HEADER - catch.h - ) +set(CLANG_UML_TEST_DECORATOR_PARSER_SRC test_decorator_parser.cc ${TEST_UTIL_SOURCES}) +set(CLANG_UML_TEST_DECORATOR_PARSER_HEADER catch.h) -set(CLANG_UML_TEST_FILTERS_SRC - test_filters.cc - ${TEST_FILTERS_SOURCES} - ) -set(CLANG_UML_TEST_FILTERS_HEADER - catch.h - ) +set(CLANG_UML_TEST_CONFIG_SRC test_config.cc ${TEST_UTIL_SOURCES}) +set(CLANG_UML_TEST_CONFIG_HEADER catch.h) -set(CLANG_UML_TEST_THREAD_POOL_EXECUTOR_SRC - test_thread_pool_executor.cc - ) -set(CLANG_UML_TEST_THREAD_POOL_EXECUTOR_HEADER - catch.h - ) +set(CLANG_UML_TEST_FILTERS_SRC test_filters.cc ${TEST_FILTERS_SOURCES}) +set(CLANG_UML_TEST_FILTERS_HEADER catch.h) -add_executable(test_util - ${CLANG_UML_TEST_UTIL_SRC} - ${CLANG_UML_TEST_UTIL_HEADER}) +set(CLANG_UML_TEST_THREAD_POOL_EXECUTOR_SRC test_thread_pool_executor.cc) +set(CLANG_UML_TEST_THREAD_POOL_EXECUTOR_HEADER catch.h) -target_link_libraries(test_util - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) +add_executable(test_util ${CLANG_UML_TEST_UTIL_SRC} ${CLANG_UML_TEST_UTIL_HEADER}) +target_link_libraries(test_util PRIVATE ${CLANG_UML_TEST_LIBRARIES}) -add_executable(test_model - ${CLANG_UML_TEST_MODEL_SRC} - ${CLANG_UML_TEST_MODEL_HEADER}) +add_executable(test_model ${CLANG_UML_TEST_MODEL_SRC} ${CLANG_UML_TEST_MODEL_HEADER}) +target_link_libraries(test_model PRIVATE ${CLANG_UML_TEST_LIBRARIES}) -target_link_libraries(test_model - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) +add_executable(test_decorator_parser ${CLANG_UML_TEST_DECORATOR_PARSER_SRC} ${CLANG_UML_TEST_DECORATOR_PARSER_HEADER}) +target_link_libraries(test_decorator_parser PRIVATE ${CLANG_UML_TEST_LIBRARIES}) -add_executable(test_decorator_parser - ${CLANG_UML_TEST_DECORATOR_PARSER_SRC} - ${CLANG_UML_TEST_DECORATOR_PARSER_HEADER}) +add_executable(test_config ${CLANG_UML_TEST_CONFIG_SRC} ${CLANG_UML_TEST_CONFIG_HEADER}) +target_link_libraries(test_config PRIVATE ${CLANG_UML_TEST_LIBRARIES}) -target_link_libraries(test_decorator_parser - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) +add_executable(test_filters ${CLANG_UML_TEST_FILTERS_SRC} ${CLANG_UML_TEST_FILTERS_HEADER}) +target_link_libraries(test_filters PRIVATE ${CLANG_UML_TEST_LIBRARIES}) -add_executable(test_config - ${CLANG_UML_TEST_CONFIG_SRC} - ${CLANG_UML_TEST_CONFIG_HEADER}) +add_executable(test_thread_pool_executor ${CLANG_UML_TEST_THREAD_POOL_EXECUTOR_SRC} ${CLANG_UML_TEST_THREAD_POOL_EXECUTOR_HEADER}) +target_link_libraries(test_thread_pool_executor PRIVATE ${CLANG_UML_TEST_LIBRARIES}) -target_link_libraries(test_config - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) - -add_executable(test_filters - ${CLANG_UML_TEST_FILTERS_SRC} - ${CLANG_UML_TEST_FILTERS_HEADER}) - -target_link_libraries(test_filters - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) - -add_executable(test_thread_pool_executor - ${CLANG_UML_TEST_THREAD_POOL_EXECUTOR_SRC} - ${CLANG_UML_TEST_THREAD_POOL_EXECUTOR_HEADER}) - -target_link_libraries(test_thread_pool_executor - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) - -add_executable(test_cases - ${CLANG_UML_TEST_CASES_SRC} - ${CLANG_UML_TEST_CASES_HEADER}) - -target_link_libraries(test_cases - PRIVATE - ${LIBCLANG_LIBRARIES} - ${YAML_CPP_LIBRARIES} - clang-umllib cppast ${CMAKE_THREAD_LIBS_INIT}) +add_executable(test_cases ${CLANG_UML_TEST_CASES_SRC} ${CLANG_UML_TEST_CASES_HEADER}) +target_link_libraries(test_cases PRIVATE ${CLANG_UML_TEST_LIBRARIES}) foreach(TEST_CASE_CONFIG ${TEST_CASE_CONFIGS}) file(RELATIVE_PATH From 1126f649ebb6e4f61895b684fb5a42c0998778c4 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 23:15:51 +0200 Subject: [PATCH 24/34] Added environment variables required for unit tests --- packaging/debian/rules | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packaging/debian/rules b/packaging/debian/rules index 785bf144..17e4f288 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -2,6 +2,9 @@ export DH_VERBOSE=1 export CLANGUML_GIT_TOPLEVEL_DIR=$(CURDIR) +export CLANGUML_GIT_REVISION={{VERSION}} +export CLANGUML_GIT_BRANCH={{GIT_BRANCH}} +export CLANGUML_GIT_COMMIT={{GIT_COMMIT}} override_dh_auto_configure: dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr From dc769d282a6cbba1473666bdcda9c60e6d5ffc19 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 23:33:27 +0200 Subject: [PATCH 25/34] Updated debian control files --- packaging/debian/changelog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/debian/changelog b/packaging/debian/changelog index a8ec7ad3..0112d0ac 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -1,4 +1,4 @@ -clang-uml ({{VERSION}}-0{{OS}}{{REBUILD}}ppa1~{{DISTRIBUTION}}1) {{DISTRIBUTION}}; urgency=low +clang-uml ({{VERSION}}-0{{OS}}{{REBUILD}}ppa1~{{DISTRIBUTION}}) {{DISTRIBUTION}}; urgency=low * Initial release From 618ee276b4ec1ead5bb93c7d63dd6cabd34b29f6 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Sun, 12 Jun 2022 23:49:47 +0200 Subject: [PATCH 26/34] Updated cppast ref --- thirdparty/cppast | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thirdparty/cppast b/thirdparty/cppast index 8f8b81d6..fec53b1e 160000 --- a/thirdparty/cppast +++ b/thirdparty/cppast @@ -1 +1 @@ -Subproject commit 8f8b81d6eb05122b6e3d33960d6ba9923a55dcbd +Subproject commit fec53b1e99e8c4358811d9d0571e488058620386 From b1a7d3e2f548eee578a103a12dd59e221ce682ed Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Mon, 13 Jun 2022 00:19:18 +0200 Subject: [PATCH 27/34] Cleaned up packaging makefile --- packaging/Makefile | 39 ++++++++++++++++++++++++++++----------- packaging/README.md | 8 ++------ 2 files changed, 30 insertions(+), 17 deletions(-) diff --git a/packaging/Makefile b/packaging/Makefile index e8269f6e..2b410152 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -33,6 +33,7 @@ build_dir = _BUILD/$(OS)/$(DIST) VERSION ?= $(shell git describe --tags --always --abbrev=7) COMMIT ?= $(shell git rev-parse HEAD) BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) +SOURCE_ARCHIVE ?= $(NAME)-$(VERSION).tar.$(TAR_EXT) # # Replace mustache template variable in all files in directory recursively, @@ -47,16 +48,27 @@ define subst_conda_meta_yaml find $(3) -name meta.yaml -exec sed -i "s/{{$(1)}}/$(2)/g" {} \; endef -deb: + + +_BUILD/$(SOURCE_ARCHIVE): + echo "############################" + echo "Creating source archive from latest commit $(COMMIT) - $(SOURCE_ARCHIVE)" + echo "############################" + mkdir -p $(build_dir) + git-archive-all --prefix=$(NAME)-$(VERSION)/ _BUILD/$(SOURCE_ARCHIVE) + +deb: _BUILD/$(SOURCE_ARCHIVE) + echo "############################" + echo "Creating deb source package for $(OS) $(DIST)" + echo "Creating directory: ", $(build_dir)/$(NAME)-$(VERSION) + echo "Extracting source archive..." + echo "############################" rm -rf $(build_dir) mkdir -p $(build_dir) - git-archive-all --prefix=clang-uml-$(VERSION)/ $(build_dir)/clang-uml-$(VERSION).tar.$(TAR_EXT) + cp _BUILD/$(SOURCE_ARCHIVE) $(build_dir) cd $(build_dir) - echo "Creating archive from current source" - echo "Creating directory: ", $(NAME)-$(VERSION) - mkdir $(NAME)-$(VERSION) - echo "Extracting source archive..." - tar xf $(NAME)-$(VERSION).tar.$(TAR_EXT) -C $(NAME)-$(VERSION) --strip-components 1 + mkdir -p $(NAME)-$(VERSION) + tar xf $(SOURCE_ARCHIVE) -C $(NAME)-$(VERSION) --strip-components 1 cp -R ../../../debian $(NAME)-$(VERSION)/debian cd $(NAME)-$(VERSION) $(call subst_template_dir,DATETIME,$(shell date -R),debian) @@ -67,16 +79,21 @@ deb: $(call subst_template_dir,DISTRIBUTION,${DIST},debian) $(call subst_template_dir,MAINTAINER_NAME,${MAINTAINER_NAME},debian) $(call subst_template_dir,MAINTAINER_EMAIL,${MAINTAINER_EMAIL},debian) + $(call subst_template_dir,GIT_COMMIT,${COMMIT},debian) + $(call subst_template_dir,GIT_BRANCH,${BRANCH},debian) mk-origtargz ../$(NAME)-$(VERSION).tar.$(TAR_EXT) cp debian/control.$(DIST) debian/control # BUILD SOURCE PACKAGE FOR LAUNCHPAD - debuild -S -sa -us -d -k$(GPG_KEY) #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession + debuild -S -sa -us -d -k$(GPG_KEY) # BUILD LOCALLY BINARY PACKAGE - #debuild -us -uc #--source-option=--include-binaries --source-option=--include-removal --source-option=-isession + # debuild -us -uc -conda: +conda: _BUILD/$(SOURCE_ARCHIVE) + echo "############################" + echo "Creating conda archive from source file $(SOURCE_ARCHIVE)" + echo "############################" mkdir -p _BUILD/conda - git-archive-all --prefix=clang-uml-$(VERSION)/ _BUILD/conda/clang-uml-$(VERSION).tar.$(TAR_EXT) + cp $(SOURCE_ARCHIVE) _BUILD/conda/ cp conda/meta.yaml.in conda/meta.yaml $(call subst_conda_meta_yaml,PKG_VERSION,${VERSION},conda) $(call subst_conda_meta_yaml,PKG_SOURCE,..\/_BUILD\/conda\/clang-uml-$(VERSION).tar.$(TAR_EXT),conda) diff --git a/packaging/README.md b/packaging/README.md index 8d2adf74..12da4597 100644 --- a/packaging/README.md +++ b/packaging/README.md @@ -7,12 +7,8 @@ ```bash cd packaging -make DIST=bionic REBUILD=1 deb -make DIST=focal REBUILD=1 deb -make DIST=jammy REBUILD=1 deb - -cd _BUILD/ubuntu/bionic -dput ppa:bkryza/clang-uml *.changes +make DIST=focal deb +make DIST=jammy deb cd _BUILD/ubuntu/focal dput ppa:bkryza/clang-uml *.changes From c8f78f6aad6fc849f2e740867865c3d9d896fcca Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 10:14:30 +0200 Subject: [PATCH 28/34] Update conda build rule --- packaging/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packaging/Makefile b/packaging/Makefile index 2b410152..b6b319e6 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -92,11 +92,13 @@ conda: _BUILD/$(SOURCE_ARCHIVE) echo "############################" echo "Creating conda archive from source file $(SOURCE_ARCHIVE)" echo "############################" + conda config --add channels conda-forge + conda config --set channel_priority strict mkdir -p _BUILD/conda cp $(SOURCE_ARCHIVE) _BUILD/conda/ cp conda/meta.yaml.in conda/meta.yaml $(call subst_conda_meta_yaml,PKG_VERSION,${VERSION},conda) - $(call subst_conda_meta_yaml,PKG_SOURCE,..\/_BUILD\/conda\/clang-uml-$(VERSION).tar.$(TAR_EXT),conda) + $(call subst_conda_meta_yaml,PKG_SOURCE,..\/_BUILD\/clang-uml-$(VERSION).tar.$(TAR_EXT),conda) $(call subst_conda_meta_yaml,GIT_COMMIT,${COMMIT},conda) $(call subst_conda_meta_yaml,GIT_BRANCH,${BRANCH},conda) conda build conda From 9e2a1284cb7fd2e358c1f18b025ade3cf4814792 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 11:02:38 +0200 Subject: [PATCH 29/34] Updated minimum cmake version --- CMakeLists.txt | 2 +- tests/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e085e1b4..d7263cda 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.12) project(clang-uml) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 0a9031ed..b1783520 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.12) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) From 527aa72b628665ee4c4a0881176f7573933fab47 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 20:13:35 +0200 Subject: [PATCH 30/34] Updated test compiler flags --- tests/CMakeLists.txt | 4 +++- tests/test_cases.cc | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index b1783520..4c02f600 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,7 +4,9 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_FLAGS "-std=c++17 ${LIBCLANG_CXXFLAGS}") +set(TEST_DISABLE_WARNINGS "-Wno-unused-parameter -Wno-unused-variable -Wno-attributes") + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${LIBCLANG_CXXFLAGS} ${TEST_DISABLE_WARNINGS}") file(GLOB_RECURSE TEST_CASE_SOURCES t*/*.cc) file(GLOB_RECURSE TEST_CASE_CONFIGS t*/.clang-uml) diff --git a/tests/test_cases.cc b/tests/test_cases.cc index 02683907..6abba504 100644 --- a/tests/test_cases.cc +++ b/tests/test_cases.cc @@ -55,7 +55,7 @@ generate_sequence_diagram(cppast::libclang_compilation_database &db, diagram_config, diagram_visitor>(db, diagram->name, dynamic_cast(*diagram)); - return std::move(model); + return model; } std::unique_ptr generate_class_diagram( @@ -73,7 +73,7 @@ std::unique_ptr generate_class_diagram( diagram_config, diagram_visitor>( db, diagram->name, dynamic_cast(*diagram)); - return std::move(model); + return model; } std::unique_ptr From ff50df5bc48cb8adf2dfe8ce00de41e03bdb48cd Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 21:49:47 +0200 Subject: [PATCH 31/34] Updated debian rules --- CMakeLists.txt | 1 + README.md | 1 + packaging/debian/rules | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d7263cda..7eb2b75d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,7 @@ set(CLANG_UML_INSTALL_BIN_DIR ${PROJECT_SOURCE_DIR}/bin) set(UML_HEADERS_DIR ${PROJECT_SOURCE_DIR}/src/uml) option(LLVM_CONFIG_PATH "Path to custom llvm-config executable") + option(GIT_VERSION "clang-uml version" "0.1.0") if(LLVM_CONFIG_PATH) diff --git a/README.md b/README.md index 2cc2b802..bc8f7bf2 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Build status](https://github.com/bkryza/clang-uml/actions/workflows/build.yml/badge.svg)](https://github.com/bkryza/clang-uml/actions) [![Coverage](https://codecov.io/gh/bkryza/clang-uml/branch/master/graph/badge.svg)](https://codecov.io/gh/bkryza/clang-uml) +[![Version](https://img.shields.io/badge/version-0.1.0-blue)](https://github.com/bkryza/clang-uml/releases) `clang-uml` is an automatic C++ to [PlantUML](https://plantuml.com) class, sequence and package diagram generator, driven by YAML configuration files. The main idea behind the diff --git a/packaging/debian/rules b/packaging/debian/rules index 17e4f288..99626ef6 100755 --- a/packaging/debian/rules +++ b/packaging/debian/rules @@ -7,7 +7,7 @@ export CLANGUML_GIT_BRANCH={{GIT_BRANCH}} export CLANGUML_GIT_COMMIT={{GIT_COMMIT}} override_dh_auto_configure: - dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr + dh_auto_configure --buildsystem=cmake -- -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=/usr -DGIT_VERSION={{VERSION}} %: From e88286db9249e3f519f2cc56004584b20f689ea2 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 22:21:30 +0200 Subject: [PATCH 32/34] Updated conda make rule --- packaging/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packaging/Makefile b/packaging/Makefile index b6b319e6..a59d6c91 100644 --- a/packaging/Makefile +++ b/packaging/Makefile @@ -34,6 +34,7 @@ VERSION ?= $(shell git describe --tags --always --abbrev=7) COMMIT ?= $(shell git rev-parse HEAD) BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD) SOURCE_ARCHIVE ?= $(NAME)-$(VERSION).tar.$(TAR_EXT) +CONDA_TOKEN ?= # # Replace mustache template variable in all files in directory recursively, @@ -95,10 +96,10 @@ conda: _BUILD/$(SOURCE_ARCHIVE) conda config --add channels conda-forge conda config --set channel_priority strict mkdir -p _BUILD/conda - cp $(SOURCE_ARCHIVE) _BUILD/conda/ + cp _BUILD/$(SOURCE_ARCHIVE) _BUILD/conda/ cp conda/meta.yaml.in conda/meta.yaml $(call subst_conda_meta_yaml,PKG_VERSION,${VERSION},conda) $(call subst_conda_meta_yaml,PKG_SOURCE,..\/_BUILD\/clang-uml-$(VERSION).tar.$(TAR_EXT),conda) $(call subst_conda_meta_yaml,GIT_COMMIT,${COMMIT},conda) $(call subst_conda_meta_yaml,GIT_BRANCH,${BRANCH},conda) - conda build conda + conda build --user bkryza --token $(CONDA_TOKEN) conda From d312579e8a2b81946d4979b3110844fa2fb611be Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 22:36:18 +0200 Subject: [PATCH 33/34] Updated conda spec --- packaging/conda/meta.yaml.in | 1 + 1 file changed, 1 insertion(+) diff --git a/packaging/conda/meta.yaml.in b/packaging/conda/meta.yaml.in index ed65b924..4c890470 100644 --- a/packaging/conda/meta.yaml.in +++ b/packaging/conda/meta.yaml.in @@ -12,6 +12,7 @@ build: binary_relocation: true script_env: - PKG_VERSION + - GIT_VERSION={{PKG_VERSION}} - CLANGUML_GIT_REVISION={{PKG_VERSION}} - CLANGUML_GIT_BRANCH={{GIT_BRANCH}} - CLANGUML_GIT_COMMIT={{GIT_COMMIT}} From bba8c74c4ea885fc78d0f024c6bf32c0b2953408 Mon Sep 17 00:00:00 2001 From: Bartek Kryza Date: Tue, 14 Jun 2022 23:30:40 +0200 Subject: [PATCH 34/34] Updated installation instructions for Ubuntu and Conda --- README.md | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index bc8f7bf2..ce9a1c15 100644 --- a/README.md +++ b/README.md @@ -35,17 +35,34 @@ To see what `clang-uml` can do so far, checkout the diagrams generated for unit ## Installation +### Distribution packages + +#### Ubuntu +```bash +sudo add-apt-repository ppa:bkryza/clang-uml +sudo apt update +sudo apt install clang-uml +``` + +#### Conda +```bash +conda config --add channels conda-forge +conda config --set channel_priority strict +conda install -c bkryza/label/clang-uml clang-uml +``` + ### Building from source -Currently, the only method to install `clang-uml` is from source. First make sure -that you have the following dependencies installed: +First make sure that you have the following dependencies installed: ```bash -# Ubuntu +# Ubuntu (clang version will vary depending on Ubuntu version) apt install ccache cmake libyaml-cpp-dev clang-12 libclang-12-dev libclang-cpp12-dev # macos brew install ccache cmake llvm yaml-cpp ``` +> Please note that on macos this tool is not fully functional, i.e. several test cases fail. The build instructions are +> provided for development purposes only. Then proceed with building the sources: