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

Update GeneratedThirdPartyNotices.txt and make sure it stays in sync #673

Merged
merged 3 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/third_party_notices.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
# yamllint disable rule:line-length
name: Check for updated Third Party Notices

on: # yamllint disable-line rule:truthy
pull_request:

jobs:
third-party-notices:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/[email protected]
with:
python-version: '3.12'
- name: Run the generator
run: |
python Support/Python/unitybuild/generate_notice.py
git diff --exit-code
83 changes: 83 additions & 0 deletions Support/Python/unitybuild/generate_notice.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright 2020 The Tilt Brush Authors
# Copyright 2024 The Open Brush Authors
#
# 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.

import os
import io
import re
import codecs


class BuildFailed(Exception):
pass


def create_notice_file(project_dir):
def iter_notice_files():
"""Yields (library_name, notice_file_name) tuples."""
root = os.path.join(project_dir, "Assets/ThirdParty")
if not os.path.exists(root):
raise BuildFailed("Cannot generate NOTICE: missing %s" % root)
for r, d, fs in os.walk(root):
d.sort()
for f in fs:
if f.lower() in (
"notice",
"notice.txt",
"notice.tiltbrush",
"notice.md",
):
yield (os.path.basename(r), os.path.join(r, f))
root = os.path.join(project_dir, "Assets/ThirdParty/NuGet/Packages")
if not os.path.exists(root):
raise BuildFailed("Cannot generate NOTICE: missing %s" % root)
for r, d, fs in os.walk(root):
d.sort()
for f in sorted(fs):
if f.lower() in ("notice", "notice.md", "notice.txt"):
m = re.match(r"\D+", os.path.basename(r))
if m:
name = m.group(0).rstrip(".")
if name[-2:] == ".v" or name[-2:] == ".V":
name = name[:-2]
yield (name, os.path.join(r, f))

tmpf = io.StringIO()
tmpf.write(
"""This file is automatically generated.
This software makes use of third-party software with the following notices.
"""
)
for library_name, notice_file in iter_notice_files():
tmpf.write("\n \n=== %s ===\n" % library_name)
with open(notice_file) as inf:
contents = inf.read()
if contents.startswith(str(codecs.BOM_UTF8)):
contents = contents[len(codecs.BOM_UTF8) :]
tmpf.write(contents)
tmpf.write("\n")

output_filename = os.path.join(
project_dir, "Support/ThirdParty/GeneratedThirdPartyNotices.txt"
)
with open(output_filename, "w") as outf:
outf.write(tmpf.getvalue())


def main(project_dir):
create_notice_file(project_dir)


if __name__ == "__main__":
create_notice_file(os.getcwd())
25 changes: 6 additions & 19 deletions Support/ThirdParty/GeneratedThirdPartyNotices.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.



=== GraphicsAnton ===
This product includes software developed by Anton Kirczenow.
https://www.shadertoy.com/view/ldsGWX



=== Ionic.Zip ===
DotNetZip - Copyright (c) 2006 - 2011 Dino Chiesa
Expand Down Expand Up @@ -151,22 +157,3 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



=== Usd ===
Universal Scene Description
Copyright 2016 Pixar

All rights reserved.



This product includes software developed at:

Pixar (http://www.pixar.com/).


=== GraphicsAnton ===
This product includes software developed by Anton Kirczenow.
https://www.shadertoy.com/view/ldsGWX

Loading