3 Replies Last post: Nov 12, 2009 5:16 PM by Pavel Sher  
Gabriel Dogaru Newbie 13 posts since
Aug 24, 2009
Currently Being Moderated

Oct 20, 2009 12:26 PM

Add "Clean all files before build " programtically

Hi,

 

I want to add the "Clean all files before build " flag to a jetbrains.buildServer.serverSide.SBuildType

 

I saw there is a method  boolean isCleanBuild(); but no setter.

 

I tried setOption(new BooleanOption("cleanBuild", true),true) but nothing happened.

 

Also, I need to add "swabra.mode", "swabra.after.build", but I guess it is done the same way since in the project-config.xml they both appear under options

 

Thanks.

Pavel Sher JetBrains 2,081 posts since
Mar 6, 2008
Currently Being Moderated
Oct 20, 2009 1:52 PM in response to: Gabriel Dogaru
Re: Add "Clean all files before build " programtically

Try:

buildType.setOption(SBuildType.BT_CLEAN_BUILD, true);

 

If you want this option to be persisted, add this too:

buildType.getProject().persist();

 

"swabra.mode" and "swabra.after.build" are runner parameters (i.e. parameters which should be passed to build runner on the agent), to set them use:

buildType.addRunParameter(new SimpleParameter("swabra.mode", "true"));

 

BTW if Swabra plugin is enabled there is no need to set clean build option.

Pavel Sher JetBrains 2,081 posts since
Mar 6, 2008
Currently Being Moderated
Nov 12, 2009 5:16 PM in response to: Gabriel Dogaru
Re: Add "Clean all files before build " programtically

To update build number pattern use:

 

buildType.getBuildNumbers().setBuildNumberPattern(pattern)

buildType.getBuildNumbers().persist();

 

As for VcsTrigger - this is not a part of open API, and most likely will change in the future (in fact VcsTrigger API has already changed in 5.0). But if you really need it you can do the following:

// iterate over build type triggers and find jetbrains.buildServer.buildTriggers.vcs.VcsTrigger using instanceof

buildType.getBuildTriggers()

 

// use method setIncludeRules() to set collection of rules:

vcsTrigger.setIncludeRules(list<string>)

 

Note that this method is named differently in 5.0.

 

Do not forget to call persist after the settings change.

More Like This

  • Retrieving data ...