Documentation
¶
Overview ¶
nolint:gochecknoglobals
Index ¶
- Constants
- Variables
- func BuildOtherCFlagsValue(p PrefixMapPaths) string
- func HasBuildAction(argv []string) bool
- func MergeOtherCFlagsValue(userValue, suffix string) string
- type CompCacheStats
- type Default
- func (p Default) Args(additional map[string]string) []string
- func (p Default) Command() string
- func (p Default) DerivedDataPath() string
- func (p Default) HasBuildAction() bool
- func (p Default) ProjectDir() string
- func (p Default) ProjectTempDir() string
- func (p Default) ShortCommand() string
- func (p Default) UserOtherCFlags() string
- type DefaultRunner
- type PrefixMapPaths
- type RunStats
- type XcodeArgs
Constants ¶
const ( ClangEnablePrefixMappingKey = "CLANG_ENABLE_PREFIX_MAPPING" OtherCFlagsKey = "OTHER_CFLAGS" ProjectTempDirKey = "PROJECT_TEMP_DIR" DerivedDataPathFlag = "-derivedDataPath" )
Build-setting keys and derivedDataPath flag literal used by the wrapper when injecting prefix-map rules.
Variables ¶
var CacheArgs = map[string]string{
"COMPILATION_CACHE_ENABLE_CACHING": "YES",
"COMPILATION_CACHE_ENABLE_PLUGIN": "YES",
"COMPILATION_CACHE_ENABLE_INTEGRATED_QUERIES": "YES",
"COMPILATION_CACHE_ENABLE_DETACHED_KEY_QUERIES": "YES",
"SWIFT_ENABLE_COMPILE_CACHE": "YES",
"SWIFT_ENABLE_EXPLICIT_MODULES": "YES",
"SWIFT_USE_INTEGRATED_DRIVER": "YES",
"CLANG_ENABLE_COMPILE_CACHE": "YES",
"CLANG_ENABLE_MODULES": "YES",
"COMPILATION_CACHE_REMOTE_SUPPORTED_LANGUAGES": "swift c c++ objective-c objective-c++",
}
Xcode 26 gates the compile-cache plugin behind the master toggle COMPILATION_CACHE_ENABLE_CACHING. Without it, SwiftBuild resolves the individual COMPILATION_CACHE_* keys but never emits -cache-compile-job on swiftc argv, so the plugin never loads and the remote CAS stays dark for projects whose target defaults don't already have caching on.
Functions ¶
func BuildOtherCFlagsValue ¶ added in v3.2.0
func BuildOtherCFlagsValue(p PrefixMapPaths) string
BuildOtherCFlagsValue returns the suffix to append after "$(inherited) " in OTHER_CFLAGS. Rule ordering is narrowest-first: when one mapped path sits inside another (e.g. DerivedDataPath under $HOME), the narrower rule must fire first so its virtual name wins regardless of whether clang interprets -fdepscan-prefix-map as first-match-wins or longest-match-wins.
func HasBuildAction ¶ added in v3.2.0
HasBuildAction reports whether argv triggers a real xcodebuild build. An explicit build-action keyword wins; otherwise argv is a build unless a query-only action (-list, -version, -showBuildSettings, ...) is present.
func MergeOtherCFlagsValue ¶ added in v3.2.0
MergeOtherCFlagsValue splices the injected prefix-map suffix into a user-supplied OTHER_CFLAGS value. Any leading $(inherited) markers in the user value are collapsed to a single leading marker so the final layout is:
$(inherited) <user tokens minus $(inherited)> <suffix>
An empty user value + empty suffix returns "". An empty user value with a non-empty suffix still emits $(inherited) so the target/xcconfig chain is not lost.
Types ¶
type CompCacheStats ¶
type Default ¶
type Default struct {
Cmds []*cobra.Command
OriginalArgs []string
// contains filtered or unexported fields
}
func NewDefault ¶
func (Default) DerivedDataPath ¶ added in v3.2.0
DerivedDataPath returns the last -derivedDataPath value from OriginalArgs, supporting both `-derivedDataPath X` and `-derivedDataPath=X` forms. A value that begins with `-` in the space form is treated as the next flag and the current one as missing. Relative values are resolved against the current working directory — clang rejects non-absolute inputs to -fdepscan-prefix-map=.
func (Default) HasBuildAction ¶ added in v3.2.0
func (Default) ProjectDir ¶ added in v3.2.0
ProjectDir returns the parent directory of the -project or -workspace value on OriginalArgs. -project wins when both are present. When neither flag is present xcodebuild auto-discovers a single .xcworkspace/.xcodeproj in CWD, so CWD is the project dir. Relative -project/-workspace values are resolved against the current working directory before taking the parent — a bare `App.xcworkspace` would otherwise give `.`, which clang rejects as a -fdepscan-prefix-map= input.
func (Default) ProjectTempDir ¶ added in v3.2.0
ProjectTempDir returns the last PROJECT_TEMP_DIR=... build-setting value from OriginalArgs. Missing → empty. Relative values are resolved against the current working directory — clang rejects non-absolute inputs to -fdepscan-prefix-map=.
func (Default) ShortCommand ¶
func (Default) UserOtherCFlags ¶ added in v3.2.0
UserOtherCFlags returns the last OTHER_CFLAGS=... build-setting value from OriginalArgs. Missing → empty.
type DefaultRunner ¶
type DefaultRunner struct {
// contains filtered or unexported fields
}
type PrefixMapPaths ¶ added in v3.2.0
type PrefixMapPaths struct {
Home string
ProjectDir string
DerivedDataPath string
ProjectTempDir string
}
PrefixMapPaths is the set of absolute paths whose values will be rewritten to stable virtual names in clang's CAS cache keys via -fdepscan-prefix-map. Empty fields produce no rule.