Skip to content

Commit c7be756

Browse files
committed
Update Makefile
1 parent d434adf commit c7be756

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

Makefile

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,82 +12,82 @@ PACKAGE_PATHS := Package.swift
1212
.SILENT: commit
1313
.PHONY: commit
1414
commit:
15-
echo "::debug::[commit] start $(file)"
15+
@echo "::debug::[commit] start $(file)"
1616
git add "$(file)"
1717
git commit -m "Commit via running: make $(file)" >/dev/null \
18-
&& echo "::notice:: git commit $(file)\n" \
18+
&& @echo "::notice:: git commit $(file)\n" \
1919
|| true;
2020
touch "$(file)";
21-
echo "::debug::[commit] end $(file)"
21+
@echo "::debug::[commit] end $(file)"
2222

2323
.PHONY: swift-openapi-generator
2424
swift-openapi-generator:
25-
echo "::debug::[generator] setup swift-openapi-generator"
25+
@echo "::debug::[generator] setup swift-openapi-generator"
2626
mise use spm:apple/swift-openapi-generator
2727

2828
## Create sources
2929

3030
%/openapi-generator-config.yml:
31-
echo "::debug::[config] start $(@D)"
31+
@echo "::debug::[config] start $(@D)"
3232
@mkdir -p "$(@D)"; \
3333
tag_name=$(shell basename $(shell dirname $@)); \
34-
echo "::debug::[config] tag=$$tag_name"; \
34+
@echo "::debug::[config] tag=$$tag_name"; \
3535
swift Scripts/GeneratorConfigBuilder.swift $$tag_name
36-
echo "::debug::[config] end $(@D)"
36+
@echo "::debug::[config] end $(@D)"
37+
38+
.NOTPARALLEL: Submodule # Prevent submodule update from running in parallel with other jobs
39+
Submodule:
40+
@echo "::debug::[submodule] start"
41+
ifdef GITHUB_ACTIONS
42+
@echo "::debug::[submodule] CI mode skip update"
43+
else
44+
@echo "::debug::[submodule] updating"
45+
@git submodule update --remote
46+
@$(MAKE) commit file="$@"
47+
endif
48+
@echo "::debug::[submodule] end"
49+
50+
$(OPENAPI_PATH): Submodule
51+
@touch "$@"
3752

3853
%/Client.swift %/Types.swift: $(OPENAPI_PATH)
39-
echo "::debug::[generate] start $(@D)"
40-
@echo "\n\nFolder $(@D) running"
54+
@echo "::debug::[generate] start $(@D)"
55+
@echo "Folder $(@D) running"
4156
@$(MAKE) "$(@D)/openapi-generator-config.yml"
42-
echo "::debug::[generate] running openapi-generator"
57+
@echo "::debug::[generate] running openapi-generator"
4358
swift-openapi-generator generate \
4459
"$(OPENAPI_PATH)" \
4560
--config "$(@D)/openapi-generator-config.yml" \
4661
--output-directory "$(@D)";
47-
echo "::debug::[generate] finished openapi-generator"
62+
@echo "::debug::[generate] finished openapi-generator"
4863
@touch $(@D)/*.swift
4964
@rm "$(@D)/openapi-generator-config.yml";
5065
@echo ;
51-
echo "::debug::[generate] end $(@D)"
66+
@echo "::debug::[generate] end $(@D)"
5267

5368
Sources/%: Sources/%/Client.swift Sources/%/Types.swift
54-
echo "::debug::[target] build $@"
69+
@echo "::debug::[target] build $@"
5570
@$(MAKE) commit file="$@"
5671

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))
72+
.DELETE_ON_ERROR: Sources
73+
Sources: $(OPENAPI_PATH)
74+
@echo "::debug::[sources] start"
75+
@names=$$(swift Scripts/PackageTargetsParser.swift $(OPENAPI_PATH)); \
76+
$(MAKE) $$(printf "Sources/%s " $$names)
77+
@echo "::debug::[sources] end"
6378

64-
.DELETE_ON_ERROR: $(SOURCE_DIRS)
65-
$(PACKAGE_PATHS): $(SOURCE_DIRS)
66-
echo "::debug::[package] start Package.swift"
79+
$(PACKAGE_PATHS): Sources
80+
@echo "::debug::[package] start Package.swift"
6781
swift Scripts/PackageBuilder.swift "$@"
6882
@$(MAKE) commit file="$@"
69-
echo "::debug::[package] end Package.swift"
83+
@echo "::debug::[package] end Package.swift"
7084

7185
.spi.yml: $(PACKAGE_PATHS)
72-
echo "::debug::[spi] start"
86+
@echo "::debug::[spi] start"
7387
swift Scripts/SPIManifestBuilder.swift
7488
@$(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"
89+
@echo "::debug::[spi] end"
9090

9191
## Install
9292

93-
install: Submodule .spi.yml
93+
install: .spi.yml

0 commit comments

Comments
 (0)