package jetbrains.buildServer.agent.rakerunner; import jetbrains.buildServer.RunBuildException; import jetbrains.buildServer.agent.BuildRunnerContext; import jetbrains.buildServer.agent.rakerunner.utils.EnvironmentPatchableMap; import jetbrains.buildServer.agent.rakerunner.utils.FileUtil2; import org.jetbrains.annotations.NotNull; import java.util.HashMap; import java.util.Map; /** * @author Vladislav.Rassokhin */ public class ModifiableRunnerContext { @NotNull private final Map myRunnerParameters; @NotNull private final Map myBuildParameters; @NotNull private final EnvironmentPatchableMap myEnvParameters; @NotNull private final String myCheckoutDirectory; @NotNull private final String myWorkingDirectory; public ModifiableRunnerContext(@NotNull final BuildRunnerContext origin) throws RunBuildException { myRunnerParameters = new HashMap(origin.getRunnerParameters()); myBuildParameters = new HashMap(origin.getBuildParameters().getAllParameters()); myEnvParameters = new EnvironmentPatchableMap(origin.getBuildParameters().getEnvironmentVariables()); myCheckoutDirectory = FileUtil2.getCanonicalPath(origin.getBuild().getCheckoutDirectory()); myWorkingDirectory = FileUtil2.getCanonicalPath(origin.getWorkingDirectory()); } @NotNull public Map getRunnerParameters() { return myRunnerParameters; } @NotNull public Map getBuildParameters() { return myBuildParameters; } @NotNull public EnvironmentPatchableMap getEnvParameters() { return myEnvParameters; } @NotNull public String getCheckoutDirectory() { return myCheckoutDirectory; } @NotNull public String getWorkingDirectory() { return myWorkingDirectory; } }