cli

package
v0.0.0-...-62694dd Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package cli provides utilities for writing languages-specific main packages, such as Jade.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClassNamesToResolve

func ClassNamesToResolve(ctx context.Context, workingDir string, loader pkgloading.Loader, arg string, classNamesArg []string, implicitImports *future.Value, blacklist []string) []jadeplib.ClassName

ClassNamesToResolve returns the list of class names which should be satisfied with BUILD dependencies. If the user provided a list in --classnames (which is passed in classNamesArg), that list is returned. Otherwise, it parses Java files as described in FilesToParse(). blacklist is a list of regular expressions matching names of classes for which we will not look for BUILD rules. See FilesToParse for explanation about 'workingDir' and 'arg'.

func FilesToParse

func FilesToParse(arg, workingDir string, loader pkgloading.Loader) ([]string, error)

FilesToParse returns the list of files to parse based on 'arg'. If arg is a label, FilesToParse loads the rule and returns the files referenced in its "srcs" attribute. Otherwise, 'arg' is assumed to be a file name which is returned in absolute form. 'arg' is treated relative to 'workingDir', which is not necessarily $pwd in case the user provided an explicit -workapce flag.

func LogRulesToFix

func LogRulesToFix(rules []*bazel.Rule)

LogRulesToFix prints 'rules'. It is used to announce which rules we're about to fix.

func ReportAddedDeps

func ReportAddedDeps(addedDeps map[*bazel.Rule][]bazel.Label)

ReportAddedDeps prints which deps this Jadep run added to which consuming rule.

func ReportMissingDeps

func ReportMissingDeps(missingDeps map[*bazel.Rule]map[jadeplib.ClassName][]bazel.Label)

ReportMissingDeps logs the dependencies that Jadep detected as missing.

func ReportUnresolvedClassnames

func ReportUnresolvedClassnames(unresolvedClassNames []jadeplib.ClassName)

ReportUnresolvedClassnames logs the class names that Jadep couldn't find any BUILD dependencies for.

func RulesToFix

func RulesToFix(ctx context.Context, config jadeplib.Config, relWorkingDir, arg string, namingRules []jadeplib.NamingRule, defaultRuleKind string) ([]*bazel.Rule, error)

RulesToFix returns the set of rules whose 'deps' Jade should manipulate, based on 'arg'. If 'arg' is a label, it will be loaded and returned. Otherwise, 'arg' is assumed to be a file name, and RulesToFix will load its containig package and return any Java rule that 'srcs' it. In this case, 'arg' is treated relative to 'relWorkingDir', which is the working directory relative to the workspace root. For a description of namingRules and defaultRuleKind, see jadeplib.CreateRule.

func StartProfiler

func StartProfiler(outFile string) (stopProfiler func())

StartProfiler starts CPU profiling and writes the output to outFile.

func Workspace

func Workspace(workspaceFlag string) (workspaceDir, relWorkingDir string, err error)

Workspace returns the directory path of the workspace in which Jade should operate (workspaceDir) and the working dir relative to it (relWorkingDir). workspaceFlag is what the user specified on the command-line. If workspaceFlag is empty, Workspace() searches for a directory that contains a WORKSPACE file starting at the working directory and moving upwards. relWorkingDir will be empty if workspaceFlag isn't empty (= -workspace was specifief explicitly)

Types

This section is empty.

Jump to

Keyboard shortcuts

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