@Override public Result call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getResult(); } }
/** {@inheritDoc} */ public Result call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getResult(); } }
/** {@inheritDoc} */ public Result call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getResult(); } }
@Override public Result call(final MavenBuild mavenBuild) throws IOException, InterruptedException { return mavenBuild.getResult(); } }
public void setResult(Result result) { if (!isBuilding()) { LOGGER.log(Level.WARNING, "JENKINS-25406: illegal attempt to change result from {0} to {1} after {2} finished building", new Object[] {getResult(), result, MavenBuild.this}); return; } MavenBuild.this.setResult(result); }
private Result computeResult() { Result r = super.getResult(); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("Current result is: " + r); } for (MavenBuild b : getModuleLastBuilds().values()) { Result br = b.getResult(); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("Module result is: " + br + " for " + b.getParent().getGroupId() + ":" + b.getParent().getArtifactId()); } if (r == null) { r = br; } else if (br == Result.NOT_BUILT || br == Result.ABORTED) { if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("Result not updated: " + r); } continue; // UGLY: when computing combined status, ignore the modules that were not built } else if (br != null) { r = r.combine(br); } if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest("New result is: " + r); } } return r; }
/** * Displays the combined status of all modules. * <p> * More precisely, this picks up the status of this build itself, * plus all the latest builds of the modules that belongs to this build. */ @Override public Result getResult() { Result r = super.getResult(); for (MavenBuild b : getModuleLastBuilds().values()) { Result br = b.getResult(); if(r==null) r = br; else if(br==Result.NOT_BUILT) continue; // UGLY: when computing combined status, ignore the modules that were not built else if(br!=null) r = r.combine(br); } return r; }
/** * Returns the estimated duration for this builds. * Takes only the modules into account which are actually being build in * case of incremental builds. */ @Override public long getEstimatedDuration() { if (!project.isIncrementalBuild()) { return super.getEstimatedDuration(); } long result = 0; Map<MavenModule, List<MavenBuild>> moduleBuilds = getModuleBuilds(); for (List<MavenBuild> builds : moduleBuilds.values()) { if (!builds.isEmpty()) { MavenBuild build = builds.get(0); if (build.getResult() != Result.NOT_BUILT && build.getEstimatedDuration() != -1) { result += build.getEstimatedDuration(); } } } result += estimateModuleSetBuildDurationOverhead(3); return result != 0 ? result : -1; }
public void deploy() throws IOException, InterruptedException, NoSuchAlgorithmException { listener.getLogger().println("Deploying artifacts to " + artifactoryServer.getUrl()); Map<MavenModule, MavenBuild> mavenBuildMap = mavenModuleSetBuild.getModuleLastBuilds(); for (Map.Entry<MavenModule, MavenBuild> mavenBuildEntry : mavenBuildMap.entrySet()) { MavenBuild mavenBuild = mavenBuildEntry.getValue(); Result result = mavenBuild.getResult(); if (Result.NOT_BUILT.equals(result)) { // HAP-52 - the module build might be skipped if using incremental build listener.getLogger().println( "Module: '" + mavenBuildEntry.getKey().getName() + "' wasn't built. Skipping."); continue; } listener.getLogger().println("Deploying artifacts of module: " + mavenBuildEntry.getKey().getName()); MavenArtifactRecord mar = ActionableHelper.getLatestMavenArtifactRecord(mavenBuild); MavenArtifact mavenArtifact = mar.mainArtifact; // deploy main artifact debuggingLogger.fine("Deploying main artifact: " + artifactToString(mavenArtifact, mavenBuild)); deployArtifact(mavenBuild, mavenArtifact); if (!mar.isPOM() && mar.pomArtifact != null && mar.pomArtifact != mar.mainArtifact) { // deploy the pom if the main artifact is not the pom debuggingLogger.fine("Deploying pom artifact: " + artifactToString(mavenArtifact, mavenBuild)); deployArtifact(mavenBuild, mar.pomArtifact); } // deploy attached artifacts for (MavenArtifact attachedArtifact : mar.attachedArtifacts) { debuggingLogger.fine("Deploying attached artifact: " + artifactToString(mavenArtifact, mavenBuild)); deployArtifact(mavenBuild, attachedArtifact); } } }
noModuleBuildsYet = false; MavenBuild build = builds.get(0); if (build.getResult() != Result.NOT_BUILT && build.getEstimatedDuration() != -1) { result += build.getEstimatedDuration();
private void gatherModuleAndDependencyInfo(MavenModuleSetBuild mavenModulesBuild) { Map<MavenModule, MavenBuild> mavenBuildMap = mavenModulesBuild.getModuleLastBuilds(); List<Module> modules = Lists.newArrayList(); for (Map.Entry<MavenModule, MavenBuild> moduleBuild : mavenBuildMap.entrySet()) { MavenModule mavenModule = moduleBuild.getKey(); MavenBuild mavenBuild = moduleBuild.getValue(); Result result = mavenBuild.getResult(); if (Result.NOT_BUILT.equals(result)) { // HAP-52 - the module build might be skipped if using incremental build continue; } MavenArtifactRecord mar = ActionableHelper.getLatestMavenArtifactRecord(mavenBuild); String moduleId = mavenModule.getName() + ":" + mavenModule.getVersion(); ModuleBuilder moduleBuilder = new ModuleBuilder().id(moduleId); // add artifacts moduleBuilder.addArtifact(toArtifact(mar.mainArtifact)); if (!mar.isPOM() && mar.pomArtifact != null && mar.pomArtifact != mar.mainArtifact) { moduleBuilder.addArtifact(toArtifact(mar.pomArtifact)); } for (MavenArtifact attachedArtifact : mar.attachedArtifacts) { moduleBuilder.addArtifact(toArtifact(attachedArtifact)); } addDependencies(moduleBuilder, mavenBuild); modules.add(moduleBuilder.build()); } buildInfo.setModules(modules); }
/** * Called whenever a new module build is completed, to update the aggregated * report. When multiple builds complete simultaneously, Hudson serializes * the execution of this method, so this method needs not be * concurrency-safe. * * @param moduleBuilds * Same as <tt>MavenModuleSet.getModuleBuilds()</tt> but provided * for convenience and efficiency. * @param newBuild * Newly completed build. */ public void update(final Map<MavenModule, List<MavenBuild>> moduleBuilds, final MavenBuild newBuild) { MavenResultAction<T> additionalAction = newBuild.getAction(getIndividualActionType()); MavenModule project = newBuild.getProject(); if (additionalAction != null && !getModules().contains(project)) { T existingResult = delegate.getResult(); T additionalResult = additionalAction.getResult(); if (newBuild.getResult().isBetterThan(Result.FAILURE) || additionalResult.getPluginResult().isWorseOrEqualTo(Result.FAILURE)) { getModules().add(project); setResult(createAggregatedResult(existingResult, additionalResult)); copySourceFilesToModuleBuildFolder(newBuild); } } }
/** * Called whenever a new module build is completed, to update the aggregated * report. When multiple builds complete simultaneously, Jenkins serializes * the execution of this method, so this method needs not be * concurrency-safe. * * @param moduleBuilds * Same as <tt>MavenModuleSet.getModuleBuilds()</tt> but provided * for convenience and efficiency. * @param newBuild * Newly completed build. */ @Override public void update(final Map<MavenModule, List<MavenBuild>> moduleBuilds, final MavenBuild newBuild) { MavenResultAction<T> additionalAction = newBuild.getAction(getIndividualActionType()); MavenModule project = newBuild.getProject(); if (additionalAction != null && !getModules().contains(project)) { T existingResult = delegate.getResult(); T additionalResult = additionalAction.getResult(); if (newBuild.getResult().isBetterThan(Result.FAILURE) || additionalResult.getPluginResult().isWorseOrEqualTo(Result.FAILURE)) { getModules().add(project); setResult(createAggregatedResult(existingResult, additionalResult)); copySourceFilesToModuleBuildFolder(newBuild); } } }
LOGGER.log(Level.FINER, "adding {0} to changedModules for {1} because we have never seen this module before", new Object[] {moduleName, MavenModuleSetBuild.this}); changedModules.add(moduleName); } else if (mb.getPreviousBuiltBuild().getResult().isWorseThan(Result.SUCCESS)) { LOGGER.log(Level.FINER, "adding {0} to changedModules for {1} because the previous build failed or was unstable", new Object[] {moduleName, MavenModuleSetBuild.this}); changedModules.add(moduleName);
|| (mb.getPreviousBuiltBuild().getResult().isWorseThan(Result.SUCCESS))) { changedModules.add(m.getModuleName().toString());