Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add command line arguments to print licenses, authors and donors #51028

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Jul 29, 2021

This is required for complying with third-party licenses when distributing headless/server binaries (including Docker containers).

Since the license text is already included within the binary, this doesn't increase the binary size.

This adds the following command line arguments:

  • --about license - Prints Godot's MIT license
  • --about thirdparty-copyrights - Prints third-party copyright notices with SPDX license names
  • --about thirdparty-licenses - Prints the full text of third-party licenses
  • --about authors - Print the engine contributors' names
  • --about donors - Print the engine donors' names

Preview

Note: The Unicode parsing error demonstrated in this preview has since been fixed.

October 2022 edit: I tweaked the output to use print_line_rich() for prettier output (not shown on the output below).

--about license

❯ bin/godot.linuxbsd.tools.64.llvm --about license
MIT license
===========

Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.
Copyright (c) 2014-2021 Godot Engine contributors (cf. `--about authors` CLI argument).

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

--about thirdparty-copyrights

❯ bin/godot.linuxbsd.tools.64.llvm --about thirdparty-copyrights
Godot Engine includes the following components. Some of them are developed by third parties:

- Godot Engine

    © 2007-2021, Juan Linietsky, Ariel Manzur.
    © 2014-2021, Godot Engine contributors.
    License: Expat

- Godot Engine logo

    © 2017, Andrea Calabró
    License: CC-BY-4.0

- Bullet Continuous Collision Detection and Physics Library

    © 2011, Ole Kniemeyer, MAXON, www.maxon.net
    © 2007-2021, Juan Linietsky, Ariel Manzur.
    © 2014-2021, Godot Engine contributors.
    License: Expat and Zlib

    © 2003-2008, Erwin Coumans
    © 2007-2021, Juan Linietsky, Ariel Manzur.
    © 2014-2021, Godot Engine contributors.
    License: Expat and Zlib

    © 2007, Starbreeze Studios
    © 2007-2021, Juan Linietsky, Ariel Manzur.
    © 2014-2021, Godot Engine contributors.
    License: Expat and Zlib

    © 2003-2013, Erwin Coumans
    License: Zlib

[...]

--about thirdparty-licenses

❯ bin/godot.linuxbsd.tools.64.llvm --about thirdparty-licenses 
Godot Engine includes components licensed under the following open source licenses:

- Apache-2.0

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    
    http://www.apache.org/licenses/LICENSE-2.0
    
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
    

- Bitstream Vera Fonts Copyright

[...]

--about authors

❯ bin/godot.linuxbsd.tools.64.llvm --about authors            

Lead Developers
===============

Juan Linietsky (reduz)

Project Managers
================

Unicode parsing error: Invalid unicode codepoint ffffffc3.


Founders
========

Juan Linietsky (reduz)                            Ariel Manzur (punto-)

Developers
==========

Aaron Franke (aaronfranke)                        Aaron Record (LightningAA)
Alexander Holland (AlexHolly)                     Alexey Khoroshavin (allkhor)

[...]

--about donors

❯ bin/godot.linuxbsd.tools.64.llvm --about donors 

Platinum Sponsors
=================

Gamblify <https://www.gamblify.com>    Heroic Labs <https://heroiclabs.com>    Spiffcode <http://www.spiffcode.com>

Gold Sponsors
=============

None currently, become one! <https://godotengine.org/donate>

Silver Sponsors
===============

ASIFA-Hollywood <https://www.asifa-hollywood.org>    LITSLINK <https://litslink.com>

Bronze Sponsors
===============

Ben Nolan                     Brandon Lamb                  Garry Newman
Gordon MacPherson             Hunter Dickson                Kitcat490
Kyle Szklenski                Moonwards <https://www.moonwards.com>    TrampolineTales <http://trampolinetales.com>

Mini Sponsors
=============

AD Ford                       alex brown                    Andrew Dunai
Angry Skull                   anti666                       blurp

[...]

TODO

  • Fix --about authors and --about donors misbehaving on names containing Unicode characters. I can never figure out how to use String::utf8() on a Variant 🙁

@Calinou Calinou added this to the 4.0 milestone Jul 29, 2021
@bruvzg

This comment has been minimized.

@YuriSizov
Copy link
Contributor

FYI, the Unicode part was fixed separately in #53773.

main/main.cpp Outdated
@@ -640,6 +642,130 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
print_line(get_full_version_string());
goto error;

} else if (I->get() == "--about") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we could move this to another file like main/show_license.h/cpp or similar to avoid adding even more bloat to that file.

Copy link
Member Author

@Calinou Calinou Oct 4, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can look into this. Should this be done with some static methods in a main/show_license.cpp file, or is something more elaborate needed?

@Riteo
Copy link
Contributor

Riteo commented Apr 5, 2023

I'm kinda surprised that this wasn't available already. Are reduz' changes the only blocker here?

@Calinou
Copy link
Member Author

Calinou commented Apr 5, 2023

Rebased and tested again, it works as expected.

Regarding splitting to a separate file, I'm not sure if there are enough lines of code to warrant this. There would be a lot of boilerplate compared to actual code. I've started working on a built-in licenses GUI which is a complement to this CLI, but it'll likely need different code as the output will be formatted differently.

Edit: Pull request opened: #79599

@Calinou Calinou force-pushed the cli-add-license-authors-donors branch from 547108c to f95498e Compare April 5, 2023 15:05
@Riteo
Copy link
Contributor

Riteo commented Apr 5, 2023

@Calinou

Regarding splitting to a separate file, I'm not sure if there are enough lines of code to warrant this.

Yeah it looks like a fairly small and single-use part of code. I'm aware that main.cpp is a bit messy but I don't think that this would tidy it that much.

@nathanfranke
Copy link
Contributor

nathanfranke commented Apr 5, 2023

This should comply for desktop, android, HTML5, but not iOS nor UWP docs.

Also I would argue a message on startup like "use flag --about for licensing information" is necessary, assuming it isn't already added.

Edit 1: Crossed out ones that might not support passing command line arguments

Edit 2: Message can be added to existing line "Godot engine, copyright. Pass --about for license details."

Not perfect since the message might be different on unsupported platforms.

@Calinou
Copy link
Member Author

Calinou commented Apr 5, 2023

This PR only aims to provide automatic compliance on desktop platforms. It's also the only way to provide automatic compliance when distributing a headless binary 🙂

For mobile/web platforms, a GUI is needed as I commented above. It'll also be useful on desktop platforms in situations where you can't use a command prompt or don't know how to.

This is why I think we need both a CLI and GUI for this – they're complementary to each other.

Also I would argue a message on startup like "use flag --about for licensing information" is necessary, assuming it isn't already added.

This could be added, but I've seen complaints about the two-line startup banner already being intrusive. Making it three lines would worsen this, especially since it would also be printed in the Output panel in the editor every time you run the project.

@YuriSizov YuriSizov modified the milestones: 4.1, 4.2 Jun 14, 2023
@AThousandShips AThousandShips modified the milestones: 4.2, 4.3 Oct 26, 2023
Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like this for 4.3 but @akien-mga let us know if it is a blocker to move the change to a separate file.

This is required for complying with third-party licenses when
distributing headless/server binaries (including Docker containers).

Since the license text is already included within the binary,
this doesn't increase the binary size.
@Calinou Calinou force-pushed the cli-add-license-authors-donors branch from 56e23a0 to ba92d70 Compare November 1, 2024 23:12
@fire
Copy link
Member

fire commented Nov 2, 2024

Question is there a current feature to add licenses from godot extensions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants