Class DefaultBuildManager

  • All Implemented Interfaces:
    BuildManager

    @Singleton
    public class DefaultBuildManager
    extends java.lang.Object
    implements BuildManager
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getGopath()
      Get GOPATH in this build.
      java.util.List<java.nio.file.Path> getGopaths()
      Get GOPATH as a list.
      int go​(java.util.List<java.lang.String> args, java.util.Map<java.lang.String,​java.lang.String> env)
      Fork a go process and run commands specified by args, under the environments comprised by env + GOPATH/GOROOT/GOARCH/GOEXE, where env has higher priority.
      int go​(java.util.List<java.lang.String> args, java.util.Map<java.lang.String,​java.lang.String> env, java.util.function.Consumer<java.lang.String> stdoutLineConsumer, java.util.function.Consumer<java.lang.String> stderrLineConsumer)
      Fork a go process and run commands specified by args, under the environments comprised by env + GOPATH/GOROOT/GOARCH/GOEXE, where env has higher priority.
      int go​(java.util.List<java.lang.String> args, java.util.Map<java.lang.String,​java.lang.String> env, java.util.function.Consumer<java.lang.String> stdoutLineConsumer, java.util.function.Consumer<java.lang.String> stderrLineConsumer, boolean continueOnFailure)  
      void prepareProjectGopathIfNecessary()
      Determine GOPATH to be used.
      int run​(java.util.List<java.lang.String> args, java.util.Map<java.lang.String,​java.lang.String> env, java.util.function.Consumer<java.lang.String> stdoutLineConsumer, java.util.function.Consumer<java.lang.String> stderrLineConsumer)
      Fork a process and run commands specified by args, under the environments comprised by env + GOPATH/GOROOT/GOARCH/GOEXE, where env has higher priority.
      int run​(java.util.List<java.lang.String> args, java.util.Map<java.lang.String,​java.lang.String> env, java.util.function.Consumer<java.lang.String> stdoutLineConsumer, java.util.function.Consumer<java.lang.String> stderrLineConsumer, boolean continueOnFailure)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • prepareProjectGopathIfNecessary

        public void prepareProjectGopathIfNecessary()
        Description copied from interface: BuildManager
        Determine GOPATH to be used. If global GOPATH doesn't exist, a project-level GOPATH will be prepared.
        Specified by:
        prepareProjectGopathIfNecessary in interface BuildManager
      • go

        public int go​(java.util.List<java.lang.String> args,
                      java.util.Map<java.lang.String,​java.lang.String> env)
        Description copied from interface: BuildManager
        Fork a go process and run commands specified by args, under the environments comprised by env + GOPATH/GOROOT/GOARCH/GOEXE, where env has higher priority.
        Specified by:
        go in interface BuildManager
        Parameters:
        args - the arguments to be passed to go
        env - extra environment variables to be passed to go
        Returns:
        return code of go command
      • go

        public int go​(java.util.List<java.lang.String> args,
                      java.util.Map<java.lang.String,​java.lang.String> env,
                      java.util.function.Consumer<java.lang.String> stdoutLineConsumer,
                      java.util.function.Consumer<java.lang.String> stderrLineConsumer)
        Description copied from interface: BuildManager
        Fork a go process and run commands specified by args, under the environments comprised by env + GOPATH/GOROOT/GOARCH/GOEXE, where env has higher priority.

        Stdout and stderr line of the forked process will be consumed by stdoutLineConsumer and stderrLineConsumer line by line, respectively.

        Return code of the forked process will be consumed by retcodeConsumer.

        Specified by:
        go in interface BuildManager
        Parameters:
        args - the arguments to be passed to go
        env - extra environment variables to be passed to go
        stdoutLineConsumer - the consumer by which stdout line is consumed
        stderrLineConsumer - the consumer by which stderr line is consumed
        Returns:
        return code of go command
      • go

        public int go​(java.util.List<java.lang.String> args,
                      java.util.Map<java.lang.String,​java.lang.String> env,
                      java.util.function.Consumer<java.lang.String> stdoutLineConsumer,
                      java.util.function.Consumer<java.lang.String> stderrLineConsumer,
                      boolean continueOnFailure)
        Specified by:
        go in interface BuildManager
      • run

        public int run​(java.util.List<java.lang.String> args,
                       java.util.Map<java.lang.String,​java.lang.String> env,
                       java.util.function.Consumer<java.lang.String> stdoutLineConsumer,
                       java.util.function.Consumer<java.lang.String> stderrLineConsumer)
        Description copied from interface: BuildManager
        Fork a process and run commands specified by args, under the environments comprised by env + GOPATH/GOROOT/GOARCH/GOEXE, where env has higher priority.

        Stdout and stderr line of the forked process will be consumed by stdoutLineConsumer and stderrLineConsumer line by line, respectively.

        Return code of the forked process will be consumed by retcodeConsumer.

        Specified by:
        run in interface BuildManager
        Parameters:
        args - the arguments start a process
        env - extra environment variables to be passed to go
        stdoutLineConsumer - the consumer by which stdout line is consumed
        stderrLineConsumer - the consumer by which stderr line is consumed
        Returns:
        return code of go command
      • run

        public int run​(java.util.List<java.lang.String> args,
                       java.util.Map<java.lang.String,​java.lang.String> env,
                       java.util.function.Consumer<java.lang.String> stdoutLineConsumer,
                       java.util.function.Consumer<java.lang.String> stderrLineConsumer,
                       boolean continueOnFailure)
        Specified by:
        run in interface BuildManager
      • getGopath

        public java.lang.String getGopath()
        Description copied from interface: BuildManager
        Get GOPATH in this build.
        Specified by:
        getGopath in interface BuildManager
        Returns:
        the GOPATH to be used
      • getGopaths

        public java.util.List<java.nio.file.Path> getGopaths()
        Description copied from interface: BuildManager
        Get GOPATH as a list.
        Specified by:
        getGopaths in interface BuildManager
        Returns:
        the list of GOPATHs