It's all about the answers!

Ask a question

How to update RTC build engine status from inside a running java build process


Bruce Eifler (3912) | asked Dec 03 '13, 12:06 p.m.
retagged Dec 16 '13, 11:32 a.m. by David Lafreniere (4.8k7)
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();
      }
  }

One answer



permanent link
Jeff Care (1.0k3833) | answered Dec 03 '13, 2:39 p.m.
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.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.