From b3e40942f83eb943ecdccc23872c0518cad935d8 Mon Sep 17 00:00:00 2001 From: oguzkaganozt Date: Fri, 29 Mar 2024 16:46:57 +0300 Subject: [PATCH] fix(ccache): enable ccache on bare-metal setups (#4566) * . Signed-off-by: Oguz Ozturk * fix ccache usage in docker build Signed-off-by: oguzkaganozt * . Signed-off-by: oguzkaganozt * change ccache directory Signed-off-by: oguzkaganozt * . Signed-off-by: oguzkaganozt * . Signed-off-by: Oguz Ozturk --------- Signed-off-by: Oguz Ozturk Signed-off-by: oguzkaganozt --- ansible/roles/build_tools/tasks/main.yaml | 14 +++++++++++++- docker/autoware-openadk/Dockerfile | 5 ++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ansible/roles/build_tools/tasks/main.yaml b/ansible/roles/build_tools/tasks/main.yaml index 91f8718a039..836501f6a94 100644 --- a/ansible/roles/build_tools/tasks/main.yaml +++ b/ansible/roles/build_tools/tasks/main.yaml @@ -8,7 +8,7 @@ - name: Add CCACHE_DIR to .bashrc ansible.builtin.lineinfile: dest: ~/.bashrc - line: export CCACHE_DIR="/ccache" + line: export CCACHE_DIR="/var/tmp/ccache" state: present create: true mode: 0644 @@ -28,3 +28,15 @@ state: present create: true mode: 0644 + +- name: Create ccache directory + ansible.builtin.file: + path: /var/tmp/ccache + state: directory + mode: 0755 + +- name: Source .bashrc + ansible.builtin.shell: source ~/.bashrc + args: + executable: /bin/bash + changed_when: false diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index 7b8919b20b9..3a2a7095ce8 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -45,6 +45,9 @@ SHELL ["/bin/bash", "-o", "pipefail", "-c"] ARG ROS_DISTRO ARG SETUP_ARGS ARG ROS_DISTRO +ENV CCACHE_DIR="/var/tmp/ccache" +ENV CC="/usr/lib/ccache/gcc" +ENV CXX="/usr/lib/ccache/g++" # Set up development environment RUN --mount=type=ssh \ @@ -71,7 +74,7 @@ RUN --mount=type=ssh \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ && find /autoware/install -type d -exec chmod 777 {} \; \ - && chmod -R 777 /ccache \ + && chmod -R 777 /var/tmp/ccache \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache \ && rm -rf /autoware/build /autoware/src