Skip to content

Commit ead1911

Browse files
authored
have enable-autogen generate all serviceapi resources (#3410)
1 parent 0d57f12 commit ead1911

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Makefile

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
ifdef ACCTEST_PACKAGES
32
# remove newlines and blanks coming from GH Actions
43
ACCTEST_PACKAGES := $(strip $(subst $(newline),, $(ACCTEST_PACKAGES)))
@@ -199,7 +198,10 @@ jira-release-version: ## Update Jira version in a release
199198

200199
.PHONY: enable-autogen
201200
enable-autogen: ## Enable use of autogen resources in the provider
202-
make add-lines filename=./internal/provider/provider.go find="project.Resource," add="customdbroleapi.Resource,databaseuserapi.Resource,pushbasedlogexportapi.Resource,searchdeploymentapi.Resource,projectapi.Resource,resourcepolicyapi.Resource,"
201+
$(eval filename := ./internal/provider/provider.go)
202+
$(eval resources := $(shell ls -d internal/serviceapi/*/ | xargs -n1 basename))
203+
$(foreach resource,$(resources),make add-lines filename=${filename} find="project.Resource," add="$(resource).Resource,\n";)
204+
goimports -w ${filename}
203205

204206
.PHONY: delete-lines ${filename} ${delete}
205207
delete-lines:
@@ -211,16 +213,14 @@ delete-lines:
211213
.PHONY: add-lines ${filename} ${find} ${add}
212214
add-lines:
213215
rm -f file.tmp
214-
sed 's/${find}/${find}${add}/' "${filename}" > "file.tmp"
216+
sed 's/${find}/${add}${find}/' "${filename}" > "file.tmp"
215217
mv file.tmp ${filename}
216-
goimports -w ${filename}
217218

218219
.PHONY: change-lines ${filename} ${find} ${new}
219220
change-lines:
220221
rm -f file.tmp
221222
sed 's/${find}/${new}/' "${filename}" > "file.tmp"
222223
mv file.tmp ${filename}
223-
goimports -w ${filename}
224224

225225
.PHONY: gen-purls
226226
gen-purls: # Generate purls on linux os
@@ -236,4 +236,4 @@ upload-sbom: ## Upload SBOM
236236

237237
.PHONY: augment-sbom
238238
augment-sbom: ## Augment SBOM
239-
./scripts/augment-sbom.sh
239+
./scripts/augment-sbom.sh

0 commit comments

Comments
 (0)