Skip to content

Commit

Permalink
Merge pull request #331 from bkryza/add-dockerfile-for-build-environment
Browse files Browse the repository at this point in the history
Add dockerfile for build environment
  • Loading branch information
bkryza authored Nov 2, 2024
2 parents daf1b3b + f7f1880 commit 93ffcc8
Show file tree
Hide file tree
Showing 381 changed files with 10,179 additions and 8,815 deletions.
8 changes: 8 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Checks: >-
-bugprone-exception-escape,
-bugprone-easily-swappable-parameters,
-bugprone-empty-catch,
-bugprone-incorrect-enable-if,
-bugprone-crtp-constructor-accessibility,
-bugprone-unused-local-non-trivial-variable,
-clang-analyzer-alpha.*,
-clang-analyzer-core.StackAddressEscape,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
Expand Down Expand Up @@ -44,22 +47,27 @@ Checks: >-
-misc-non-private-member-variables-in-classes,
-misc-const-correctness,
-misc-include-cleaner,
-misc-use-internal-linkage,
-modernize-use-nodiscard,
-modernize-use-trailing-return-type,
-modernize-concat-nested-namespaces,
-mpi*,
-objc*,
-openmp*,
-performance-unnecessary-value-param,
-performance-enum-size,
-readability-inconsistent-declaration-parameter-name,
-readability-identifier-length,
-readability-identifier-naming,
-readability-redundant-smartptr-get,
-readability-redundant-member-init,
-readability-convert-member-functions-to-static,
-readability-function-cognitive-complexity,
-readability-const-return-type,
-readability-simplify-boolean-expr,
-readability-make-member-function-const,
-readability-redundant-casting,
-readability-avoid-return-with-void-value,
-darwin*,
-zircon*
WarningsAsErrors: '*'
Expand Down
38 changes: 30 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ else
NUMPROC ?= 1
endif

BUILDER_IMAGE ?= bkryza/clang-uml-builder:v1
LLVM_VERSION ?=
LLVM_CONFIG_PATH ?=
LLVM_SHARED ?= ON
Expand Down Expand Up @@ -122,10 +123,6 @@ debug: debug/CMakeLists.txt
echo "Using ${NUMPROC} cores"
cmake --build debug -j$(NUMPROC)

debug_tidy: debug_tidy/CMakeLists.txt
echo "Using ${NUMPROC} cores"
cmake --build debug_tidy -j$(NUMPROC)

release: release/CMakeLists.txt
cmake --build release -j$(NUMPROC)

Expand Down Expand Up @@ -189,8 +186,8 @@ format:
docker run --rm -v $(CURDIR):/root/sources bkryza/clang-format-check:1.5

.PHONY: debug_tidy
tidy: debug_tidy
run-clang-tidy-17 -extra-arg=-Wno-unknown-warning-option -j $(NUMPROC) -p debug_tidy ./src
tidy: debug
run-clang-tidy-17 -extra-arg=-Wno-unknown-warning-option -j $(NUMPROC) -p debug "./clang-uml/src"

.PHONY: check-formatting
check-formatting:
Expand Down Expand Up @@ -225,7 +222,32 @@ fedora/%:
venv:
test -d venv || virtualenv -p /usr/bin/python3 venv;. venv/bin/activate; pip install -Ur dev-requirements.txt


.PHONY: cmake-format
cmake-format:
cmake-format -i CMakeLists.txt src/CMakeLists.txt tests/CMakeLists.txt
cmake-format -i CMakeLists.txt src/CMakeLists.txt tests/CMakeLists.txt

#
# This target allows to run other targets (e.g. make test_diagrams) in a dedicated
# preconfigured Docker image, e.g.:
#
# NUMPROC=8 ENABLE_CXX_MODULES_TEST_CASES=ON ENABLE_CUDA_TEST_CASES=ON ENABLE_CXX_MODULES_TEST_CASES=ON docker/test
#
# It requires a Docker volume called clanguml_ccache for ccache cache directory.
# The current user running this Docker image should have default Ubuntu UID=1000 and GID=1000,
# or permission issues may occur.
#
.PHONY: docker/%
docker/%:
docker run --rm -v /var/cache/ccache:/var/cache/ccache \
-v clanguml_ccache:/ccache \
-v ${PWD}:${PWD} -w ${PWD} -u 1000:1000 \
--entrypoint /usr/bin/make \
-it $(BUILDER_IMAGE) \
CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 \
LLVM_VERSION=18 \
NUMPROC=$(NUMPROC) \
ENABLE_CXX_MODULES_TEST_CASES=$(ENABLE_CXX_MODULES_TEST_CASES) \
ENABLE_OBJECTIVE_C_TEST_CASES=$(ENABLE_OBJECTIVE_C_TEST_CASES) \
ENABLE_CUDA_TEST_CASES=$(ENABLE_CUDA_TEST_CASES) \
CMAKE_GENERATOR=$(CMAKE_GENERATOR) \
$*
90 changes: 90 additions & 0 deletions docker/Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
FROM ubuntu:24.04
LABEL org.opencontainers.image.authors="[email protected]"

ENV DEBIAN_FRONTEND noninteractive

#
# Install basic software
#
RUN apt update && \
apt -y install wget software-properties-common git make grcov ninja-build \
pkg-config gcc g++ ccache cmake libyaml-cpp-dev gnustep-make plantuml \
gnustep-back-common libgnustep-base-dev nodejs npm

#
# Install LLVM 18 & 19
#
RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add - && \
add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-17 main" && \
add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-18 main" && \
add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-19 main" && \
apt update && \
apt -y install llvm-17 clang-17 libclang-17-dev libclang-cpp17-dev clang-tools-17 clang-format-17 clang-tidy-17 \
llvm-18 clang-18 libclang-18-dev libclang-cpp18-dev clang-tools-18 clang-format-18 clang-tidy-18 \
llvm-19 clang-19 libclang-19-dev libclang-cpp19-dev clang-tools-19 clang-format-19 clang-tidy-19 \
lcov zlib1g-dev libunwind-dev libdw-dev
#
# Install libobjc2
#
RUN git clone https://github.com/gnustep/libobjc2 && \
cd libobjc2 && \
CC=/usr/bin/clang-18 CXX=/usr/bin/clang++-18 cmake -B_build -S. && \
cd _build && \
make -j12 && \
make install && \
cd ../.. && \
rm -rf libobjc2

#
# Install CUDA
#
RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2404/x86_64/cuda-keyring_1.1-1_all.deb && \
dpkg -i cuda-keyring_1.1-1_all.deb && \
apt-get update && \
apt-get -y install cuda-toolkit && \
rm cuda-keyring_1.1-1_all.deb

RUN apt -y install nvidia-cuda-toolkit

#
# Update PlantUML plantuml.jar to 2024.7
#
RUN wget https://github.com/plantuml/plantuml/releases/download/v1.2024.7/plantuml.jar -O /usr/share/plantuml/plantuml.jar

#
# Install mermaidjs-cli
#
RUN apt -y install && \
npm install -g @mermaid-js/mermaid-cli@10.6.1

ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true

ADD puppeteer-config.json /etc/puppeteer-config.json

RUN apt-get update && apt-get install gnupg wget -y && \
wget --quiet --output-document=- https://dl-ssl.google.com/linux/linux_signing_key.pub | gpg --dearmor > /etc/apt/trusted.gpg.d/google-archive.gpg && \
sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' && \
apt-get update && \
apt-get install google-chrome-stable -y --no-install-recommends && \
rm -rf /var/lib/apt/lists/* && \
rm /etc/apt/sources.list.d/google-chrome.list

#
# Install Python3 dependencies
#
RUN apt update && \
apt -y install python3-pip python3-full python3-jinja2 python3-lxml python3-yaml

#
# Clean up
#
RUN apt clean

ENV CCACHE_DIR /ccache
ENV CCACHE_UMASK 000
RUN mkdir ${CCACHE_DIR} && \
chown ubuntu:ubuntu ${CCACHE_DIR}

USER ubuntu


23 changes: 23 additions & 0 deletions docker/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# docker/Makefile
#
# Copyright (c) 2021-2024 Bartek Kryza <[email protected]>
#
# 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.

.PHONY: builder_docker
builder_docker:
docker build -f Dockerfile.builder -t bkryza/clang-uml-builder:v1 .

.PHONY: builder_cacche_volume
builder_cacche_volume:
docker volume create clanguml_ccache
6 changes: 6 additions & 0 deletions docker/puppeteer-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"executablePath": "/usr/bin/google-chrome",
"args": [
"--no-sandbox"
]
}
2 changes: 2 additions & 0 deletions docs/test_cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
* [t00084](./test_cases/t00084.md) - Objective-C overall use case
* [t00085](./test_cases/t00085.md) - Objective-C test case for various class members and methods
* [t00086](./test_cases/t00086.md) - Objective-C nested structs and enums test case
* [t00087](./test_cases/t00087.md) - Typed element class diagram filter test case
* [t00088](./test_cases/t00088.md) - Typed element Objective-C class diagram filter test case
## Sequence diagrams
* [t20001](./test_cases/t20001.md) - Basic sequence diagram test case
* [t20002](./test_cases/t20002.md) - Free function sequence diagram test case
Expand Down
Loading

0 comments on commit 93ffcc8

Please sign in to comment.