THINK FIRST·CODE LATER

← All labs

Licence compatibility checker

Problem

Check StudyBuddy's dependencies against its distribution mode and project licence using these simplified rules (not legal advice):

  • Licence families: MIT, BSD, APACHE2 → permissive; LGPL, MPL2 → weak; GPL2, GPL3 → strong; AGPL3 → network; NONE → no licence.
  • Project licence: PROPRIETARY, APACHE2, GPL3. Mode: DISTRIBUTED (app/download) or SERVICE (runs only on our server).

Rules for each dependency, checked in this order:

  1. NONE → BLOCK (no licence: no permission).
  2. AGPL3: if the project licence is GPL3 → OK (offer source to network users); otherwise → BLOCK (AGPL3 requires offering source) — in both modes.
  3. GPL2 or GPL3 in mode SERVICE → OK (not distributed).
  4. GPL2/GPL3 in mode DISTRIBUTED: allowed only if the project is GPL3 and the dependency is GPL3 → OK (same licence); project GPL3 with GPL2 → BLOCK (GPL2-only is incompatible with GPL3); otherwise → BLOCK (strong copyleft in distributed non-GPL work).
  5. APACHE2 when the project is GPL3 → OK (compatible with GPL3; keep NOTICE).
  6. Weak copyleft → OK (keep library changes under its licence).
  7. Other permissive → OK (keep notices).

Input: first line projectLicence mode, then lines dependency licence. Output dependency (LICENCE): RESULT per line, then Blocked: b and Verdict: SHIP if b = 0, otherwise Verdict: DO NOT SHIP.

Input:

PROPRIETARY DISTRIBUTED
gson APACHE2
charts GPL3
utils NONE
pdfkit MPL2

Output:

gson (APACHE2): OK (keep notices)
charts (GPL3): BLOCK (strong copyleft in distributed non-GPL work)
utils (NONE): BLOCK (no licence: no permission)
pdfkit (MPL2): OK (keep library changes under its licence)
Blocked: 2
Verdict: DO NOT SHIP

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.