Documentation
¶
Index ¶
- Constants
- func Activate(ctx context.Context, logger log.Logger, osProxy utils.OsProxy, ...) error
- func ApplyBenchmarkPhase(params *Params, logger log.Logger, ...)
- func ConfigFile(osProxy utils.OsProxy) string
- func DirPath(osProxy utils.OsProxy) string
- func PathFor(osProxy utils.OsProxy, subpath string) string
- func ResolveProxySocketPath(override string, envs map[string]string, osProxy utils.OsProxy) string
- type Config
- type ConfigMigrator
- type EnvExporter
- type Params
Constants ¶
const ( ActivateXcodeSuccessful = "✅ Bitrise Build Cache for Xcode activated" AddXcelerateToPath = "ℹ️ To start building, run `export PATH=~/.bitrise-xcelerate/bin:$PATH` or restart your terminal." ErrFmtCreateXcodeConfig = "failed to create Xcode config: %w" )
const ( DefaultXcodePath = "/usr/bin/xcodebuild" DefaultXcrunPath = "/usr/bin/xcrun" ErrFmtCreateConfigFile = `failed to create xcelerate config file: %w` ErrFmtEncodeConfigFile = `failed to encode xcelerate config file: %w` ErrFmtCreateFolder = `failed to create .xcelerate folder (%s): %w` ErrNoAuthConfig = "resolve auth config: %w" )
const ( BinDir = "bin" ErrFmtDetermineHome = `could not determine home: %w` )
const EnvInactivityTimeout = "TEST_BITRISE_XCELERATE_INACTIVITY_TIMEOUT"
EnvInactivityTimeout overrides the xcelerate proxy inactivity window that triggers a slim invocation emit. Value is a time.ParseDuration string. Test-only knob: sole caller is the e2e-xcode-wrapper-watcher-race workflow, which forces slim-emit slow so the watcher's poll observes the manifest first.
const EnvProxySocketPath = "BITRISE_XCELERATE_PROXY_SOCKET_PATH"
EnvProxySocketPath overrides the default xcelerate proxy socket location when set.
Variables ¶
This section is empty.
Functions ¶
func Activate ¶
func Activate( ctx context.Context, logger log.Logger, osProxy utils.OsProxy, commandFunc utils.CommandFunc, encoderFactory utils.EncoderFactory, decoderFactory utils.DecoderFactory, activateXcodeParams Params, envs map[string]string, ) error
Activate creates the Xcode build cache configuration, copies the CLI binary, and sets up the xcodebuild wrapper script.
func ApplyBenchmarkPhase ¶
func ApplyBenchmarkPhase( params *Params, logger log.Logger, benchmarkProvider common.BenchmarkPhaseProvider, metadata common.CacheConfigMetadata, exporter EnvExporter, )
ApplyBenchmarkPhase queries the benchmark phase and overrides xcode params accordingly. Baseline phase disables cache. The phase is exported as BITRISE_BUILD_CACHE_BENCHMARK_PHASE_XCODE env var and written to ~/.local/state/xcelerate/benchmark/benchmark-phase-xcode.json as fallback. The user-facing log line is emitted once by common.LogBenchmarkSummary at the end of activation, not from this function.
func ConfigFile ¶
ConfigFile returns the absolute path of the xcelerate config.json.
func DirPath ¶
DirPath returns the xcelerate root dir (~/.bitrise-xcelerate) using osProxy's home; falls back to working dir / executable dir / "." when home cannot be resolved.
func ResolveProxySocketPath ¶
ResolveProxySocketPath returns the proxy unix socket path in the same order activate uses: explicit override → BITRISE_XCELERATE_PROXY_SOCKET_PATH env var → <temp-dir>/xcelerate-proxy.sock.
Types ¶
type Config ¶
type Config struct {
ProxyVersion string `json:"proxyVersion"`
ProxySocketPath string `json:"proxySocketPath"`
// ConfigVersion is the semver of this config's schema. Refresh nudges only when this bumps.
ConfigVersion string `json:"configVersion,omitempty"`
// WrittenAt records when the config was last (re-)written by activate.
WrittenAt time.Time `json:"writtenAt,omitzero"`
WrapperVersion string `json:"wrapperVersion"`
OriginalXcodebuildPath string `json:"originalXcodebuildPath"`
OriginalXcrunPath string `json:"originalXcrunPath"`
BuildCacheEnabled bool `json:"buildCacheEnabled"`
BuildCacheSkipFlags bool `json:"buildCacheSkipFlags"`
DisablePrefixMapping bool `json:"disablePrefixMapping,omitempty"`
BuildCacheEndpoint string `json:"buildCacheEndpoint"`
PushEnabled bool `json:"pushEnabled"`
DebugLogging bool `json:"debugLogging,omitempty"`
Silent bool `json:"silent,omitempty"`
XcodebuildTimestamps bool `json:"xcodebuildTimestamps,omitempty"`
// AuthConfig is sourced from the multiplatform analytics config at runtime
// (single canonical source for auth credentials on disk). The JSON tag is
// preserved for read-side backwards compatibility with older xcelerate
// configs that still have `authConfig` on disk from a previous CLI version;
// Save zeroes it before writing and `omitzero` keeps it out of the file.
AuthConfig common.CacheAuthConfig `json:"authConfig,omitzero"`
ExternalAppID string `json:"externalAppId,omitempty"`
ExternalBuildID string `json:"externalBuildId,omitempty"`
ExternalWorkflowName string `json:"externalWorkflowName,omitempty"`
}
Config is the xcelerate config saved to ~/.bitrise-xcelerate/config.json. Note: the benchmark phase is NOT stored here — matching gradle, it is exported as the BITRISE_BUILD_CACHE_BENCHMARK_PHASE env var and written to ~/.local/state/xcelerate/benchmark/benchmark-phase.json during activation.
func DefaultConfig ¶
func DefaultConfig() Config
func ReadConfig ¶
type ConfigMigrator ¶
ConfigMigrator implements toolconfig.Migrator for ~/.bitrise-xcelerate/config.json.
func (ConfigMigrator) Migrate ¶
func (m ConfigMigrator) Migrate(_ string) error
func (ConfigMigrator) Tool ¶
func (ConfigMigrator) Tool() toolconfig.Tool
type EnvExporter ¶
EnvExporter abstracts environment variable export for testability.
type Params ¶
type Params struct {
BuildCacheEnabled bool
BuildCacheEndpoint string
BuildCacheSkipFlags bool
DisablePrefixMapping bool
DebugLogging bool
Silent bool
XcodePathOverride string
XcrunPathOverride string
ProxySocketPathOverride string
PushEnabled bool
XcodebuildTimestampsEnabled bool
}
func DefaultParams ¶
func DefaultParams() Params