Right, I'm aware that the code needs to either all be CPS or non-CPS.
That's why I'm trying to find a way to transform code to CPS at compile
time, so I don't have to load/parse that code at runtime if I want to have
it be able to take a closure as an argument in a Jenkinsfile.

Note also that the closure in question doesn't actually contain any CPS
code - it's a configuration format, for all intents and purposes, and I'd
actually prefer if I could have that closure as argument to a step not be
CPS transformed at all. But I see no way to do that but declaring the
closure in a NonCPS method and then returning that method as the argument
to the step.

A.
On Mar 30, 2016 11:25, "Jesse Glick" <jgl...@cloudbees.com> wrote:

> On Wed, Mar 30, 2016 at 2:08 PM, Andrew Bayer <andrew.ba...@gmail.com>
> wrote:
> > if you try to pass a Closure from CPS
> > context to a method in non-CPS-land, you get a CpsClosure and it doesn't,
> > well, work
>
> Nor could it possibly work. Non-CPS code may not ever call into CPS code.
>
> > get code that gets used by Pipeline code CPS transformed
>
> If you mean code that accepts closures, then this must be pulled up
> into the Pipeline Groovy code. Alternately, some code currently in
> Pipeline Groovy script could be marked `@NonCPS` (if it is never
> calling steps or CPS code), and could be pushed down into
> `src/main/groovy/` (or `src/main/java/`).
>
> Without any context, I cannot really tell what it is you are doing
> wrong and thus cannot offer more meaningful advice.
>
> --
> 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/CANfRfr0a4Qx%3D1FpBkXpZj0Hm_66%3D97CfmRrPwDfYDefs1%2BvxCA%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CAPbPdOZ2fwHKC7kW05HkNJm27%2Be0Z92vS5GN7HPO1BpD%3D%3DUhgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to