Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 9b527bbc authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Use latest ccache for builds

parent 39e3cf5c
Loading
Loading
Loading
Loading
+10 −10
Original line number Diff line number Diff line
@@ -20,15 +20,7 @@ ENV USER root

# By default we want to use CCACHE, you can disable this
# WARNING: disabling this may slow down a lot your builds!
ENV USE_CCACHE 1

# ccache maximum size. It should be a number followed by an optional suffix: k,
# M, G, T (decimal), Ki, Mi, Gi or Ti (binary). The default suffix is G. Use 0
# for no limit.
ENV CCACHE_SIZE 100G

# We need to specify the ccache binary since it is no longer packaged along with AOSP
ENV CCACHE_EXEC /usr/bin/ccache
ENV USE_CCACHE=1

# Environment for the /e/ branches name
# See https://github.com/LineageOS/android_vendor_cm/branches for possible options
@@ -194,7 +186,7 @@ RUN mkdir -p $USERSCRIPTS_DIR
RUN apt-get -qq update
RUN apt-get -qqy upgrade

RUN apt-get install -y android-sdk-libsparse-utils bc bison bsdmainutils build-essential ccache cgpt clang cron \
RUN apt-get install -y android-sdk-libsparse-utils bc bison bsdmainutils build-essential cgpt clang cron \
      curl flex g++-multilib gcc-multilib git git-crypt git-lfs gnupg gperf imagemagick kmod jq \
      lib32readline-dev lib32z1-dev liblz4-tool \
      libsdl1.2-dev libssl-dev libxml2 \
@@ -202,6 +194,14 @@ RUN apt-get install -y android-sdk-libsparse-utils bc bison bsdmainutils build-e
      procps python3 python-is-python3 rsync schedtool squashfs-tools software-properties-common wget xdelta3 xsltproc xxd yasm \
      zip zlib1g-dev

RUN apt-get install -y \
    cmake \
    pkg-config \
    libzstd-dev \
    libhiredis-dev

RUN /root/install-latest-ccache.sh

# Install Python 2.7 for legacy device support
RUN wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python2.7/python2.7_2.7.18-13ubuntu1_amd64.deb && \
    wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python2.7/libpython2.7-stdlib_2.7.18-13ubuntu1_amd64.deb && \
+10 −10
Original line number Diff line number Diff line
@@ -22,15 +22,7 @@ ENV USER root

# By default we want to use CCACHE, you can disable this
# WARNING: disabling this may slow down a lot your builds!
ENV USE_CCACHE 1

# ccache maximum size. It should be a number followed by an optional suffix: k,
# M, G, T (decimal), Ki, Mi, Gi or Ti (binary). The default suffix is G. Use 0
# for no limit.
ENV CCACHE_SIZE 50G

# We need to specify the ccache binary since it is no longer packaged along with AOSP
ENV CCACHE_EXEC /usr/bin/ccache
ENV USE_CCACHE=1

# Environment for the /e/ branches name
# See https://github.com/LineageOS/android_vendor_cm/branches for possible options
@@ -177,7 +169,7 @@ RUN mkdir -p $USERSCRIPTS_DIR
RUN apt-get -qq update
RUN apt-get -qqy upgrade

RUN apt-get install -y android-sdk-libsparse-utils bc bison bsdmainutils build-essential ccache cgpt clang cron \
RUN apt-get install -y android-sdk-libsparse-utils bc bison bsdmainutils build-essential cgpt clang cron \
      curl flex g++-multilib gcc-multilib git git-lfs gnupg gperf imagemagick kmod jq \
      lib32readline-dev lib32z1-dev liblz4-tool \
      libsdl1.2-dev libssl-dev libxml2 \
@@ -185,6 +177,14 @@ RUN apt-get install -y android-sdk-libsparse-utils bc bison bsdmainutils build-e
      procps python3 python-is-python3 rsync schedtool squashfs-tools software-properties-common wget xdelta3 xsltproc xxd yasm \
      zip zlib1g-dev

RUN apt-get install -y \
    cmake \
    pkg-config \
    libzstd-dev \
    libhiredis-dev

RUN /root/install-latest-ccache.sh

# Install Python 2.7 for legacy device support
RUN wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python2.7/python2.7_2.7.18-13ubuntu1_amd64.deb && \
    wget http://archive.ubuntu.com/ubuntu/pool/universe/p/python2.7/libpython2.7-stdlib_2.7.18-13ubuntu1_amd64.deb && \
+2 −0
Original line number Diff line number Diff line
@@ -24,6 +24,8 @@ repo_log="$LOGS_DIR/repo-$(date +%Y%m%d).log"
nproc_value=$(nproc --all)
JOBS=$((nproc_value > 10 ? 10 : nproc_value))

source /root/init-ccache.sh

# cd to working directory
cd "$SRC_DIR"

+5 −1
Original line number Diff line number Diff line
@@ -83,6 +83,9 @@ exit_script() {
    /root/userscripts/end.sh
  fi

  # Print ccache usage after build
  ccache -s

  if [ "$build_successful" = false ] || [ "$sync_successful" = false ]; then
    exit 1
  fi
@@ -145,8 +148,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then

  mkdir -p "$CCACHE_BASE_DIR/$branch_dir"
  export CCACHE_DIR="$CCACHE_BASE_DIR/$branch_dir"
  source /root/init-ccache.sh

  echo ">> [$(date)] Setting up CCache, CCACHE_DIR=${CCACHE_DIR} CCACHE_SIZE=${CCACHE_SIZE}"
  echo ">> [$(date)] Setting up CCache, CCACHE_DIR=${CCACHE_DIR} CCACHE_SIZE=$(ccache --get-config max_size)"

  echo ">> [$(date)] Branch: ${BRANCH_NAME}"
  echo ">> [$(date)] Device: ${DEVICE}"

src/init-ccache.sh

0 → 100755
+15 −0
Original line number Diff line number Diff line
#!/bin/bash

# Initialize CCache if it will be used
if [ "$USE_CCACHE" = 1 ]; then
  echo ">> [$(date)] Setting up ccache config"
  ccache --set-config=max_size=100G \
    --set-config=compression_level=6
  # Recompress the cache
  ccache --recompress 6
  # Delete not recently used files
  ccache -c
  # Reset stats
  ccache -z
  export PATH="/usr/lib/ccache:$PATH"
fi
Loading