Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Hudson » man page for plugin classes(looking for class documentation to write a plugin)
man page for plugin classes [message #938415] Tue, 09 October 2012 21:32 Go to next message
Suu Quan is currently offline Suu QuanFriend
Messages: 8
Registered: August 2012
Junior Member
Newbie here, trying to learn how to modify the HelloWorldBuilder.java plugin

It is a subclass of Builder that contains several objects: (cut/paste from another wiki)

Build - Object representing the build of the job being performed. Build in turn give access to important model objects like
Project - The buildable Job
Workspace - The folder where the build happens
Result - Result of the build until this build step
Launcher - Launcher which is used to launch the build of this job
BuildListener - An interface to communicate the status of the build steps being performed in this Builder and send any console message from this Build Step to Hudson

I would like to use those objects to extract information and act on it.

Where do I find documentation on those classes? (properties, interfaces...)

For example, I want to know the BUILD_ID (build number). If only I have the man page on those classes.

thanks
Re: man page for plugin classes [message #938474 is a reply to message #938415] Tue, 09 October 2012 22:57 Go to previous messageGo to next message
Steve Christou is currently offline Steve ChristouFriend
Messages: 125
Registered: June 2012
Location: Milwaukee, Wisconsin
Senior Member

Hi Suu,

http://hudson-ci.org/javadoc/ is the documentations page.

To grab the current build number, in the perform(AbstractBuild, Launcher, BuildListener) method insert the following:

build.getNumber();


/**
 * @author Steven Christou
 * @dev    Hudson-ci
 */
Re: man page for plugin classes [message #939084 is a reply to message #938474] Wed, 10 October 2012 12:13 Go to previous messageGo to next message
Suu Quan is currently offline Suu QuanFriend
Messages: 8
Registered: August 2012
Junior Member
Thanks Steve. Exactly what I need.

But that brought up another question: in your example, the Object itself is spelled "build" (as in build.getNumber()).
What about the spelling of the other objects: Project Workspace Result Launcher BuildListener ?

is it as simple as the same as the class but starting in lower case (as in "workspace") or need to call a function like getWorkspace()as in getWorkspace().doThis() ?
Re: man page for plugin classes [message #939154 is a reply to message #939084] Wed, 10 October 2012 13:29 Go to previous messageGo to next message
Suu Quan is currently offline Suu QuanFriend
Messages: 8
Registered: August 2012
Junior Member
in HelloWorldBuilder.java, is the "build" object predefined somewhere? because I do not see a definition of it (as in build = new Build(...))

Or is there a class method I can call to get it, as in build = getBuild(...) ?

Same question for the other objects of the class Project Workspace Result Launcher BuildListener
Re: man page for plugin classes [message #939317 is a reply to message #939154] Wed, 10 October 2012 16:38 Go to previous messageGo to next message
Steve Christou is currently offline Steve ChristouFriend
Messages: 125
Registered: June 2012
Location: Milwaukee, Wisconsin
Senior Member

The build prarmeter is not defined as build = new Build, but it is passed in as a value into the perform method. If you look at the method perform it declares an AbstractBuild as build, so we can use the variable build within the perform method.

Project - If you want to get the project you can do build.getProject() which returns the parent project to the current build.

Workspace - To get the workspace for the current build you can do build.getWorkspace() which returns the workspace for the current build. There is another method to get the workspace which is build.getProject().getWorkspace() which is deprecated and should not be used because when building a project concurrently if the workspace changes it will just obtain the last build workspace instead of the build workspace.

Result Launcher - I don't believe you need to invoke this, it should automatically invoke the Result Launcher as long as you leave the perform method. If you would like to get results from the builder and put them in some result set I would advise creating a new class and extending either Recorder or Publisher class.

BuildListener - Build Listener is obtained from the perform method declaration just like AbstractBuild, but the BuildListener is called listener.


/**
 * @author Steven Christou
 * @dev    Hudson-ci
 */
Re: man page for plugin classes [message #940731 is a reply to message #939317] Thu, 11 October 2012 23:13 Go to previous message
Suu Quan is currently offline Suu QuanFriend
Messages: 8
Registered: August 2012
Junior Member
Thanks Sir,
dumb of me not to read the subroutine signature
Previous Topic:JDK Insatllation
Next Topic:svn post commit hook does not trigger any job
Goto Forum:
  


Current Time: Thu Apr 18 13:12:06 GMT 2024

Powered by FUDForum. Page generated in 0.02506 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top