Implemented the "generate-docs", "preview-doc", and "flush-docs" targets in the Makefile file.
This commit is contained in:
parent
1874d6ecec
commit
f701202933
99
Makefile
99
Makefile
@ -8,11 +8,12 @@ export $(shell sed 's/=.*//' $(environment_vars))
|
|||||||
|
|
||||||
# --- ARGUMENTS --- #
|
# --- ARGUMENTS --- #
|
||||||
|
|
||||||
override docker?=${CLI_USE_DOCKER}
|
|
||||||
override tag?=${DOCKER_IMAGE_TAG}
|
|
||||||
override platform?=${DOCKER_IMAGE_PLATFORM}
|
|
||||||
override config?=${SWIFT_BUILD_CONFIGURATION}
|
|
||||||
override clean?=${DOCKER_IMAGE_CLEAN}
|
override clean?=${DOCKER_IMAGE_CLEAN}
|
||||||
|
override config?=${SWIFT_BUILD_CONFIGURATION}
|
||||||
|
override docker?=${CLI_USE_DOCKER}
|
||||||
|
override library?=${DOCKER_TARGET_COMPONENT}
|
||||||
|
override platform?=${DOCKER_IMAGE_PLATFORM}
|
||||||
|
override tag?=${DOCKER_IMAGE_TAG}
|
||||||
|
|
||||||
# --- IDE --- #
|
# --- IDE --- #
|
||||||
|
|
||||||
@ -68,7 +69,59 @@ endif
|
|||||||
|
|
||||||
# --- DOCUMENTAION --- #
|
# --- DOCUMENTAION --- #
|
||||||
|
|
||||||
|
generate-docs: ## Generate DocC documentation for both Xcode and Web.
|
||||||
|
@make generate-doc-communication
|
||||||
|
@make generate-doc-coordination
|
||||||
|
@make generate-doc-dependency
|
||||||
|
@make generate-doc-foundation
|
||||||
|
@make generate-doc-persistence
|
||||||
|
|
||||||
|
generate-doc-communication: SWIFT_TARGET_NAME=SwiftLibsCommunication
|
||||||
|
generate-doc-communication: SWIFT_TARGET_COMPONENT=communication
|
||||||
|
generate-doc-communication: generate-doc-xcode generate-doc-github
|
||||||
|
|
||||||
|
generate-doc-coordination: SWIFT_TARGET_NAME=SwiftLibsCoordination
|
||||||
|
generate-doc-coordination: SWIFT_TARGET_COMPONENT=coordination
|
||||||
|
generate-doc-coordination: generate-doc-xcode generate-doc-github
|
||||||
|
|
||||||
|
generate-doc-dependency: SWIFT_TARGET_NAME=SwiftLibsDependency
|
||||||
|
generate-doc-dependency: SWIFT_TARGET_COMPONENT=dependency
|
||||||
|
generate-doc-dependency: generate-doc-xcode generate-doc-github
|
||||||
|
|
||||||
|
generate-doc-foundation: SWIFT_TARGET_NAME=SwiftLibsFoundation
|
||||||
|
generate-doc-foundation: SWIFT_TARGET_COMPONENT=foundation
|
||||||
|
generate-doc-foundation: generate-doc-xcode generate-doc-github
|
||||||
|
|
||||||
|
generate-doc-persistence: SWIFT_TARGET_NAME=SwiftLibsPersistence
|
||||||
|
generate-doc-persistence: SWIFT_TARGET_COMPONENT=persistence
|
||||||
|
generate-doc-persistence: generate-doc-xcode generate-doc-github
|
||||||
|
|
||||||
|
generate-doc-xcode:
|
||||||
|
@swift package \
|
||||||
|
--allow-writing-to-directory ${DOCC_XCODE_DIRECTORY} \
|
||||||
|
generate-documentation \
|
||||||
|
--include-extended-types \
|
||||||
|
--target ${SWIFT_TARGET_NAME} \
|
||||||
|
--output-path ${DOCC_XCODE_OUTPUT}
|
||||||
|
|
||||||
|
generate-doc-github:
|
||||||
|
@swift package \
|
||||||
|
--allow-writing-to-directory ${DOCC_GITHUB_DIRECTORY} \
|
||||||
|
generate-documentation \
|
||||||
|
--target ${SWIFT_TARGET_NAME} \
|
||||||
|
--include-extended-types \
|
||||||
|
--disable-indexing \
|
||||||
|
--transform-for-static-hosting \
|
||||||
|
--hosting-base-path ${DOCC_GITHUB_BASE_PATH} \
|
||||||
|
--output-path ${DOCC_GITHUB_OUTPUT}
|
||||||
|
|
||||||
|
preview-doc: set-target ## Preview DocC documentation for a particular library.
|
||||||
|
@open -a safari ${DOCC_PREVIEW_URL}${library}
|
||||||
|
@swift package \
|
||||||
|
--disable-sandbox \
|
||||||
|
preview-documentation \
|
||||||
|
--include-extended-types \
|
||||||
|
--target ${target}
|
||||||
|
|
||||||
# --- HOUSE-KEEPING --- #
|
# --- HOUSE-KEEPING --- #
|
||||||
|
|
||||||
@ -78,20 +131,50 @@ clean: ## Clean the build artifacts of the package.
|
|||||||
reset: ## Reset the build folder of the package.
|
reset: ## Reset the build folder of the package.
|
||||||
@swift package reset
|
@swift package reset
|
||||||
|
|
||||||
|
flush-docs: ## Flush the documentation for Xcode and Web.
|
||||||
|
ifeq ("$(shell test -e ${DOCC_GITHUB_DIRECTORY} && echo yes)","yes")
|
||||||
|
@rm -rf ${DOCC_GITHUB_DIRECTORY}
|
||||||
|
@mkdir ${DOCC_GITHUB_DIRECTORY}
|
||||||
|
endif
|
||||||
|
ifeq ("$(shell test -e ${DOCC_XCODE_DIRECTORY} && echo yes)","yes")
|
||||||
|
@rm -rf ${DOCC_XCODE_DIRECTORY}
|
||||||
|
@mkdir ${DOCC_XCODE_DIRECTORY}
|
||||||
|
endif
|
||||||
|
|
||||||
flush-images: ## Flush all outstanding Swift docker images.
|
flush-images: ## Flush all outstanding Swift docker images.
|
||||||
@docker images \
|
@docker images \
|
||||||
--all | grep ${DOCKER_IMAGE_NAME} | awk '{print $$3}' | xargs docker rmi --force
|
--all | grep ${DOCKER_IMAGE_NAME} | awk '{print $$3}' | xargs docker rmi --force
|
||||||
|
|
||||||
# --- HELP ---
|
# --- HELPERS --- #
|
||||||
|
|
||||||
# Outputs the documentation for each of the defined tasks when `help` is called.
|
set-target:
|
||||||
|
override target?=${SWIFT_TARGET_NAME}
|
||||||
|
ifeq (${library},communication)
|
||||||
|
override target=SwiftLibsCommunication
|
||||||
|
endif
|
||||||
|
ifeq (${library},coordination)
|
||||||
|
override target=SwiftLibsCoordination
|
||||||
|
endif
|
||||||
|
ifeq (${library},dependency)
|
||||||
|
override target=SwiftLibsDependency
|
||||||
|
endif
|
||||||
|
ifeq (${library},foundation)
|
||||||
|
override target=SwiftLibsFoundation
|
||||||
|
endif
|
||||||
|
ifeq (${library},persistence)
|
||||||
|
override target=SwiftLibsPersistence
|
||||||
|
endif
|
||||||
|
|
||||||
|
# --- HELP --- #
|
||||||
|
|
||||||
|
# Output the documentation for each of the defined tasks when `help` is called.
|
||||||
# Reference: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
# Reference: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||||
.PHONY: help
|
.PHONY: help
|
||||||
|
|
||||||
help: ## Prints the written documentation for all the defined tasks.
|
help: ## Print the written documentation for all the defined tasks.
|
||||||
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
||||||
|
|
||||||
help-docc-plugin: ## Prints the help for the Swift-DocC plugin.
|
help-docc-plugin: ## Print the help for the Swift-DocC plugin.
|
||||||
@swift package plugin generate-documentation --help
|
@swift package plugin generate-documentation --help
|
||||||
|
|
||||||
.DEFAULT_GOAL := help
|
.DEFAULT_GOAL := help
|
||||||
|
Loading…
x
Reference in New Issue
Block a user