Exemplo n.º 1
0
 /** 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);
  }
Exemplo n.º 3
0
  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");
    }
  }
Exemplo n.º 4
0
  protected void submit(StaplerRequest req, StaplerResponse rsp)
      throws IOException, ServletException, FormException {
    super.submit(req, rsp);
    JSONObject json = req.getSubmittedForm();

    rootPOM = Util.fixEmpty(req.getParameter("rootPOM").trim());
    if (rootPOM != null && rootPOM.equals("pom.xml")) rootPOM = null; // normalization

    goals = Util.fixEmpty(req.getParameter("goals").trim());
    alternateSettings = Util.fixEmpty(req.getParameter("alternateSettings").trim());
    mavenOpts = Util.fixEmpty(req.getParameter("mavenOpts").trim());
    mavenName = req.getParameter("maven_version");
    aggregatorStyleBuild = !req.hasParameter("maven.perModuleBuild");
    usePrivateRepository = req.hasParameter("maven.usePrivateRepository");
    ignoreUpstremChanges = !json.has("triggerByDependency");
    incrementalBuild = req.hasParameter("maven.incrementalBuild");
    archivingDisabled = req.hasParameter("maven.archivingDisabled");

    reporters.rebuild(req, json, MavenReporters.getConfigurableList());
    publishers.rebuild(req, json, BuildStepDescriptor.filter(Publisher.all(), this.getClass()));
    buildWrappers.rebuild(req, json, BuildWrappers.getFor(this));
  }
 /**
  * Gets the build steps.
  *
  * @return the build steps.
  */
 public static List<Descriptor<? extends BuildStep>> getBuildSteps() {
   List<Descriptor<? extends BuildStep>> list = new ArrayList<Descriptor<? extends BuildStep>>();
   addTo(Builder.all(), list);
   addTo(Publisher.all(), list);
   return list;
 }
Exemplo n.º 6
0
 public static List<Descriptor<Publisher>> getPublisherDescriptors(AbstractProject<?, ?> project) {
   return BuildStepDescriptor.filter(Publisher.all(), project.getClass());
 }