diff --git a/Makefile b/Makefile index b12cd06..6ba0fb2 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,28 @@ +# VARIABLES + +DOCC_ARCHIVES = Doxy*.doccarchive +DOCC_ARCHIVES_FOLDER = Resources/Archives +DOCC_BUILD_FOLDER = .build/plugins/Swift-DocC/outputs +DOCC_TEST_FOLDER = Resources/Archives/Test +DOCKER_IMAGE_NAME = doxy-app +TARGET_APP = DoxyApp +TARGET_LIBRARY = DoxyLibrary + +# FUNCTIONS + +define copy-docs + @cp -rf $(DOCC_BUILD_FOLDER)/$(DOCC_ARCHIVES) $(1) +endef + +define gen-doc + @swift package plugin generate-documentation\ + --target $(1)\ + --hosting-base-path "archives/$(1)"\ + --include-extended-types\ + --symbol-graph-minimum-access-level internal\ + --enable-inherited-docs +endef + # PROJECT build: ## Builds the project locally. @@ -25,18 +50,22 @@ update: ## Updates the SPM package dependencies. # DOCUMENTATION -build-doc: ## Builds the DocC documentation for the library target. - @swift package plugin generate-documentation\ - --target DoxyLibrary\ - --include-extended-types\ - --symbol-graph-minimum-access-level internal - @cp -rf .build/plugins/Swift-DocC/outputs/DoxyLibrary.doccarchive . +build-doc: ## Builds the DocC documentation for the apps and library targets. + @$(call gen-doc,$(TARGET_APP)) + @$(call gen-doc,$(TARGET_LIBRARY)) + @$(call copy-docs,$(DOCC_ARCHIVES_FOLDER)) preview-doc: ## Previews the DocC documentation for the library target. @swift package --disable-sandbox plugin preview-documentation\ - --target DoxyLibrary\ + --target $(TARGET_LIBRARY)\ --include-extended-types\ - --symbol-graph-minimum-access-level internal + --symbol-graph-minimum-access-level internal\ + --enable-inherited-docs + +test-doc: ## Builds the DocC documentation for the app and the library targets in the test folder. + @$(call gen-doc,$(TARGET_APP)) + @$(call gen-doc,$(TARGET_LIBRARY)) + @$(call copy-docs,$(DOCC_TEST_FOLDER)) # DOCKER @@ -51,7 +80,7 @@ unmount-image: ## Stops and unmounts a docker container locally @make remove-image remove-image: # Removes the generated Docker images - @docker image rm $(shell docker image ls | grep doxy-app | awk '{print $$1 ":" $$2}') + @docker image rm $(shell docker image ls | grep $(DOCKER_IMAGE_NAME) | awk '{print $$1 ":" $$2}') # HELP