THINK FIRST·CODE LATER

← All labs

Third-party notices generator

Problem

Permissive licences require that copyright and licence notices travel with the product. Generate StudyBuddy's THIRD-PARTY NOTICES screen.

Input: lines component|version|licence|copyright holder until the end of input (fields separated by |; the copyright holder may contain spaces and may be empty).

Output:

  1. THIRD-PARTY NOTICES and an empty line.
  2. Components grouped by licence, licences in alphabetical order; within a licence, components in alphabetical order (case-insensitive). For each licence print == LICENCE == and then one line per component: component version - Copyright (c) holder.
  3. After the groups, an empty line and Problems: with one line per problem, in input order: - component: missing copyright holder (empty holder) or - component: unknown licence (licence UNKNOWN) — or Problems: none (on the same line).

Components with licence UNKNOWN are not listed in the groups.

Input:

gson|2.10.1|Apache-2.0|Google Inc.
jsoup|1.17.2|MIT|Jonathan Hedley
Commons-Text|1.10.0|Apache-2.0|The Apache Software Foundation
tinyjson|0.3|UNKNOWN|

Output:

THIRD-PARTY NOTICES

== Apache-2.0 ==
Commons-Text 1.10.0 - Copyright (c) The Apache Software Foundation
gson 2.10.1 - Copyright (c) Google Inc.
== MIT ==
jsoup 1.17.2 - Copyright (c) Jonathan Hedley

Problems:
- tinyjson: missing copyright holder
- tinyjson: unknown licence

Write it here or in your IDE, then paste it. Compile and test it yourself before comparing. Your code stays in your browser — it is never sent to or stored on the server.