[Setup] DocC #13
11
.env
Normal file
11
.env
Normal file
@ -0,0 +1,11 @@
|
||||
# -- PROJECT ---
|
||||
|
||||
SWIFT_TARGET_NAME=AmiiboService
|
||||
|
||||
# --- DOCUMENTATION ---
|
||||
|
||||
SWIFT_DOC_FOLDER=./Documentation
|
||||
SWIFT_DOC_GITHUB_OUTPUT=${SWIFT_DOC_FOLDER}/github
|
||||
SWIFT_DOC_GITHUB_BASE_PATH=amiibo-service
|
||||
SWIFT_DOC_PREVIEW_URL=http://localhost:8080/documentation/amiiboservice
|
||||
SWIFT_DOC_XCODE_OUTPUT=${SWIFT_DOC_FOLDER}/${SWIFT_TARGET_NAME}.doccarchive
|
57
Makefile
Normal file
57
Makefile
Normal file
@ -0,0 +1,57 @@
|
||||
# --- IMPORTS ---
|
||||
|
||||
# Imports environment variables.
|
||||
environment_vars ?= .env
|
||||
|
||||
include $(environment_vars)
|
||||
export $(shell sed 's/=.*//' $(environment_vars))
|
||||
|
||||
# --- DOCUMENTATION ---
|
||||
|
||||
preview-doc: ## Previews the project documentation for web.
|
||||
@open -a safari $(SWIFT_DOC_PREVIEW_URL)
|
||||
@swift package \
|
||||
--disable-sandbox \
|
||||
preview-documentation \
|
||||
--target $(SWIFT_TARGET_NAME)
|
||||
|
||||
generate-doc: generate-doc-setup generate-doc-xcode generate-doc-github ## Generates the project documentation for Xcode and Github.
|
||||
|
||||
generate-doc-setup:
|
||||
# Checks if the documentation root folder exists.
|
||||
ifeq ("$(shell test -e ${SWIFT_DOC_FOLDER} && echo yes)","yes")
|
||||
@echo Cleaning up the documentation folder...
|
||||
@rm -rf ${SWIFT_DOC_FOLDER}
|
||||
endif
|
||||
@echo Creating the documentation folder...
|
||||
@mkdir ${SWIFT_DOC_FOLDER}
|
||||
|
||||
generate-doc-xcode:
|
||||
@echo Generating documentation for Xcode...
|
||||
@swift package \
|
||||
--allow-writing-to-directory $(SWIFT_DOC_XCODE_OUTPUT) \
|
||||
generate-documentation \
|
||||
--target $(SWIFT_TARGET_NAME) \
|
||||
--output-path $(SWIFT_DOC_XCODE_OUTPUT)
|
||||
|
||||
generate-doc-github:
|
||||
@echo Generating documentation for Github pages...
|
||||
@swift package \
|
||||
--allow-writing-to-directory $(SWIFT_DOC_GITHUB_OUTPUT) \
|
||||
generate-documentation \
|
||||
--target $(SWIFT_TARGET_NAME) \
|
||||
--disable-indexing \
|
||||
--transform-for-static-hosting \
|
||||
--hosting-base-path $(SWIFT_DOC_GITHUB_BASE_PATH) \
|
||||
--output-path $(SWIFT_DOC_GITHUB_OUTPUT)
|
||||
|
||||
# --- HELP ---
|
||||
|
||||
# Outputs the documentation for each of the defined tasks when `help` is called.
|
||||
# Reference: https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
||||
.PHONY: help
|
||||
|
||||
help: ## Prints 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)
|
||||
|
||||
.DEFAULT_GOAL := help
|
Loading…
x
Reference in New Issue
Block a user