Class CommandLineBuildService

    • Constructor Detail

      • CommandLineBuildService

        public CommandLineBuildService()
    • Method Detail

      • initialize

        public final void initialize​(@NotNull
                                     AgentRunningBuild build,
                                     @NotNull
                                     BuildRunnerContext runner)
                              throws RunBuildException
        Makes the second phase of initialization. Called by TeamCity. Derived classes should not call or override this method. The signature of this method may change in the future versions.
        Parameters:
        build - build on agent
        runner - runner context containing actual parameters for the run
        Throws:
        RunBuildException - to break the build
      • afterInitialized

        public void afterInitialized()
                              throws RunBuildException
        called after the service is initialized and all necessary dependencies are injected. Derived classes should not perform any significant activities or use TeamCity infrastructure until initialization is completed and this method is called.
        Throws:
        RunBuildException - to break the build
      • beforeProcessStarted

        public void beforeProcessStarted()
                                  throws RunBuildException
        this method is called before creation commandline preparation started
        Throws:
        RunBuildException - to break the build
      • getListeners

        @NotNull
        public java.util.List<ProcessListener> getListeners()
        Build process event listeners

        To log all process output to the build log consider using LoggingProcessListener

        To log only latest lines from class

        Returns:
        build process event listener if needed
      • interrupt

        @NotNull
        public TerminationAction interrupt()
        called only if build is about to be interrupted by TeamCity.
        Returns:
        the way to stop the process on interruption event
      • getRunResult

        @NotNull
        public BuildFinishedStatus getRunResult​(int exitCode)
        This method is called if process was not interrupted by build agent. In case build was interrupted, that method may not be called. NOTE. If a build is not interrupted this method is called only once. If a build is interrupted, this method is not called at all. This is a good place to run any post-build activity the computes some BuildFinishedStatus. If you do not need changing BuildFinishedStatus consider using afterProcessFinished() method instead. This method is called strictly after afterProcessFinished() NOTE: The result of this method depends on AgentRunningBuild.getFailBuildOnExitCode(), if you need more predictable behaviour, override this method.
        Parameters:
        exitCode - started process exit code
        Returns:
        final build status
      • createExitCodeBuildProblem

        @NotNull
        @Deprecated
        public static BuildProblemData createExitCodeBuildProblem​(int exitCode,
                                                                  @NotNull
                                                                  java.lang.String runType,
                                                                  @Nullable
                                                                  java.lang.String processFlowId)
        Deprecated.
        since 2018.1.1: use ExitCodeProblemBuilder instead
      • logBuildProblem

        protected final void logBuildProblem​(BuildProblemData buildProblem)
      • isCommandLineLoggingEnabled

        public boolean isCommandLineLoggingEnabled()
        Returns:
        if true, TeamCity will print the full command line string into the build log. True by default.
      • getBuild

        @NotNull
        protected final AgentRunningBuild getBuild()
        Returns:
        current AgentRunningBuild instance
      • getRunnerContext

        @NotNull
        protected final BuildRunnerContext getRunnerContext()
        Returns:
        current BuildRunnerContext instance associated with build
      • getLogger

        @NotNull
        public final BuildProgressLogger getLogger()
        Returns:
        current running build progress logger
      • getFlowLogger

        @NotNull
        public final FlowLogger getFlowLogger()