Skip to content

Commit 511d956

Browse files
committed
chore(ci): fix license paths on windows
1 parent 65c9160 commit 511d956

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Makefile.Common

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ ALL_SRC_AND_SHELL_CMD := find . -type f \( \( -name "*.go" -o -name "*.sh" \) -a
111111
# The absolute paths to all directories containing a go.mod file.
112112
ALL_GO_MOD_DIR_CMD := find . -type f \( \( -name "go.mod" \) -and \( -not -path '*/third_party/*' \) \) | xargs realpath | grep -v "$(SRC_ROOT)/go.mod" | xargs dirname | sort
113113

114+
# Relative paths to all subdirectory go.mod directories (excludes root go.mod).
115+
# Uses relative paths to avoid Windows path format mismatches between make and shell utilities.
116+
# Intended for use in targets that run from SRC_ROOT (e.g. addoverrides).
117+
ALL_GO_MOD_SUBDIR_CMD := find . -mindepth 2 -type f \( \( -name "go.mod" \) -and \( -not -path '*/third_party/*' \) \) | xargs dirname | sort
118+
114119
pwd:
115120
@pwd
116121

@@ -215,10 +220,10 @@ NOTICE_OVERRIDES_FILE="$(SRC_ROOT)/internal/assets/license/overrides.jsonl"
215220
addoverrides:
216221
@pushd $(SRC_ROOT); \
217222
overrides=""; \
218-
for dir in $$($(ALL_GO_MOD_DIR_CMD)); do \
219-
go_mod_path="$${dir#$(SRC_ROOT)/}/go.mod"; \
223+
for dir in $$($(ALL_GO_MOD_SUBDIR_CMD)); do \
224+
go_mod_path="$${dir#./}/go.mod"; \
220225
if ! git check-ignore -q "$$go_mod_path"; then \
221-
overrides+="{\"name\": \"github.com/newrelic/nrdot-collector-components/$${dir#$(SRC_ROOT)/}\", \"licenceType\": \"Apache-2.0\"}\n"; \
226+
overrides+="{\"name\": \"github.com/newrelic/nrdot-collector-components/$${dir#./}\", \"licenceType\": \"Apache-2.0\"}\n"; \
222227
fi; \
223228
done; \
224229
echo -e "$$overrides" | sort | grep -v '^$$' > "$(NOTICE_OVERRIDES_FILE)"; \

0 commit comments

Comments
 (0)