11

Google's Dart language is not supported by any Web Browsers other than a special build of Chromium known as Dartium. To use Dart for production code you need to run it through a Dart->JavaScript compiler/translator and then use the outputted JavaScript in your web application.

Because JavaScript is an interpreted language everyone who receives the "binary"(Aka, the .js file) has also received the source code.

Now, the GNU General Public License v3.0 states that:

"The “source code” for a work means the preferred form of the work for making modifications to it."

Which would imply that the original Dart code in addition to the JavaScript code must also be provided to the end user. Does this mean that any web applications written in Dart must also provide the original Dart code to all visitors of their website even though a copy of the source code has already been provided in a human readable/writable/modifiable form?

Peter-W
  • 211
  • 1
  • 2
  • 3
    I wouldn't really call the .js file the "source code" any more than obfuscated js is "source code". Sure, it's still interpreted, but in no way is it the source code. It's more like the HTML output of a PHP script. Not sure how it works licensing-wise however. – Ben Brocka Aug 22 '12 at 13:56
  • When you say "Production Code", do you mean "Productized"? Internal use requires no source code release. Is the Dart code you are using based on someone else's GPL (or other) licensed code?, or is this all original code developed by you? The answer really depends on those details – Paul Aug 22 '12 at 16:45
  • 1
    You don't have to provide the source code to visitors if you run a GPL'd application. You only have to provide the source code if you **distribute** the application. (If it was AGPL'd then you had to provide source: http://www.gnu.org/licenses/why-affero-gpl.html) – JCasso Aug 22 '12 at 19:29
  • 1
    Assuming the application is running on a public facing web sever then is the code not being "distributed" to every visitor? Even if it's only downloaded by the browser to a temporary location before being executed. – Peter-W Aug 23 '12 at 12:28
  • @Peter-W I'd say the argument is technical and not clear-cut. That the browser downloads javascript is an implementation detail of sorts; most users aren't aware they have been "distributed" anything, whereas most users would understand getting a CD or downloading stuff counts as "distribution". In this case, the implementation mechanism is a distribution (to the browser, and temporary), which makes the whole issue unclear to me. **EDIT**: also, in a way js code is "bytecode" from the viewpoint of a Dart coder, isn't it? – Andres F. Aug 29 '12 at 17:20

4 Answers4

9

Yes, if the code is under the GPL and you deliver the outputted JavaScript, you must also provide the original Dart code. This would typically be done with a link to download the source code from your site but you could also embed it in a comment or something like that.

I think the easiest way to comply with the GPL in this case is to use option d for distributing the source

d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.

Essentially you do this when you include the JS file in your page

<script src="file.js" /><!-- source at http://example.com/path/to/modified/source/file.dart -->
Dirk Holsopple
  • 2,701
  • 18
  • 16
  • 2
    Please read my answer. Notice the remarks about GPL not requiring Original source to be released, only generated in this case. In this case, GPL would not require him to distribute, so the distribution mechanism doesn't matter. Like I said, other licenses have different rules. – Paul Aug 22 '12 at 16:36
  • 1
    I think GCC is an example. Since GCC is GPL and I use it to compile a "closed source" program, does that require that I release the original source? I believe the same would be true for any GPL "compiler" – Paul Aug 22 '12 at 16:42
  • @Paul dart2js isn't GPL, so the question clearly isn't about whether compiling non-GPL programs with dart2js is allowed. This is about programs that are themselves licensed under the GPL. Your answer is correct but it answers the wrong question. – Dirk Holsopple Aug 22 '12 at 17:33
  • Yep, it's not GPL. I was just saying that even it was GPL it still wouldn't matter. – Paul Aug 22 '12 at 18:36
  • 3
    This answer is wrong. Even if the Dart code is licensed under GPL you don't have to provide the Dart source code unless you **distribute** the application. Running a GPL'd application on a server does not require providing source code for that application. That is why there is another license named **AGPL**. For that specific purpose. – JCasso Aug 22 '12 at 19:22
  • 2
    @JCasso that would be true if the code were running on the server, but in the case of Dart the resulting object code is JavaScript which is distributed to the client in the vast majority of cases. Obviously, if you're doing something really weird like running JavaScript server-side, then it doesn't count as distribution. – Dirk Holsopple Aug 22 '12 at 19:37
  • 1
    @DirkHolsopple, since when allowing use of an online app (or a web site) counted as "distribution". Do you know when GPL applies? GPL is applied with this opening sentence: **This program is free software: you can *redistribute it and/or modify it* under the terms of the GNU General Public License..** – JCasso Aug 22 '12 at 19:57
  • 1
    @JCasso since you put it on a public facing server and let people download it. If someone's browser executes JavaScript from your site then they have downloaded it and you have distributed it. – Dirk Holsopple Aug 22 '12 at 20:22
  • 1
    @DirkHolsopple, do you know what Drupal is? Obviously Drupal contains lot's of javascript files. But they do not share your conclusion. Here read what they say: **Question: Do I have to give the code for my web site to anyone who visits it?** Answer: No. The GPL does not consider viewing a web site to count as "distributing", so you are not required to share the code running on your server. – JCasso Aug 22 '12 at 20:29
  • 3
    @JCasso that only applies to server-side code. From the same page: **Drupal's JavaScript, including the copy of jQuery that is included with Drupal, is itself under the GPL as well, so any Javascript that interacts with Drupal's JavaScript in the browser must also be under the GPL or a GPL compatible license.** – Dirk Holsopple Aug 22 '12 at 20:34
2

First of all we are talking about GPL, not AGPL.

If you do not distribute a GPL'd the application, if you run it on a server, you don't have to provide the source code. There is AGPL for that. GPL is all about distribution.

From Drupal FAQ:

Do I have to give the code for my web site to anyone who visits it?

No. The GPL does not consider viewing a web site to count as "distributing", so you are not required to share the code running on your server.http://drupal.org/licensing/faq/#q6

Please note that Drupal is licensed under GPL and contains js files (a lot).

From GNU:

The purpose of the GNU Affero GPL is to prevent a problem that affects developers of free programs that are often used on servers.

Suppose you develop and release a free program under the ordinary GNU GPL. If developer D modifies the program and releases it, the GPL requires him to distribute his version under the GPL too. Thus, if you get a copy of his version, you are free to incorporate some or all of his changes into your own version.

But suppose the program is mainly useful on servers. When D modifies the program, he might very likely run it on his own server and never release copies. Then you would never get a copy of the source code of his version, so you would never have the chance to include his changes in your version. You may not like that outcome.

Using the GNU Affero GPL avoids that outcome. If D runs his version on a server that everyone can use, you too can use it. Assuming he has followed the license requirement to let the server's users download the source code of his version, you can do so, and then you can incorporate his changes into your version. (If he hasn't followed it, you have your lawyer complain to him.) Source: http://www.gnu.org/licenses/why-affero-gpl.html

JCasso
  • 144
  • 6
  • 2
    But seeing as this is Dart, which is compiled to Javascript, and then executed as on the cilent, does this apply? – Winston Ewert Aug 22 '12 at 19:41
  • 1
    GPL is clear about that. If i give you an ubuntu cd i must provide you a way to get the source code. If i put ubuntu.iso to a fileserver also i must provide a download link (or something like that). This is called distribution. If you distribute it you have to provide the source code. But having an online app (on a server) is never counted "distribution". – JCasso Aug 22 '12 at 19:51
  • 1
    All true, but the question isn't discussing an online app, therefore I think your answer is irrelevant. – Winston Ewert Aug 22 '12 at 19:53
  • @WinstonEwert let me think. We are discussing a source code which will be converted to javascript and runs on a web browser and also it **is not an online app**. WOW! So it is an intranet app? Well you don't have provide the source code anyway. And did you read the last sentences of the question? I can swear that i read words such as web application and web site. Let me quote here: **Does this mean that any web applications written in Dart must also provide the original Dart code to all visitors of their website even though a copy of the source code has already been provided in ...** – JCasso Aug 22 '12 at 20:01
  • 3
    the point is that the code runs on the browser, not the server. Your answer is only meaningful if we are looking at code that runs on the server. But we aren't. We are looking at code that runs on client computers. If the code was executed on the server, you'd be right, it's not distribution. But because the code is download by the browser and run it is distribution and your answer is irreverent. – Winston Ewert Aug 22 '12 at 20:04
  • The point is it doesn't matter which CPU processes it! GPL is about distribution. Not what works on where. If you provide an online app, and only an online app. If you do not alow the user to download, if you do not send it via mail etc.. it does not mean that you distribute the application. This is really clear about GPL. – JCasso Aug 22 '12 at 20:14
  • @JCasso how do you propose to get the user's browser to execute the JavaScript without letting them download it? – Dirk Holsopple Aug 22 '12 at 20:24
  • 2
    Actually, I think it very much does matter which CPU processes it. If I run your code on my CPU, then by necessity, you've distributed your code to me. For all intents and purposes its exactly the same as if I downloaded a program and run it. The question has been discussed before: http://stackoverflow.com/questions/1239470/restrictions-of-gpl-on-javascript-libraries, http://programmers.stackexchange.com/questions/62869/how-is-client-side-javascript-covered-by-the-gpl. – Winston Ewert Aug 22 '12 at 20:26
  • 2
    Also, see the AGPL page you linked to. It explicitly discusses code executed on servers, not code executed on clients. If the author thought that GPL didn't apply to your javascript executed code, he'd have mentioned that in his discussion. – Winston Ewert Aug 22 '12 at 20:27
  • @WinstonEwert, i checked the your links the other questions. They are nothing more than upvoted answers. And you understood AGPL page wrong. There is no word on execution. According to you i got copies of google, stackexchange, stackoverflow, gnu web sites everyday. But... Drupal does not agree with you. It is released under GPL. Check my edit. – JCasso Aug 22 '12 at 20:36
  • 1
    @JCasso from the same page: **Drupal's JavaScript, including the copy of jQuery that is included with Drupal, is itself under the GPL as well, so any Javascript that interacts with Drupal's JavaScript in the browser must also be under the GPL or a GPL compatible license.** – Dirk Holsopple Aug 22 '12 at 20:38
  • 1
    @JCasso, The AGPL page **does** discuss execution, it refers to it as running the code **on the server**. Of course I'm not getting a complete copy of stackoverflow when I visit this site, but I do get a copy of the javascript for this site. Most of drupal is run on the server, and so is not distributed to the client. Its completely different for code which is run on the client. – Winston Ewert Aug 22 '12 at 20:44
  • 1
    As a final point see: ExtJS. It is GPL licensed, and for commercial projects you are supposed to pay for a commercial license. That only possibly works if downloading the javascript making up ExtJS counts as distribution. – Winston Ewert Aug 22 '12 at 21:17
1

In general, it really depends on the license. In your case, Dart is a bad example since it's BSD, and it seems GNU 3.0 covers the case you are talking about. As a non-lawyer I would interpret that quote as "The generated code isn't specifically covered"

Dart Home Page Refers to this: BSD License

So you question about GPL is moot

Also: GNU 3.0 License

Is there some way that I can GPL the output people get from use of my program? For example, if my program is used to develop hardware designs, can I require that these designs must be free? (#GPLOutput)

In general this is legally impossible; copyright law does not give you any say in the use of the output people make from their data using your program. If the user uses your program to enter or convert his own data, the copyright on the output belongs to him, not you. More generally, when a program translates its input into some other form,> the copyright status of the output inherits that of the input it was generated from.

So the only way you have a say in the use of the output is if substantial parts of the output are copied (more or less) from text in your program. For instance, part of the output of Bison (see above) would be covered by the GNU GPL, if we had not made an exception in this specific case.

You could artificially make a program copy certain text into its output even if there is no technical reason to do so. But if that copied text serves no practical purpose, the user could simply deletethat text from the output and use only the rest. Then he would not have to obey the conditions on redistribution of the copied text.

Paul
  • 730
  • 3
  • 13
  • 3
    The question is not about a Dart compiler which is GPL (which would BTW be irrelevant to program (compiler) output), but about a Dart program that is GPL'd. –  Aug 22 '12 at 14:30
  • 2
    @delnan I didn't read the question the same as you did. 1) See my 1st link, Dart is BSD. 2) If the Dara program was GPL'd he wouldn't ask the question. I read the question as him wanting to know if he was required to also release his Dart source code. Did you actually read my answer? – Paul Aug 22 '12 at 16:33
  • 2
    Well, you appear to be the only one who read it like that. While OP does not explicitly mention that the Dart program in question is GPL'd, nothing hints at him assuming the Dart compiler is GPL either, so I'm not willing to assume he did so little research. –  Aug 22 '12 at 16:39
  • Sorry so stretch this out... So if neither the Dart program is GPL and the Dart is BSD (really, it is, or at least the site says it is), then what is the question? If it's just about "Do I have to distribute A (GPL'd) when I want to release B (not GPL)", then it's a duplicate question – Paul Aug 22 '12 at 17:00
  • +1. This is the right answer. Even if Dart Compiler was GPL'd, this does not make any dart code to javascript code "a derivate work". – JCasso Aug 22 '12 at 17:00
  • 2
    @Paul My assumption, and everyone else's assumption, is the Dart program is in fact GPL'd. –  Aug 22 '12 at 17:01
  • @delnan, please... lets assume that Dart is GPL'd. Any language input (dart language) and corresponding javascript output means **derivative** work? – JCasso Aug 22 '12 at 17:11
  • This is the last paragraph of the question: **Does this mean that any web applications written in Dart must also provide the original Dart code to all visitors of their website even though a copy of the source code has already been provided in a human readable/writable/modifiable form?** – JCasso Aug 22 '12 at 17:13
  • @JCasso the title is this: **How does the GPL work in regards to languages like Dart which compile to other languages?** So it clearly means any GPL web applications written in Dart. No one is arguing that a GPL compiler's output has to be GPL. – Dirk Holsopple Aug 22 '12 at 18:42
  • @DirkHolsopple, please answer the full question. OK, you answered the "title". How about answering the last paragraph of the question. I did that. – JCasso Aug 22 '12 at 18:56
  • @JCasso given the context established in the title, the last paragraph is clearly asking the question that I answered which is whether GPL programs written in Dart have to distribute the Dart source when distributing the JS output. – Dirk Holsopple Aug 22 '12 at 19:09
  • Actually you are wrong anyway. Your answer is wrong. Even if the dart code is released under GPL and the op asks that, you don't have to provide the source code to visitors. GPL is about distribution. That is why there is AGPL. check http://www.gnu.org/licenses/gpl-faq.html#UnreleasedMods – JCasso Aug 22 '12 at 19:15
  • @JCasso as I said in my response, Dart is almost universally used as a client-side language, which requires distributing the object code to the client which means that you are still required to distribute the source if the application is GPL. – Dirk Holsopple Aug 22 '12 at 19:43
  • let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/4592/discussion-between-jcasso-and-dirk-holsopple) – JCasso Aug 22 '12 at 20:04
0

The basic question is:

Does including javascript on web page (e.g. referencing via a script tag) count as "Conveying" the GPLed work?

If it does, you must make the source available in the preferred form for modifying the code, if not you don't. In this case the preferred form is the original Dart source code used to generate the javascript.

I can't find an explicit answer to this question on the FSF site but Stallman's essay "The Javascript Trap" seems to indicate that he does consider it Conveying and as such you would have to make the original Dart source code available. See his note about allowing minified versions that do not include the text of the license but are still covered by the license.

See also this FAQ about javascript and templates for an exception that would allow templates to use GPLed javascript without being GPLed.

The absolute best way to know if what you want to do is compliant with the license is to ask the Copyright holder of the code, because only they have the right to enforce the license. They may have interpreted the license differently and be willing to add an exception to make their interpretation explicit.

Craig
  • 4,462
  • 3
  • 19
  • 13
  • Actually, that's not the question. If you read the question carefully, the OP assumes that you'd be required to distribute the javascript. Its only others on this question who've questioned that interpretation. The question is whether he has to also distribute the Dart code. – Winston Ewert Aug 29 '12 at 16:07
  • @WinstonEwert When I say "source code" I mean the original Dart source files used to generate the javascript. I will update my answer to make this clear. – Craig Aug 29 '12 at 16:56