swiftcfg

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package swiftcfg defines the types for the Swift-specific config used in the Gazelle extension.

Index

Constants

View Source
const (
	MatchCaseModuleNamingConvention  string = "match_case"
	PascalCaseModuleNamingConvention string = "pascal_case"
)
View Source
const DefaultDependencyIndexBasename = "swift_deps_index.json"
View Source
const SwiftConfigName = "swift"

Variables

This section is empty.

Functions

func SetSwiftConfig

func SetSwiftConfig(c *config.Config, sc *SwiftConfig)

SetSwiftConfig stores the Swift configuration in the Gazelle configuration.

Types

type GenerateRulesMode

type GenerateRulesMode int

A GenerateRulesMode is an enum for the mode for build file generation.

const (
	SkipGenRulesMode GenerateRulesMode = iota
	SwiftPkgGenRulesMode
	SrcFileGenRulesMode
)

type ModuleFilesCollector

type ModuleFilesCollector map[string][]string

A ModuleFilesCollector organizes source files by the directory where the module/target should be defined.

func NewModuleFilesCollector

func NewModuleFilesCollector() ModuleFilesCollector

func (ModuleFilesCollector) AppendModuleFiles

func (mfc ModuleFilesCollector) AppendModuleFiles(moduleDir string, paths []string)

AppendModuleFiles adds the paths under the specified module directory.

func (ModuleFilesCollector) GetModuleFiles

func (mfc ModuleFilesCollector) GetModuleFiles(moduleDir string) []string

GetModuleFiles returns the files for a module directory.

type SwiftConfig

type SwiftConfig struct {
	SwiftBinPath         string
	ModuleFilesCollector ModuleFilesCollector
	DependencyIndex      *swift.DependencyIndex
	// DependencyIndexRel is the path relative to the RepoRoot to the dependency index
	DependencyIndexRel string
	// DependencyIndexPath is the full path to the dependency index
	DependencyIndexPath      string
	UpdatePkgsToLatest       bool
	ResolutionLogPath        string
	ResolutionLogFile        *os.File
	ResolutionLogger         reslog.ResolutionLogger
	UpdateBzlmodUseRepoNames bool
	PrintBzlmodStanzas       bool
	UpdateBzlmodStanzas      bool
	BazelModuleRel           string
	// BazelModulePath is the full path to the MODULE.bazel
	BazelModulePath string

	GenerateSwiftDepsForWorkspace bool

	ModuleNamingConvention string

	// Mapping of relative path to default module name. These values are populated from directives
	// that can be applied to
	DefaultModuleNames map[string]string

	// Path to the YAML file that contains the patch information
	PatchesPath string
}

A SwiftConfig represents the Swift-specific configuration for the Gazelle extension.

func GetSwiftConfig

func GetSwiftConfig(c *config.Config) *SwiftConfig

GetSwiftConfig extracts the Swift configuration from the Gazelle configuration.

func NewSwiftConfig

func NewSwiftConfig() *SwiftConfig

func (*SwiftConfig) GenerateRulesMode

func (sc *SwiftConfig) GenerateRulesMode(args language.GenerateArgs) GenerateRulesMode

GenerateRulesMode determines how the specified directory should be processed.

func (*SwiftConfig) LoadDependencyIndex

func (sc *SwiftConfig) LoadDependencyIndex() error

LoadDependencyIndex reads the dependency index from disk.

func (*SwiftConfig) SwiftBin

func (sc *SwiftConfig) SwiftBin() *swiftbin.SwiftBin

SwiftBin returns the Swift binary.

func (*SwiftConfig) WriteDependencyIndex

func (sc *SwiftConfig) WriteDependencyIndex() error

WriteDependencyIndex writes the dependency index to disk.

Jump to

Keyboard shortcuts

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