protected List<MavenAbstractArtifactRecord> getArtifactRecordActions(MavenModuleSetBuild build) { List<MavenAbstractArtifactRecord> actions = Lists.newArrayList(); for (MavenBuild moduleBuild : build.getModuleLastBuilds().values()) { MavenAbstractArtifactRecord action = moduleBuild.getAction(MavenAbstractArtifactRecord.class); if (action != null) { actions.add(action); } } return actions; }
/** * {@link MavenArtifactRecord}s of every module build contributed to {@link #parent}. */ @Exported(inline=true) public List<MavenArtifactRecord> getModuleRecords() { List<MavenArtifactRecord> r = new ArrayList<MavenArtifactRecord>(); for (MavenBuild build : parent.getModuleLastBuilds().values()) { MavenArtifactRecord mar = build.getAction(MavenArtifactRecord.class); if(mar!=null) r.add(mar); } return r; }
protected List<MavenAbstractArtifactRecord> getActions(AbstractBuild<?, ?> build, BuildListener listener) { List<MavenAbstractArtifactRecord> actions = new ArrayList<MavenAbstractArtifactRecord>(); if (!(build instanceof MavenModuleSetBuild)) { return actions; } for (Entry<MavenModule, MavenBuild> e : ((MavenModuleSetBuild)build).getModuleLastBuilds().entrySet()) { MavenAbstractArtifactRecord a = e.getValue().getAction( MavenAbstractArtifactRecord.class ); if (a == null) { listener.getLogger().println("No artifacts are recorded for module" + e.getKey().getName() + ". Is this a Maven project?"); } else { actions.add( a ); } } return actions; }
public void deploy(MavenEmbedder embedder, ArtifactRepository deploymentRepository, TaskListener listener) throws MavenEmbedderException, IOException, ComponentLookupException, ArtifactDeploymentException { if(debug) listener.getLogger().println("Redeploying artifacts of "+parent+" timestamp="+parent.getTimestamp()); for (MavenBuild build : parent.getModuleLastBuilds().values()) { MavenArtifactRecord mar = build.getAction(MavenArtifactRecord.class); if(mar!=null) { if(debug) listener.getLogger().println("Deploying module: "+build+" timestamp="+build.getTimestamp()); mar.deploy(embedder,deploymentRepository,listener); } } } }
protected List<MavenAbstractArtifactRecord> getActions(AbstractBuild<?, ?> build, BuildListener listener) { List<MavenAbstractArtifactRecord> actions = new ArrayList<>(); MavenModuleSetBuild mavenBuild = getMavenBuild(build); if (mavenBuild == null) { return actions; } for (Entry<MavenModule, MavenBuild> e : mavenBuild.getModuleLastBuilds().entrySet()) { MavenAbstractArtifactRecord a = e.getValue().getAction( MavenAbstractArtifactRecord.class ); if (a == null) { listener.getLogger().println("No artifacts are recorded for module" + e.getKey().getName() + ". Is this a Maven project?"); } else { actions.add( a ); } } return actions; }
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; }
public boolean perform(AbstractBuild<?,?> build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { MavenModuleSetBuild msb = (MavenModuleSetBuild) build; Map<MavenModule, MavenBuild> moduleLastBuilds = msb.getModuleLastBuilds(); for (MavenBuild moduleBuild : moduleLastBuilds.values()) { SurefireReport report = moduleBuild.getAction(SurefireReport.class); if (report == null) { continue; } List<Data> data = new ArrayList<Data>(); if (getTestDataPublishers() != null) { for (TestDataPublisher tdp : getTestDataPublishers()) { Data d = tdp.getTestData(moduleBuild, launcher, listener, report.getResult()); if (d != null) { data.add(d); } } } if (!data.isEmpty()) { report.setData(data); moduleBuild.save(); } } return true; }
for (Map.Entry<MavenModule, MavenBuild> e : mavenModuleSetBuild.getModuleLastBuilds().entrySet()) { MavenBuild moduleBuild = e.getValue(); if (moduleBuild != null) { AbstractBuild<?, ?> prevModuleBuild = prevBuild.getModuleLastBuilds().get(e.getKey()); if (prevModuleBuild.getResult() == null) { prevModuleBuild = BuildUtil.getPreviousBuiltBuild(prevModuleBuild);
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); } } }
private void init() { for (MavenBuild b: mavenBuild.getModuleLastBuilds().values()) { ViolationsBuildAction a = b.getAction(ViolationsBuildAction.class); if (a == null || a.getReport() == null) {
private void init() { for (MavenBuild b: mavenBuild.getModuleLastBuilds().values()) { ViolationsBuildAction a = b.getAction(ViolationsBuildAction.class); if (a == null || a.getReport() == null) {
private void init() { for (MavenBuild b: mavenBuild.getModuleLastBuilds().values()) { ViolationsBuildAction a = b.getAction(ViolationsBuildAction.class); if (a == null || a.getReport() == null) {
protected void post2(BuildListener listener) throws Exception { // asynchronous executions from the build might have left some unsaved state, // so just to be safe, save them all. for (MavenBuild b : getModuleLastBuilds().values()) b.save(); // at this point the result is all set, so ignore the return value if (!performAllBuildSteps(listener, project.getPublishers(), true)) setResult(FAILURE); if (!performAllBuildSteps(listener, project.getProperties(), true)) setResult(FAILURE); // aggregate all module fingerprints to us, // so that dependencies between module builds can be understood as // dependencies between module set builds. // TODO: we really want to implement this as a publisher, // but we don't want to ask for a user configuration, nor should it // show up in the persisted record. MavenFingerprinter.aggregate(MavenModuleSetBuild.this); }
protected void post2(BuildListener listener) throws Exception { // asynchronous executions from the build might have left some unsaved state, // so just to be safe, save them all. for (MavenBuild b : getModuleLastBuilds().values()) b.save(); // at this point the result is all set, so ignore the return value if (!performAllBuildSteps(listener, project.getPublishers(), true)) setResult(FAILURE); if (!performAllBuildSteps(listener, project.getProperties(), true)) setResult(FAILURE); // aggregate all module fingerprints to us, // so that dependencies between module builds can be understood as // dependencies between module set builds. // TODO: we really want to implement this as a publisher, // but we don't want to ask for a user configuration, nor should it // show up in the persisted record. MavenFingerprinter.aggregate(MavenModuleSetBuild.this); }
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); }
if (!didVecctorCASTRun(moduleSetBuild.getModuleLastBuilds().values())) { listener.getLogger().println("Skipping VecctorCAST coverage report as mojo did not run."); return true;
for (Run r : ((MavenModuleSetBuild)src).getModuleLastBuilds().values()) ok |= perform(r, build, expandedFilter, targetDir, baseTargetDir, console); return ok;
for (Iterator<MavenBuild> it = ((MavenModuleSetBuild)src).getModuleLastBuilds().values().iterator(); it.hasNext(); ) {