project

package
v0.0.0-...-d4afc08 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SpecialProperties = map[string]bool{
	"TargetFramework": true,
	"OutputType":      true,
}

Functions

func Forward

func Forward(p string) string

func GetLabel

func GetLabel(dir, referencePath, repoRoot string) (label.Label, error)

GetLabel takes an unclean absolute path to a project file and constructs a bazel label for it The path may contain any combination of `.`, `..`, `/` and `\` Constructing a label is not strictly necessary, but this is bazel, and a label is a convenient notation

Types

type AnyElement

type AnyElement struct {
	XMLName xml.Name
}

type DirectoryInfo

type DirectoryInfo struct {
	Children map[string]*DirectoryInfo
	Exts     map[string][]string
	Base     string
	Project  *Project
	SrcsMode SrcsMode
	Protos   []*rule.Rule
}

type FileGroup

type FileGroup struct {
	ItemType       string
	BazelAttribute string
	Explicit       []bzl.Expr
	Globs          []bzl.Expr
	IncludeGlobs   []bzl.Expr
	Filters        []string
	Comments       []bzl.Comment
}

func (*FileGroup) IncludeGlob

func (fg *FileGroup) IncludeGlob(g string)

func (*FileGroup) IsExcluded

func (fg *FileGroup) IsExcluded(file string) bool

type Import

type Import struct {
	XMLName xml.Name `xml:"Import"`
	Project string   `xml:"Project,attr"`
	Unsupported
}

func (Import) Evaluate

func (i Import) Evaluate(proj *Project)

type Item

type Item struct {
	XMLName xml.Name
	Include string `xml:"Include,attr"`
	Exclude string `xml:"Exclude,attr"`
	// Remove is not directly output to starlark, but is used to filter globbed files
	Remove    string `xml:"Remove,attr"`
	Condition string `xml:"Condition,attr"`
	Unsupported
}

func (*Item) Evaluate

func (i *Item) Evaluate(p *Project)

type ItemGroup

type ItemGroup struct {
	Compile           []*Item             `xml:"Compile"`
	Content           []*Item             `xml:"Content"`
	ProjectReferences []*ProjectReference `xml:"ProjectReference"`
	PackageReferences []*PackageReference `xml:"PackageReference"`
	Protobuf          []*Protobuf         `xml:"Protobuf"`
	// None items are completely ignored
	None []*Item `xml:"None"`
	Unsupported
}

type NugetSpec

type NugetSpec struct {
	Name    string
	Version *NugetVer
	Tfms    map[string]bool
}

type NugetVer

type NugetVer struct {
	Raw string
	// contains filtered or unexported fields
}

func Best

func Best(a *NugetVer, b *NugetVer) *NugetVer

func ParseVersion

func ParseVersion(s string) *NugetVer

parseVersion makes a lazy attempt at parsing a probably semver version any number parts are extracted for precise comparison any non-alpha suffix is stored as a raw string and will be alphabetically sorted. suffix comparison is not intended to be accurate, only deterministic

type PackageReference

type PackageReference struct {
	XMLName   xml.Name
	Include   string   `xml:"Include,attr"`
	Version   string   `xml:"Version,attr"`
	VersionEl *Version `xml:"Version"`
	Unsupported
}

func (*PackageReference) Evaluate

func (r *PackageReference) Evaluate(proj *Project)

type Project

type Project struct {
	XMLName        xml.Name         `xml:"Project"`
	Sdk            string           `xml:"Sdk,attr"`
	PropertyGroups []*PropertyGroup `xml:"PropertyGroup"`
	ItemGroups     []*ItemGroup     `xml:"ItemGroup"`
	Imports        []*Import        `xml:"Import"`
	Unsupported

	Properties      map[string]string
	AssemblyName    string
	TargetFramework string
	PackageId       string
	IsExe           bool
	IsWeb           bool
	IsTest          bool
	LangExt         string
	Files           map[string]*FileGroup
	Data            []string

	// Rel is the workspace relative path to the csproj file
	// Other projects will import this project with this path
	Rel       string
	Name      string
	FileLabel *label.Label
	Rule      *rule.Rule
	Deps      []interface{}
	Directory *DirectoryInfo

	Ext    string
	Protos []string
	// contains filtered or unexported fields
}

func Load

func Load(projectFile string) (*Project, error)

func (*Project) CollectFiles

func (p *Project) CollectFiles(dir *DirectoryInfo, rel string)

func (*Project) Evaluate

func (p *Project) Evaluate(s string) string

func (*Project) GenerateRule

func (p *Project) GenerateRule(f *rule.File) *rule.Rule

func (*Project) GetFileGroup

func (p *Project) GetFileGroup(key string) *FileGroup

func (*Project) GetUnsupported

func (p *Project) GetUnsupported() []string

func (*Project) ProcessItemGroup

func (p *Project) ProcessItemGroup(fgKey string, getItems func(ig *ItemGroup) []*Item)

func (*Project) SetFileAttributes

func (p *Project) SetFileAttributes()

func (*Project) SetProperties

func (p *Project) SetProperties()

todo: delete this when I decide to not re-introduce msbuild_properties

type ProjectReference

type ProjectReference struct {
	XMLName xml.Name
	Include string `xml:",attr"`
	Unsupported
}

func (*ProjectReference) Evaluate

func (i *ProjectReference) Evaluate(p *Project)

type Property

type Property struct {
	XMLName xml.Name
	Value   string `xml:",chardata"`
	Unsupported
}

type PropertyGroup

type PropertyGroup struct {
	Properties []Property `xml:",any"`
	Unsupported
}

type Protobuf

type Protobuf struct {
	XMLName xml.Name
	Item
	GrpcServices string `xml:"GrpcServices,attr"`
}

type SrcsMode

type SrcsMode int
const (
	Implicit SrcsMode = iota
	Folders
	Explicit
)

type Unsupported

type Unsupported struct {
	UnsupportedAttrs    []xml.Attr   `xml:",attr,any"`
	UnsupportedElements []AnyElement `xml:",any"`
}

func (*Unsupported) Append

func (u *Unsupported) Append(messages []string, prefix string, includeElements bool) []string

func (*Unsupported) Messages

func (u *Unsupported) Messages(prefix string, includeElements bool) []string

type Version

type Version struct {
	XMLName xml.Name
	Value   string `xml:",chardata"`
}

Jump to

Keyboard shortcuts

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