Author Topic: Source code synchronization  (Read 186 times)


  • EA Novice
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Source code synchronization
« on: July 20, 2012, 12:51:35 am »
Good afternoon,

I'm trying to build an application that will be run as a post build step in our continuous integration server so that, everytime a code check-in is performed, EA rebuilds the class diagrams from the source code and exports the results in html and xmi format.

In order to get familiar with the API, I wrote an app that performs the following steps:
1) Creates a new eap file (RepositoryClass::CreateModel).
2) Opens the eap file (RepositoryClass::OpenFile).
3) Imports the source code directory into the package (ImportDirectory).
4) Laids out the diagrams contained inside the package (LayoutDiagramEx).
5) Exports the HTML report (RunHTMLReport).
6) Exports the XMI report (ExportPackageXMI).

The problem I'm experiencing now is that I need to be able to store two models in my solution: one that will contain the diagrams automatically generated from the source code and another one that will contain models made by me using EA. I modified my app so that it performs the following steps:

1) Opens an existing eap file (which was created with the previous version of the app).
2) Imports the source code directory into the only package contained inside the file.
3) Laids out the diagrams contained inside the package.
4) Exports the HTML report.
5) Exports the XMI report.

The result I'm getting from the new app is that the diagrams for my model are now duplicated! Now, my understanding is that in the last parameter of the ImportDirectory method I can specify some ExtraOptions. According to the documentation, the only available option is "recurse" and I'm wondering whether there's an undocumented option in order to let EA know that it should overwrite the existing diagram during an import instead of creating a new one. I know this can be done from EA's GUI, but I'm not sure whether this functionality is exposed in the API.

I've also tried using the SynchronizePackage method on an already imported package and, although it works fine for source files that have already been imported, it cannot detect whether a new source file has been added to a previously imported directory.

Can you give me some advice on how can I fix this?

Thanks in advance,