Skip to content

Commit

Permalink
feat: Enable ccache automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
ponces committed Oct 19, 2023
1 parent d4a998a commit a6f324a
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 119be39107fb04ddf020e7b4030c97ef62ff2180 Mon Sep 17 00:00:00 2001
From: Victor Bo <bvoid@yandex.ru>
Date: Sat, 14 Dec 2019 23:46:34 +0200
Subject: [PATCH 1/2] Remove su from vanilla builds
Subject: [PATCH 1/3] Remove su from vanilla builds

---
target/product/base_system.mk | 1 -
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 80d8ecd1ef65a94d98aa4c30f1dee93c3e749ac8 Mon Sep 17 00:00:00 2001
From: Iceows <mounierr07@gmail.com>
Date: Tue, 12 Jul 2022 10:40:14 +0200
Subject: [PATCH 2/2] Build with release keys
Subject: [PATCH 2/3] Build with release keys

Build with release keys instead of test-keys
---
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
From 57cb5ea561e40950f346c2f3e26d21ba620f56c3 Mon Sep 17 00:00:00 2001
From: ganeshi4u <ganeshvarmai4u@gmail.com>
Date: Fri, 6 Sep 2019 18:31:15 +0200
Subject: [PATCH 3/3] Automatically set CCACHE_EXEC to the system's ccache

* Check for ccache tool and set its path in CCACHE_EXEC if it hasn't been set already

* Enable ccache and compression by default

Change-Id: Ife9d0a723cb90b89392ee288ebe6e7e9f2be7eef
---
envsetup.sh | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/envsetup.sh b/envsetup.sh
index 905635c890..d7b785a042 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -2085,3 +2085,18 @@ set_global_paths
source_vendorsetup
addcompletions

+# check and set ccache path on envsetup
+if [ -z ${CCACHE_EXEC} ]; then
+ ccache_path=$(which ccache)
+ if [ ! -z "$ccache_path" ]; then
+ export USE_CCACHE=1
+ export CCACHE_EXEC="$ccache_path"
+ if [ -z ${CCACHE_DIR} ]; then
+ export CCACHE_DIR=${HOME}/.ccache
+ fi
+ $ccache_path -o compression=true
+ echo -e "ccache enabled and CCACHE_EXEC has been set to : $ccache_path"
+ else
+ echo -e "ccache not found installed!"
+ fi
+fi
--
2.34.1

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
From a965fe2c8adea0b20b210816aaadbfd58f405d37 Mon Sep 17 00:00:00 2001
From: daniml3 <danimoral1001@gmail.com>
Date: Mon, 11 Oct 2021 14:12:34 +0200
Subject: [PATCH] sandbox_linux: set CCACHE_DIR as a writable path

fixes Read-only dir issue when using ccache

Signed-off-by: daniml3 <danimoral1001@gmail.com>
Change-Id: I99afe644c8ee0e0b881c1643fef0cb31b83bcd17
---
ui/build/sandbox_linux.go | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index edb3b66d4..386dc552e 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -228,6 +228,10 @@ func (c *Cmd) wrapSandbox() {
sandboxArgs = append(sandboxArgs, "-N")
}

+ if ccacheDir := os.Getenv("CCACHE_DIR"); ccacheDir != "" {
+ sandboxArgs = append(sandboxArgs, "-B", ccacheDir)
+ }
+
// Stop nsjail from parsing arguments
sandboxArgs = append(sandboxArgs, "--")

--
2.34.1

0 comments on commit a6f324a

Please sign in to comment.