Book a Demo

Author Topic: Source code engineering in batch mode  (Read 4468 times)

crepuscule31

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Source code engineering in batch mode
« on: September 10, 2014, 06:10:43 pm »
Hi,

   Is it possible do generate source code in batch mode, without a graphical interface, so that it can be integrated to a continous integration ?

  Thanks

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Source code engineering in batch mode
« Reply #1 on: September 10, 2014, 07:06:21 pm »
You can write a batch script that uses ProjectInterface.GenerateClass/Package to trigger code gen.

q.

crepuscule31

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Source code engineering in batch mode
« Reply #2 on: September 17, 2014, 06:20:41 pm »
Ok, thank you.
The problem is that I don't understant the format of the first argument that is "the GUID in XML format". What does that mean ?

I have tried some things like:
 -     "{42CC2FBC-522F-4110-9B62-10E907D03DF3}"
 - <guid>{42CC2FBC-522F-4110-9B62-10E907D03DF3}</guid>
- 42CC2FBC-522F-4110-9B62-10E907D03DF3
- ...

But nothing works.

Do you know the exact format for the GUID argument ?

Thank you  :)

crepuscule31

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Source code engineering in batch mode
« Reply #3 on: September 17, 2014, 07:00:41 pm »
I find project.GUIDtoXML that converts a GUID to the expected format.

Well.

But, the generation still does not work. GeneratePackage returns false and nothing is generated.

Does a log file exist ?
Any idea ?

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Source code engineering in batch mode
« Reply #4 on: September 17, 2014, 07:32:33 pm »
Does the manual generation work without issue?

q.

crepuscule31

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Source code engineering in batch mode
« Reply #5 on: September 17, 2014, 07:38:08 pm »
Yes, the manual generation works fine.

For information, my code is the following :

Code: [Select]
           Repository repository  = new Repository();
            
            Project project = repository.GetProjectInterface();
            
            String guidXML = project.GUIDtoXML("{A8917EA3-6FDE-42cf-A30E-1E061647082A}");
                        
            boolean b = project.GeneratePackage(guidXML,
                        "recurse=1;overwrite=1;dir=C:\\SDE");
            System.out.println(b);
            
            System.out.println("Repository exit...");
            r.Exit();
« Last Edit: September 17, 2014, 08:05:22 pm by crepuscule31 »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Source code engineering in batch mode
« Reply #6 on: September 17, 2014, 08:23:13 pm »
I have tried that here and had no issues. Can you try that with an almost empty test repository?

q.

crepuscule31

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Source code engineering in batch mode
« Reply #7 on: September 17, 2014, 08:43:42 pm »
The model is already very trivial as it is the model generated by EA when selecting "New Model" with just "Class" selected in Model Wizard.


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Source code engineering in batch mode
« Reply #8 on: September 17, 2014, 08:46:19 pm »
Can you send me the repository? I'd try here. You can find my mail address in the book links below.

q.

crepuscule31

  • EA Novice
  • *
  • Posts: 7
  • Karma: +0/-0
    • View Profile
Re: Source code engineering in batch mode
« Reply #9 on: September 17, 2014, 08:47:53 pm »
It works now... I wonder why it didn't work before !

Very thank you for your help.