52
52
FIND_EXCLUSIONS = \
53
53
-not \( \( -path '*/.git/*' -o -path './build/*' -o -path './vendor/*' -o -path './.coderv2/*' -o -path '*/node_modules/*' -o -path './site/out/*' -o -path './coderd/apidoc/*' \) -prune \)
54
54
# Source files used for make targets, evaluated on use.
55
- GO_SRC_FILES := $(shell find . $(FIND_EXCLUSIONS ) -type f -name '* .go')
55
+ GO_SRC_FILES := $(shell find . $(FIND_EXCLUSIONS ) -type f -name '* .go' -not -name ' * _test.go' )
56
56
# All the shell files in the repo, excluding ignored files.
57
57
SHELL_SRC_FILES := $(shell find . $(FIND_EXCLUSIONS ) -type f -name '* .sh')
58
58
@@ -427,11 +427,20 @@ lint/helm:
427
427
make lint
428
428
.PHONY : lint/helm
429
429
430
+ # All files generated by the database should be added here, and this can be used
431
+ # as a target for jobs that need to run after the database is generated.
432
+ DB_GEN_FILES := \
433
+ coderd/database/querier.go \
434
+ coderd/database/unique_constraint.go \
435
+ coderd/database/dbfake/dbfake.go \
436
+ coderd/database/dbmetrics/dbmetrics.go \
437
+ coderd/database/dbauthz/dbauthz.go \
438
+ coderd/database/dbmock/dbmock.go
439
+
430
440
# all gen targets should be added here and to gen/mark-fresh
431
441
gen : \
432
442
coderd/database/dump.sql \
433
- coderd/database/querier.go \
434
- coderd/database/dbmock/dbmock.go \
443
+ $(DB_GEN_FILES ) \
435
444
provisionersdk/proto/provisioner.pb.go \
436
445
provisionerd/proto/provisionerd.pb.go \
437
446
site/src/api/typesGenerated.ts \
@@ -452,8 +461,7 @@ gen: \
452
461
gen/mark-fresh :
453
462
files=" \
454
463
coderd/database/dump.sql \
455
- coderd/database/querier.go \
456
- coderd/database/dbmock/dbmock.go \
464
+ $(DB_GEN_FILES ) \
457
465
provisionersdk/proto/provisioner.pb.go \
458
466
provisionerd/proto/provisionerd.pb.go \
459
467
site/src/api/typesGenerated.ts \
@@ -489,7 +497,6 @@ coderd/database/dump.sql: coderd/database/gen/dump/main.go $(wildcard coderd/dat
489
497
coderd/database/querier.go : coderd/database/sqlc.yaml coderd/database/dump.sql $(wildcard coderd/database/queries/* .sql)
490
498
./coderd/database/generate.sh
491
499
492
-
493
500
coderd/database/dbmock/dbmock.go : coderd/database/db.go coderd/database/querier.go
494
501
go generate ./coderd/database/dbmock/
495
502
@@ -532,22 +539,22 @@ docs/admin/audit-logs.md: scripts/auditdocgen/main.go enterprise/audit/table.go
532
539
cd site
533
540
yarn run format:write:only ../docs/admin/audit-logs.md
534
541
535
- coderd/apidoc/swagger.json : $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS ) -type f) $(wildcard coderd/* .go) $(wildcard enterprise/coderd/* .go) $(wildcard codersdk/* .go) $(wildcard enterprise/wsproxy/wsproxysdk/* .go) coderd/database/querier.go .swaggo docs/manifest.json coderd/rbac/object_gen.go
542
+ coderd/apidoc/swagger.json : $(shell find ./scripts/apidocgen $(FIND_EXCLUSIONS ) -type f) $(wildcard coderd/* .go) $(wildcard enterprise/coderd/* .go) $(wildcard codersdk/* .go) $(wildcard enterprise/wsproxy/wsproxysdk/* .go) $( DB_GEN_FILES ) .swaggo docs/manifest.json coderd/rbac/object_gen.go
536
543
./scripts/apidocgen/generate.sh
537
544
yarn run --cwd=site format:write:only ../docs/api ../docs/manifest.json ../coderd/apidoc/swagger.json
538
545
539
546
update-golden-files : cli/testdata/.gen-golden helm/tests/testdata/.gen-golden scripts/ci-report/testdata/.gen-golden enterprise/cli/testdata/.gen-golden
540
547
.PHONY : update-golden-files
541
548
542
- cli/testdata/.gen-golden : $(wildcard cli/testdata/* .golden) $(wildcard cli/* .tpl) $(GO_SRC_FILES )
549
+ cli/testdata/.gen-golden : $(wildcard cli/testdata/* .golden) $(wildcard cli/* .tpl) $(GO_SRC_FILES ) $( wildcard cli/ * _test.go)
543
550
go test ./cli -run=" Test(CommandHelp|ServerYAML)" -update
544
551
touch " $@ "
545
552
546
- enterprise/cli/testdata/.gen-golden : $(wildcard enterprise/cli/testdata/* .golden) $(wildcard cli/* .tpl) $(GO_SRC_FILES )
553
+ enterprise/cli/testdata/.gen-golden : $(wildcard enterprise/cli/testdata/* .golden) $(wildcard cli/* .tpl) $(GO_SRC_FILES ) $( wildcard enterprise/cli/ * _test.go)
547
554
go test ./enterprise/cli -run=" TestEnterpriseCommandHelp" -update
548
555
touch " $@ "
549
556
550
- helm/tests/testdata/.gen-golden : $(wildcard helm/tests/testdata/* .yaml) $(wildcard helm/tests/testdata/* .golden) $(GO_SRC_FILES )
557
+ helm/tests/testdata/.gen-golden : $(wildcard helm/tests/testdata/* .yaml) $(wildcard helm/tests/testdata/* .golden) $(GO_SRC_FILES ) $( wildcard helm/tests/ * _test.go)
551
558
go test ./helm/tests -run=TestUpdateGoldenFiles -update
552
559
touch " $@ "
553
560
0 commit comments