Hi,

I'm working on updating the Flowdock plugin to support pipeline and am 
getting hung up in how to map some of the old calls to the new API.  In 
general, I've gone through and replaced AbstractProject with Run<?, ?>. 
 I've got a few hangups that I was hoping that someone with direct 
knowledge could help me through.

I have this:

    *public* *static* ChatMessage fromBuild(Run<?, ?> build, BuildResult 
buildResult, TaskListener listener) {

        ChatMessage msg = *new* ChatMessage();

        StringBuilder content = *new* StringBuilder();

        String projectName = "";

        String configuration = "";

       

       *if*(build.getProject().getRootProject() != build.getProject()) {

           projectName = build.getProject().getRootProject().getDisplayName
();

           configuration = " on " + build.getProject().getDisplayName();

       } *else* {

           projectName = build.getProject().getDisplayName();

       }

>From the call, I've switched the fromBuild method to take Run<?,?> instead 
of AbstractProject, but the issue is that I'm not clear on what needs to be 
done in the conditional.  The existing code seems to be trying to figure 
out if it is the root project in order to construct the message (which will 
be sent to flowdock) but I'm not sure what the equivalent would be when 
working from Run instead of AbstractProject.

I have a similar problem with trying to figure out ChangeSets here, 
although it looks like I found some code on this forum to go after the 
changesets via reflection.

    *public* *static* List<Entry> parseCommits(Run<?, ?> build) {

        *final* ChangeLogSet<? *extends* Entry> cs = build.getChangeSet();

        *if*(cs == *null* || cs.isEmptySet())

           *return* *null*;

        List<Entry> commits = *new* ArrayList();

        *for* (*final* Entry entry : cs) {

           // reverse order in order to have recent commits first

           commits.add(0, entry);

       }

        *return* commits;

   }

Thanks for any suggestions!
Tim

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-dev/a2b2c6d0-5aaa-45f2-ba3d-dcad7caabfb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to