CCnet preprocessor on dynamic parameters

174 views Asked by At

I'm very frustrated about a config problem in CCnet concerning parameter and preprocessor. It's hard to get some documentation on ccnet, and I fell like I'm on a bug so, I thought I could ask you guys :

I need to separate the minor and major version inside a CCnet project

This works great inside a task :

  <cb:define version="1.25"></cb:define>

  <cb:define name="version2">
        <cb:eval expr="'$(version)'.split('.')[0]" />
  </cb:define>

I get a clean result of $(version2) = "1" (version is splitted ok)

BUT using parameters, it's not working :

<cb:define name="version2">
    <cb:eval expr="'$[versionParam]'.split('.')[0]" />
</cb:define>

If versionParam is "1.25", result is "1.25"

No split is done. The param seems to be processed but not recognized as a string.

Could someone please tell me what I'm doing wrong or perhaps a better way to do this ?

1

There are 1 answers

1
Adam Bruss On

The ccnet config file is loaded one time at ccnet startup and set in stone until a restart of the ccnet service/exe. You can't have dynamic expressions like 'expr' based on incoming ccnet parameter values. You're better off sending versionParam to a Nant target in the ccnet tasks section and parsing it there. I'm assuming you're doing more work with 'expr' later anyway.