On Thu, Aug 7, 2014 at 6:10 AM, pallen <[email protected]> wrote:
> I'm trying to update the Perforce 'p4' plugin to use Run/Job and not the old
> AbstractBuild/AbstractProject

Great!

https://github.com/jenkinsci/workflow-plugin/blob/master/scm-step/README.md#supporting-workflow-from-an-scm-plugin

> but can't seem to access the SCM without an ugly cast.
>
> AbstractBuild<?, ?> build = (AbstractBuild<?, ?>) run;
> AbstractProject<?, ?> project = build.getProject();
> PerforceScm scm = (PerforceScm) project.getScm();

You can in fact get a List<SCM> using SCMTriggerItem, but if you are
trying to do this you are probably doing something wrong to begin
with. Why do you not already have access to the SCM object in this
context? I see some usages in PerforceScm.java, which makes no sense
since it could just use ‘this’. ReviewProperty could use
SCMTriggerItem. P4ChangeParser is invoked by
PerforceScm.createChangeLogParser, so the latter just needs to pass a
reference to itself along rather than jumping back up into the project
configuration.

> Not all the methods seem to have been moved over: poll() and buildEnvVars()
> still use the older classes.

buildEnvVars has indeed not been updated; it is not clear that it
needs to be, since its behavior seems to be specific to
AbstractProject semantics with a single SCM invoked at a predefined
time.

poll(…) was not updated since it is not implementable by the SCM
anyway, and it is just a convenience used by AbstractProject. You just
need to override the new versions of compareRemoteRevisionWith and
calcRevisionsFromBuild.

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to