Makefile 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. # Lint rules to ignore
  2. LINTIGNORESINGLEFIGHT='internal/sync/singleflight/singleflight.go:.+error should be the last type'
  3. LINT_IGNORE_S3MANAGER_INPUT='feature/s3/manager/upload.go:.+struct field SSEKMSKeyId should be SSEKMSKeyID'
  4. UNIT_TEST_TAGS=
  5. BUILD_TAGS=-tags "example,codegen,integration,ec2env,perftest"
  6. SMITHY_GO_SRC ?= $(shell pwd)/../smithy-go
  7. SDK_MIN_GO_VERSION ?= 1.15
  8. EACHMODULE_FAILFAST ?= true
  9. EACHMODULE_FAILFAST_FLAG=-fail-fast=${EACHMODULE_FAILFAST}
  10. EACHMODULE_CONCURRENCY ?= 1
  11. EACHMODULE_CONCURRENCY_FLAG=-c ${EACHMODULE_CONCURRENCY}
  12. EACHMODULE_SKIP ?=
  13. EACHMODULE_SKIP_FLAG=-skip="${EACHMODULE_SKIP}"
  14. EACHMODULE_FLAGS=${EACHMODULE_CONCURRENCY_FLAG} ${EACHMODULE_FAILFAST_FLAG} ${EACHMODULE_SKIP_FLAG}
  15. # SDK's Core and client packages that are compatible with Go 1.9+.
  16. SDK_CORE_PKGS=./aws/... ./internal/...
  17. SDK_CLIENT_PKGS=./service/...
  18. SDK_COMPA_PKGS=${SDK_CORE_PKGS} ${SDK_CLIENT_PKGS}
  19. # SDK additional packages that are used for development of the SDK.
  20. SDK_EXAMPLES_PKGS=
  21. SDK_ALL_PKGS=${SDK_COMPA_PKGS} ${SDK_EXAMPLES_PKGS}
  22. RUN_NONE=-run NONE
  23. RUN_INTEG=-run '^TestInteg_'
  24. CODEGEN_RESOURCES_PATH=$(shell pwd)/codegen/smithy-aws-go-codegen/src/main/resources/software/amazon/smithy/aws/go/codegen
  25. CODEGEN_API_MODELS_PATH=$(shell pwd)/codegen/sdk-codegen/aws-models
  26. ENDPOINTS_JSON=${CODEGEN_RESOURCES_PATH}/endpoints.json
  27. ENDPOINT_PREFIX_JSON=${CODEGEN_RESOURCES_PATH}/endpoint-prefix.json
  28. LICENSE_FILE=$(shell pwd)/LICENSE.txt
  29. SMITHY_GO_VERSION ?=
  30. PRE_RELEASE_VERSION ?=
  31. RELEASE_MANIFEST_FILE ?=
  32. RELEASE_CHGLOG_DESC_FILE ?=
  33. REPOTOOLS_VERSION ?= latest
  34. REPOTOOLS_MODULE = github.com/awslabs/aws-go-multi-module-repository-tools
  35. REPOTOOLS_CMD_ANNOTATE_STABLE_GEN = ${REPOTOOLS_MODULE}/cmd/annotatestablegen@${REPOTOOLS_VERSION}
  36. REPOTOOLS_CMD_MAKE_RELATIVE = ${REPOTOOLS_MODULE}/cmd/makerelative@${REPOTOOLS_VERSION}
  37. REPOTOOLS_CMD_CALCULATE_RELEASE = ${REPOTOOLS_MODULE}/cmd/calculaterelease@${REPOTOOLS_VERSION}
  38. REPOTOOLS_CMD_UPDATE_REQUIRES = ${REPOTOOLS_MODULE}/cmd/updaterequires@${REPOTOOLS_VERSION}
  39. REPOTOOLS_CMD_UPDATE_MODULE_METADATA = ${REPOTOOLS_MODULE}/cmd/updatemodulemeta@${REPOTOOLS_VERSION}
  40. REPOTOOLS_CMD_GENERATE_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/generatechangelog@${REPOTOOLS_VERSION}
  41. REPOTOOLS_CMD_CHANGELOG = ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}
  42. REPOTOOLS_CMD_TAG_RELEASE = ${REPOTOOLS_MODULE}/cmd/tagrelease@${REPOTOOLS_VERSION}
  43. REPOTOOLS_CMD_EDIT_MODULE_DEPENDENCY = ${REPOTOOLS_MODULE}/cmd/editmoduledependency@${REPOTOOLS_VERSION}
  44. REPOTOOLS_CALCULATE_RELEASE_VERBOSE ?= false
  45. REPOTOOLS_CALCULATE_RELEASE_VERBOSE_FLAG=-v=${REPOTOOLS_CALCULATE_RELEASE_VERBOSE}
  46. REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS ?=
  47. ifneq ($(PRE_RELEASE_VERSION),)
  48. REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS += -preview=${PRE_RELEASE_VERSION}
  49. endif
  50. .PHONY: all
  51. all: generate unit
  52. ###################
  53. # Code Generation #
  54. ###################
  55. .PHONY: generate smithy-generate smithy-build smithy-build-% smithy-clean smithy-go-publish-local format \
  56. gen-config-asserts gen-repo-mod-replace gen-mod-replace-smithy gen-mod-dropreplace-smithy-% gen-aws-ptrs tidy-modules-% \
  57. add-module-license-files sync-models sync-endpoints-model sync-endpoints.json clone-v1-models gen-internal-codegen \
  58. sync-api-models copy-attributevalue-feature min-go-version-% update-requires smithy-annotate-stable \
  59. update-module-metadata download-modules-%
  60. generate: smithy-generate update-requires gen-repo-mod-replace update-module-metadata smithy-annotate-stable \
  61. gen-config-asserts gen-internal-codegen copy-attributevalue-feature gen-mod-dropreplace-smithy-. min-go-version-. \
  62. tidy-modules-. add-module-license-files gen-aws-ptrs format
  63. smithy-generate:
  64. cd codegen && ./gradlew clean build -Plog-tests && ./gradlew clean
  65. smithy-build:
  66. cd codegen && ./gradlew clean build -Plog-tests
  67. smithy-build-%:
  68. @# smithy-build- command that uses the pattern to define build filter that
  69. @# the smithy API model service id starts with. Strips off the
  70. @# "smithy-build-".
  71. @#
  72. @# e.g. smithy-build-com.amazonaws.rds
  73. @# e.g. smithy-build-com.amazonaws.rds#AmazonRDSv19
  74. cd codegen && \
  75. SMITHY_GO_BUILD_API="$(subst smithy-build-,,$@)" ./gradlew clean build -Plog-tests
  76. smithy-annotate-stable:
  77. go run ${REPOTOOLS_CMD_ANNOTATE_STABLE_GEN}
  78. smithy-clean:
  79. cd codegen && ./gradlew clean
  80. smithy-go-publish-local:
  81. rm -rf /tmp/smithy-go-local
  82. git clone https://github.com/aws/smithy-go /tmp/smithy-go-local
  83. make -C /tmp/smithy-go-local smithy-clean smithy-publish-local
  84. format:
  85. gofmt -w -s .
  86. gen-config-asserts:
  87. @echo "Generating SDK config package implementor assertions"
  88. cd config \
  89. && go mod tidy \
  90. && go generate
  91. gen-internal-codegen:
  92. @echo "Generating internal/codegen"
  93. cd internal/codegen \
  94. && go mod tidy \
  95. && go generate
  96. gen-repo-mod-replace:
  97. @echo "Generating go.mod replace for repo modules"
  98. go run ${REPOTOOLS_CMD_MAKE_RELATIVE}
  99. gen-mod-replace-smithy-%:
  100. @# gen-mod-replace-smithy- command that uses the pattern to define build filter that
  101. @# for modules to add replace to. Strips off the "gen-mod-replace-smithy-".
  102. @#
  103. @# SMITHY_GO_SRC environment variable is the path to add replace to
  104. @#
  105. @# e.g. gen-mod-replace-smithy-service_ssooidc
  106. cd ./internal/repotools/cmd/eachmodule \
  107. && go run . -p $(subst _,/,$(subst gen-mod-replace-smithy-,,$@)) ${EACHMODULE_FLAGS} \
  108. "go mod edit -replace github.com/aws/smithy-go=${SMITHY_GO_SRC}"
  109. gen-mod-dropreplace-smithy-%:
  110. @# gen-mod-dropreplace-smithy- command that uses the pattern to define build filter that
  111. @# for modules to add replace to. Strips off the "gen-mod-dropreplace-smithy-".
  112. @#
  113. @# e.g. gen-mod-dropreplace-smithy-service_ssooidc
  114. cd ./internal/repotools/cmd/eachmodule \
  115. && go run . -p $(subst _,/,$(subst gen-mod-dropreplace-smithy-,,$@)) ${EACHMODULE_FLAGS} \
  116. "go mod edit -dropreplace github.com/aws/smithy-go"
  117. gen-aws-ptrs:
  118. cd aws && go generate
  119. tidy-modules-%:
  120. @# tidy command that uses the pattern to define the root path that the
  121. @# module testing will start from. Strips off the "tidy-modules-" and
  122. @# replaces all "_" with "/".
  123. @#
  124. @# e.g. tidy-modules-internal_protocoltest
  125. cd ./internal/repotools/cmd/eachmodule \
  126. && go run . -p $(subst _,/,$(subst tidy-modules-,,$@)) ${EACHMODULE_FLAGS} \
  127. "go mod tidy"
  128. download-modules-%:
  129. @# download command that uses the pattern to define the root path that the
  130. @# module testing will start from. Strips off the "download-modules-" and
  131. @# replaces all "_" with "/".
  132. @#
  133. @# e.g. download-modules-internal_protocoltest
  134. cd ./internal/repotools/cmd/eachmodule \
  135. && go run . -p $(subst _,/,$(subst download-modules-,,$@)) ${EACHMODULE_FLAGS} \
  136. "go mod download all"
  137. add-module-license-files:
  138. cd internal/repotools/cmd/eachmodule && \
  139. go run . -skip-root \
  140. "cp $(LICENSE_FILE) ."
  141. sync-models: sync-endpoints-model sync-api-models
  142. sync-endpoints-model: sync-endpoints.json
  143. sync-endpoints.json:
  144. [[ ! -z "${ENDPOINTS_MODEL}" ]] && cp ${ENDPOINTS_MODEL} ${ENDPOINTS_JSON} || echo "ENDPOINTS_MODEL not set, must not be empty"
  145. clone-v1-models:
  146. rm -rf /tmp/aws-sdk-go-model-sync
  147. git clone https://github.com/aws/aws-sdk-go.git --depth 1 /tmp/aws-sdk-go-model-sync
  148. sync-api-models:
  149. cd internal/repotools/cmd/syncAPIModels && \
  150. go run . \
  151. -m ${API_MODELS} \
  152. -o ${CODEGEN_API_MODELS_PATH}
  153. copy-attributevalue-feature:
  154. cd ./feature/dynamodbstreams/attributevalue && \
  155. find . -name "*.go" | grep -v "doc.go" | xargs -I % rm % && \
  156. find ../../dynamodb/attributevalue -name "*.go" | grep -v "doc.go" | xargs -I % cp % . && \
  157. ls *.go | grep -v "convert.go" | grep -v "doc.go" | \
  158. xargs -I % sed -i.bk -E 's:github.com/aws/aws-sdk-go-v2/(service|feature)/dynamodb:github.com/aws/aws-sdk-go-v2/\1/dynamodbstreams:g' % && \
  159. ls *.go | grep -v "convert.go" | grep -v "doc.go" | \
  160. xargs -I % sed -i.bk 's:DynamoDB:DynamoDBStreams:g' % && \
  161. ls *.go | grep -v "doc.go" | \
  162. xargs -I % sed -i.bk 's:dynamodb\.:dynamodbstreams.:g' % && \
  163. sed -i.bk 's:streams\.:ddbtypes.:g' "convert.go" && \
  164. sed -i.bk 's:ddb\.:streams.:g' "convert.go" && \
  165. sed -i.bk 's:ddbtypes\.:ddb.:g' "convert.go" &&\
  166. sed -i.bk 's:Streams::g' "convert.go" && \
  167. rm -rf ./*.bk && \
  168. go mod tidy && \
  169. gofmt -w -s . && \
  170. go test .
  171. min-go-version-%:
  172. cd ./internal/repotools/cmd/eachmodule \
  173. && go run . -p $(subst _,/,$(subst min-go-version-,,$@)) ${EACHMODULE_FLAGS} \
  174. "go mod edit -go=${SDK_MIN_GO_VERSION}"
  175. update-requires:
  176. go run ${REPOTOOLS_CMD_UPDATE_REQUIRES}
  177. update-module-metadata:
  178. go run ${REPOTOOLS_CMD_UPDATE_MODULE_METADATA}
  179. ################
  180. # Unit Testing #
  181. ################
  182. .PHONY: unit unit-race unit-test unit-race-test unit-race-modules-% unit-modules-% build build-modules-% \
  183. go-build-modules-% test test-race-modules-% test-modules-% cachedep cachedep-modules-% api-diff-modules-%
  184. unit: lint unit-modules-.
  185. unit-race: lint unit-race-modules-.
  186. unit-test: test-modules-.
  187. unit-race-test: test-race-modules-.
  188. unit-race-modules-%:
  189. @# unit command that uses the pattern to define the root path that the
  190. @# module testing will start from. Strips off the "unit-race-modules-" and
  191. @# replaces all "_" with "/".
  192. @#
  193. @# e.g. unit-race-modules-internal_protocoltest
  194. cd ./internal/repotools/cmd/eachmodule \
  195. && go run . -p $(subst _,/,$(subst unit-race-modules-,,$@)) ${EACHMODULE_FLAGS} \
  196. "go vet ${BUILD_TAGS} --all ./..." \
  197. "go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
  198. "go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
  199. unit-modules-%:
  200. @# unit command that uses the pattern to define the root path that the
  201. @# module testing will start from. Strips off the "unit-modules-" and
  202. @# replaces all "_" with "/".
  203. @#
  204. @# e.g. unit-modules-internal_protocoltest
  205. cd ./internal/repotools/cmd/eachmodule \
  206. && go run . -p $(subst _,/,$(subst unit-modules-,,$@)) ${EACHMODULE_FLAGS} \
  207. "go vet ${BUILD_TAGS} --all ./..." \
  208. "go test ${BUILD_TAGS} ${RUN_NONE} ./..." \
  209. "go test -timeout=1m ${UNIT_TEST_TAGS} ./..."
  210. build: build-modules-.
  211. build-modules-%:
  212. @# build command that uses the pattern to define the root path that the
  213. @# module testing will start from. Strips off the "build-modules-" and
  214. @# replaces all "_" with "/".
  215. @#
  216. @# e.g. build-modules-internal_protocoltest
  217. cd ./internal/repotools/cmd/eachmodule \
  218. && go run . -p $(subst _,/,$(subst build-modules-,,$@)) ${EACHMODULE_FLAGS} \
  219. "go test ${BUILD_TAGS} ${RUN_NONE} ./..."
  220. go-build-modules-%:
  221. @# build command that uses the pattern to define the root path that the
  222. @# module testing will start from. Strips off the "build-modules-" and
  223. @# replaces all "_" with "/".
  224. @#
  225. @# Validates that all modules in the repo have buildable Go files.
  226. @#
  227. @# e.g. go-build-modules-internal_protocoltest
  228. cd ./internal/repotools/cmd/eachmodule \
  229. && go run . -p $(subst _,/,$(subst go-build-modules-,,$@)) ${EACHMODULE_FLAGS} \
  230. "go build ${BUILD_TAGS} ./..."
  231. test: test-modules-.
  232. test-race-modules-%:
  233. @# Test command that uses the pattern to define the root path that the
  234. @# module testing will start from. Strips off the "test-race-modules-" and
  235. @# replaces all "_" with "/".
  236. @#
  237. @# e.g. test-race-modules-internal_protocoltest
  238. cd ./internal/repotools/cmd/eachmodule \
  239. && go run . -p $(subst _,/,$(subst test-race-modules-,,$@)) ${EACHMODULE_FLAGS} \
  240. "go test -timeout=1m ${UNIT_TEST_TAGS} -race -cpu=4 ./..."
  241. test-modules-%:
  242. @# Test command that uses the pattern to define the root path that the
  243. @# module testing will start from. Strips off the "test-modules-" and
  244. @# replaces all "_" with "/".
  245. @#
  246. @# e.g. test-modules-internal_protocoltest
  247. cd ./internal/repotools/cmd/eachmodule \
  248. && go run . -p $(subst _,/,$(subst test-modules-,,$@)) ${EACHMODULE_FLAGS} \
  249. "go test -timeout=1m ${UNIT_TEST_TAGS} ./..."
  250. cachedep: cachedep-modules-.
  251. cachedep-modules-%:
  252. @# build command that uses the pattern to define the root path that the
  253. @# module caching will start from. Strips off the "cachedep-modules-" and
  254. @# replaces all "_" with "/".
  255. @#
  256. @# e.g. cachedep-modules-internal_protocoltest
  257. cd ./internal/repotools/cmd/eachmodule \
  258. && go run . -p $(subst _,/,$(subst cachedep-modules-,,$@)) ${EACHMODULE_FLAGS} \
  259. "go mod download"
  260. api-diff-modules-%:
  261. @# Command that uses the pattern to define the root path that the
  262. @# module testing will start from. Strips off the "api-diff-modules-" and
  263. @# replaces all "_" with "/".
  264. @#
  265. @# Requires golang.org/x/exp/cmd/gorelease to be available in the GOPATH.
  266. @#
  267. @# e.g. api-diff-modules-internal_protocoltest
  268. cd ./internal/repotools/cmd/eachmodule \
  269. && go run . -p $(subst _,/,$(subst api-diff-modules-,,$@)) \
  270. -fail-fast=true \
  271. -c 1 \
  272. -skip="internal/repotools" \
  273. "$$(go env GOPATH)/bin/gorelease"
  274. ##############
  275. # CI Testing #
  276. ##############
  277. .PHONY: ci-test ci-test-no-generate ci-test-generate-validate
  278. ci-test: generate unit-race ci-test-generate-validate
  279. ci-test-no-generate: unit-race
  280. ci-test-generate-validate:
  281. @echo "CI test validate no generated code changes"
  282. git update-index --assume-unchanged go.mod go.sum
  283. git add . -A
  284. gitstatus=`git diff --cached --ignore-space-change`; \
  285. echo "$$gitstatus"; \
  286. if [ "$$gitstatus" != "" ] && [ "$$gitstatus" != "skipping validation" ]; then echo "$$gitstatus"; exit 1; fi
  287. git update-index --no-assume-unchanged go.mod go.sum
  288. ci-lint: ci-lint-.
  289. ci-lint-%:
  290. @# Run golangci-lint command that uses the pattern to define the root path that the
  291. @# module check will start from. Strips off the "ci-lint-" and
  292. @# replaces all "_" with "/".
  293. @#
  294. @# e.g. ci-lint-internal_protocoltest
  295. cd ./internal/repotools/cmd/eachmodule \
  296. && go run . -p $(subst _,/,$(subst ci-lint-,,$@)) \
  297. -fail-fast=false \
  298. -c 1 \
  299. -skip="internal/repotools" \
  300. "golangci-lint run"
  301. ci-lint-install:
  302. @# Installs golangci-lint at GoPATH.
  303. @# This should be used to run golangci-lint locally.
  304. @#
  305. go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
  306. #######################
  307. # Integration Testing #
  308. #######################
  309. .PHONY: integration integ-modules-% cleanup-integ-buckets
  310. integration: integ-modules-service
  311. integ-modules-%:
  312. @# integration command that uses the pattern to define the root path that
  313. @# the module testing will start from. Strips off the "integ-modules-" and
  314. @# replaces all "_" with "/".
  315. @#
  316. @# e.g. test-modules-service_dynamodb
  317. cd ./internal/repotools/cmd/eachmodule \
  318. && go run . -p $(subst _,/,$(subst integ-modules-,,$@)) ${EACHMODULE_FLAGS} \
  319. "go test -timeout=10m -tags "integration" -v ${RUN_INTEG} -count 1 ./..."
  320. cleanup-integ-buckets:
  321. @echo "Cleaning up SDK integration resources"
  322. go run -tags "integration" ./internal/awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration"
  323. ##############
  324. # Benchmarks #
  325. ##############
  326. .PHONY: bench bench-modules-%
  327. bench: bench-modules-.
  328. bench-modules-%:
  329. @# benchmark command that uses the pattern to define the root path that
  330. @# the module testing will start from. Strips off the "bench-modules-" and
  331. @# replaces all "_" with "/".
  332. @#
  333. @# e.g. bench-modules-service_dynamodb
  334. cd ./internal/repotools/cmd/eachmodule \
  335. && go run . -p $(subst _,/,$(subst bench-modules-,,$@)) ${EACHMODULE_FLAGS} \
  336. "go test -timeout=10m -bench . --benchmem ${BUILD_TAGS} ${RUN_NONE} ./..."
  337. #####################
  338. # Release Process #
  339. #####################
  340. .PHONY: preview-release pre-release-validation release
  341. ls-changes:
  342. go run ${REPOTOOLS_CMD_CHANGELOG} ls
  343. preview-release:
  344. go run ${REPOTOOLS_CMD_CALCULATE_RELEASE} ${REPOTOOLS_CALCULATE_RELEASE_VERBOSE_FLAG} ${REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS}
  345. pre-release-validation:
  346. @if [[ -z "${RELEASE_MANIFEST_FILE}" ]]; then \
  347. echo "RELEASE_MANIFEST_FILE is required to specify the file to write the release manifest" && false; \
  348. fi
  349. @if [[ -z "${RELEASE_CHGLOG_DESC_FILE}" ]]; then \
  350. echo "RELEASE_CHGLOG_DESC_FILE is required to specify the file to write the release notes" && false; \
  351. fi
  352. release: pre-release-validation
  353. go run ${REPOTOOLS_CMD_CALCULATE_RELEASE} -o ${RELEASE_MANIFEST_FILE} ${REPOTOOLS_CALCULATE_RELEASE_VERBOSE_FLAG} ${REPOTOOLS_CALCULATE_RELEASE_ADDITIONAL_ARGS}
  354. go run ${REPOTOOLS_CMD_UPDATE_REQUIRES} -release ${RELEASE_MANIFEST_FILE}
  355. go run ${REPOTOOLS_CMD_UPDATE_MODULE_METADATA} -release ${RELEASE_MANIFEST_FILE}
  356. go run ${REPOTOOLS_CMD_GENERATE_CHANGELOG} -release ${RELEASE_MANIFEST_FILE} -o ${RELEASE_CHGLOG_DESC_FILE}
  357. go run ${REPOTOOLS_CMD_CHANGELOG} rm -all
  358. go run ${REPOTOOLS_CMD_TAG_RELEASE} -release ${RELEASE_MANIFEST_FILE}
  359. ##############
  360. # Repo Tools #
  361. ##############
  362. .PHONY: install-repotools
  363. install-repotools:
  364. go install ${REPOTOOLS_MODULE}/cmd/changelog@${REPOTOOLS_VERSION}
  365. set-smithy-go-version:
  366. @if [[ -z "${SMITHY_GO_VERSION}" ]]; then \
  367. echo "SMITHY_GO_VERSION is required to update SDK's smithy-go module dependency version" && false; \
  368. fi
  369. go run ${REPOTOOLS_CMD_EDIT_MODULE_DEPENDENCY} -s "github.com/aws/smithy-go" -v "${SMITHY_GO_VERSION}"
  370. ##################
  371. # Linting/Verify #
  372. ##################
  373. .PHONY: verify lint vet vet-modules-% sdkv1check
  374. verify: lint vet sdkv1check
  375. lint:
  376. @echo "go lint SDK and vendor packages"
  377. @lint=`golint ./...`; \
  378. dolint=`echo "$$lint" | grep -E -v \
  379. -e ${LINT_IGNORE_S3MANAGER_INPUT} \
  380. -e ${LINTIGNORESINGLEFIGHT}`; \
  381. echo "$$dolint"; \
  382. if [ "$$dolint" != "" ]; then exit 1; fi
  383. vet: vet-modules-.
  384. vet-modules-%:
  385. cd ./internal/repotools/cmd/eachmodule \
  386. && go run . -p $(subst _,/,$(subst vet-modules-,,$@)) ${EACHMODULE_FLAGS} \
  387. "go vet ${BUILD_TAGS} --all ./..."
  388. sdkv1check:
  389. @echo "Checking for usage of AWS SDK for Go v1"
  390. @sdkv1usage=`go list -test -f '''{{ if not .Standard }}{{ range $$_, $$name := .Imports }} * {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ range $$_, $$name := .TestImports }} *: {{ $$.ImportPath }} -> {{ $$name }}{{ print "\n" }}{{ end }}{{ end}}''' ./... | sort -u | grep '''/aws-sdk-go/'''`; \
  391. echo "$$sdkv1usage"; \
  392. if [ "$$sdkv1usage" != "" ]; then exit 1; fi
  393. list-deps: list-deps-.
  394. list-deps-%:
  395. @# command that uses the pattern to define the root path that the
  396. @# module testing will start from. Strips off the "list-deps-" and
  397. @# replaces all "_" with "/".
  398. @#
  399. @# Trim output to only include stdout for list of dependencies only.
  400. @# make list-deps 2>&-
  401. @#
  402. @# e.g. list-deps-internal_protocoltest
  403. @cd ./internal/repotools/cmd/eachmodule \
  404. && go run . -p $(subst _,/,$(subst list-deps-,,$@)) ${EACHMODULE_FLAGS} \
  405. "go list -m all | grep -v 'github.com/aws/aws-sdk-go-v2'" | sort -u
  406. ###################
  407. # Sandbox Testing #
  408. ###################
  409. .PHONY: sandbox-tests sandbox-build-% sandbox-run-% sandbox-test-% update-aws-golang-tip
  410. sandbox-tests: sandbox-test-go1.15 sandbox-test-go1.16 sandbox-test-go1.17 sandbox-test-go1.18 sandbox-test-go1.19 sandbox-test-go1.20 sandbox-test-gotip
  411. sandbox-build-%:
  412. @# sandbox-build-go1.17
  413. @# sandbox-build-gotip
  414. @if [ $@ == sandbox-build-gotip ]; then\
  415. docker build \
  416. -f ./internal/awstesting/sandbox/Dockerfile.test.gotip \
  417. -t "aws-sdk-go-$(subst sandbox-build-,,$@)" . ;\
  418. else\
  419. docker build \
  420. --build-arg GO_VERSION=$(subst sandbox-build-go,,$@) \
  421. -f ./internal/awstesting/sandbox/Dockerfile.test.goversion \
  422. -t "aws-sdk-go-$(subst sandbox-build-,,$@)" . ;\
  423. fi
  424. sandbox-run-%: sandbox-build-%
  425. @# sandbox-run-go1.17
  426. @# sandbox-run-gotip
  427. docker run -i -t "aws-sdk-go-$(subst sandbox-run-,,$@)" bash
  428. sandbox-test-%: sandbox-build-%
  429. @# sandbox-test-go1.17
  430. @# sandbox-test-gotip
  431. docker run -t "aws-sdk-go-$(subst sandbox-test-,,$@)"
  432. update-aws-golang-tip:
  433. docker build --no-cache=true -f ./internal/awstesting/sandbox/Dockerfile.golang-tip -t "aws-golang:tip" .