@@ -19,7 +19,9 @@ import (
1919 "github.com/sourcegraph/go-diff/diff"
2020 "github.com/sourcegraph/src-cli/internal/api"
2121 "github.com/sourcegraph/src-cli/internal/batches"
22+ "github.com/sourcegraph/src-cli/internal/batches/executor"
2223 "github.com/sourcegraph/src-cli/internal/batches/graphql"
24+ "github.com/sourcegraph/src-cli/internal/batches/service"
2325 "github.com/sourcegraph/src-cli/internal/output"
2426)
2527
@@ -189,7 +191,7 @@ func batchOpenFileFlag(flag *string) (io.ReadCloser, error) {
189191// batchExecute performs all the steps required to upload the campaign spec
190192// to Sourcegraph, including execution as needed. The return values are the
191193// spec ID, spec URL, and error.
192- func batchExecute (ctx context.Context , out * output.Output , svc * batches .Service , flags * batchApplyFlags ) (graphql.BatchSpecID , string , error ) {
194+ func batchExecute (ctx context.Context , out * output.Output , svc * service .Service , flags * batchApplyFlags ) (graphql.BatchSpecID , string , error ) {
193195 if err := checkExecutable ("git" , "version" ); err != nil {
194196 return "" , "" , err
195197 }
@@ -275,13 +277,12 @@ func batchExecute(ctx context.Context, out *output.Output, svc *batches.Service,
275277 task .Archive = fetcher .Checkout (task .Repository , task .ArchivePathToFetch ())
276278 }
277279
278- opts := batches. ExecutorOpts {
279- Cache : svc . NewExecutionCache ( flags .cacheDir ) ,
280+ opts := executor. Opts {
281+ TempDir : flags .tempDir ,
280282 Creator : workspaceCreator ,
281283 ClearCache : flags .clearCache ,
282284 KeepLogs : flags .keepLogs ,
283285 Timeout : flags .timeout ,
284- TempDir : flags .tempDir ,
285286 Parallelism : flags .parallelism ,
286287 }
287288
@@ -354,7 +355,7 @@ func batchExecute(ctx context.Context, out *output.Output, svc *batches.Service,
354355// batchParseSpec parses and validates the given batch spec. If the spec has
355356// validation errors, the errors are output in a human readable form and an
356357// exitCodeError is returned.
357- func batchParseSpec (out * output.Output , svc * batches .Service , input io.ReadCloser ) (* batches.BatchSpec , string , error ) {
358+ func batchParseSpec (out * output.Output , svc * service .Service , input io.ReadCloser ) (* batches.BatchSpec , string , error ) {
358359 spec , raw , err := svc .ParseBatchSpec (input )
359360 if err != nil {
360361 if merr , ok := err .(* multierror.Error ); ok {
@@ -400,7 +401,7 @@ func printExecutionError(out *output.Output, err error) {
400401 }
401402
402403 for _ , e := range errs {
403- if taskErr , ok := e .(batches .TaskExecutionErr ); ok {
404+ if taskErr , ok := e .(executor .TaskExecutionErr ); ok {
404405 block .Write (formatTaskExecutionErr (taskErr ))
405406 } else {
406407 if err == context .Canceled {
@@ -455,7 +456,7 @@ func flattenErrs(err error) (result []error) {
455456 return result
456457}
457458
458- func formatTaskExecutionErr (err batches .TaskExecutionErr ) string {
459+ func formatTaskExecutionErr (err executor .TaskExecutionErr ) string {
459460 if ee , ok := errors .Cause (err ).(* exec.ExitError ); ok && ee .String () == "signal: killed" {
460461 return fmt .Sprintf (
461462 "%s%s%s: killed by interrupt signal" ,
0 commit comments