Merge tag 'android-16.0.0_r1' of https://android.googlesource.com/platform/build/soong into HEAD
Android 16.0.0 release 1
Change-Id: Ide1ec574e3f9743d18ee70b928056bb7fe248f80
diff --git a/android/namespace.go b/android/namespace.go
index 9ba5025..d0e90b0 100644
--- a/android/namespace.go
+++ b/android/namespace.go
@@ -156,6 +156,9 @@
return fmt.Errorf("a namespace must be the first module in the file")
}
}
+ if (namespace.exportToKati) {
+ r.rootNamespace.visibleNamespaces = append(r.rootNamespace.visibleNamespaces, namespace)
+ }
r.sortedNamespaces.add(namespace)
r.namespacesByDir.Store(namespace.Path, namespace)
diff --git a/android/paths.go b/android/paths.go
index 6612d37..a254717 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -1314,6 +1314,31 @@
return ret, nil
}
+// pathForSourceRelaxed creates a SourcePath from pathComponents, but does not check that it exists.
+// It differs from pathForSource in that the path is allowed to exist outside of the PathContext.
+func pathForSourceRelaxed(ctx PathContext, pathComponents ...string) (SourcePath, error) {
+ p := filepath.Join(pathComponents...)
+ ret := SourcePath{basePath{p, ""}}
+
+ abs, err := filepath.Abs(ret.String())
+ if err != nil {
+ return ret, err
+ }
+ buildroot, err := filepath.Abs(ctx.Config().outDir)
+ if err != nil {
+ return ret, err
+ }
+ if strings.HasPrefix(abs, buildroot) {
+ return ret, fmt.Errorf("source path %s is in output", abs)
+ }
+
+ if pathtools.IsGlob(ret.String()) {
+ return ret, fmt.Errorf("path may not contain a glob: %s", ret.String())
+ }
+
+ return ret, nil
+}
+
// existsWithDependencies returns true if the path exists, and adds appropriate dependencies to rerun if the
// path does not exist.
func existsWithDependencies(ctx PathGlobContext, path SourcePath) (exists bool, err error) {
@@ -1386,6 +1411,31 @@
return path
}
+// PathForSourceRelaxed joins the provided path components. Unlike PathForSource,
+// the result is allowed to exist outside of the source dir.
+// On error, it will return a usable, but invalid SourcePath, and report a ModuleError.
+func PathForSourceRelaxed(ctx PathContext, pathComponents ...string) SourcePath {
+ path, err := pathForSourceRelaxed(ctx, pathComponents...)
+ if err != nil {
+ reportPathError(ctx, err)
+ }
+
+ if modCtx, ok := ctx.(ModuleMissingDepsPathContext); ok && ctx.Config().AllowMissingDependencies() {
+ exists, err := existsWithDependencies(modCtx, path)
+ if err != nil {
+ reportPathError(ctx, err)
+ }
+ if !exists {
+ modCtx.AddMissingDependencies([]string{path.String()})
+ }
+ } else if exists, _, err := ctx.Config().fs.Exists(path.String()); err != nil {
+ ReportPathErrorf(ctx, "%s: %s", path, err.Error())
+ } else if !exists {
+ ReportPathErrorf(ctx, "source path %s does not exist", path)
+ }
+ return path
+}
+
// ExistentPathForSource returns an OptionalPath with the SourcePath, rooted from SrcDir, *not*
// rooted from the module's local source directory, if the path exists, or an empty OptionalPath if
// it doesn't exist. Dependencies are added so that the ninja file will be regenerated if the state
@@ -2208,7 +2258,7 @@
}
path := filepath.Clean(path)
- if path == ".." || strings.HasPrefix(path, "../") || strings.HasPrefix(path, "/") {
+ if path == ".." || strings.HasPrefix(path, "../") || i != initialEmpty && strings.HasPrefix(path, "/") {
return "", fmt.Errorf("Path is outside directory: %s", path)
}
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 6485cc5..e723abd 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -781,6 +781,13 @@
return fmt.Errorf("Currently LOCAL_PROTOC_FLAGS only support with value '--proto_path=$(LOCAL_PATH)/...'")
}
+func exportCflags(ctx variableAssignmentContext) error {
+ // The Soong replacement for EXPORT_CFLAGS doesn't need the same extra escaped quotes that were present in Make
+ ctx.mkvalue = ctx.mkvalue.Clone()
+ ctx.mkvalue.ReplaceLiteral(`\"`, `"`)
+ return includeVariableNow(bpVariable{"export_cflags", bpparser.ListType}, ctx)
+}
+
func proguardEnabled(ctx variableAssignmentContext) error {
val, err := makeVariableToBlueprint(ctx.file, ctx.mkvalue, bpparser.ListType)
if err != nil {
diff --git a/cc/cc.go b/cc/cc.go
index c616165..3e0444d 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -2938,6 +2938,23 @@
variantNdkLibs := []string{}
variantLateNdkLibs := []string{}
if ctx.Os() == android.Android {
+ rewriteHeaderLibs := func(list []string) (newHeaderLibs []string) {
+ newHeaderLibs = []string{}
+ for _, entry := range list {
+ // Replace device_kernel_headers with generated_kernel_headers
+ // for inline kernel building
+ if entry == "device_kernel_headers" || entry == "qti_kernel_headers" {
+ if (ctx.Config().Getenv("INLINE_KERNEL_BUILDING") == "true") {
+ newHeaderLibs = append(newHeaderLibs, "generated_kernel_headers")
+ continue
+ }
+ }
+ newHeaderLibs = append(newHeaderLibs, entry)
+ }
+ return newHeaderLibs
+ }
+ deps.HeaderLibs = rewriteHeaderLibs(deps.HeaderLibs)
+
deps.SharedLibs, variantNdkLibs = FilterNdkLibs(c, ctx.Config(), deps.SharedLibs)
deps.LateSharedLibs, variantLateNdkLibs = FilterNdkLibs(c, ctx.Config(), deps.LateSharedLibs)
deps.ReexportSharedLibHeaders, _ = FilterNdkLibs(c, ctx.Config(), deps.ReexportSharedLibHeaders)
diff --git a/cc/library.go b/cc/library.go
index 5299771..7b85486 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -203,6 +203,9 @@
// using -isystem for this module and any module that links against this module.
Export_system_include_dirs []string `android:"arch_variant,variant_prepend"`
+ // list of plain cc flags to be used for any module that links against this module.
+ Export_cflags proptools.Configurable[[]string] `android:"arch_variant"`
+
Target struct {
Vendor, Product struct {
// list of exported include directories, like
@@ -327,6 +330,10 @@
f.systemDirs = append(f.systemDirs, android.PathsForModuleSrc(ctx, f.Properties.Export_system_include_dirs)...)
}
+func (f *flagExporter) exportExtraFlags(ctx ModuleContext) {
+ f.flags = append(f.flags, f.Properties.Export_cflags.GetOrDefault(ctx, nil)...)
+}
+
// exportIncludesAsSystem registers the include directories and system include directories to be
// exported transitively both as system include directories to modules depending on this module.
func (f *flagExporter) exportIncludesAsSystem(ctx ModuleContext) {
@@ -1757,6 +1764,7 @@
// Export include paths and flags to be propagated up the tree.
library.exportIncludes(ctx)
+ library.exportExtraFlags(ctx)
library.reexportDirs(deps.ReexportedDirs...)
library.reexportSystemDirs(deps.ReexportedSystemDirs...)
library.reexportFlags(deps.ReexportedFlags...)
diff --git a/etc/install_symlink.go b/etc/install_symlink.go
index aa33445..31da3f6 100644
--- a/etc/install_symlink.go
+++ b/etc/install_symlink.go
@@ -18,6 +18,8 @@
"android/soong/android"
"path/filepath"
"strings"
+
+ "github.com/google/blueprint/proptools"
)
func init() {
@@ -52,7 +54,7 @@
// properties.
Installed_location string
// The target of the symlink, aka where the symlink points.
- Symlink_target string
+ Symlink_target proptools.Configurable[string]
}
type InstallSymlink struct {
@@ -64,7 +66,8 @@
}
func (m *InstallSymlink) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- if filepath.Clean(m.properties.Symlink_target) != m.properties.Symlink_target {
+ symlink_target := m.properties.Symlink_target.GetOrDefault(ctx, "")
+ if filepath.Clean(symlink_target) != symlink_target {
ctx.PropertyErrorf("symlink_target", "Should be a clean filepath")
return
}
@@ -83,7 +86,7 @@
name := filepath.Base(m.properties.Installed_location)
installDir := android.PathForModuleInstall(ctx, filepath.Dir(m.properties.Installed_location))
- m.installedPath = ctx.InstallAbsoluteSymlink(installDir, name, m.properties.Symlink_target)
+ m.installedPath = ctx.InstallAbsoluteSymlink(installDir, name, symlink_target)
}
func (m *InstallSymlink) AndroidMkEntries() []android.AndroidMkEntries {
diff --git a/fsgen/prebuilt_etc_modules_gen.go b/fsgen/prebuilt_etc_modules_gen.go
index c0f114c..b3666a1 100644
--- a/fsgen/prebuilt_etc_modules_gen.go
+++ b/fsgen/prebuilt_etc_modules_gen.go
@@ -197,6 +197,7 @@
"etc": etc.PrebuiltEtcFactory,
"etc/dsp": etc.PrebuiltDSPFactory,
"etc/firmware": etc.PrebuiltFirmwareFactory,
+ "etc/firmware_8475": etc.PrebuiltFirmwareFactory,
"firmware": etc.PrebuiltFirmwareFactory,
"gpu": etc.PrebuiltGPUFactory,
"first_stage_ramdisk": etc.PrebuiltFirstStageRamdiskFactory,
diff --git a/java/aar.go b/java/aar.go
index ebada65..86c6bfa 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -376,7 +376,7 @@
if !hasVersionName {
var versionName string
- if ctx.ModuleName() == "framework-res" {
+ if ctx.ModuleName() == "framework-res" || ctx.ModuleName() == "omnirom-res" {
// Some builds set AppsDefaultVersionName() to include the build number ("O-123456"). aapt2 copies the
// version name of framework-res into app manifests as compileSdkVersionCodename, which confuses things
// if it contains the build number. Use the PlatformVersionName instead.
@@ -402,6 +402,9 @@
if sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.omniromResModule != "" {
+ ctx.AddVariationDependencies(nil, omniromResTag, sdkDep.omniromResModule)
+ }
}
var extractAssetsRule = pctx.AndroidStaticRule("extractAssets",
@@ -891,7 +894,7 @@
sharedResourcesNodeDepSets = append(sharedResourcesNodeDepSets, aarDep.ResourcesNodeDepSet)
sharedLibs = append(sharedLibs, exportPackage)
}
- case frameworkResTag:
+ case frameworkResTag, omniromResTag:
if exportPackage != nil {
sharedLibs = append(sharedLibs, exportPackage)
}
@@ -1255,6 +1258,9 @@
if sdkDep.useModule && sdkDep.frameworkResModule != "" {
ctx.AddVariationDependencies(nil, frameworkResTag, sdkDep.frameworkResModule)
}
+ if sdkDep.useModule && sdkDep.omniromResModule != "" {
+ ctx.AddVariationDependencies(nil, omniromResTag, sdkDep.omniromResModule)
+ }
}
ctx.AddVariationDependencies(nil, libTag, a.properties.Libs...)
diff --git a/java/android_manifest.go b/java/android_manifest.go
index 0c77968..44b12f1 100644
--- a/java/android_manifest.go
+++ b/java/android_manifest.go
@@ -156,7 +156,7 @@
targetSdkVersion := targetSdkVersionForManifestFixer(ctx, params)
if useApiFingerprint, fingerprintTargetSdkVersion, fingerprintDeps :=
- UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" {
+ UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "omnirom-res" {
targetSdkVersion = fingerprintTargetSdkVersion
deps = append(deps, fingerprintDeps)
}
@@ -174,7 +174,7 @@
}
if useApiFingerprint, fingerprintMinSdkVersion, fingerprintDeps :=
- UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" {
+ UseApiFingerprint(ctx); useApiFingerprint && ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "omnirom-res" {
minSdkVersion = fingerprintMinSdkVersion
deps = append(deps, fingerprintDeps)
}
diff --git a/java/androidmk.go b/java/androidmk.go
index c9de7e6..e9b1f64 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -342,7 +342,7 @@
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_DICT", app.dexer.proguardDictionary)
entries.SetOptionalPath("LOCAL_SOONG_PROGUARD_USAGE_ZIP", app.dexer.proguardUsageZip)
- if app.Name() == "framework-res" {
+ if app.Name() == "framework-res" || app.Name() == "omnirom-res" {
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
// Make base_rules.mk not put framework-res in a subdirectory called
// framework_res.
@@ -467,7 +467,7 @@
entries.SetPath("LOCAL_SOONG_AAR", a.aarFile)
}
- if a.Name() == "framework-res" {
+ if a.Name() == "framework-res" || a.Name() == "omnirom-res" {
entries.SetString("LOCAL_MODULE_PATH", "$(TARGET_OUT_JAVA_LIBRARIES)")
// Make base_rules.mk not put framework-res in a subdirectory called
// framework_res.
diff --git a/java/app.go b/java/app.go
index 05b4a96..a3414f6 100644
--- a/java/app.go
+++ b/java/app.go
@@ -744,6 +744,9 @@
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
installDir = "framework"
+ } else if ctx.ModuleName() == "omnirom-res" {
+ // omnirom-res.apk is installed as system/framework/omnirom-res.apk
+ installDir = "framework"
} else if a.Privileged() {
installDir = filepath.Join("priv-app", a.installApkName)
} else {
@@ -769,7 +772,7 @@
var packageResources = a.exportPackage
javaInfo := &JavaInfo{}
- if ctx.ModuleName() != "framework-res" {
+ if ctx.ModuleName() != "framework-res" && ctx.ModuleName() != "omnirom-res" {
if a.dexProperties.resourceShrinkingEnabled(ctx) {
protoFile := android.PathForModuleOut(ctx, packageResources.Base()+".proto.apk")
aapt2Convert(ctx, protoFile, packageResources, "proto")
@@ -959,6 +962,9 @@
if ctx.ModuleName() == "framework-res" {
// framework-res.apk is installed as system/framework/framework-res.apk
a.installDir = android.PathForModuleInstall(ctx, "framework")
+ } else if ctx.ModuleName() == "omnirom-res" {
+ // omnirom-res.apk is installed as system/framework/omnirom-res.apk
+ a.installDir = android.PathForModuleInstall(ctx, "framework")
} else if a.Privileged() {
a.installDir = android.PathForModuleInstall(ctx, "priv-app", a.installApkName)
} else if ctx.InstallInTestcases() {
diff --git a/java/app_test.go b/java/app_test.go
index 5f5f04d..c6b22c7 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -80,8 +80,11 @@
expectedLinkImplicits = append(expectedLinkImplicits, manifestFixer.Output.String())
frameworkRes := result.ModuleForTests(t, "framework-res", "android_common")
+ omniromRes := result.ModuleForTests(t,"omnirom-res", "android_common")
expectedLinkImplicits = append(expectedLinkImplicits,
frameworkRes.Output("package-res.apk").Output.String())
+ expectedLinkImplicits = append(expectedLinkImplicits,
+ omniromRes.Output("package-res.apk").Output.String())
// Test the mapping from input files to compiled output file names
compile := foo.Output(compiledResourceFiles[0])
diff --git a/java/java.go b/java/java.go
index 07e38a1..2e14b82 100644
--- a/java/java.go
+++ b/java/java.go
@@ -571,6 +571,7 @@
bootClasspathTag = dependencyTag{name: "bootclasspath", runtimeLinked: true}
systemModulesTag = dependencyTag{name: "system modules", runtimeLinked: true}
frameworkResTag = dependencyTag{name: "framework-res"}
+ omniromResTag = dependencyTag{name: "omnirom-res"}
kotlinPluginTag = dependencyTag{name: "kotlin-plugin", toolchain: true}
proguardRaiseTag = dependencyTag{name: "proguard-raise"}
certificateTag = dependencyTag{name: "certificate"}
@@ -639,6 +640,7 @@
java9Classpath []string
frameworkResModule string
+ omniromResModule string
jars android.Paths
aidl android.OptionalPath
@@ -682,6 +684,10 @@
if sdkDep.systemModules != "" {
ctx.AddVariationDependencies(nil, systemModulesTag, sdkDep.systemModules)
}
+
+ if ctx.ModuleName() == "omnirom-res" {
+ ctx.AddVariationDependencies(nil, frameworkResTag, "framework-res")
+ }
}
type deps struct {
diff --git a/java/sdk.go b/java/sdk.go
index 73262da..1dbea3b 100644
--- a/java/sdk.go
+++ b/java/sdk.go
@@ -166,6 +166,7 @@
systemModules: systemModules,
java9Classpath: []string{module},
frameworkResModule: "framework-res",
+ omniromResModule: "omnirom-res",
aidl: android.OptionalPathForPath(aidl),
}
}
@@ -178,6 +179,7 @@
bootclasspath: corePlatformBootclasspathLibraries(ctx),
classpath: config.FrameworkLibraries,
frameworkResModule: "framework-res",
+ omniromResModule: "omnirom-res",
}
case android.SdkNone:
systemModules := sdkContext.SystemModules()
diff --git a/java/testing.go b/java/testing.go
index 82dbcee..a6e72cf 100644
--- a/java/testing.go
+++ b/java/testing.go
@@ -536,6 +536,11 @@
android_app {
name: "framework-res",
sdk_version: "core_platform",
+ }
+
+ android_app {
+ name: "omnirom-res",
+ sdk_version: "core_platform",
}`
systemModules := []string{
diff --git a/scripts/check_boot_jars/package_allowed_list.txt b/scripts/check_boot_jars/package_allowed_list.txt
index 9e001ca..2c97ae4 100644
--- a/scripts/check_boot_jars/package_allowed_list.txt
+++ b/scripts/check_boot_jars/package_allowed_list.txt
@@ -261,6 +261,10 @@
org\.chromium\.arc
org\.chromium\.arc\..*
+# OmniROM adds
+omnirom\.platform
+org\.omnirom\.omnilib
+org\.omnirom\.omnilib\..*
###################################################
# Packages used for wear-sdk in Wear OS
com\.google\.wear
diff --git a/scripts/gen_build_prop.py b/scripts/gen_build_prop.py
index cef7241..2167741 100644
--- a/scripts/gen_build_prop.py
+++ b/scripts/gen_build_prop.py
@@ -41,9 +41,30 @@
def get_build_keys(product_config):
default_cert = product_config.get("DefaultAppCertificate", "")
- if default_cert == "" or default_cert == os.path.join(TEST_KEY_DIR, "testKey"):
+ if "ROM_BUILDTYPE" in product_config:
+ return "release-keys"
+ elif default_cert == os.path.join(TEST_KEY_DIR, "testKey"):
return "test-keys"
- return "dev-keys"
+ else:
+ return "dev-keys"
+
+def override_config(config):
+ if "PRODUCT_BUILD_PROP_OVERRIDES" in config:
+ current_key = None
+ props_overrides = {}
+
+ for var in config["PRODUCT_BUILD_PROP_OVERRIDES"]:
+ if "=" in var:
+ current_key, value = var.split("=")
+ props_overrides[current_key] = value
+ else:
+ props_overrides[current_key] += f" {var}"
+
+ for key, value in props_overrides.items():
+ if key not in config:
+ print(f"Key \"{key}\" isn't a valid prop override", file=sys.stderr)
+ sys.exit(1)
+ config[key] = value
def parse_args():
"""Parse commandline arguments."""
@@ -100,6 +121,11 @@
if args.build_thumbprint_file:
config["BuildThumbprint"] = args.build_thumbprint_file.read().strip()
+ config["OmniRomDesc"] = config["BuildDesc"]
+ config["OmniRomDevice"] = config["DeviceName"]
+
+ override_config(config)
+
append_additional_system_props(args)
append_additional_vendor_props(args)
append_additional_product_props(args)
@@ -177,6 +203,8 @@
config = args.config
build_flags = config["BuildFlags"]
+ print(f"ro.build.fingerprint?={config['BuildFingerprint']}")
+
# The ro.build.id will be set dynamically by init, by appending the unique vbmeta digest.
if config["BoardUseVbmetaDigestInFingerprint"]:
print(f"ro.build.legacy.id={config['BuildId']}")
@@ -195,6 +223,7 @@
print(f"ro.build.display.id?={config['BuildId']} {config['BuildKeys']}")
else:
# Non-user builds should show detailed build information (See build desc above)
+ print(f"ro.build.display.id?={config['OmniRomDesc']}")
print(f"ro.build.display.id?={config['BuildDesc']}")
print(f"ro.build.version.incremental={config['BuildNumber']}")
print(f"ro.build.version.sdk={config['Platform_sdk_version']}")
@@ -223,6 +252,8 @@
# flavor (via a dedicated lunch config for example).
print(f"ro.build.flavor={config['BuildFlavor']}")
+ print(f"ro.omni.device={config['OmniRomDevice']}")
+
# These values are deprecated, use "ro.product.cpu.abilist"
# instead (see below).
print(f"# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,")
@@ -562,6 +593,7 @@
# TODO(b/117892318): don't allow duplicates so that the ordering doesn't matter
variables = [
"ADDITIONAL_PRODUCT_PROPERTIES",
+ "OMNI_PRODUCT_PROPERTIES",
"PRODUCT_PRODUCT_PROPERTIES",
]
diff --git a/shared/Android.bp b/shared/Android.bp
index d5e8614..2092869 100644
--- a/shared/Android.bp
+++ b/shared/Android.bp
@@ -17,4 +17,6 @@
deps: [
"golang-protobuf-proto",
],
+ // Used by plugins
+ visibility: ["//visibility:public"],
}
diff --git a/ui/build/cleanbuild.go b/ui/build/cleanbuild.go
index 723d90f..3df8b7a 100644
--- a/ui/build/cleanbuild.go
+++ b/ui/build/cleanbuild.go
@@ -125,6 +125,7 @@
hostCommonOut("obj/PACKAGING"),
productOut("*.img"),
productOut("*.zip"),
+ productOut("*.zip.md5sum"),
productOut("android-info.txt"),
productOut("misc_info.txt"),
productOut("apex"),
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index 710be84..0f1a3dd 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -170,6 +170,7 @@
"BUILD_ID",
"OUT_DIR",
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE",
+ "ROM_BUILDTYPE",
}
func Banner(config Config, make_vars map[string]string) string {
diff --git a/ui/build/paths/config.go b/ui/build/paths/config.go
index 110ddee..bd7f3d0 100644
--- a/ui/build/paths/config.go
+++ b/ui/build/paths/config.go
@@ -108,6 +108,8 @@
"tr": Allowed,
"unzip": Allowed,
"zip": Allowed,
+ "nproc": Allowed,
+ "perl": Allowed,
// Host toolchain is removed. In-tree toolchain should be used instead.
// GCC also can't find cc1 with this implementation.
diff --git a/ui/build/sandbox_linux.go b/ui/build/sandbox_linux.go
index 95b71a7..1edbe21 100644
--- a/ui/build/sandbox_linux.go
+++ b/ui/build/sandbox_linux.go
@@ -307,6 +307,13 @@
sandboxArgs = append(sandboxArgs, "-N")
}
+ if ccacheExec := os.Getenv("CCACHE_EXEC"); ccacheExec != "" {
+ bytes, err := exec.Command(ccacheExec, "-k", "cache_dir").Output()
+ if err == nil {
+ sandboxArgs = append(sandboxArgs, "-B", strings.TrimSpace(string(bytes)))
+ }
+ }
+
// Stop nsjail from parsing arguments
sandboxArgs = append(sandboxArgs, "--")