Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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?

share|improve this question
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: 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
add comment

4 Answers

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 -->
share|improve this answer
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
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
1  
@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
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
show 5 more comments

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.

share|improve this answer
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. –  delnan 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. –  delnan 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
2  
@Paul My assumption, and everyone else's assumption, is the Dart program is in fact GPL'd. –  delnan Aug 22 '12 at 17:01
show 9 more comments

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

share|improve this answer
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
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
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: stackoverflow.com/questions/1239470/…, programmers.stackexchange.com/questions/62869/…. –  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
show 8 more comments

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.

share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.