/** Invoked after the Ant has finished running, and in the master, not in the Ant process. */ void end(Launcher launcher) throws IOException, InterruptedException { for (Map.Entry<ModuleName, ProxyImpl2> e : sourceProxies.entrySet()) { ProxyImpl2 p = e.getValue(); for (Publisher publisher : modulePublishers.get(e.getKey())) { // we'd love to do this when the module build ends, but doing so requires // we know how many task segments are in the current build. publisher.perform(p.owner(), launcher, listener); p.appendLastLog(); } p.close(); } }
public void testPublisher() throws IOException, InterruptedException { AbstractBuild<?, ?> build = createBuild(15, GregorianCalendar.getInstance()); File root = SystemUtils.getJavaIoTmpDir(); FilePath rootPath = new FilePath(root); final AbstractProject<?, ?> project = mock(AbstractProject.class); stub(project.getRootDir()).toReturn(root); stub(project.getModuleRoot()).toReturn(rootPath); Publisher publisher = new FreestylePublisher("reports.xml", "", "", "100", "10") { protected AbstractProject getProject(AbstractBuild build) { return project; } }; publisher.perform(build, null, null); }
public synchronized void checkPendingDownstream( AbstractBuild<?, ?> owner, TaskListener listener) { if (pendingDownstreamProjects.isEmpty()) { listener.getLogger().println("All downstream projects complete!"); Result threshold = this.evenIfDownstreamUnstable ? Result.UNSTABLE : Result.SUCCESS; if (this.overallResult.isWorseThan(threshold)) { listener.getLogger().println("Minimum result threshold not met for join project"); } else { // Construct a launcher since CopyArchiver wants to get the // channel from it. We use the channel of the node where the // splitProject was built on. final Launcher launcher = new NoopLauncher(listener, owner); for (Publisher pub : this.joinPublishers) { try { pub.perform(owner, launcher, (BuildListener) listener); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } if (!JoinTrigger.canDeclare(owner.getProject())) { List<AbstractProject> projects = Items.fromNameList(joinProjects, AbstractProject.class); for (AbstractProject project : projects) { listener.getLogger().println("Scheduling join project: " + project.getName()); project.scheduleBuild(new JoinCause(owner)); } } } } else { listener .getLogger() .println( "Project " + owner.getProject().getName() + " still waiting for " + pendingDownstreamProjects.size() + " builds to complete"); } }