diff --git a/Makefile b/Makefile deleted file mode 100644 index 6a68765..0000000 --- a/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -DOC_DIR = doc - -SPDX_LICENSE_LIST_FILE = licenses.json -SPDX_LICENSE_LIST_FILE_MIN = licenses.min.json -SPDX_LICENSE_LIST_FILE_TMP = /tmp/licenses.json.new -SPDX_LICENSE_LIST_JSON_URL = https://spdx.org/licenses/licenses.json - -licenses: - wget -q -O $(SPDX_LICENSE_LIST_FILE_TMP) $(SPDX_LICENSE_LIST_JSON_URL) - if ! diff $(SPDX_LICENSE_LIST_FILE) $(SPDX_LICENSE_LIST_FILE_TMP) >/dev/null 2>&1; \ - then mv -v $(SPDX_LICENSE_LIST_FILE_TMP) $(SPDX_LICENSE_LIST_FILE); \ - fi - jq -c . < $(SPDX_LICENSE_LIST_FILE) > $(SPDX_LICENSE_LIST_FILE_MIN) - -doc: - v doc -f html -m . -o $(DOC_DIR) - -serve: clean doc - v -e "import net.http.file; file.serve(folder: '$(DOC_DIR)')" - -clean: - rm -r $(DOC_DIR) || true diff --git a/make.vsh b/make.vsh new file mode 100755 index 0000000..0f13d77 --- /dev/null +++ b/make.vsh @@ -0,0 +1,25 @@ +#!/usr/bin/env -S v run + +import build +import net.http + +const source_url = 'https://spdx.org/licenses/licenses.json' + +mut context := build.context(default: 'licenses.min.json') + +context.artifact( + name: 'licenses.json' + help: 'SPDX licenses list in JSON format' + should_run: |self| true + run: |self| http.download_file(source_url, self.name)! +) + +context.artifact( + name: 'licenses.min.json' + help: 'The minified licenses.json ready for embedding (requires jq util)' + depends: ['licenses.json'] + should_run: |self| true + run: |self| system('jq -c . < licenses.json > ${self.name}') +) + +context.run()