Documentation
¶
Overview ¶
Package kits 存放"某个工程用哪些Kit构建"的持久化状态: Kit列表, 叠在Kit上的构建变体(Debug/Release), 以及当前激活的那一组.
Store 绑定一个工程根目录, 只读写该目录下的一个文件 <root>/.silk-kits.json, 自己不探测机器 —— 需要填充新工程时由调用方跑 core.DetectKits 再 Set 进来.
Index ¶
- Constants
- type Store
- func (s *Store) ActiveKit() (core.Kit, bool)
- func (s *Store) ActiveKitName() string
- func (s *Store) ActiveVariant() (Variant, bool)
- func (s *Store) ActiveVariantName() string
- func (s *Store) Dir() string
- func (s *Store) Exists() bool
- func (s *Store) Get(name string) (core.Kit, bool)
- func (s *Store) List() []core.Kit
- func (s *Store) Load() error
- func (s *Store) Path() string
- func (s *Store) Remove(name string) bool
- func (s *Store) Resolved() (core.Kit, bool)
- func (s *Store) Save() error
- func (s *Store) Set(k core.Kit) error
- func (s *Store) SetActiveKit(name string) error
- func (s *Store) SetActiveVariant(name string) error
- func (s *Store) SetVariant(v Variant) error
- func (s *Store) Variant(name string) (Variant, bool)
- func (s *Store) Variants() []Variant
- type Variant
Constants ¶
const ( VariantDebug = "Debug" VariantRelease = "Release" )
默认构建变体名
const FileName = ".silk-kits.json"
FileName 是工程级Kit文件名, 放在工程根目录下
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store 是一个工程的Kit配置 New 之后是"默认状态"(无Kit, Debug/Release两个变体, 激活Debug), Load 把磁盘上的内容读进来, Save 写回去
func (*Store) ActiveKitName ¶
ActiveKitName 返回激活Kit的名字, 没有则为 ""
func (*Store) ActiveVariantName ¶
ActiveVariantName 返回激活变体的名字
func (*Store) Load ¶
Load 读取Kit文件 文件不存在不算错误: 这是"工程还没配过Kit", Store保持默认状态并返回nil. 文件损坏时返回包装后的error, 同样保持默认状态, 绝不让脏文件把面板带崩
func (*Store) SetActiveKit ¶
SetActiveKit 切换激活Kit, 名字不存在时报错且不改动状态
func (*Store) SetActiveVariant ¶
SetActiveVariant 切换激活变体, 名字不存在时报错且不改动状态 命中后写回变体自身的规范名字, 磁盘上不会留下 "release" 这类随手输入的大小写
type Variant ¶
type Variant struct {
Name string `json:"name"`
Tags []string `json:"tags,omitempty"` // 追加到Kit的tag后面
Race bool `json:"race,omitempty"` // 与Kit的Race取或
Coverage bool `json:"coverage,omitempty"` // 与Kit的Coverage取或
OutputDir string `json:"output_dir,omitempty"` // 非空则覆盖Kit的输出目录
}
Variant 是叠在Kit之上的具名构建变体, 对应 Qt Creator 的 Debug/Release 构建配置. 零值字段表示"沿用Kit本身的设置", 只有非零字段才覆盖
func DefaultVariants ¶
func DefaultVariants() []Variant
DefaultVariants 是新工程的两个标准变体: Debug 开竞态检测, Release 不开, 产物分别落在 build/debug 与 build/release, 避免两种构建互相覆盖