@Override public void afterSuccessfulReleaseVersionBuild() throws IOException, InterruptedException { AbstractBuildContext context = AbstractBuildContext.createContextFromMap(configuration); AbstractBuildContext.ReleaseManagementContext releaseManagementContext = context.releaseManagementContext; String labelChangeListId = configuration.get("repository.revision.number"); if (modifiedFilesForReleaseVersion) { log("Submitting release version changes"); labelChangeListId = currentChangeListId + ""; perforce.commitWorkingCopy(currentChangeListId, releaseManagementContext.getTagComment()); } else { safeRevertWorkingCopy(); currentChangeListId = perforce.getDefaultChangeListId(); } if (releaseManagementContext.isCreateVcsTag()) { log( "Creating label: '" + releaseManagementContext.getTagUrl() + "' with change list id: " + labelChangeListId); perforce.createTag( releaseManagementContext.getTagUrl(), releaseManagementContext.getTagComment(), labelChangeListId); tagCreated = true; } }
@Override public void buildCompleted(BuildContext buildContext) throws IOException, InterruptedException { AbstractBuildContext context = AbstractBuildContext.createContextFromMap(configuration); CurrentBuildResult result = buildContext.getBuildResult(); if (!BuildState.SUCCESS.equals(result.getBuildState())) { safeRevertWorkingCopy(); if (tagCreated) { safeDeleteLabel(context.releaseManagementContext.getTagUrl()); } } else { log("Closing connection to perforce server"); perforce.closeConnection(); } }
@Override public void afterDevelopmentVersionChange(boolean modified) throws IOException, InterruptedException { super.afterDevelopmentVersionChange(modified); AbstractBuildContext context = AbstractBuildContext.createContextFromMap(configuration); AbstractBuildContext.ReleaseManagementContext releaseManagementContext = context.releaseManagementContext; if (modified) { log("Submitting next development version changes"); perforce.commitWorkingCopy( currentChangeListId, releaseManagementContext.getNextDevelopmentComment()); } else { safeRevertWorkingCopy(); currentChangeListId = perforce.getDefaultChangeListId(); } }