xcode

package
v0.14.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCacheNotFound = errors.New("no cache archive found for the provided keys")

ErrCacheNotFound ...

View Source
var ErrFileExistsAndNotWritable = errors.New("file already exists and is not writable")

ErrFileExistsAndNotWritable ...

Functions

func Checksum

func Checksum(source io.Reader) (string, error)

func ChecksumOfFile

func ChecksumOfFile(path string) (string, error)

func DeleteFileGroup

func DeleteFileGroup(fgi FileGroupInfo, logger log.Logger)

func DownloadFileFromBuildCache

func DownloadFileFromBuildCache(ctx context.Context, fileName, key string, kvClient *kv.Client, logger log.Logger) error

func DownloadStreamFromBuildCache

func DownloadStreamFromBuildCache(ctx context.Context, destination io.Writer, key string, kvClient *kv.Client, logger log.Logger) error

func GetCacheKey

func GetCacheKey(envProvider func(string) string, keyParams CacheKeyParams) (string, error)

func RestoreDirectoryInfos

func RestoreDirectoryInfos(dirInfos []*DirectoryInfo, rootDir string, logger log.Logger) error

func RestoreFileInfos

func RestoreFileInfos(fileInfos []*FileInfo, rootDir string, logger log.Logger) (int, error)
func RestoreSymlinks(symlinks []*SymlinkInfo, logger log.Logger) (int, error)

func SaveMetadata

func SaveMetadata(metadata *Metadata, fileName string, logger log.Logger) (int64, error)

func UploadFileToBuildCache

func UploadFileToBuildCache(ctx context.Context, filePath, key string, kvClient *kv.Client, logger log.Logger) error

func UploadStreamToBuildCache

func UploadStreamToBuildCache(ctx context.Context, source io.Reader, key string, size int64, kvClient *kv.Client, logger log.Logger) error

Types

type CacheKeyParams

type CacheKeyParams struct {
	IsFallback bool
}

type CreateMetadataParams

type CreateMetadataParams struct {
	ProjectRootDirPath string
	DerivedDataPath    string
	XcodeCacheDirPath  string
	CacheKey           string
	FollowSymlinks     bool
	SkipSPM            bool
}

type DefaultStepAnalyticsTracker

type DefaultStepAnalyticsTracker struct {
	// contains filtered or unexported fields
}

func NewDefaultStepTracker

func NewDefaultStepTracker(stepID string, envProvider func(string) string, logger log.Logger) *DefaultStepAnalyticsTracker

func (*DefaultStepAnalyticsTracker) LogDerivedDataDownloaded

func (t *DefaultStepAnalyticsTracker) LogDerivedDataDownloaded(duration time.Duration, stats DownloadFilesStats)

func (*DefaultStepAnalyticsTracker) LogDerivedDataUploaded

func (t *DefaultStepAnalyticsTracker) LogDerivedDataUploaded(duration time.Duration, stats UploadFilesStats)

func (*DefaultStepAnalyticsTracker) LogMetadataLoaded

func (t *DefaultStepAnalyticsTracker) LogMetadataLoaded(duration time.Duration, cacheKeyType string, totalFileCount int, restoredFileCount int, size int64)

func (*DefaultStepAnalyticsTracker) LogMetadataSaved

func (t *DefaultStepAnalyticsTracker) LogMetadataSaved(duration time.Duration, fileCount int, size int64)

func (*DefaultStepAnalyticsTracker) LogRestoreFinished

func (t *DefaultStepAnalyticsTracker) LogRestoreFinished(totalDuration time.Duration, err error)

func (*DefaultStepAnalyticsTracker) LogSaveFinished

func (t *DefaultStepAnalyticsTracker) LogSaveFinished(totalDuration time.Duration, err error)

func (*DefaultStepAnalyticsTracker) Wait

func (t *DefaultStepAnalyticsTracker) Wait()

type DirectoryInfo

type DirectoryInfo struct {
	Path    string    `json:"path"`
	ModTime time.Time `json:"modTime"`
}

type DownloadFilesStats

type DownloadFilesStats struct {
	FilesToBeDownloaded   int
	FilesDownloaded       int
	FilesMissing          int
	FilesFailedToDownload int
	DownloadSize          int64
	LargestFileSize       int64
}

func DownloadCacheFilesFromBuildCache

func DownloadCacheFilesFromBuildCache(ctx context.Context, dd FileGroupInfo, kvClient *kv.Client, logger log.Logger,
	isDebugLogMode, skipExisting, forceOverwrite bool, maxLoggedDownloadErrors int) (DownloadFilesStats, error)

nolint: gocognit

type FileGroupInfo

type FileGroupInfo struct {
	Files       []*FileInfo      `json:"files"`
	Directories []*DirectoryInfo `json:"directories"`
	Symlinks    []*SymlinkInfo   `json:"symlinks,omitempty"`
}

type FileInfo

type FileInfo struct {
	Path       string            `json:"path"`
	Size       int64             `json:"size"`
	Hash       string            `json:"hash"`
	ModTime    time.Time         `json:"modTime"`
	Mode       os.FileMode       `json:"mode"`
	Attributes map[string]string `json:"attributes,omitempty"`
}

type Metadata

type Metadata struct {
	ProjectFiles         FileGroupInfo `json:"projectFiles"`
	DerivedData          FileGroupInfo `json:"derivedData"`
	XcodeCacheDir        FileGroupInfo `json:"xcodeCacheDir"`
	CacheKey             string        `json:"cacheKey"`
	CreatedAt            time.Time     `json:"createdAt"`
	AppID                string        `json:"appId,omitempty"`
	BuildID              string        `json:"buildId,omitempty"`
	WorkspaceID          string        `json:"workspaceId,omitempty"`
	GitCommit            string        `json:"gitCommit,omitempty"`
	GitBranch            string        `json:"gitBranch,omitempty"`
	BuildCacheCLIVersion string        `json:"cliVersion,omitempty"`
	MetadataVersion      int           `json:"metadataVersion"`
}

func CreateMetadata

func CreateMetadata(params CreateMetadataParams, envProvider func(string) string, logger log.Logger) (*Metadata, error)

func LoadMetadata

func LoadMetadata(file string) (*Metadata, int64, error)

type StepAnalyticsTracker

type StepAnalyticsTracker interface {
	LogMetadataSaved(duration time.Duration, fileCount int, size int64)
	LogDerivedDataUploaded(duration time.Duration, stats UploadFilesStats)
	LogSaveFinished(totalDuration time.Duration, err error)
	LogMetadataLoaded(duration time.Duration, cacheKeyType string, totalFileCount int, restoredFileCount int, size int64)
	LogDerivedDataDownloaded(duration time.Duration, stats DownloadFilesStats)
	LogRestoreFinished(totalDuration time.Duration, err error)

	Wait()
}

type SymlinkInfo

type SymlinkInfo struct {
	Path    string    `json:"path"`
	Target  string    `json:"target"`
	ModTime time.Time `json:"modTime"`
}

type UploadFilesStats

type UploadFilesStats struct {
	FilesToUpload       int
	FilesUploaded       int
	FilesFailedToUpload int
	TotalFiles          int
	UploadSize          int64
	LargestFileSize     int64
}

func UploadCacheFilesToBuildCache

func UploadCacheFilesToBuildCache(ctx context.Context, dd FileGroupInfo, kvClient *kv.Client, logger log.Logger) (UploadFilesStats, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL