release | ||
dev |
A Clojure wrapper around Spdx-Java-Library
, plus some bespoke functionality (e.g. custom SPDX expression parsing).
Note that that library's functionality is being wrapped on-demand by the author based on their needs in other projects, so this wrapper library is not yet comprehensive. Contributions of any kind are warmly welcomed, especially wrapping additional parts of the Java library!
Note also that this project has no official relationship with the SPDX project (who maintain Spdx-Java-Library
), and this work is in no way associated with, or endorsed by, them.
clj-spdx
is available as a Maven artifact from Clojars.
$ clj -Sdeps '{:deps {com.github.pmonks/clj-spdx {:mvn/version "RELEASE"}}}'
$ lein try com.github.pmonks/clj-spdx
$ deps-try com.github.pmonks/clj-spdx
(require '[spdx.licenses :as sl])
; This is optional but can be time consuming, so we run it explicitly to force
; population of the local Spdx-Java-Library cache.
(sl/init!)
(sl/ids)
;=> #{"MulanPSL-1.0" "OPUBL-1.0" "CC-BY-SA-1.0" [and many more]
(require '[spdx.exceptions :as se])
(se/ids)
;=> #{"GCC-exception-2.0-note" "Qwt-exception-1.0" [and many more]
(require '[spdx.matching :as sm])
(def apache-20-text (slurp "https://www.apache.org/licenses/LICENSE-2.0.txt"))
(sm/licenses-within-text apache-20-text)
;=> #{"Apache-2.0"}
(require '[spdx.expressions :as sexp])
(sexp/parse "GPL-2.0+ WITH Classpath-exception-2.0 OR Apache-2.0")
;=> [:or
;=> {:license-id "Apache-2.0"}
;=> {:license-id "GPL-2.0-or-later" :license-exception-id "Classpath-exception-2.0"}]
API documentation is available here, or here on cljdoc.
This project uses the git-flow branching strategy, and the permanent branches are called release
and dev
. Any changes to the release
branch are considered a release and auto-deployed (JARs to Clojars, API docs to GitHub Pages, etc.).
For this reason, all development must occur either in branch dev
, or (preferably) in temporary branches off of dev
. All PRs from forked repos must also be submitted against dev
; the release
branch is only updated from dev
via PRs created by the core development team. All other changes submitted to release
will be rejected.
clj-spdx
uses tools.build
. You can get a list of available tasks by running:
clojure -A:deps -T:build help/doc
Of particular interest are:
clojure -T:build test
- run the unit testsclojure -T:build lint
- run the linters (clj-kondo and eastwood)clojure -T:build ci
- run the full CI suite (check for outdated dependencies, run the unit tests, run the linters)clojure -T:build install
- build the JAR and install it locally (e.g. so you can test it with downstream code)Please note that the release
and deploy
tasks are restricted to the core development team (and will not function if you run them yourself).
Copyright © 2023 Peter Monks
Distributed under the Apache License, Version 2.0.
SPDX-License-Identifier: Apache-2.0
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close