diff --git a/apple/apple_library.bzl b/apple/apple_library.bzl index 6923ef931..f78a51531 100644 --- a/apple/apple_library.bzl +++ b/apple/apple_library.bzl @@ -224,7 +224,8 @@ def _compile_index_store(ctx: AnalysisContext, src_compile_cmd: CxxSrcCompileCom cmd, category = category, identifier = identifier, - allow_cache_upload = True, + allow_cache_upload = False, + local_only = True, ) return index_store diff --git a/apple/swift/swift_compilation.bzl b/apple/swift/swift_compilation.bzl index c2f9d0451..b560e84e9 100644 --- a/apple/swift/swift_compilation.bzl +++ b/apple/swift/swift_compilation.bzl @@ -532,6 +532,7 @@ def _compile_index_store( additional_flags, toolchain, module_name, + cacheable = False, ) return index_store_output @@ -545,7 +546,8 @@ def _compile_with_argsfile( additional_flags: cmd_args, toolchain: SwiftToolchainInfo, identifier: str | None = None, - num_threads: int = 1) -> CompileArgsfiles: + num_threads: int = 1, + cacheable: bool = True) -> CompileArgsfiles: shell_quoted_args = cmd_args(shared_flags, quote = "shell") argsfile, _ = ctx.actions.write(extension + "_compile_argsfile", shell_quoted_args, allow_args = True) input_args = [shared_flags] @@ -568,7 +570,7 @@ def _compile_with_argsfile( # because there's no shared module cache across different libraries. prefer_local = not explicit_modules_enabled - if build_swift_incrementally and not toolchain.supports_relative_resource_dir: + if (not cacheable) or (build_swift_incrementally and not toolchain.supports_relative_resource_dir): # When Swift code is built incrementally, the swift-driver embeds # absolute paths into the artifacts without relative resource dir # support. In this case we can only build locally.