luci: Index | Files

package isolate

import ""

Package isolate implements the code to process '.isolate' files to generate '.isolated' files.


Package Files

doc.go format.go isolate.go utils.go


const IsolatedGenJSONVersion = 1

IsolatedGenJSONVersion is used in the batcharchive json format.

TODO(tandrii): Migrate to batch_archive.go.

const ValidVariable = "[A-Za-z_][A-Za-z_0-9]*"

ValidVariable is the regexp of valid isolate variable name.

func Archive Uses

func Archive(arch *archiver.Archiver, opts *ArchiveOptions) *archiver.PendingItem

Archive processes a .isolate, generates a .isolated and archive it. Returns a *PendingItem to the .isolated.

func IsValidVariable Uses

func IsValidVariable(variable string) bool

IsValidVariable returns true if the variable is a valid symbol name.

func LoadIsolateForConfig Uses

func LoadIsolateForConfig(isolateDir string, content []byte, configVariables map[string]string) (
    []string, string, error)

LoadIsolateForConfig loads the .isolate file and returns the information unprocessed but filtered for the specific OS.


dependencies, relDir, error.

relDir and dependencies are fixed to use os.PathSeparator.

func ProcessIsolate Uses

func ProcessIsolate(opts *ArchiveOptions) ([]string, string, *isolated.Isolated, error)

ProcessIsolate parses an isolate file, returning the list of dependencies (both files and directories), the root directory and the initial Isolated struct.

func ProcessIsolateForCAS Uses

func ProcessIsolateForCAS(opts *ArchiveOptions) ([]string, string, error)

ProcessIsolateForCAS works similarly to ProcessIsolate. However, it is simpler in that it returns a list of dependency *relative* paths and the root directory, which are the necessary input to upload to RBE-CAS.

func ReplaceVariables Uses

func ReplaceVariables(str string, opts *ArchiveOptions) (string, error)

ReplaceVariables replaces any occurrences of '<(FOO)' in 'str' with the corresponding variable from 'opts'.

If any substitution refers to a variable that is missing, the returned error will refer to the first such variable. In the case of errors, the returned string will still contain a valid result for any non-missing substitutions.

type ArchiveOptions Uses

type ArchiveOptions struct {
    Isolate             string              `json:"isolate"`
    Isolated            string              `json:"isolated"`
    IgnoredPathFilterRe string              `json:"ignored_path_filter_re"`
    PathVariables       stringmapflag.Value `json:"path_variables"`
    ConfigVariables     stringmapflag.Value `json:"config_variables"`
    AllowMissingFileDir bool                `json:"allow_missing_file_dir"`

ArchiveOptions for archiving trees.

func (*ArchiveOptions) Init Uses

func (a *ArchiveOptions) Init()

Init initializes with non-nil values.

func (*ArchiveOptions) PostProcess Uses

func (a *ArchiveOptions) PostProcess(cwd string)

PostProcess post-processes the flags to fix any compatibility issue.

type ConfigSettings Uses

type ConfigSettings struct {
    // Files is the list of dependencies. The items use '/' as a path separator.
    Files []string
    // IsolateDir is the path where to start the command from.
    // It uses the OS' native path separator and it must be an absolute path.
    IsolateDir string

ConfigSettings represents the dependency variables for a single build configuration.

The structure is immutable.

type Configs Uses

type Configs struct {
    // ConfigVariables contains names only, sorted by name; the order is same as in byConfig.
    ConfigVariables []string
    // contains filtered or unexported fields

Configs represents a processed .isolate file.

Stores the file in a processed way, split by configuration.

At this point, we don't know all the possibilities. So mount a partial view that we have.

This class doesn't hold isolateDir, since it is dependent on the final configuration selected.

func LoadIsolateAsConfig Uses

func LoadIsolateAsConfig(isolateDir string, content []byte) (*Configs, error)

LoadIsolateAsConfig parses one .isolate file and returns a Configs instance.

  isolateDir: only used to load relative includes so it doesn't depend on
  value: is the loaded dictionary that was defined in the gyp file.

The expected format is strict, anything diverting from the format below will
result in error:
  'includes': [
  'conditions': [
    ['OS=="vms" and foo=42', {
      'variables': {
        'files': [
  'variables': {

func (*Configs) GetConfig Uses

func (c *Configs) GetConfig(cn configName) (*ConfigSettings, error)

GetConfig returns all configs that matches this config as a single ConfigSettings.

Returns nil if none apply.

Package isolate imports 24 packages (graph) and is imported by 3 packages. Updated 2020-12-06. Refresh now. Tools for package owners.