jazzy 0.13.7 → 0.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/Tests.yml +6 -6
- data/.rubocop.yml +155 -24
- data/CHANGELOG.md +91 -0
- data/CONTRIBUTING.md +1 -1
- data/Dangerfile +11 -8
- data/Gemfile +3 -1
- data/Gemfile.lock +85 -64
- data/ObjectiveC.md +208 -0
- data/README.md +63 -33
- data/Rakefile +18 -15
- data/bin/jazzy +3 -2
- data/bin/sourcekitten +0 -0
- data/jazzy.gemspec +9 -6
- data/lib/jazzy/config.rb +135 -69
- data/lib/jazzy/doc.rb +3 -1
- data/lib/jazzy/doc_builder.rb +72 -83
- data/lib/jazzy/docset_builder.rb +3 -1
- data/lib/jazzy/documentation_generator.rb +6 -2
- data/lib/jazzy/executable.rb +3 -0
- data/lib/jazzy/extensions/bitbucket/img/bitbucket.svg +11 -0
- data/lib/jazzy/{themes/apple/assets → extensions/github}/img/gh.png +0 -0
- data/lib/jazzy/extensions/gitlab/img/gitlab.svg +23 -0
- data/lib/jazzy/gem_version.rb +3 -1
- data/lib/jazzy/highlighter.rb +5 -3
- data/lib/jazzy/jazzy_markdown.rb +75 -32
- data/lib/jazzy/podspec_documenter.rb +14 -16
- data/lib/jazzy/search_builder.rb +5 -6
- data/lib/jazzy/source_declaration/access_control_level.rb +7 -5
- data/lib/jazzy/source_declaration/type.rb +29 -3
- data/lib/jazzy/source_declaration.rb +22 -5
- data/lib/jazzy/source_document.rb +8 -5
- data/lib/jazzy/source_host.rb +111 -0
- data/lib/jazzy/source_mark.rb +8 -6
- data/lib/jazzy/source_module.rb +6 -6
- data/lib/jazzy/sourcekitten.rb +155 -81
- data/lib/jazzy/stats.rb +14 -3
- data/lib/jazzy/symbol_graph/constraint.rb +5 -1
- data/lib/jazzy/symbol_graph/ext_node.rb +3 -1
- data/lib/jazzy/symbol_graph/graph.rb +19 -12
- data/lib/jazzy/symbol_graph/relationship.rb +9 -0
- data/lib/jazzy/symbol_graph/sym_node.rb +25 -7
- data/lib/jazzy/symbol_graph/symbol.rb +54 -25
- data/lib/jazzy/symbol_graph.rb +43 -32
- data/lib/jazzy/themes/apple/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/apple/assets/css/jazzy.css.scss +5 -1
- data/lib/jazzy/themes/apple/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/apple/assets/js/jazzy.search.js +4 -0
- data/lib/jazzy/themes/apple/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/apple/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/apple/templates/header.mustache +6 -6
- data/lib/jazzy/themes/apple/templates/task.mustache +6 -11
- data/lib/jazzy/themes/fullwidth/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/fullwidth/assets/css/jazzy.css.scss +6 -2
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/fullwidth/assets/js/jazzy.search.js +4 -0
- data/lib/jazzy/themes/fullwidth/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/fullwidth/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/fullwidth/templates/header.mustache +8 -8
- data/lib/jazzy/themes/fullwidth/templates/task.mustache +6 -11
- data/lib/jazzy/themes/jony/assets/css/highlight.css.scss +63 -59
- data/lib/jazzy/themes/jony/assets/css/jazzy.css.scss +5 -1
- data/lib/jazzy/themes/jony/assets/js/jazzy.js +4 -0
- data/lib/jazzy/themes/jony/templates/doc.mustache +4 -5
- data/lib/jazzy/themes/jony/templates/footer.mustache +1 -1
- data/lib/jazzy/themes/jony/templates/header.mustache +6 -6
- data/lib/jazzy/themes/jony/templates/task.mustache +6 -11
- data/lib/jazzy.rb +2 -0
- data/spec/integration_spec.rb +46 -42
- data/spec/spec_helper/pre_flight.rb +2 -0
- data/spec/spec_helper.rb +3 -1
- metadata +32 -16
- data/lib/jazzy/themes/fullwidth/assets/img/gh.png +0 -0
- data/lib/jazzy/themes/jony/assets/img/gh.png +0 -0
- data/spec/sourcekitten_spec.rb +0 -6
data/Gemfile.lock
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
jazzy (0.
|
4
|
+
jazzy (0.14.2)
|
5
5
|
cocoapods (~> 1.5)
|
6
6
|
mustache (~> 1.1)
|
7
|
-
open4
|
7
|
+
open4 (~> 1.3)
|
8
8
|
redcarpet (~> 3.4)
|
9
|
+
rexml (~> 3.2)
|
9
10
|
rouge (>= 2.0.6, < 4.0)
|
10
11
|
sassc (~> 2.1)
|
11
12
|
sqlite3 (~> 1.3)
|
@@ -14,13 +15,15 @@ PATH
|
|
14
15
|
GEM
|
15
16
|
remote: https://rubygems.org/
|
16
17
|
specs:
|
17
|
-
CFPropertyList (3.0.
|
18
|
-
|
18
|
+
CFPropertyList (3.0.5)
|
19
|
+
rexml
|
20
|
+
activesupport (6.1.5)
|
19
21
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
20
|
-
i18n (>=
|
21
|
-
minitest (
|
22
|
-
tzinfo (~>
|
23
|
-
|
22
|
+
i18n (>= 1.6, < 2)
|
23
|
+
minitest (>= 5.1)
|
24
|
+
tzinfo (~> 2.0)
|
25
|
+
zeitwerk (~> 2.3)
|
26
|
+
addressable (2.8.0)
|
24
27
|
public_suffix (>= 2.0.2, < 5.0)
|
25
28
|
algoliasearch (1.27.5)
|
26
29
|
httpclient (~> 2.8, >= 2.8.3)
|
@@ -28,7 +31,7 @@ GEM
|
|
28
31
|
ast (2.4.2)
|
29
32
|
atomos (0.1.3)
|
30
33
|
bacon (1.2.0)
|
31
|
-
claide (1.0
|
34
|
+
claide (1.1.0)
|
32
35
|
claide-plugins (0.9.2)
|
33
36
|
cork
|
34
37
|
nap
|
@@ -36,10 +39,10 @@ GEM
|
|
36
39
|
clintegracon (0.7.0)
|
37
40
|
colored (~> 1.2)
|
38
41
|
diffy
|
39
|
-
cocoapods (1.
|
40
|
-
addressable (~> 2.
|
42
|
+
cocoapods (1.11.3)
|
43
|
+
addressable (~> 2.8)
|
41
44
|
claide (>= 1.0.2, < 2.0)
|
42
|
-
cocoapods-core (= 1.
|
45
|
+
cocoapods-core (= 1.11.3)
|
43
46
|
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
44
47
|
cocoapods-downloader (>= 1.4.0, < 2.0)
|
45
48
|
cocoapods-plugins (>= 1.0.0, < 2.0)
|
@@ -50,37 +53,37 @@ GEM
|
|
50
53
|
escape (~> 0.0.4)
|
51
54
|
fourflusher (>= 2.3.0, < 3.0)
|
52
55
|
gh_inspector (~> 1.0)
|
53
|
-
molinillo (~> 0.
|
56
|
+
molinillo (~> 0.8.0)
|
54
57
|
nap (~> 1.0)
|
55
|
-
ruby-macho (
|
56
|
-
xcodeproj (>= 1.
|
57
|
-
cocoapods-core (1.
|
58
|
-
activesupport (
|
59
|
-
addressable (~> 2.
|
58
|
+
ruby-macho (>= 1.0, < 3.0)
|
59
|
+
xcodeproj (>= 1.21.0, < 2.0)
|
60
|
+
cocoapods-core (1.11.3)
|
61
|
+
activesupport (>= 5.0, < 7)
|
62
|
+
addressable (~> 2.8)
|
60
63
|
algoliasearch (~> 1.0)
|
61
64
|
concurrent-ruby (~> 1.1)
|
62
65
|
fuzzy_match (~> 2.0.4)
|
63
66
|
nap (~> 1.0)
|
64
67
|
netrc (~> 0.11)
|
65
|
-
public_suffix
|
68
|
+
public_suffix (~> 4.0)
|
66
69
|
typhoeus (~> 1.0)
|
67
|
-
cocoapods-deintegrate (1.0.
|
68
|
-
cocoapods-downloader (1.
|
70
|
+
cocoapods-deintegrate (1.0.5)
|
71
|
+
cocoapods-downloader (1.5.1)
|
69
72
|
cocoapods-plugins (1.0.0)
|
70
73
|
nap
|
71
|
-
cocoapods-search (1.0.
|
72
|
-
cocoapods-trunk (1.
|
74
|
+
cocoapods-search (1.0.1)
|
75
|
+
cocoapods-trunk (1.6.0)
|
73
76
|
nap (>= 0.8, < 2.0)
|
74
77
|
netrc (~> 0.11)
|
75
78
|
cocoapods-try (1.2.0)
|
76
79
|
colored (1.2)
|
77
80
|
colored2 (3.1.2)
|
78
|
-
concurrent-ruby (1.1.
|
81
|
+
concurrent-ruby (1.1.9)
|
79
82
|
cork (0.3.0)
|
80
83
|
colored2 (~> 3.1)
|
81
84
|
crack (0.4.5)
|
82
85
|
rexml
|
83
|
-
danger (8.
|
86
|
+
danger (8.4.5)
|
84
87
|
claide (~> 1.0)
|
85
88
|
claide-plugins (>= 0.9.2)
|
86
89
|
colored2 (~> 3.1)
|
@@ -95,107 +98,125 @@ GEM
|
|
95
98
|
terminal-table (>= 1, < 4)
|
96
99
|
diffy (3.4.0)
|
97
100
|
escape (0.0.4)
|
98
|
-
ethon (0.
|
101
|
+
ethon (0.15.0)
|
99
102
|
ffi (>= 1.15.0)
|
100
|
-
faraday (1.
|
103
|
+
faraday (1.10.0)
|
104
|
+
faraday-em_http (~> 1.0)
|
105
|
+
faraday-em_synchrony (~> 1.0)
|
101
106
|
faraday-excon (~> 1.1)
|
107
|
+
faraday-httpclient (~> 1.0)
|
108
|
+
faraday-multipart (~> 1.0)
|
102
109
|
faraday-net_http (~> 1.0)
|
103
|
-
faraday-net_http_persistent (~> 1.
|
104
|
-
|
110
|
+
faraday-net_http_persistent (~> 1.0)
|
111
|
+
faraday-patron (~> 1.0)
|
112
|
+
faraday-rack (~> 1.0)
|
113
|
+
faraday-retry (~> 1.0)
|
105
114
|
ruby2_keywords (>= 0.0.4)
|
115
|
+
faraday-em_http (1.0.0)
|
116
|
+
faraday-em_synchrony (1.0.0)
|
106
117
|
faraday-excon (1.1.0)
|
107
118
|
faraday-http-cache (2.2.0)
|
108
119
|
faraday (>= 0.8)
|
120
|
+
faraday-httpclient (1.0.1)
|
121
|
+
faraday-multipart (1.0.3)
|
122
|
+
multipart-post (>= 1.2, < 3)
|
109
123
|
faraday-net_http (1.0.1)
|
110
|
-
faraday-net_http_persistent (1.
|
111
|
-
|
124
|
+
faraday-net_http_persistent (1.2.0)
|
125
|
+
faraday-patron (1.0.0)
|
126
|
+
faraday-rack (1.0.0)
|
127
|
+
faraday-retry (1.0.3)
|
128
|
+
ffi (1.15.5)
|
112
129
|
fourflusher (2.3.1)
|
113
130
|
fuzzy_match (2.0.4)
|
114
131
|
gh_inspector (1.1.3)
|
115
|
-
git (1.
|
132
|
+
git (1.10.2)
|
116
133
|
rchardet (~> 1.8)
|
117
134
|
hashdiff (1.0.1)
|
118
135
|
httpclient (2.8.3)
|
119
|
-
i18n (1.
|
136
|
+
i18n (1.10.0)
|
120
137
|
concurrent-ruby (~> 1.0)
|
121
|
-
json (2.
|
138
|
+
json (2.6.1)
|
122
139
|
kramdown (2.3.1)
|
123
140
|
rexml
|
124
141
|
kramdown-parser-gfm (1.1.0)
|
125
142
|
kramdown (~> 2.0)
|
126
143
|
liferaft (0.0.6)
|
127
|
-
minitest (5.
|
128
|
-
mocha (1.
|
144
|
+
minitest (5.15.0)
|
145
|
+
mocha (1.13.0)
|
129
146
|
mocha-on-bacon (0.2.3)
|
130
147
|
mocha (>= 0.13.0)
|
131
|
-
molinillo (0.
|
148
|
+
molinillo (0.8.0)
|
132
149
|
multipart-post (2.1.1)
|
133
150
|
mustache (1.1.1)
|
134
151
|
nanaimo (0.3.0)
|
135
152
|
nap (1.1.0)
|
136
153
|
netrc (0.11.0)
|
137
154
|
no_proxy_fix (0.1.2)
|
138
|
-
octokit (4.
|
155
|
+
octokit (4.22.0)
|
139
156
|
faraday (>= 0.9)
|
140
157
|
sawyer (~> 0.8.0, >= 0.5.3)
|
141
158
|
open4 (1.3.4)
|
142
|
-
parallel (1.
|
143
|
-
parser (
|
159
|
+
parallel (1.21.0)
|
160
|
+
parser (3.1.1.0)
|
144
161
|
ast (~> 2.4.1)
|
145
|
-
powerpack (0.1.3)
|
146
162
|
prettybacon (0.0.2)
|
147
163
|
bacon (~> 1.2)
|
148
164
|
public_suffix (4.0.6)
|
149
|
-
rainbow (
|
150
|
-
|
151
|
-
rake (13.0.3)
|
165
|
+
rainbow (3.1.1)
|
166
|
+
rake (13.0.6)
|
152
167
|
rchardet (1.8.0)
|
153
168
|
redcarpet (3.5.1)
|
169
|
+
regexp_parser (2.2.1)
|
154
170
|
rexml (3.2.5)
|
155
|
-
rouge (3.
|
156
|
-
rubocop (
|
171
|
+
rouge (3.28.0)
|
172
|
+
rubocop (1.26.0)
|
157
173
|
parallel (~> 1.10)
|
158
|
-
parser (>=
|
159
|
-
|
160
|
-
|
174
|
+
parser (>= 3.1.0.0)
|
175
|
+
rainbow (>= 2.2.2, < 4.0)
|
176
|
+
regexp_parser (>= 1.8, < 3.0)
|
177
|
+
rexml
|
178
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
161
179
|
ruby-progressbar (~> 1.7)
|
162
|
-
unicode-display_width (
|
163
|
-
|
180
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
181
|
+
rubocop-ast (1.16.0)
|
182
|
+
parser (>= 3.1.1.0)
|
183
|
+
ruby-macho (2.5.1)
|
164
184
|
ruby-progressbar (1.11.0)
|
165
|
-
ruby2_keywords (0.0.
|
185
|
+
ruby2_keywords (0.0.5)
|
166
186
|
sassc (2.4.0)
|
167
187
|
ffi (~> 1.9)
|
168
188
|
sawyer (0.8.2)
|
169
189
|
addressable (>= 2.3.5)
|
170
190
|
faraday (> 0.8, < 2.0)
|
171
191
|
sqlite3 (1.4.2)
|
172
|
-
terminal-table (3.0.
|
173
|
-
unicode-display_width (
|
174
|
-
thread_safe (0.3.6)
|
192
|
+
terminal-table (3.0.2)
|
193
|
+
unicode-display_width (>= 1.1.1, < 3)
|
175
194
|
typhoeus (1.4.0)
|
176
195
|
ethon (>= 0.9.0)
|
177
|
-
tzinfo (
|
178
|
-
|
179
|
-
unicode-display_width (1.
|
180
|
-
webmock (3.
|
181
|
-
addressable (>= 2.
|
196
|
+
tzinfo (2.0.4)
|
197
|
+
concurrent-ruby (~> 1.0)
|
198
|
+
unicode-display_width (2.1.0)
|
199
|
+
webmock (3.14.0)
|
200
|
+
addressable (>= 2.8.0)
|
182
201
|
crack (>= 0.3.2)
|
183
202
|
hashdiff (>= 0.4.0, < 2.0.0)
|
184
203
|
xcinvoke (0.3.0)
|
185
204
|
liferaft (~> 0.0.6)
|
186
|
-
xcodeproj (1.
|
205
|
+
xcodeproj (1.21.0)
|
187
206
|
CFPropertyList (>= 2.3.3, < 4.0)
|
188
207
|
atomos (~> 0.1.3)
|
189
208
|
claide (>= 1.0.2, < 2.0)
|
190
209
|
colored2 (~> 3.1)
|
191
210
|
nanaimo (~> 0.3.0)
|
211
|
+
rexml (~> 3.2.4)
|
212
|
+
zeitwerk (2.5.4)
|
192
213
|
|
193
214
|
PLATFORMS
|
194
215
|
ruby
|
195
216
|
|
196
217
|
DEPENDENCIES
|
197
218
|
bacon
|
198
|
-
bundler (~> 1
|
219
|
+
bundler (~> 2.1)
|
199
220
|
clintegracon (= 0.7.0)
|
200
221
|
danger
|
201
222
|
diffy
|
@@ -204,8 +225,8 @@ DEPENDENCIES
|
|
204
225
|
mocha-on-bacon
|
205
226
|
prettybacon
|
206
227
|
rake (~> 13.0)
|
207
|
-
rubocop (
|
228
|
+
rubocop (~> 1.18)
|
208
229
|
webmock
|
209
230
|
|
210
231
|
BUNDLED WITH
|
211
|
-
|
232
|
+
2.2.22
|
data/ObjectiveC.md
ADDED
@@ -0,0 +1,208 @@
|
|
1
|
+
This document is about Jazzy's Objective-C documentation generation.
|
2
|
+
|
3
|
+
It's intended for users who are having problems after trying to follow the
|
4
|
+
examples in the [README](README.md#objective-c). It gives some solutions to
|
5
|
+
common problems and explains how the system works to help users work through
|
6
|
+
uncommon problems.
|
7
|
+
|
8
|
+
* [How it works](#how-objective-c-docs-generation-works)
|
9
|
+
* Common problems:
|
10
|
+
* [Apple SDK include failure](#problem-apple-sdk-importinclude-failure)
|
11
|
+
* [Non-SDK include failure](#problem-non-sdk-include-failure)
|
12
|
+
* [Argument list too long](#problem-argument-list-too-long-e2big-and-more)
|
13
|
+
* [Enum cases with wrong doc comment](#problem-enum-cases-have-the-wrong-doc-comment)
|
14
|
+
* [Swift API versions missing](#problem-swift-api-versions-are-all-missing)
|
15
|
+
* [Swift API versions use `Any`](#problem-swift-api-versions-have-any-instead-of-type-name)
|
16
|
+
* [Structural `NS_SWIFT_NAME` not working](#problem-structural-ns_swift_name-not-working)
|
17
|
+
|
18
|
+
# How Objective-C docs generation works
|
19
|
+
|
20
|
+
Jazzy uses `libclang` to generate docs for Objective-C projects. You can think
|
21
|
+
of this as running some parts of the `clang` compiler against a header file.
|
22
|
+
Jazzy refers to this header file as the _umbrella header_ but it does not have
|
23
|
+
to be the umbrella header from a Clang module: it's just the header file that
|
24
|
+
includes everything to be documented.
|
25
|
+
|
26
|
+
This means there are two problems to solve:
|
27
|
+
1. What `clang` flags are required; and
|
28
|
+
2. How to pass them to the tools.
|
29
|
+
|
30
|
+
Jazzy has two modes here: a smart mode that covers 90% of projects and a direct mode where the user provides all the flags.
|
31
|
+
|
32
|
+
> *Important*: Jazzy does _not_ use any Objective-C build settings from your
|
33
|
+
Xcode project or `Package.swift`. If your project needs special settings
|
34
|
+
such as `#define`s then you need to repeat those in the Jazzy invocation.
|
35
|
+
|
36
|
+
## Direct mode
|
37
|
+
|
38
|
+
Passing a basic set of `clang` flags looks like this:
|
39
|
+
|
40
|
+
```shell
|
41
|
+
jazzy ...
|
42
|
+
--objc
|
43
|
+
--build-tool-arguments
|
44
|
+
--objc,MyProject/MyProject.h,--,-x,objective-c,
|
45
|
+
-isysroot,$(xcrun --show-sdk-path),
|
46
|
+
-I,$(pwd),
|
47
|
+
-fmodules
|
48
|
+
```
|
49
|
+
The `--build-tool-arguments` are arguments to `sourcekitten`. Everything after
|
50
|
+
the `--` are the `clang` flags that will be used with the header file given
|
51
|
+
before the `--`.
|
52
|
+
|
53
|
+
You can try these flags outside of Jazzy's environment:
|
54
|
+
```shell
|
55
|
+
clang -c -x objective-c -isysroot $(xcrun --show-sdk-path) -I $(pwd) MyProject/MyProject.h -fmodules
|
56
|
+
```
|
57
|
+
(The `-c` stops `clang` from trying to link an executable.)
|
58
|
+
|
59
|
+
This is a good method of experimenting with compiler flags to get a working
|
60
|
+
build without getting bogged down in the Jazzy and SourceKitten layers.
|
61
|
+
|
62
|
+
## Smart mode
|
63
|
+
|
64
|
+
The smart mode takes the variable parts of the basic set of flags and maps
|
65
|
+
them from Jazzy flags:
|
66
|
+
```shell
|
67
|
+
jazzy ...
|
68
|
+
--objc
|
69
|
+
--umbrella-header MyProject/MyProject.h
|
70
|
+
--framework-root $(pwd)
|
71
|
+
[--sdk <sdk name>]
|
72
|
+
```
|
73
|
+
|
74
|
+
The `--umbrella-header` maps directly to the file passed to `sourcekitten`.
|
75
|
+
|
76
|
+
The `--framework-root` is used for the `-I` include path, as well as every
|
77
|
+
directory beneath it, recursively. So if your project structure looks like:
|
78
|
+
```
|
79
|
+
MyProject/
|
80
|
+
Sources/
|
81
|
+
Main/
|
82
|
+
Extension/
|
83
|
+
```
|
84
|
+
... and you pass `--framework-root MyProject`, then the `-I` flags passed to
|
85
|
+
`clang` are `-I MyProject -I MyProject/Sources -I MyProject/Sources/Main -I
|
86
|
+
MyProject/Sources/Extension`. This feature helps some projects resolve
|
87
|
+
`#include` directives.
|
88
|
+
|
89
|
+
Finally the `--sdk` option is passed through instead of the default `macosx` to
|
90
|
+
find the SDK.
|
91
|
+
|
92
|
+
## Mixing modes
|
93
|
+
|
94
|
+
Do not mix modes. For example do not set both `--umbrella-header` and
|
95
|
+
`--build-tool-arguments`. Jazzy does not flag this as an error for
|
96
|
+
historical compatibility reasons, but the results are at best confusing.
|
97
|
+
|
98
|
+
# Problem: Apple SDK import/include failure
|
99
|
+
|
100
|
+
For example `fatal error: module 'UIKit' not found`.
|
101
|
+
|
102
|
+
This means Jazzy is using the wrong SDK: the default is for macOS which does
|
103
|
+
not have `UIKit`. Use `--sdk iphonesimulator`.
|
104
|
+
|
105
|
+
# Problem: Non-SDK include failure
|
106
|
+
|
107
|
+
For example `fatal error: 'MyModule/SomeHeader.h' file not found`.
|
108
|
+
|
109
|
+
This means `clang` is not being passed the right flags to resolve a `#include` /
|
110
|
+
`#import`.
|
111
|
+
|
112
|
+
Start by finding the header file in the filesystem. You might be able to fix
|
113
|
+
the problem just by adding extra `-I <path>` flags.
|
114
|
+
|
115
|
+
Usually though the problem is that Xcode has done something clever that needs
|
116
|
+
to be worked around or replicated.
|
117
|
+
|
118
|
+
Xcode uses technology including Clang header maps to let files be found using
|
119
|
+
lines like `#import <ModuleName/Header.h>` even when there is no such
|
120
|
+
filesystem directory.
|
121
|
+
|
122
|
+
To make the Jazzy build work you need to make these `#include`s work. The
|
123
|
+
solution depends on your project structure. Some suggestions in rough order
|
124
|
+
of complexity:
|
125
|
+
* Use symlinks to create an equivalent directory tree. For example if
|
126
|
+
`Header.h` is inside `Sources/include` then symlink that directory to
|
127
|
+
`ModuleName` and pass `-I $(pwd)`.
|
128
|
+
|
129
|
+
* Copy/link your header files into a throwaway directory tree that matches
|
130
|
+
the required structure and is used just for building docs.
|
131
|
+
|
132
|
+
* Create a 'docs header file' separate to the framework's regular umbrella
|
133
|
+
header that contains only filesystem-correct `#import`s.
|
134
|
+
|
135
|
+
* If you are happy to build the framework project before generating docs and
|
136
|
+
all the problematic paths have the form `ModuleName/PublicHeader.h` then
|
137
|
+
have `clang` resolve those includes to the built framework by passing
|
138
|
+
`-F <path of directory containing ModuleName.framework>`.
|
139
|
+
|
140
|
+
* If you are happy to build the project before generating docs then you may
|
141
|
+
be able to use the header maps Xcode has generated. Check the build log in
|
142
|
+
Xcode to find them and the invocation syntax.
|
143
|
+
|
144
|
+
* Manually construct an equivalent header map. This is complex not least
|
145
|
+
because Apple does not make tools or proper documentation available.
|
146
|
+
[An open-source starting point](https://milen.me/writings/swift-module-maps-vfs-overlays-header-maps/).
|
147
|
+
|
148
|
+
# Problem: Argument list too long `E2BIG` (and more...)
|
149
|
+
|
150
|
+
For example ``...open4.rb:49:in `exec': Argument list too long - [...]/bin/sourcekitten (Errno::E2BIG)``
|
151
|
+
|
152
|
+
Can also manifest as 'generally weird' errors such as `sourcekitten` just
|
153
|
+
crashing and `fatal error: could not build module 'Foundation'`.
|
154
|
+
|
155
|
+
This means `--framework-root` is trying to add too many include directories:
|
156
|
+
there are too many subdirectories of its parameter. If you cannot change this
|
157
|
+
to something more specific that works then you need to use Jazzy's
|
158
|
+
[direct mode](#direct-mode) to pass in the correct directories.
|
159
|
+
|
160
|
+
# Problem: Enum cases have the wrong doc comment
|
161
|
+
|
162
|
+
If you write an enum case with a doc comment followed by an enum case without
|
163
|
+
a doc comment, then both get the same doc comment.
|
164
|
+
|
165
|
+
This seems to be a bug in `libclang`. The only workaround is to add the missing
|
166
|
+
doc comment.
|
167
|
+
|
168
|
+
# Problem: Swift API versions are all missing
|
169
|
+
|
170
|
+
This usually means the `clang` flags are malformed in a way that is ignored by
|
171
|
+
`libclang` but not by the Swift Objective-C importer.
|
172
|
+
|
173
|
+
One easy way to accidentally do this is passing `-I` without a path, for
|
174
|
+
example `--build-tool-flags ...,-I,-I,Headers`,....
|
175
|
+
|
176
|
+
This also sometimes happens if you are frequently switching back and forth
|
177
|
+
between some Swift / Xcode versions -- it's a bug somewhere in the Apple tools.
|
178
|
+
The bad state goes away with time / reboot.
|
179
|
+
|
180
|
+
# Problem: Swift API versions have `Any` instead of type name
|
181
|
+
|
182
|
+
Jazzy finds the Swift version of an Objective-C API using the SourceKit
|
183
|
+
`source.request.editor.open.interface.header` request on the header file that
|
184
|
+
contains the declaration, passing in the same `clang` flags used for the
|
185
|
+
umbrella header. [See the code](https://github.com/jpsim/SourceKitten/blob/bed112c313ca8c3c149f8cb84069f1c080e86a7e/Source/SourceKittenFramework/Clang%2BSourceKitten.swift#L202).
|
186
|
+
|
187
|
+
This means that each header file needs to compile standalone, without
|
188
|
+
any implicit dependencies. For example:
|
189
|
+
```
|
190
|
+
MyModule.h // umbrella, includes MyClass.h then Utils.h
|
191
|
+
MyClass.h // @interface MyClass ... @end
|
192
|
+
Utils.h // void my_function( MyClass * myClass);
|
193
|
+
```
|
194
|
+
Here, `Utils.h` has an implicit dependency on `MyClass.h` that is normally
|
195
|
+
satisfied by the include order of `MyModule.h`. One fix that allows `Utils.h`
|
196
|
+
to compile standalone is to add `@class MyClass;`.
|
197
|
+
|
198
|
+
# Problem: Structural `NS_SWIFT_NAME` not working
|
199
|
+
|
200
|
+
The `NS_SWIFT_NAME` macro is mostly used to give an Objective-C API a
|
201
|
+
different name in Swift. There are no known problems with this part.
|
202
|
+
|
203
|
+
The macro can also be used to change the 'structure' of an API, for example
|
204
|
+
make a C global function appear as a member function in Swift, or make a C
|
205
|
+
class appear as a nested type in Swift.
|
206
|
+
|
207
|
+
Jazzy doesn't understand or communicate these structural changes: you'll need
|
208
|
+
to explain it in doc comments.
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ Instead of parsing your source files, `jazzy` hooks into [Clang][clang] and
|
|
13
13
|
its comments for more accurate results. The output matches the look and feel
|
14
14
|
of Apple’s official reference documentation, post WWDC 2014.
|
15
15
|
|
16
|
-
Jazzy can also generate documentation from compiled
|
16
|
+
Jazzy can also generate documentation from compiled Swift modules [using their
|
17
17
|
symbol graph](#docs-from-swiftmodules-or-frameworks) instead of source code.
|
18
18
|
|
19
19
|

|
@@ -60,11 +60,14 @@ all available options, run `jazzy --help config`.
|
|
60
60
|
### Supported documentation keywords
|
61
61
|
|
62
62
|
Swift documentation is written in markdown and supports a number of special keywords.
|
63
|
-
|
64
|
-
|
63
|
+
Here are some resources with tutorials and examples, starting with the most modern:
|
64
|
+
* Apple's [Writing Symbol Documentation in Your Source Files](https://developer.apple.com/documentation/xcode/writing-symbol-documentation-in-your-source-files) article.
|
65
|
+
* Apple's [Formatting Your Documentation Content](https://developer.apple.com/documentation/xcode/formatting-your-documentation-content) article.
|
66
|
+
* Apple's [Xcode Markup Formatting Reference](https://developer.apple.com/library/content/documentation/Xcode/Reference/xcode_markup_formatting_ref/).
|
67
|
+
* Erica Sadun's [Swift header documentation in Xcode 7](https://ericasadun.com/2015/06/14/swift-header-documentation-in-xcode-7/) post and her [book on Swift Documentation Markup](https://itunes.apple.com/us/book/swift-documentation-markup/id1049010423).
|
65
68
|
|
66
69
|
For Objective-C documentation the same keywords are supported, but note that the format
|
67
|
-
is slightly different. In Swift you would write `- returns:`, but in Objective-C you write `@return`. See Apple's [*HeaderDoc User Guide*](https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/HeaderDoc/tags/tags.html) for more details. **Note: `jazzy` currently does not support _all_ Objective-C keywords listed in this document, only @param, @return, @warning, @see, and @
|
70
|
+
is slightly different. In Swift you would write `- returns:`, but in Objective-C you write `@return`. See Apple's [*HeaderDoc User Guide*](https://developer.apple.com/legacy/library/documentation/DeveloperTools/Conceptual/HeaderDoc/tags/tags.html) for more details. **Note: `jazzy` currently does not support _all_ Objective-C keywords listed in this document, only @param, @return, @warning, @see, @note, @code, @endcode, and @c.**
|
68
71
|
|
69
72
|
Jazzy can also generate cross-references within your documentation. A symbol name in
|
70
73
|
backticks generates a link, for example:
|
@@ -76,6 +79,12 @@ backticks generates a link, for example:
|
|
76
79
|
* \`[MyClass method1]\` - a link to an Objective-C method.
|
77
80
|
* \`-[MyClass method2:param1]\` - a link to another Objective-C method.
|
78
81
|
|
82
|
+
Jazzy understands Apple's DocC-style links too, for example:
|
83
|
+
* \`\`MyClass/method(param1:)\`\` - a link to the documentation for that method
|
84
|
+
that appears as just `method(param1:)` in the rendered page.
|
85
|
+
* \`\`\<doc:method(_:)-e873\>\`\` - a link to a specific overload of `method(_:)`.
|
86
|
+
Jazzy can't tell which overload you intend and links to the first one.
|
87
|
+
|
79
88
|
### Math
|
80
89
|
|
81
90
|
Jazzy can render math equations written in LaTeX embedded in your markdown:
|
@@ -108,8 +117,9 @@ jazzy \
|
|
108
117
|
--clean \
|
109
118
|
--author Realm \
|
110
119
|
--author_url https://realm.io \
|
111
|
-
--
|
112
|
-
--
|
120
|
+
--source-host github \
|
121
|
+
--source-host-url https://github.com/realm/realm-cocoa \
|
122
|
+
--source-host-files-url https://github.com/realm/realm-cocoa/tree/v0.96.2 \
|
113
123
|
--module-version 0.96.2 \
|
114
124
|
--build-tool-arguments -scheme,RealmSwift \
|
115
125
|
--module RealmSwift \
|
@@ -129,20 +139,36 @@ jazzy \
|
|
129
139
|
|
130
140
|
### Objective-C
|
131
141
|
|
132
|
-
To generate documentation for Objective-C
|
133
|
-
parameters
|
134
|
-
|
142
|
+
To generate documentation for a simple Objective-C project, you must pass the
|
143
|
+
following parameters:
|
135
144
|
* `--objc`
|
136
145
|
* `--umbrella-header ...`
|
137
146
|
* `--framework-root ...`
|
138
|
-
|
147
|
+
|
148
|
+
...and optionally:
|
149
|
+
* `--sdk [iphone|watch|appletv][os|simulator]|macosx` (default value
|
139
150
|
of `macosx`)
|
140
|
-
* `--hide-declarations [objc|swift]` (
|
141
|
-
declarations)
|
151
|
+
* `--hide-declarations [objc|swift]` (hides the selected language declarations)
|
142
152
|
|
143
|
-
|
153
|
+
For example, this is how the `AFNetworking` docs are generated:
|
154
|
+
|
155
|
+
```shell
|
156
|
+
jazzy \
|
157
|
+
--objc \
|
158
|
+
--author AFNetworking \
|
159
|
+
--author_url http://afnetworking.com \
|
160
|
+
--source-host github \
|
161
|
+
--source-host-url https://github.com/AFNetworking/AFNetworking \
|
162
|
+
--source-host-files-url https://github.com/AFNetworking/AFNetworking/tree/2.6.2 \
|
163
|
+
--module-version 2.6.2 \
|
164
|
+
--umbrella-header AFNetworking/AFNetworking.h \
|
165
|
+
--framework-root . \
|
166
|
+
--module AFNetworking
|
167
|
+
```
|
144
168
|
|
145
|
-
|
169
|
+
For a more complicated Objective-C project, instead use `--build-tool-arguments`
|
170
|
+
to pass arbitrary compiler flags. For example, this is how Realm Objective-C
|
171
|
+
docs are generated:
|
146
172
|
|
147
173
|
```shell
|
148
174
|
jazzy \
|
@@ -150,8 +176,9 @@ jazzy \
|
|
150
176
|
--clean \
|
151
177
|
--author Realm \
|
152
178
|
--author_url https://realm.io \
|
153
|
-
--
|
154
|
-
--
|
179
|
+
--source-host github \
|
180
|
+
--source-host-url https://github.com/realm/realm-cocoa \
|
181
|
+
--source-host-files-url https://github.com/realm/realm-cocoa/tree/v2.2.0 \
|
155
182
|
--module-version 2.2.0 \
|
156
183
|
--build-tool-arguments --objc,Realm/Realm.h,--,-x,objective-c,-isysroot,$(xcrun --show-sdk-path),-I,$(pwd) \
|
157
184
|
--module Realm \
|
@@ -160,20 +187,8 @@ jazzy \
|
|
160
187
|
--head "$(cat docs/custom_head.html)"
|
161
188
|
```
|
162
189
|
|
163
|
-
|
164
|
-
|
165
|
-
```shell
|
166
|
-
jazzy \
|
167
|
-
--objc \
|
168
|
-
--author AFNetworking \
|
169
|
-
--author_url http://afnetworking.com \
|
170
|
-
--github_url https://github.com/AFNetworking/AFNetworking \
|
171
|
-
--github-file-prefix https://github.com/AFNetworking/AFNetworking/tree/2.6.2 \
|
172
|
-
--module-version 2.6.2 \
|
173
|
-
--umbrella-header AFNetworking/AFNetworking.h \
|
174
|
-
--framework-root . \
|
175
|
-
--module AFNetworking
|
176
|
-
```
|
190
|
+
See [the Objective-C docs](ObjectiveC.md) for more information and some tips
|
191
|
+
on troubleshooting.
|
177
192
|
|
178
193
|
### Mixed Objective-C / Swift
|
179
194
|
|
@@ -227,7 +242,7 @@ Some examples:
|
|
227
242
|
```shell
|
228
243
|
jazzy --module Combine --swift-build-tool symbolgraph
|
229
244
|
--sdk iphoneos
|
230
|
-
--build-tool-arguments
|
245
|
+
--build-tool-arguments -target,arm64-apple-ios14.1
|
231
246
|
```
|
232
247
|
The `target` is the LLVM target triple and needs to match the SDK. The
|
233
248
|
default here is the target of the host system that Jazzy is running on,
|
@@ -248,8 +263,16 @@ Some examples:
|
|
248
263
|
This implies that `/Build/Products/MyMod.framework` exists and contains
|
249
264
|
a `.swiftmodule`. Again the `--source-directory` is searched by default
|
250
265
|
if `-F` is not passed in.
|
251
|
-
|
252
|
-
|
266
|
+
5. With pre-generated symbolgraph files:
|
267
|
+
```shell
|
268
|
+
jazzy --module MyMod --swift-build-tool symbolgraph
|
269
|
+
--symbolgraph-directory Build/symbolgraphs
|
270
|
+
```
|
271
|
+
If you've separately generated symbolgraph files by the use of
|
272
|
+
`-emit-symbol-graph`, you can pass the location of these files using
|
273
|
+
`--symbolgraph-directory` from where they can be parsed directly.
|
274
|
+
|
275
|
+
See `swift symbolgraph-extract -help` for all the things you can pass via
|
253
276
|
`--build-tool-arguments`: if your module has dependencies then you may need
|
254
277
|
to add various search path options to let Swift load it.
|
255
278
|
|
@@ -306,6 +329,9 @@ In Swift mode, Jazzy by default documents only `public` and `open` declarations.
|
|
306
329
|
include declarations with a lower access level, set the `--min-acl` flag to `internal`,
|
307
330
|
`fileprivate`, or `private`.
|
308
331
|
|
332
|
+
By default, Jazzy does not document declarations marked `@_spi` when `--min-acl` is
|
333
|
+
set to `public` or `open`. Set the `--include-spi-declarations` flag to include them.
|
334
|
+
|
309
335
|
In Objective-C mode, Jazzy documents all declarations found in the `--umbrella-header`
|
310
336
|
header file and any other header files included by it.
|
311
337
|
|
@@ -393,6 +419,10 @@ Check the `--min-acl` setting -- see [above](#controlling-what-is-documented).
|
|
393
419
|
environment variable to point to the Xcode you want before running Jazzy
|
394
420
|
without the `--swift-version` flag.
|
395
421
|
|
422
|
+
### Objective-C
|
423
|
+
|
424
|
+
See [this document](ObjectiveC.md).
|
425
|
+
|
396
426
|
### Installation Problems
|
397
427
|
|
398
428
|
**Can't find header files / clang**
|