krasa / EclipseCodeFormatter

IntelliJ plugin - use Eclipse's code formatter directly from IntelliJ. https://plugins.jetbrains.com/plugin/6546
Apache License 2.0
484 stars 118 forks source link

Re-introduce bundled eclipse #237

Closed LumnitzF closed 2 years ago

LumnitzF commented 2 years ago

The main dependency org.eclipse.jdt.core is now referenced in the eclipseLibs pom, which will download it and package it together with its dependencies in the eclipse.jar. The manual eclipse download and repackaging is not required anymore. Only the dependency version must be updated and mvn package executed. No license or about.html is removed, only the plugin.xml

LumnitzF commented 2 years ago

@howlger I would greatly appreciate it, if you could give a short notice whether the EPL is still violated with this approach

LumnitzF commented 2 years ago

Fixes: #230, #232 and #233

howlger commented 2 years ago

@howlger I would greatly appreciate it, if you could give a short notice whether the EPL is still violated with this approach

Maybe I overlooked something, but this change looks to me like the recovering of the EPL violation. I don't see that the EPL has been added, neither in the Git repository nor into the product. It still seems to be falsely claimed that everything would be under the Apache 2.0 License (in both, in the Git repository and the product). No links to the projects and source code neither. Please be aware that the repacking into a fat JAR (which seems not be necessary) is a modification that needs to be published as well and which causing the plugin.xml and META-INF/MANIFEST.MF files to be removed.

Keep in mind that someone may be interested not to use it, but in the libraries used, to e.g. build something similar. Or someone wants to contribute to one of the libraries. For this purpose, it should be made clear which library is being developed by which project, under which license, and where the source code can be found: "the Contributor must accompany the Program with a statement that the Source Code for the Program is available under this Agreement, and informs Recipients how to obtain it in a reasonable manner on or through a medium customarily used for software exchange".

Disclaimer: I'm not an intellectual property expert and can just tell how I understand the EPL and what makes sense to me. I have reported the violation, assuming the report would be helpful and welcomed. Neither have I used the project, nor will I. I do not want to spend further time on this project. So please ask others. If in doubt, you can also ask the Eclipse Foundation.

jmiserez commented 2 years ago

IANAL (and this is not legal advice), so no guarantees for the statements below. I'm not affiliated with Eclipse JDT.

The EPL-2.0 FAQ seems to state that just a reference to the source code needs to be included when you "compile it without modification", and the full license text and source code if you make modifications. From the EPL-2.0 FAQ:

4.17. If I take a Program licensed under the EPL, compile it without modification, and commercially license the result, do I need to include the source code with the object code distribution? No. But you do need to include a statement indicating where the source code is available and information on how to obtain it. The source code may be provided by you, or you may choose to provide a reference to where the source code originated from, such as the correct repository hosted at git.eclipse.org.

4.21. If I modify a Program licensed under the EPL and distribute the object code of the modified Program, must I make the source code available?

Yes. By distributing the modified Program, even if it is only a free version of the object code, you are obligated to make the source code to the modified Program available to others.

I'm not sure if using the maven-shade-plugin on an already compiled jar with a plugin.xml exclusion counts as a modification. But the modified source code can be generated quite easily by using the maven-shade-plugin option <createSourcesJar>. You should probably include both the EPL-2.0 license and a link to the Eclipse repository in any case.

I think the conditions may be satisfied if these 3 things are done (but no guarantees!):

  1. Add the file https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html to the folder lib/eclipse
  2. Add a short README containing a link to https://git.eclipse.org/c/jdt/eclipse.jdt.core.git/tree/org.eclipse.jdt.core to the folder lib/eclipse
  3. Add <createSourcesJar>true</createSourcesJar> after the line <minimizeJar>true</minimizeJar> in the pom.xml, and commit the generated eclipse-sources.jar.

Then the license, reference to it, and the source code would all be included.

jmiserez commented 2 years ago

Sorry the formatting for point 3 was off, the relevant eclipseLibs/pom.xml section would look like this:

<execution>
    <phase>package</phase>
    <goals>
        <goal>shade</goal>
    </goals>
    <configuration>
        <minimizeJar>true</minimizeJar>
        <createSourcesJar>true</createSourcesJar>
        <finalName>eclipse</finalName>
        <outputDirectory>${project.basedir}/../../lib/eclipse</outputDirectory>
    </configuration>
</execution>
howlger commented 2 years ago

@jmiserez I don't think this would be legal for the reasons already stated before. Why do you refuse to make it clear which library is developed by which project, under which license, and where the source code can be found?

LumnitzF commented 2 years ago

@jmiserez Thank you for your suggestions. I implemented them and added the respective files. For me (IANAL) it looks like the requirements made by EPL-2.0 are now matched.

In addition I added a prominent note in the main README, which states that this plugin uses code licensed under EPL-2.0. I think it is clear now, which projects are used under which license and where the source code can be found.

jmiserez commented 2 years ago

@jmiserez I don't think this would be legal for the reasons already stated before. Why do you refuse to make it clear which library is developed by which project, under which license, and where the source code can be found?

@howlger What specifically do you think is missing in order to comply with the EPL-2.0 license requirements? All that is required is that the terms of the license(s) of all involved libraries are followed, as far as I see the suggestions should cover those (again, no guarantees).

Note that (i) a .jar really is nothing more than a renamed zip file (although I assume you know this already), and both the source code, license(s) and object code are all now present.

Also note that (ii) some of the JDT code itself is Apache 2.0 licensed (see the about_files folder in the eclipse.jar).

If I understand your argument correctly, you seem to be saying that having just the Apache 2.0 license in the LICENSE file is some sort of problem as it would imply that everything in the repository is licensed as Apache 2.0 including the eclipse.jar? It is my understanding (again, IANAL) that this is not the case, and I don't see where the EPL-2.0 states that there should be a notice in the root directory of any projects redistributing the code. The license of the 3rd party code doesn't just change (and it usually cannot), so the terms of the EPL-2.0 license have to be followed regardless of this plugins license.

The newly added README in the parent directory of eclipse.jar makes this quite clear: https://github.com/krasa/EclipseCodeFormatter/pull/237/commits/11bf25982e437cff9a422a614438e9fb5109beac (EDIT: And the sentence added to the main README.markdown here: https://github.com/krasa/EclipseCodeFormatter/pull/237/commits/a52752d2f749e5d88e74c70653401e7700df19cd)

Are you perhaps proposing to move the contents of that README into the root README.markdown file? That's really all I can think of. There's a few different possible approaches listed e.g. here.

This project is free, open-source and developed in good faith, used by many developers around the world, and the EPL-2.0 explicitly allows using and redistributing the code for the formatter. I would be very surprised if the Eclipse Foundation were to take issue with it in general, but of course I agree that it must follow the terms of all the licenses involved.

It would really help if you could be more specific in what you think would additionally be required to get this PR merged.

jmiserez commented 2 years ago

@LumnitzF I just noticed there are a few other jars in the libs/ folder. I had not looked at the licenses for those. bare-bones-browser-launch-3.1.jar seems to be "Public Domain Software -- Free to Use as You Like" (and the full sources are inside the jar), Objenesis is version 1.2 (so Apache 2.0, only older versions are MIT) and the others are all Apache 2.0.

LumnitzF commented 2 years ago

@krasa Are you willing to merge this pull request? I think this provides a best effort to honor the EPL without changing too much of the existing approach of re-packaging the required eclipse jars.

krasa commented 2 years ago

Looks good. Thanks, everyone!

ncgisudo commented 2 years ago

I know this is really an "off-topic" comment, but I wanted to give a sincere thank you to everyone in this thread for working to resolve this for the benefit of all of the plugin users like myself.