1

Currently I perform a manual import of my code base via the context menu Code Engineering > Import Source Directory of my model in Enterprise Architect.

Now I would like to automate this and make our Team Foundation Server 2015 perform this import action as soon as the build process succeeds.

Is this possible? How can I achieve that?

EDIT: Our code base is written in C#, we're importing recursively over subdirectories, we do not want logical diagrams for each package, we want to see private members in EA, we want to have packages per namespace, we opted for synchronization of existing classes and we want to have classes not found in code to be removed.

David
  • 2,426
  • 3
  • 24
  • 36
  • 1
    Is there a way to automate Enterprise Architect from the commandline? Or through an API? There is no built-in thing in TFS to do this for you, so you'll have to build something. – jessehouwing Apr 18 '16 at 12:50
  • @jessehouwing The [Enterprise Architect Object Model](http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/theautomationinterface.html) looks promising... – David Apr 19 '16 at 11:13

1 Answers1

1

Big question, almost too big. But yes, it is possible, and here are some overall pointers. There's nothing in EA or TFS to do this for you out of the box, so overall pointers is all I can give.

You can either write a trigger which executes in the context of TFS and, using the EA API, connects to the appropriate EA repository and performs the necessary import there.

Or you can write an EA Add-In (which executes in the context of EA), which subscribes to some TFS event and performs the import.

EA's API is reasonably well documented, but where EA falls down is that it doesn't have good server-side automation -- it essentially assumes that every session always has a user. So I would recommend integrating your solution into TFS rather than EA.

You'd need to set up an EA project, and create a package in it to hold the imported code.

You connect to an EA project by creating an EA.Repository object and calling Repository.OpenFile().

Then you call Repository.GetProjectInterface() to obtain an EA.Project object, on which you call Project.ImportDirectory().

Uffe
  • 10,396
  • 1
  • 33
  • 40
  • Big answer :) and I think it will get me up and running in very little time... Let me have a look at it. – David Apr 18 '16 at 13:19
  • Where can I find detailed info on which parameters to pass to `ImportDirectory` ([EA's Project Class Reference](http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/automation/project_2.html) is not concise about these) in my case (see edit)? – David Apr 18 '16 at 13:47
  • That's pretty much what you get in the API documentation. For details on any one call, the [user forum](http://sparxsystems.com/forums/smf/index.php/) or SO are your best bets (but please don't edit this question, ask new ones instead). Also please note that your link points to the documentation for version 9.3, whereas the current version is 12.1. – Uffe Apr 18 '16 at 13:56
  • This is the link to [EA's Project Class Reference](http://www.sparxsystems.com/enterprise_architect_user_guide/12/automation_and_scripting/project_2.html) for version 12 which unfortunately doesn't specify more... – David Apr 18 '16 at 14:06
  • I posted a [follow-up question](http://stackoverflow.com/questions/36716607/in-which-format-do-i-have-to-pass-arguments-to-project-importdirectory) concerning the parameters of `ImportDirectory`. – David Apr 19 '16 at 11:16