Skip to content

Commit 16fe433

Browse files
committed
make doc generates DocC for hosting on Github pages
Example: http://groue.github.io/GRDB.swift/docs/6.3/documentation/grdb
1 parent 5ff2ad9 commit 16fe433

File tree

2 files changed

+16
-27
lines changed

2 files changed

+16
-27
lines changed

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ How you can Contribute
1515
- [xcpretty](https://github.com/xcpretty/xcpretty) (gem)
1616
- For contributing code:
1717
- [Swiftlint](https://github.com/realm/SwiftLint) (present in the `$PATH` or in `/opt/homebrew/bin/`)
18-
- For generating documentation:
19-
- [Jazzy](https://github.com/realm/jazzy) (gem)
2018

2119
2. **Clone the `development` branch on your machine.**
2220

Makefile

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#
44
# make test - Run all tests but performance tests
55
# make test_performance - Run performance tests
6-
# make documentation - Generate jazzy documentation
6+
# make doc - Generate DocC documentation
77
# make clean - Remove build artifacts
88
# make distclean - Restore repository to a pristine state
99

@@ -15,10 +15,8 @@ smokeTest: test_framework_GRDBiOS_maxTarget test_framework_GRDBiOS_minTarget tes
1515
#
1616
# Xcode
1717
# CocoaPods - https://cocoapods.org
18-
# Jazzy - https://github.com/realm/jazzy
1918

2019
GIT := $(shell command -v git)
21-
JAZZY := $(shell command -v jazzy)
2220
POD := $(shell command -v pod)
2321
XCRUN := $(shell command -v xcrun)
2422
XCODEBUILD := set -o pipefail && $(shell command -v xcodebuild)
@@ -41,6 +39,7 @@ ifeq ($(TRAVIS),true)
4139
COCOAPODS_EXTRA_TIME = --verbose
4240
endif
4341

42+
DOCS_PATH = Documentation/Reference
4443

4544
# Tests
4645
# =====
@@ -483,11 +482,11 @@ SQLiteCustom/src/sqlite3.h:
483482
# Documentation
484483
# =============
485484

486-
docs-localhost:
485+
doc-localhost:
487486
# Generates documentation in ~/Sites/GRDB
488487
# See https://discussions.apple.com/docs/DOC-3083 for Apache setup on the mac
489488
mkdir -p ~/Sites/GRDB
490-
GRDB_DOCC_PLUGIN=1 swift package \
489+
GRDB_DOCC_PLUGIN=1 $(SWIFT) package \
491490
--allow-writing-to-directory ~/Sites/GRDB \
492491
generate-documentation \
493492
--output-path ~/Sites/GRDB \
@@ -498,25 +497,17 @@ docs-localhost:
498497
open "http://localhost/~$(USER)/GRDB/documentation/grdb/"
499498

500499
doc:
501-
ifdef JAZZY
502-
$(JAZZY) \
503-
--clean \
504-
--author 'Gwendal Roué' \
505-
--author_url https://github.com/groue \
506-
--source-host github \
507-
--source-host-url https://github.com/groue/GRDB.swift \
508-
--source-host-files-url https://github.com/groue/GRDB.swift/tree/v6.2.0 \
509-
--module-version 6.2.0 \
510-
--module GRDB \
511-
--root-url http://groue.github.io/GRDB.swift/docs/6.2/ \
512-
--output Documentation/Reference \
513-
--swift-build-tool xcodebuild \
514-
--undocumented-text '' \
515-
--xcodebuild-arguments -project,GRDB.xcodeproj,-scheme,GRDB
516-
else
517-
@echo Jazzy must be installed for doc
518-
@exit 1
519-
endif
500+
# https://apple.github.io/swift-docc-plugin/documentation/swiftdoccplugin/publishing-to-github-pages/
501+
rm -rf $(DOCS_PATH)
502+
mkdir -p $(DOCS_PATH)
503+
GRDB_DOCC_PLUGIN=1 $(SWIFT) package \
504+
--allow-writing-to-directory $(DOCS_PATH) \
505+
generate-documentation \
506+
--output-path $(DOCS_PATH) \
507+
--target GRDB \
508+
--disable-indexing \
509+
--transform-for-static-hosting \
510+
--hosting-base-path GRDB.swift/docs/6.3
520511

521512

522513
# Cleanup
@@ -530,7 +521,7 @@ distclean:
530521
clean:
531522
$(SWIFT) package reset
532523
cd Tests/SPM && $(SWIFT) package reset
533-
rm -rf Documentation/Reference
524+
rm -rf $(DOCS_PATH)
534525
find . -name Package.resolved | xargs rm -f
535526

536527
.PHONY: distclean clean doc test smokeTest SQLiteCustom

0 commit comments

Comments
 (0)