@@ -25,14 +25,6 @@ EACHMODULE_SKIP_FLAG=-skip="${EACHMODULE_SKIP}"
2525
2626EACHMODULE_FLAGS =${EACHMODULE_CONCURRENCY_FLAG} ${EACHMODULE_FAILFAST_FLAG} ${EACHMODULE_SKIP_FLAG}
2727
28- # SDK's Core and client packages that are compatible with Go 1.9+.
29- SDK_CORE_PKGS =./aws/... ./internal/...
30- SDK_CLIENT_PKGS =./service/...
31- SDK_COMPA_PKGS =${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS}
32-
33- # SDK additional packages that are used for development of the SDK.
34- SDK_EXAMPLES_PKGS =
35- SDK_ALL_PKGS =${SDK_COMPA_PKGS} ${SDK_EXAMPLES_PKGS}
3628
3729RUN_NONE =-run NONE
3830RUN_INTEG =-run '^TestInteg_'
@@ -105,11 +97,18 @@ smithy-generate:
10597smithy-build :
10698 cd codegen && ./gradlew clean build -Plog-tests
10799
100+ # suffix-to-path pattern
101+ # Targets with pattern suffix -% convert the suffix to a path by:
102+ # 1. Stripping the target prefix (e.g., "go-build-modules-", "build-modules-", "ci-lint-")
103+ # 2. Converting underscores to slashes (e.g., internal_protocoltest -> internal/protocoltest)
104+ # The resulting path is passed to the eachmodule cmd via the -p flag to specify which
105+ # modules to operate on. Using "." targets all modules in the current directory.
106+ # Usage examples:
107+ # make go-build-modules-internal_protocoltest
108+ # make ci-lint-internal_protocoltest
109+
108110smithy-build-% :
109- @# smithy-build- command that uses the pattern to define build filter that
110- @# the smithy API model service id starts with. Strips off the
111- @# "smithy-build-".
112- @#
111+ @# See suffix-to-path pattern. Defines the smithy API model service id starts with.
113112 @# e.g. smithy-build-com.amazonaws.rds
114113 @# e.g. smithy-build-com.amazonaws.rds#AmazonRDSv19
115114 cd codegen && \
@@ -149,8 +148,7 @@ gen-repo-mod-replace:
149148 go run ${REPOTOOLS_CMD_MAKE_RELATIVE}
150149
151150gen-mod-replace-smithy-% :
152- @# gen-mod-replace-smithy- command that uses the pattern to define build filter that
153- @# for modules to add replace to. Strips off the "gen-mod-replace-smithy-".
151+ @# See suffix-to-path pattern. Defines build filter for modules to add `-replace` to
154152 @#
155153 @# SMITHY_GO_SRC environment variable is the path to add replace to
156154 @#
@@ -160,8 +158,7 @@ gen-mod-replace-smithy-%:
160158 " go mod edit -replace github.com/aws/smithy-go=${SMITHY_GO_SRC} "
161159
162160gen-mod-dropreplace-smithy-% :
163- @# gen-mod-dropreplace-smithy- command that uses the pattern to define build filter that
164- @# for modules to add replace to. Strips off the "gen-mod-dropreplace-smithy-".
161+ @# See suffix-to-path pattern. Defines build filter for modules to add `-dropreplace` to
165162 @#
166163 @# e.g. gen-mod-dropreplace-smithy-service_ssooidc
167164 cd ./internal/repotools/cmd/eachmodule \
@@ -172,21 +169,13 @@ gen-aws-ptrs:
172169 cd aws && go generate
173170
174171tidy-modules-% :
175- @# tidy command that uses the pattern to define the root path that the
176- @# module testing will start from. Strips off the "tidy-modules-" and
177- @# replaces all "_" with "/".
178- @#
179- @# e.g. tidy-modules-internal_protocoltest
172+ @# See suffix-to-path pattern. Runs `go mod tidy`
180173 cd ./internal/repotools/cmd/eachmodule \
181174 && go run . -p $(subst _,/,$(subst tidy-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
182175 " go mod tidy"
183176
184177download-modules-% :
185- @# download command that uses the pattern to define the root path that the
186- @# module testing will start from. Strips off the "download-modules-" and
187- @# replaces all "_" with "/".
188- @#
189- @# e.g. download-modules-internal_protocoltest
178+ @# See suffix-to-path pattern. Runs `go mod download all`
190179 cd ./internal/repotools/cmd/eachmodule \
191180 && go run . -p $(subst _,/,$(subst download-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
192181 " go mod download all"
@@ -256,37 +245,21 @@ unit-test: test-modules-.
256245unit-race-test : test-race-modules-.
257246
258247unit-race-modules-% :
259- @# unit command that uses the pattern to define the root path that the
260- @# module testing will start from. Strips off the "unit-race-modules-" and
261- @# replaces all "_" with "/".
262- @#
263- @# e.g. unit-race-modules-internal_protocoltest
248+ @# See suffix-to-path pattern. Runs `go test` with `-race` flag
264249 cd ./internal/repotools/cmd/eachmodule \
265250 && go run . -p $(subst _,/,$(subst unit-race-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
266- " go vet ${BUILD_TAGS} --all ./..." \
267- " go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
268251 " go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
269252
270253unit-modules-% :
271- @# unit command that uses the pattern to define the root path that the
272- @# module testing will start from. Strips off the "unit-modules-" and
273- @# replaces all "_" with "/".
274- @#
275- @# e.g. unit-modules-internal_protocoltest
254+ @# See suffix-to-path pattern. Runs `go test`
276255 cd ./internal/repotools/cmd/eachmodule \
277256 && go run . -p $(subst _,/,$(subst unit-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
278- " go vet ${BUILD_TAGS} --all ./..." \
279- " go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
280257 " go test -timeout=2m ${UNIT_TEST_TAGS} ./..."
281258
282259build : build-modules-.
283260
284261build-modules-% :
285- @# build command that uses the pattern to define the root path that the
286- @# module testing will start from. Strips off the "build-modules-" and
287- @# replaces all "_" with "/".
288- @#
289- @# e.g. build-modules-internal_protocoltest
262+ @# See suffix-to-path pattern. Builds all modules and test files via `go test -run NONE`
290263 cd ./internal/repotools/cmd/eachmodule \
291264 && go run . -p $(subst _,/,$(subst build-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
292265 " go test ${BUILD_TAGS} ${RUN_NONE} ./..."
@@ -305,49 +278,19 @@ build-tagged-modules:
305278 done < " $( TEMP_FILE) " ;
306279
307280go-build-modules-% :
308- @# build command that uses the pattern to define the root path that the
309- @# module testing will start from. Strips off the "build-modules-" and
310- @# replaces all "_" with "/".
311- @#
312- @# Validates that all modules in the repo have buildable Go files.
313- @#
314- @# e.g. go-build-modules-internal_protocoltest
281+ @# See suffix-to-path pattern. Builds all modules without test files
315282 cd ./internal/repotools/cmd/eachmodule \
316283 && go run . -p $(subst _,/,$(subst go-build-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
317284 " go build ${BUILD_TAGS} ./..."
318285
319- test : test-modules-.
320-
321- test-race-modules-% :
322- @# Test command that uses the pattern to define the root path that the
323- @# module testing will start from. Strips off the "test-race-modules-" and
324- @# replaces all "_" with "/".
325- @#
326- @# e.g. test-race-modules-internal_protocoltest
327- cd ./internal/repotools/cmd/eachmodule \
328- && go run . -p $(subst _,/,$(subst test-race-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
329- " go test -timeout=2m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
286+ test : unit-modules-.
330287
331288test-race-vet-modules-% :
332- @# Test command that uses the pattern to define the root path that the
333- @# module testing will start from. Strips off the "test-race-modules-" and
334- @# replaces all "_" with "/".
335- @#
336- @# e.g. test-race-modules-internal_protocoltest
289+ @# See suffix-to-path pattern. Runs `go test` with `-race -vet` flags
337290 cd ./internal/repotools/cmd/eachmodule \
338291 && go run . -p $(subst _,/,$(subst test-race-vet-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
339292 " go test -timeout=2m ${UNIT_TEST_TAGS} -race -vet=all -cpu=4 ./..."
340293
341- test-modules-% :
342- @# Test command that uses the pattern to define the root path that the
343- @# module testing will start from. Strips off the "test-modules-" and
344- @# replaces all "_" with "/".
345- @#
346- @# e.g. test-modules-internal_protocoltest
347- cd ./internal/repotools/cmd/eachmodule \
348- && go run . -p $(subst _,/,$(subst test-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
349- " go test -timeout=2m ${UNIT_TEST_TAGS} ./..."
350-
351294test-check-snapshot-% :
352295 cd ./internal/repotools/cmd/eachmodule \
353296 && go run . -p $(subst _,/,$(subst test-check-snapshot-,,$@ ) ) ${EACHMODULE_FLAGS} \
@@ -366,23 +309,15 @@ test-ci-check-snapshot-%:
366309cachedep : cachedep-modules-.
367310
368311cachedep-modules-% :
369- @# build command that uses the pattern to define the root path that the
370- @# module caching will start from. Strips off the "cachedep-modules-" and
371- @# replaces all "_" with "/".
372- @#
373- @# e.g. cachedep-modules-internal_protocoltest
312+ @# See suffix-to-path pattern. Runs `go mod download`
374313 cd ./internal/repotools/cmd/eachmodule \
375314 && go run . -p $(subst _,/,$(subst cachedep-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
376315 " go mod download"
377316
378317api-diff-modules-% :
379- @# Command that uses the pattern to define the root path that the
380- @# module testing will start from. Strips off the "api-diff-modules-" and
381- @# replaces all "_" with "/".
318+ @# See suffix-to-path pattern. Runs `gorelease`
382319 @#
383320 @# Requires golang.org/x/exp/cmd/gorelease to be available in the GOPATH.
384- @#
385- @# e.g. api-diff-modules-internal_protocoltest
386321 cd ./internal/repotools/cmd/eachmodule \
387322 && go run . -p $(subst _,/,$(subst api-diff-modules-,,$@ ) ) \
388323 -fail-fast=true \
@@ -393,41 +328,10 @@ api-diff-modules-%:
393328# #############
394329# CI Testing #
395330# #############
396- .PHONY : ci-test ci-test- no-generate ci-test-generate-validate
331+ .PHONY : ci-test- no-generate ci-test-no- generate-no-race
397332
398- ci-test : generate unit-race ci-test-generate-validate
399333ci-test-no-generate : lint build-tagged-modules test-race-vet-modules-.
400- ci-test-no-generate-no-race : lint build-tagged-modules test-modules-.
401-
402- ci-test-generate-validate :
403- @echo " CI test validate no generated code changes"
404- git update-index --assume-unchanged go.mod go.sum
405- git add . -A
406- gitstatus=` git diff --cached --ignore-space-change` ; \
407- echo " $$ gitstatus" ; \
408- if [ " $$ gitstatus" != " " ] && [ " $$ gitstatus" != " skipping validation" ]; then echo " $$ gitstatus" ; exit 1; fi
409- git update-index --no-assume-unchanged go.mod go.sum
410-
411- ci-lint : ci-lint-.
412-
413- ci-lint-% :
414- @# Run golangci-lint command that uses the pattern to define the root path that the
415- @# module check will start from. Strips off the "ci-lint-" and
416- @# replaces all "_" with "/".
417- @#
418- @# e.g. ci-lint-internal_protocoltest
419- cd ./internal/repotools/cmd/eachmodule \
420- && go run . -p $(subst _,/,$(subst ci-lint-,,$@ ) ) \
421- -fail-fast=false \
422- -c 1 \
423- -skip=" internal/repotools" \
424- " golangci-lint run"
425-
426- ci-lint-install :
427- @# Installs golangci-lint at GoPATH.
428- @# This should be used to run golangci-lint locally.
429- @#
430- go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
334+ ci-test-no-generate-no-race : lint build-tagged-modules unit-modules-.
431335
432336# ######################
433337# Integration Testing #
@@ -437,11 +341,7 @@ ci-lint-install:
437341integration : integ-modules-service integ-modules-feature
438342
439343integ-modules-% :
440- @# integration command that uses the pattern to define the root path that
441- @# the module testing will start from. Strips off the "integ-modules-" and
442- @# replaces all "_" with "/".
443- @#
444- @# e.g. test-modules-service_dynamodb
344+ @# See suffix-to-path pattern. Runs `go test` on modules with the `integration` tag
445345 cd ./internal/repotools/cmd/eachmodule \
446346 && go run . -p $(subst _,/,$(subst integ-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
447347 " go test -timeout=10m -tags " integration" -v ${RUN_INTEG} -count 1 ./..."
@@ -458,11 +358,7 @@ cleanup-integ-buckets:
458358bench : bench-modules-.
459359
460360bench-modules-% :
461- @# benchmark command that uses the pattern to define the root path that
462- @# the module testing will start from. Strips off the "bench-modules-" and
463- @# replaces all "_" with "/".
464- @#
465- @# e.g. bench-modules-service_dynamodb
361+ @# See suffix-to-path pattern. Runs benchmark tests
466362 cd ./internal/repotools/cmd/eachmodule \
467363 && go run . -p $(subst _,/,$(subst bench-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
468364 " go test -timeout=10m -bench . --benchmem ${BUILD_TAGS} ${RUN_NONE} ./..."
@@ -538,6 +434,7 @@ lint:
538434vet : vet-modules-.
539435
540436vet-modules-% :
437+ @# See suffix-to-path pattern. Runs `go vet`
541438 cd ./internal/repotools/cmd/eachmodule \
542439 && go run . -p $(subst _,/,$(subst vet-modules-,,$@ ) ) ${EACHMODULE_FLAGS} \
543440 " go vet ${BUILD_TAGS} --all ./..."
@@ -551,14 +448,7 @@ sdkv1check:
551448list-deps : list-deps-.
552449
553450list-deps-% :
554- @# command that uses the pattern to define the root path that the
555- @# module testing will start from. Strips off the "list-deps-" and
556- @# replaces all "_" with "/".
557- @#
558- @# Trim output to only include stdout for list of dependencies only.
559- @# make list-deps 2>&-
560- @#
561- @# e.g. list-deps-internal_protocoltest
451+ @# See suffix-to-path pattern. Lists dependencies for Go modules
562452 @cd ./internal/repotools/cmd/eachmodule \
563453 && go run . -p $(subst _,/,$(subst list-deps-,,$@ ) ) ${EACHMODULE_FLAGS} \
564454 " go list -m all | grep -v 'github.com/aws/aws-sdk-go-v2'" | sort -u
0 commit comments