Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to add copyright headers to generated sources
How to add copyright headers to generated sources [message #793531] Wed, 08 February 2012 03:55 Go to next message
Harald M is currently offline Harald M
Messages: 10
Registered: March 2010
Junior Member
First I have to ask if I am allowed to add a copyright header to the generated Xtext sources.

Concerning the EMF generator I found a statement from Ed Merks
(see http://www.eclipse.org/forums/index.php/t/17839/).

Quote:
... in my opinion the input to the generator is your intellectual property, has your copyright and your license, and the generator injects nothing into the result. I.e., it's no different than a compiler generating byte code. This has always been my and IBM's position for the EMF generator, so for that I can make the statement definitively.

Is this also true for the Xtext generator?

Then the technical question:
Is there a recommended way to extend the generator to add a specific header to all generated files ?

Thanks in advance.
Harald
Re: How to add copyright headers to generated sources [message #793543 is a reply to message #793531] Wed, 08 February 2012 04:14 Go to previous messageGo to next message
Meinte Boersma is currently offline Meinte Boersma
Messages: 433
Registered: July 2009
Location: Leiden, Netherlands
Senior Member
A look at org.eclipse.xtext.xbase.compiler.JvmModelGenerator suggests there's no built-in way to do this. But you can always extend that (Xtend) class, override the generateType function to include a copyright header and re-bind the extended class to IGenerator in .ui project.

Re: How to add copyright headers to generated sources [message #793555 is a reply to message #793531] Wed, 08 February 2012 04:25 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
Registered: July 2009
Senior Member
Hi Harald,

you are free to add whatever header you want to your files. But as
Meinte already pointed out, there's currently no hook that explicitly
takes care of that. Please feel free to file a ticket.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 08.02.12 09:55, schrieb Harald M:
> First I have to ask if I am allowed to add a copyright header to the
> generated Xtext sources.
>
> Concerning the EMF generator I found a statement from Ed Merks
> (see http://www.eclipse.org/forums/index.php/t/17839/).
>
> Quote:
>> ... in my opinion the input to the generator is your intellectual
>> property, has your copyright and your license, and the generator
>> injects nothing into the result. I.e., it's no different than a
>> compiler generating byte code. This has always been my and IBM's
>> position for the EMF generator, so for that I can make the statement
>> definitively.
>
> Is this also true for the Xtext generator?
>
> Then the technical question:
> Is there a recommended way to extend the generator to add a specific
> header to all generated files ?
>
> Thanks in advance.
> Harald
>
Re: How to add copyright headers to generated sources [message #793611 is a reply to message #793555] Wed, 08 February 2012 05:47 Go to previous messageGo to next message
Alex Ruiz is currently offline Alex Ruiz
Messages: 103
Registered: March 2011
Senior Member
Probably we could extend a kind-of-similar one that I filed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=368296

Thoughts?

Thanks,
-Alex
Re: How to add copyright headers to generated sources [message #793822 is a reply to message #793611] Wed, 08 February 2012 11:07 Go to previous messageGo to next message
Harald M is currently offline Harald M
Messages: 10
Registered: March 2010
Junior Member
Thats a good idea.

I will file a feature request and add a reference to your ticket.

Thanks,
Harald
Re: How to add copyright headers to generated sources [message #870105 is a reply to message #793531] Sun, 06 May 2012 10:16 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias Böhm
Messages: 21
Registered: January 2012
Junior Member
Hi,

just wanted to follow up, has there anything been done on the topic of adding headers to generated files? The ticket that has been mentiones doesn't say it's been implemented.

Thanks,
Tobi
Re: How to add copyright headers to generated sources [message #870110 is a reply to message #870105] Sun, 06 May 2012 11:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6200
Registered: July 2009
Senior Member
What about simply adding a custom xpand post processor to the
generator component in the GenerateYourDsl.mwe2 workflow
Re: How to add copyright headers to generated sources [message #873054 is a reply to message #870110] Thu, 17 May 2012 08:19 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias Böhm
Messages: 21
Registered: January 2012
Junior Member
I'm not sure if I understand correctly but what about java files generated from my xtend files? Do I have influence on the generation process there?
Re: How to add copyright headers to generated sources [message #873073 is a reply to message #873054] Thu, 17 May 2012 09:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6200
Registered: July 2009
Senior Member
No,

i am talking about the Fragments that Generate the code using Xpand

~Christian
Re: How to add copyright headers to generated sources [message #888099 is a reply to message #873073] Sun, 17 June 2012 13:34 Go to previous messageGo to next message
Tobias Böhm is currently offline Tobias Böhm
Messages: 21
Registered: January 2012
Junior Member
Just to clarify, when I have a [name].xtend file in my workspace that, when changed, regenerates a corresponding [name].java file in the xtend-src firectory, that java file can't have a licence header added to it?
Re: How to add copyright headers to generated sources [message #888137 is a reply to message #888099] Sun, 17 June 2012 14:49 Go to previous message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6200
Registered: July 2009
Senior Member
Hi,

yes. at least if you do not want to add the header as part of the classes javadoc.

~Christian

[Updated on: Sun, 17 June 2012 14:52]

Report message to a moderator

Previous Topic:QualifiedName resolving
Next Topic:How to limit the global scope
Goto Forum:
  


Current Time: Thu Aug 21 08:09:37 EDT 2014

Powered by FUDForum. Page generated in 0.02765 seconds