github.com/getgauge/gauge@v1.6.9/execution/executionInfo.go (about)

     1  /*----------------------------------------------------------------
     2   *  Copyright (c) ThoughtWorks, Inc.
     3   *  Licensed under the Apache License, Version 2.0
     4   *  See LICENSE in the project root for license information.
     5   *----------------------------------------------------------------*/
     6  
     7  package execution
     8  
     9  import (
    10  	"github.com/getgauge/gauge/gauge"
    11  	"github.com/getgauge/gauge/logger"
    12  	"github.com/getgauge/gauge/manifest"
    13  	"github.com/getgauge/gauge/plugin"
    14  	"github.com/getgauge/gauge/runner"
    15  )
    16  
    17  type executionInfo struct {
    18  	manifest        *manifest.Manifest
    19  	specs           *gauge.SpecCollection
    20  	runner          runner.Runner
    21  	pluginHandler   plugin.Handler
    22  	errMaps         *gauge.BuildErrors
    23  	inParallel      bool
    24  	numberOfStreams int
    25  	tagsToFilter    string
    26  	stream          int
    27  }
    28  
    29  func newExecutionInfo(s *gauge.SpecCollection, r runner.Runner, ph plugin.Handler, e *gauge.BuildErrors, p bool, stream int) *executionInfo {
    30  	m, err := manifest.ProjectManifest()
    31  	if err != nil {
    32  		logger.Fatal(true, err.Error())
    33  	}
    34  	return &executionInfo{
    35  		manifest:        m,
    36  		specs:           s,
    37  		runner:          r,
    38  		pluginHandler:   ph,
    39  		errMaps:         e,
    40  		inParallel:      p,
    41  		numberOfStreams: NumberOfExecutionStreams,
    42  		tagsToFilter:    TagsToFilterForParallelRun,
    43  		stream:          stream,
    44  	}
    45  }
    46  
    47  func (executionInfo *executionInfo) getExecutor() suiteExecutor {
    48  	if executionInfo.inParallel {
    49  		return newParallelExecution(executionInfo)
    50  	}
    51  	return newSimpleExecution(executionInfo, true, false)
    52  }