IBM Support

Automating code generation and build process using the IBM Rational Rhapsody API

Question & Answer


Question

How to automate code generation and build process using the Rational Rhapsody API ?

Answer

Rhapsody code generation and build process can be scripted using Rhapsody APIs.The script can then be either executed within Rhapsody as a helper or outside Rhapsody from a batch file. Below is a code snippet that uses the set of basic APIs used for generating and building a Rhapsody component.


    IRPApplication app = RhapsodyAppServer.getActiveRhapsodyApplication();

    // Loads project

    IRPProject prj = app.openProject("C:\\Rhapsody\\Rhapsody7501\\TestAPI\\TestAPI.rpy");

    //IRPProject prj = app.activeProject();

    // set active component

    prj.setActiveComponent("TestComp");

    // set active configuration

    prj.setActiveConfiguration("TestConfig");

    //generate configuration with dependencies

    app.generateWithDependencies();

    // builds component

    app.buildWithDependencies();




[{"Product":{"code":"SSB2MU","label":"IBM Engineering Systems Design Rhapsody"},"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Component":"General Information","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5.0.1;7.5","Edition":"","Line of Business":{"code":"LOB59","label":"Sustainability Software"}}]

Product Synonym

Rational Rhapsody

Document Information

Modified date:
27 May 2022

UID

swg21409178