@@ -16,31 +16,34 @@ TOOLS_BIN_NAMES := $(addprefix $(TOOLS_BIN_DIR)/, $(notdir $(shell echo $(TOOLS_
1616GO_LICENCE_DETECTOR := $(TOOLS_BIN_DIR ) /go-licence-detector
1717GO_LICENCE_DETECTOR_CONFIG := $(SRC_ROOT ) /internal/assets/license/rules.json
1818
19- DISTRIBUTIONS ?= " nrdot-collector-host,nrdot-collector-k8s,nrdot-collector"
19+ DISTRIBUTION ?= nrdot-collector-host
2020
21- ci : check build build-fips version-check licenses-check
22- check : ensure-goreleaser-up-to-date
21+ .PHONY : ci
22+ ci : pre-compile-check generate-sources- $( DISTRIBUTION ) generate-sources- $( DISTRIBUTION ) -fips post-compile-check
2323
24- build : go ocb
25- @./scripts/build.sh -d " ${DISTRIBUTIONS} " -b ${OTELCOL_BUILDER}
24+ .PHONY : pre-compile-check
25+ pre-compile-check : ensure-goreleaser-up-to-date version-check
2626
27- build-fips : go ocb
28- @./scripts/build.sh -d " ${DISTRIBUTIONS} " -b ${OTELCOL_BUILDER} -f true
27+ .PHONY : post-compile-check
28+ post-compile-check : licenses-check
2929
30- generate : generate-sources generate-goreleaser
30+ .PHONY : generate-sources-$(DISTRIBUTION )
31+ generate-sources-$(DISTRIBUTION ) : go ocb
32+ @./scripts/build.sh -d " ${DISTRIBUTION} " -b ${OTELCOL_BUILDER}
3133
32- generate-goreleaser : go
33- @./scripts/generate-goreleaser.sh -d " ${DISTRIBUTIONS} " -g ${GO}
34-
35- generate-sources : go ocb
36- @./scripts/build.sh -d " ${DISTRIBUTIONS} " -s true -b ${OTELCOL_BUILDER}
34+ .PHONY : generate-sources-$(DISTRIBUTION ) -fips
35+ generate-sources-$(DISTRIBUTION ) -fips : go ocb
36+ @./scripts/build.sh -d " ${DISTRIBUTION} " -b ${OTELCOL_BUILDER} -f true
3737
38- goreleaser-verify : goreleaser
39- @${GORELEASER} release --snapshot --clean
38+ .PHONY : generate-goreleaser
39+ generate-goreleaser : go
40+ @./scripts/generate-goreleaser.sh -d " ${DISTRIBUTION} " -g ${GO}
4041
42+ .PHONY : ensure-goreleaser-up-to-date
4143ensure-goreleaser-up-to-date : generate-goreleaser
42- @git diff -s --exit-code distributions/* /.goreleaser.yaml || (echo " Check failed: The goreleaser templates have changed but the .goreleaser.yamls haven't. Run 'make generate-goreleaser' and update your PR." && exit 1)
44+ @git diff -s --exit-code distributions/* /.goreleaser* .yaml || (echo " Check failed: The goreleaser templates have changed but the .goreleaser.yamls haven't. Run 'make generate-goreleaser' and update your PR." && exit 1)
4345
46+ .PHONY : validate-components
4447validate-components :
4548 @./scripts/validate-components.sh
4649
@@ -149,16 +152,20 @@ FILENAME?=$(shell git branch --show-current)
149152NOTICE_OUTPUT? =THIRD_PARTY_NOTICES.md
150153
151154.PHONY : licenses
152- licenses : go generate-sources $(GO_LICENCE_DETECTOR )
153- @./scripts/licenses.sh -d " ${DISTRIBUTIONS} " -b ${GO_LICENCE_DETECTOR} -n ${NOTICE_OUTPUT} -g ${GO}
155+ licenses : go $(GO_LICENCE_DETECTOR )
156+ @{ if [ ! -d " distributions/$( DISTRIBUTION) /_build" ]; then $( MAKE) generate-sources-$( DISTRIBUTION) ; fi }
157+ @./scripts/licenses.sh -d " ${DISTRIBUTION} " -b ${GO_LICENCE_DETECTOR} -n ${NOTICE_OUTPUT} -g ${GO}
154158
155159.PHONY : licenses-check
156160licenses-check : licenses
157161 @git diff --name-only | grep -q $(NOTICE_OUTPUT ) \
158162 && { \
159- echo " Third party notices out of date, please run \" make licenses\" and commit the changes in this PR." ; \
163+ echo " 📜 Third party notices out of date, please run \" make licenses\" and commit the changes in this PR." ; \
160164 echo " Diff of $( NOTICE_OUTPUT) :" ; \
161165 git --no-pager diff HEAD -- * /$(NOTICE_OUTPUT ) ; \
162166 exit 1; \
163167 } \
164- || exit 0
168+ || { \
169+ echo " 📜 Third party notices up to date" ; \
170+ exit 0; \
171+ }
0 commit comments