Skip to content

Latest commit

 

History

History
63 lines (40 loc) · 1.54 KB

README.md

File metadata and controls

63 lines (40 loc) · 1.54 KB

LICENSE

Library for handling licenses in APIs from Global Digital Library.

Usage

Add dependency to this library: "gdl" %% "license" % "<version>",

The main way of using this library is with the case class License. It accepts a string as an identifier for the license

Use SPDX License identifiers. See https://spdx.org/licenses/

A LicenseNotSupportedException will be thrown if the string given as input is not a valid license.

Example:

class MyClass {
   def doSomeLicenseHandling = {
      val license1 = License("CC-BY-4.0")
      val license2 = License("Apache-2.0")


      println(license1)
      println(license1.description)
      println(license2)
      println(license2.description)

   }
}

Output from the above println

CC-BY-4.0
Creative Commons Attribution 4.0 International
Apache-2.0
Apache License 2.0

Scripts

We have two scripts to generate licenses in this library

  1. ./generator/generate.py is a script to update the licenses library in the Scala module

  2. ./generator/generate_py_license.py is a script to generate licenses as a python dict to use in python applications

Building and distribution

Updating the library, when standards change

To update this library, run ./generator/generate.py

This will regenerate the content of LicenseList.scala based on the url https://spdx.org/licenses/licenses.json

Compile

sbt compile

Run tests

sbt test

Build

./build.sh

Publish

./release.sh