Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 2 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

SCHEMA_FILES := $(shell find . -path './schema_out/*.json' -exec basename {} \; | sort)
include validator/Makefile

EXAMPLE_FILES := $(shell find . -path './examples/*.yaml' -exec basename {} \; | sort)
$(shell mkdir -p out)

.PHONY: all
all: install-tools compile-schema validate-examples all-meta-schema

include validator/Makefile

.PHONY: compile-schema
compile-schema:
@if ! npm ls minimatch yaml; then npm install; fi
npm run-script yaml-to-json || exit 1;
@if ! npm ls ajv-cli; then npm install; fi
@for f in $(SCHEMA_FILES); do \
npx --no ajv-cli compile --spec=draft2020 --allow-matching-properties -s ./schema_out/$$f -r "./schema_out/!($$f)" \
|| exit 1; \
done

.PHONY: validate-examples
validate-examples:
@if ! npm ls ajv-cli; then npm install; fi
Expand Down
14 changes: 14 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

SCHEMA_FILES := $(shell find . -path './schema_out/*.json' -exec basename {} \; | sort)

.PHONY: compile-schema
compile-schema:
@if ! npm ls minimatch yaml; then npm install; fi
npm run-script yaml-to-json || exit 1;
@if ! npm ls ajv-cli; then npm install; fi
@for f in $(SCHEMA_FILES); do \
npx --no ajv-cli compile --spec=draft2020 --allow-matching-properties -s ./schema_out/$$f -r "./schema_out/!($$f)" \
|| exit 1; \
done
4 changes: 3 additions & 1 deletion validator/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Copyright The OpenTelemetry Authors
# SPDX-License-Identifier: Apache-2.0

include Makefile.common

ROOT_DIR :=$(realpath $(shell dirname $(lastword $(MAKEFILE_LIST))))
PARENT_DIR :=$(realpath ${ROOT_DIR}/../)
CURRENT_GIT_REF :=$(shell git rev-parse --short HEAD)
Expand Down Expand Up @@ -32,7 +34,7 @@ $(TOOLS)/govulncheck: PACKAGE=golang.org/x/vuln/cmd/govulncheck
.PHONY: tools
tools: $(GOVULNCHECK)

validator-copy-schema:
validator-copy-schema: compile-schema
mkdir -p ${ROOT_DIR}/schema
find ${PARENT_DIR} -path '*/schema_out/*.json' ! -path '*/validator/schema/*.json' -exec cp '{}' "${ROOT_DIR}/schema/" ';'

Expand Down