Bundle licenses#

Sysand Index requires every project to declare a SPDX license expression in the license field of .project.json and to bundle the matching license texts under a LICENSES/ directory. SPDX provides standard license identifiers such as MIT and Apache-2.0; the REUSE specification provides the convention for including the matching license texts under LICENSES/. Sysand Index presents the bundled license texts on the project page’s Licenses tab.

To follow this guide you need an existing Sysand project. See Creating your first project if you do not have one yet.

Bundle the license texts#

  1. Declare the license expression in the license field of .project.json:

    {
      "license": "MIT OR Apache-2.0"
    }
    
  2. Create a LICENSES/ directory next to .project.json and add one .txt file named after each identifier in the expression:

    project-directory/
      .project.json
      .meta.json
      LICENSES/
        MIT.txt
        Apache-2.0.txt
    

    Use the same rule for WITH exceptions and custom LicenseRef- identifiers: GPL-2.0-only WITH Classpath-exception-2.0 needs LICENSES/GPL-2.0-only.txt and LICENSES/Classpath-exception-2.0.txt; LicenseRef-MyCustom needs LICENSES/LicenseRef-MyCustom.txt.

  3. Run sysand build and confirm that every license file is picked up:

    $ sysand build
        Building kpar `/path/to/my-project/output/my_project-0.0.1.kpar`
       Including license from `/path/to/my-project/LICENSES/MIT.txt`
       Including license from `/path/to/my-project/LICENSES/Apache-2.0.txt`
    

    If a license file referenced by the expression is missing, the build still succeeds but prints a warning:

    $ sysand build
        Building kpar `/path/to/my-project/output/my_project-0.0.1.kpar`
       Including license from `/path/to/my-project/LICENSES/MIT.txt`
    warning: license file `LICENSES/Apache-2.0.txt` referenced by project license `MIT OR Apache-2.0` was not found
    

Do not ignore the warning: Sysand Index rejects uploads whose LICENSES/ contents do not exactly match the license expression: both missing and unexpected license files cause the upload to fail. See KPAR archive validation for the full upload requirements.