public Iterable build()

in dotMemoryUnit-agent/src/main/java/jetbrains/buildServer/dotMemoryUnit/agent/DotMemoryUnitSetupBuilder.java [44:69]


  public Iterable<CommandLineSetup> build(@NotNull final CommandLineSetup baseSetup) {
    if(myAssertions.contains(RunnerAssertions.Assertion.PROFILING_IS_NOT_ALLOWED)) {
      return Collections.singleton(baseSetup);
    }

    final String dotMemoryUnitTool = myParametersService.tryGetRunnerParameter(Constants.USE_VAR);
    if (StringUtil.isEmptyOrSpaces(dotMemoryUnitTool) || !Boolean.parseBoolean(dotMemoryUnitTool)) {
      return Collections.singleton(baseSetup);
    }

    File toolPath = new File(myParametersService.getRunnerParameter(Constants.PATH_VAR), DOT_MEMORY_UNIT_EXE_NAME);
    if(!toolPath.isAbsolute()) {
      toolPath = new File(myFileService.getCheckoutDirectory(), toolPath.getPath());
    }

    myFileService.validatePath(toolPath);

    List<CommandLineResource> resources = new ArrayList<CommandLineResource>(baseSetup.getResources());
    final File projectFile = myFileService.getTempFileName(DOT_MEMORY_UNIT_PROJECT_EXT);
    final File outputFile = myFileService.getTempFileName(DOT_MEMORY_UNIT_OUTPUT_EXT);
    final File snapshotsDirectory = myFileService.getTempDirectory();
    final String projectFileContent = myDotMemoryUnitProjectGenerator.create(new DotMemoryUnitContext(baseSetup, snapshotsDirectory, outputFile));
    resources.add(new CommandLineFile(myBeforeBuildPublisher, projectFile, projectFileContent));
    resources.add(new CommandLineArtifact(myDotMemoryUnitPublisher, outputFile));
    return Collections.singleton(new CommandLineSetup(toolPath.getPath(), Collections.singletonList(new CommandLineArgument(projectFile.getPath(), CommandLineArgument.Type.PARAMETER)), resources));
  }