How to update RTC build engine status from inside a running java build process
Our team intends to invoke a java build process from ANT via the RTC build engine. We would like to be able to update the status of the build with a very granular detailed status throughout the course of the build process.
To do this I have attempted to use the teamBuildClient.startBuildActivity to substitute for the ANT task "startBuildActivity". A code snippit appears below. It compiles properly however I have several questions.
The two lines below are not complete because I don't know how to get the values =>
IProgressMonitor progressMonitor = null;//***Don't know how to get this ***
final String parentId = null;//***Don't know how to get this ***
Please let me know if I am on the right track with this code.
Also please provide a link to some source example to help me with this.
Thanks
Here is the code:
private void myTest( String[] args )
{
buildResultUUID = args[3];// ***BDE
System.out.println( "buildResultUUID=" + buildResultUUID );
repositoryAddress = args[4];// ***BDE
System.out.println( "repositoryAddress=" + repositoryAddress );
userId = args[5];// ***BDE
System.out.println( "userId=" + userId );
passwordFile = args[6];// ***BDE
System.out.println( "passwordFile=" + passwordFile );
final boolean autoComplete = Boolean.parseBoolean( args[7] );// ***BDE
System.out.println( "autocomplete=" + autocomplete );
IClientLibraryContext iClientLibraryContext = null;
TeamBuildClient teamBuildClient = new TeamBuildClient( iClientLibraryContext );
IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(
com.ibm.team.repository.common.UUID.valueOf( buildResultUUID ), null );
final String label = "This is a status message";
IProgressMonitor progressMonitor = null;//***Don't know how to get this ***
final String parentId = null;//***Don't know how to get this ***
try
{
String out = teamBuildClient.startBuildActivity( buildResultHandle, label, parentId, autoComplete,
progressMonitor );
System.out.println("Output="+out);
}
catch (Exception e)
{
e.printStackTrace();
}
}
To do this I have attempted to use the teamBuildClient.startBuildActivity to substitute for the ANT task "startBuildActivity". A code snippit appears below. It compiles properly however I have several questions.
The two lines below are not complete because I don't know how to get the values =>
IProgressMonitor progressMonitor = null;//***Don't know how to get this ***
final String parentId = null;//***Don't know how to get this ***
Please let me know if I am on the right track with this code.
Also please provide a link to some source example to help me with this.
Thanks
Here is the code:
private void myTest( String[] args )
{
buildResultUUID = args[3];// ***BDE
System.out.println( "buildResultUUID=" + buildResultUUID );
repositoryAddress = args[4];// ***BDE
System.out.println( "repositoryAddress=" + repositoryAddress );
userId = args[5];// ***BDE
System.out.println( "userId=" + userId );
passwordFile = args[6];// ***BDE
System.out.println( "passwordFile=" + passwordFile );
final boolean autoComplete = Boolean.parseBoolean( args[7] );// ***BDE
System.out.println( "autocomplete=" + autocomplete );
IClientLibraryContext iClientLibraryContext = null;
TeamBuildClient teamBuildClient = new TeamBuildClient( iClientLibraryContext );
IBuildResultHandle buildResultHandle = (IBuildResultHandle)IBuildResult.ITEM_TYPE.createItemHandle(
com.ibm.team.repository.common.UUID.valueOf( buildResultUUID ), null );
final String label = "This is a status message";
IProgressMonitor progressMonitor = null;//***Don't know how to get this ***
final String parentId = null;//***Don't know how to get this ***
try
{
String out = teamBuildClient.startBuildActivity( buildResultHandle, label, parentId, autoComplete,
progressMonitor );
System.out.println("Output="+out);
}
catch (Exception e)
{
e.printStackTrace();
}
}
One answer
You shouldn't need to worry about the progress monitor; at worst you can use NullProgressMonitor if necessary.
Each activity has an ID; I don't know this particular API but I assume that the return value of teamBuildClient.startBuildActivity is the ID of the activity that was started. Activities can be subordinate to a parent (renders as nested activities in the UI), so if you want one activity to appear nested within another you need to supply the parent. It should be optional.
Each activity has an ID; I don't know this particular API but I assume that the return value of teamBuildClient.startBuildActivity is the ID of the activity that was started. Activities can be subordinate to a parent (renders as nested activities in the UI), so if you want one activity to appear nested within another you need to supply the parent. It should be optional.