Skip to content

Commit d434adf

Browse files
committed
Add debug log
1 parent 8fde111 commit d434adf

File tree

1 file changed

+45
-22
lines changed

1 file changed

+45
-22
lines changed

Makefile

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,93 @@
11
#!make
2-
# Special-Targets
3-
# https://www.gnu.org/software/make/manual/html_node/Special-Targets.html
42

5-
# Variables
3+
## Variables
4+
5+
# [Special-Targets](https://www.gnu.org/software/make/manual/html_node/Special-Targets.html)
66
.DEFAULT_GOAL := install
77
OPENAPI_PATH := Submodule/github/rest-api-description/descriptions/api.github.com/api.github.com.json
8-
FILTERED_NAMES := $(shell swift Scripts/PackageTargetsParser.swift $(OPENAPI_PATH))
9-
SOURCE_DIRS := $(addprefix Sources/, $(FILTERED_NAMES))
108
PACKAGE_PATHS := Package.swift
119

12-
# Helper
10+
## Helper
11+
1312
.SILENT: commit
1413
.PHONY: commit
1514
commit:
15+
echo "::debug::[commit] start $(file)"
1616
git add "$(file)"
1717
git commit -m "Commit via running: make $(file)" >/dev/null \
1818
&& echo "::notice:: git commit $(file)\n" \
1919
|| true;
2020
touch "$(file)";
21+
echo "::debug::[commit] end $(file)"
2122

23+
.PHONY: swift-openapi-generator
2224
swift-openapi-generator:
25+
echo "::debug::[generator] setup swift-openapi-generator"
2326
mise use spm:apple/swift-openapi-generator
2427

25-
# Create sources
28+
## Create sources
29+
2630
%/openapi-generator-config.yml:
31+
echo "::debug::[config] start $(@D)"
2732
@mkdir -p "$(@D)"; \
2833
tag_name=$(shell basename $(shell dirname $@)); \
34+
echo "::debug::[config] tag=$$tag_name"; \
2935
swift Scripts/GeneratorConfigBuilder.swift $$tag_name
36+
echo "::debug::[config] end $(@D)"
3037

3138
%/Client.swift %/Types.swift: $(OPENAPI_PATH)
39+
echo "::debug::[generate] start $(@D)"
3240
@echo "\n\nFolder $(@D) running"
3341
@$(MAKE) "$(@D)/openapi-generator-config.yml"
42+
echo "::debug::[generate] running openapi-generator"
3443
swift-openapi-generator generate \
3544
"$(OPENAPI_PATH)" \
3645
--config "$(@D)/openapi-generator-config.yml" \
3746
--output-directory "$(@D)";
47+
echo "::debug::[generate] finished openapi-generator"
3848
@touch $(@D)/*.swift
3949
@rm "$(@D)/openapi-generator-config.yml";
4050
@echo ;
51+
echo "::debug::[generate] end $(@D)"
4152

4253
Sources/%: Sources/%/Client.swift Sources/%/Types.swift
54+
echo "::debug::[target] build $@"
4355
@$(MAKE) commit file="$@"
4456

45-
# Prevent submodule update from running in parallel with other jobs
46-
.NOTPARALLEL: Submodule
47-
48-
# Update openapi specification if needed
49-
.PHONY: Submodule
50-
Submodule:
51-
ifdef GITHUB_ACTIONS ## https://docs.github.com/en/actions/learn-github-actions/variables
52-
@touch "$(OPENAPI_PATH)"
53-
else
54-
@git submodule update --remote
55-
@$(MAKE) commit file="$@"
56-
# @touch "$(OPENAPI_PATH)" # Uncomment to force-install
57-
endif
57+
FILTERED_NAMES = $(shell \
58+
echo "::debug::[parse] start PackageTargetsParser"; \
59+
swift Scripts/PackageTargetsParser.swift $(OPENAPI_PATH); \
60+
echo "::debug::[parse] end PackageTargetsParser"; \
61+
)
62+
SOURCE_DIRS := $(addprefix Sources/, $(FILTERED_NAMES))
5863

59-
# Update Package.swift
6064
.DELETE_ON_ERROR: $(SOURCE_DIRS)
6165
$(PACKAGE_PATHS): $(SOURCE_DIRS)
66+
echo "::debug::[package] start Package.swift"
6267
swift Scripts/PackageBuilder.swift "$@"
6368
@$(MAKE) commit file="$@"
69+
echo "::debug::[package] end Package.swift"
6470

6571
.spi.yml: $(PACKAGE_PATHS)
72+
echo "::debug::[spi] start"
6673
swift Scripts/SPIManifestBuilder.swift
6774
@$(MAKE) commit file="$@"
75+
echo "::debug::[spi] end"
76+
77+
.PHONY: Submodule # Update openapi specification if needed
78+
.NOTPARALLEL: Submodule # Prevent submodule update from running in parallel with other jobs
79+
Submodule:
80+
echo "::debug::[submodule] start"
81+
ifdef GITHUB_ACTIONS
82+
echo "::debug::[submodule] CI mode skip update"
83+
@touch "$(OPENAPI_PATH)"
84+
else
85+
echo "::debug::[submodule] updating"
86+
@git submodule update --remote
87+
@$(MAKE) commit file="$@"
88+
endif
89+
echo "::debug::[submodule] end"
90+
91+
## Install
6892

69-
# Install
7093
install: Submodule .spi.yml

0 commit comments

Comments
 (0)