in command.line/java/com/jetbrains/teamcity/command/RemoteRun.java [106:164]
public void execute(final Server server, Args args, final IProgressMonitor monitor) throws EAuthorizationException, ECommunicationException, ERemoteError, InvalidAttributesException {
myServer = server;
// comment
myComment = args.getArgument(MESSAGE_PARAM, MESSAGE_PARAM_LONG);
// wait/no wait for build result
if (args.hasArgument(NO_WAIT_SWITCH, NO_WAIT_SWITCH_LONG)) {
isNoWait = true;
}
// timeout
if (args.hasArgument(TIMEOUT_PARAM, TIMEOUT_PARAM_LONG)) {
myTimeout = Long.valueOf(args.getArgument(TIMEOUT_PARAM, TIMEOUT_PARAM_LONG));
} else {
myTimeout = DEFAULT_TIMEOUT;
}
// do not clean after run
myCleanoff = args.isCleanOff();
final TCWorkspace workspace = new TCWorkspace(getOverridingMatcher(args));
// collect files
final Collection<File> files = getFiles(args, monitor);
// collect TC files
final Collection<ITCResource> tcResources = getTCResources(workspace, files, monitor);
// prepare patch
final File patchFile = createPatch(tcResources, monitor);
// collect configurations for running
final Collection<String> requestedInternalIds = getRequestedConfigurations(args);
final Collection<String> internalIds = getApplicableConfigurations(requestedInternalIds, tcResources, monitor, args.hasArgument(FORCE_COMPATIBILITY_CHECK_SWITCH));
if (internalIds.isEmpty()) {
throw new IllegalArgumentException(String.format("No one of [%s] configurations affected by collected changes",
StringUtil.join(",", requestedInternalIds)));
}
// prepare changes list
final long chaneListId = myServer.createChangeList(patchFile, myComment, monitor);
Map<String, String> parameterMap = convertToMapAndUnescape(args.getArgValues(BUILD_PARAM_SWITCH));
// fire RR
scheduleRemoteRun(internalIds, chaneListId,
args.hasArgument(CHECK_FOR_CHANGES_EARLY_SWITCH),
args.hasArgument(FORCE_CLEAN_SWITCH),
args.hasArgument(REBUILD_DEPS_SWITCH),
parameterMap,
monitor);
// process result
if (isNoWait) {
myResultDescription = String.format("Build for Change %d scheduled successfully", chaneListId);
} else {
waitForSuccessResult(chaneListId, myTimeout, monitor);
myResultDescription = String.format("Build for Change %d run successfully", chaneListId);
}
}