Skip to content

Commit 3ad6f7a

Browse files
authored
Add 'package' command to document Swift package contents (SourceDocs#44)
#### Enhancements - Add `sourcedocs package` command to document Swift package contents (generates `Package.md` and dependency graphs)
1 parent 090a318 commit 3ad6f7a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+8958
-17
lines changed

.travis.yml

+33-2
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,39 @@ language: generic
22

33
jobs:
44
include:
5-
- stage: Continuous Integration
5+
- stage: Lint
66
name: SwiftLint
77
os: osx
88
osx_image: xcode11
99
script:
1010
- make lint
11+
1112
- stage: Continuous Integration
12-
name: SwiftPM macOS
13+
name: SwiftPM macOS (Xcode 11)
1314
os: osx
1415
osx_image: xcode11
1516
script:
17+
- swift --version
18+
- swift test --parallel
19+
20+
- stage: Continuous Integration
21+
name: SwiftPM macOS (Xcode 11.3)
22+
os: osx
23+
osx_image: xcode11.3
24+
install:
25+
- swift --version
26+
script:
27+
- swift test --parallel
28+
29+
- stage: Continuous Integration
30+
name: SwiftPM macOS (Xcode 11.4)
31+
os: osx
32+
osx_image: xcode11.4
33+
install:
34+
- swift --version
35+
script:
1636
- swift test --parallel
37+
1738
- stage: Continuous Integration
1839
name: SwiftPM Linux
1940
os: linux
@@ -26,29 +47,39 @@ jobs:
2647
script:
2748
- swift build
2849
- swift test --parallel
50+
2951
- stage: Continuous Integration
3052
name: Code Coverage
3153
os: osx
3254
osx_image: xcode11
55+
install:
56+
- swift --version
3357
script:
3458
- swift package generate-xcodeproj --enable-code-coverage
3559
- xcodebuild -scheme SourceDocs-Package -quiet test
3660
after_success:
3761
- bash <(curl -s https://codecov.io/bash) -J 'SourceDocsLib'
62+
3863
- stage: Continuous Integration
3964
name: Installation with Homebrew (macOS)
4065
os: osx
4166
osx_image: xcode11
67+
install:
68+
- swift --version
4269
script:
4370
- brew update
4471
- brew install sourcedocs
4572
- sourcedocs version
73+
4674
- stage: Continuous Integration
4775
name: Installation from Source (macOS)
4876
os: osx
4977
osx_image: xcode11
78+
install:
79+
- swift --version
5080
script:
5181
- git clone --depth 1 https://github.com/eneko/SourceDocs.git
5282
- cd SourceDocs
5383
- make install
5484
- sourcedocs version
85+

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414

1515
#### Breaking
1616
- Add `SourceDocsLib` so it can be used by other Swift tools to generate documentation.
17+
- SourceDocs now requires Swift 5.1 or higher
1718

1819
#### Enhancements
20+
- New `package` command to analytize and document Swift packages.
1921
- Migrated from `Commandant` to [`Swift Argument Parser`](https://github.com/apple/swift-argument-parser) for command line parsing.
2022

2123
#### Bug Fixes

Icons/executable.png

787 Bytes
Loading

Icons/[email protected]

1.96 KB
Loading

Icons/framework.png

929 Bytes
Loading

Icons/[email protected]

2.58 KB
Loading

Icons/library.png

1.25 KB
Loading

Icons/[email protected]

3.07 KB
Loading

Makefile

-3
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,6 @@ docs:
2626
swift run sourcedocs generate --clean --spm-module SourceDocsDemo --output-folder docs/reference --module-name-path --min-acl private
2727
swift run sourcedocs generate --clean --spm-module SourceDocsLib --output-folder docs/reference --module-name-path
2828

29-
xcode:
30-
swift package generate-xcodeproj --enable-code-coverage
31-
3229
linuxmain:
3330
swift test --generate-linuxmain
3431

Package.md

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# Package: **SourceDocs**
2+
3+
## Products
4+
5+
List of products in this package:
6+
7+
| Product | Type | Targets |
8+
| ------- | ---- | ------- |
9+
| sourcedocs | Executable | SourceDocsCLI |
10+
| SourceDocsLib | Library (automatic) | SourceDocsLib |
11+
12+
_Libraries denoted 'automatic' can be both static or dynamic._
13+
14+
## Modules
15+
16+
### Program Modules
17+
18+
| Module | Type | Dependencies |
19+
| ------ | ---- | ------------ |
20+
| SourceDocsCLI | Regular | ArgumentParser, Rainbow, SourceDocsLib |
21+
| SourceDocsLib | Regular | MarkdownGenerator, Rainbow, SourceKittenFramework, SwiftPM, System |
22+
| SourceDocsDemo | Regular | |
23+
24+
### Test Modules
25+
26+
| Module | Type | Dependencies |
27+
| ------ | ---- | ------------ |
28+
| SourceDocsCLITests | Test | System |
29+
| SourceDocsLibTests | Test | SourceDocsLib |
30+
31+
### Module Dependency Graph
32+
33+
[![Module Dependency Graph](PackageModules.png)](PackageModules.png)
34+
35+
## External Dependencies
36+
37+
### Direct Dependencies
38+
39+
| Package | Versions |
40+
| ------- | -------- |
41+
| [MarkdownGenerator](https://github.com/eneko/MarkdownGenerator.git) | 0.4.0..<1.0.0 |
42+
| [Rainbow](https://github.com/onevcat/Rainbow) | 3.0.0..<4.0.0 |
43+
| [SourceKitten](https://github.com/jpsim/SourceKitten.git) | 0.29.0..<1.0.0 |
44+
| [System](https://github.com/eneko/System.git) | 1.0.0..<2.0.0 |
45+
| [swift-argument-parser](https://github.com/apple/swift-argument-parser) | 0.0.1..<1.0.0 |
46+
| [swift-package-manager](https://github.com/apple/swift-package-manager) | 0.4.0 |
47+
48+
### Resolved Dependencies
49+
50+
- SourceDocs (unspecified)
51+
- [swift-argument-parser (0.0.5)](https://github.com/apple/swift-argument-parser)
52+
- [SwiftPM (0.4.0)](https://github.com/apple/swift-package-manager)
53+
- [llbuild (0.1.1)](https://github.com/apple/swift-llbuild.git)
54+
- [SourceKitten (0.29.0)](https://github.com/jpsim/SourceKitten.git)
55+
- [Commandant (0.17.0)](https://github.com/Carthage/Commandant.git)
56+
- [Quick (2.2.0)](https://github.com/Quick/Quick.git)
57+
- [Nimble (8.0.4)](https://github.com/Quick/Nimble.git)
58+
- [CwlPreconditionTesting (1.2.0)](https://github.com/mattgallagher/CwlPreconditionTesting.git)
59+
- [CwlCatchException (1.2.0)](https://github.com/mattgallagher/CwlCatchException.git)
60+
- [Nimble (8.0.4)](https://github.com/Quick/Nimble.git)
61+
- [CwlPreconditionTesting (1.2.0)](https://github.com/mattgallagher/CwlPreconditionTesting.git)
62+
- [CwlCatchException (1.2.0)](https://github.com/mattgallagher/CwlCatchException.git)
63+
- [SWXMLHash (5.0.1)](https://github.com/drmohundro/SWXMLHash.git)
64+
- [Yams (2.0.0)](https://github.com/jpsim/Yams.git)
65+
- [MarkdownGenerator (0.5.0)](https://github.com/eneko/MarkdownGenerator.git)
66+
- [Rainbow (3.1.5)](https://github.com/onevcat/Rainbow)
67+
- [System (1.0.0)](https://github.com/eneko/System.git)
68+
69+
### Package Dependency Graph
70+
71+
[![Package Dependency Graph](PackageDependencies.png)](PackageDependencies.png)
72+
73+
## Requirements
74+
75+
### Minimum Required Versions
76+
77+
| Platform | Version |
78+
| -------- | ------- |
79+
| macOS | 10.13 |
80+
81+
This file was generated by [SourceDocs](https://github.com/eneko/SourceDocs) on 2020-05-10 03:02:14 +0000

Package.resolved

+3-3
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
},
9494
{
9595
"package": "SwiftPM",
96-
"repositoryURL": "https://github.com/apple/swift-package-manager.git",
96+
"repositoryURL": "https://github.com/apple/swift-package-manager",
9797
"state": {
9898
"branch": null,
9999
"revision": "8656a25cb906c1896339f950ac960ee1b4fe8034",
@@ -114,8 +114,8 @@
114114
"repositoryURL": "https://github.com/eneko/System.git",
115115
"state": {
116116
"branch": null,
117-
"revision": "381352d9479fb9c75d99a5ae5503f7d560c62449",
118-
"version": "0.2.0"
117+
"revision": "3ffd9672edf3799077373add813ba1e10b369950",
118+
"version": "1.0.0"
119119
}
120120
},
121121
{

Package.swift

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
1-
// swift-tools-version:4.0
1+
// swift-tools-version:5.1
22
import PackageDescription
33

44
let package = Package(
55
name: "SourceDocs",
6+
platforms: [
7+
.macOS(.v10_13)
8+
],
69
products: [
710
.executable(name: "sourcedocs", targets: ["SourceDocsCLI"]),
811
.library(name: "SourceDocsLib", targets: ["SourceDocsLib"])
912
],
1013
dependencies: [
1114
.package(url: "https://github.com/apple/swift-argument-parser", from: "0.0.1"),
15+
.package(url: "https://github.com/apple/swift-package-manager", .exact("0.4.0")),
1216
.package(url: "https://github.com/jpsim/SourceKitten.git", from: "0.29.0"),
1317
.package(url: "https://github.com/eneko/MarkdownGenerator.git", from: "0.4.0"),
1418
.package(url: "https://github.com/onevcat/Rainbow", from: "3.0.0"),
15-
.package(url: "https://github.com/eneko/System.git", .exact("0.2.0"))
19+
.package(url: "https://github.com/eneko/System.git", from: "1.0.0")
1620
],
1721
targets: [
18-
.target(name: "SourceDocsCLI", dependencies: ["SourceDocsLib", "ArgumentParser", "Rainbow"]),
19-
.target(name: "SourceDocsLib", dependencies: ["SourceKittenFramework", "MarkdownGenerator", "Rainbow"]),
22+
.target(name: "SourceDocsCLI", dependencies: [
23+
.product(name: "ArgumentParser", package: "swift-argument-parser"),
24+
"SourceDocsLib",
25+
"Rainbow"
26+
]),
27+
.target(name: "SourceDocsLib", dependencies: [
28+
.product(name: "SourceKittenFramework", package: "SourceKitten"),
29+
"SwiftPM-auto",
30+
"MarkdownGenerator",
31+
"Rainbow",
32+
"System"
33+
]),
2034
.target(name: "SourceDocsDemo", dependencies: []),
2135
.testTarget(name: "SourceDocsCLITests", dependencies: ["System"]),
2236
.testTarget(name: "SourceDocsLibTests", dependencies: ["SourceDocsLib"])

PackageDependencies.dot

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
digraph PackageDependencyGraph {
2+
rankdir = LR
3+
graph [fontname="Helvetica-light", style = filled, color = "#eaeaea"]
4+
node [shape=box, fontname="Helvetica", style=filled, color="#fafafa"]
5+
edge [color="#545454"]
6+
7+
subgraph cluster {
8+
label = "Package Dependencies"
9+
"SourceDocs\nunspecified" -> "swift-argument-parser\n0.0.5"
10+
"SourceDocs\nunspecified" -> "SwiftPM\n0.4.0"
11+
"SourceDocs\nunspecified" -> "SourceKitten\n0.29.0"
12+
"SourceDocs\nunspecified" -> "MarkdownGenerator\n0.5.0"
13+
"SourceDocs\nunspecified" -> "Rainbow\n3.1.5"
14+
"SourceDocs\nunspecified" -> "System\n1.0.0"
15+
"SwiftPM\n0.4.0" -> "llbuild\n0.1.1"
16+
"SourceKitten\n0.29.0" -> "Commandant\n0.17.0"
17+
"SourceKitten\n0.29.0" -> "SWXMLHash\n5.0.1"
18+
"SourceKitten\n0.29.0" -> "Yams\n2.0.0"
19+
"Commandant\n0.17.0" -> "Quick\n2.2.0"
20+
"Commandant\n0.17.0" -> "Nimble\n8.0.4"
21+
"Quick\n2.2.0" -> "Nimble\n8.0.4"
22+
"Nimble\n8.0.4" -> "CwlPreconditionTesting\n1.2.0"
23+
"CwlPreconditionTesting\n1.2.0" -> "CwlCatchException\n1.2.0"
24+
"Nimble\n8.0.4" -> "CwlPreconditionTesting\n1.2.0"
25+
"CwlPreconditionTesting\n1.2.0" -> "CwlCatchException\n1.2.0"
26+
}
27+
}

PackageDependencies.png

68.7 KB
Loading

PackageModules.dot

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
digraph ModuleDependencyGraph {
2+
rankdir = LR
3+
graph [fontname="Helvetica-light", style = filled, color = "#eaeaea"]
4+
node [shape=box, fontname="Helvetica", style=filled]
5+
edge [color="#545454"]
6+
7+
subgraph clusterRegular {
8+
label = "Program Modules"
9+
node [color="#caecec"]
10+
"SourceDocsCLI"
11+
"SourceDocsLib"
12+
"SourceDocsDemo"
13+
}
14+
subgraph clusterTest {
15+
label = "Test Modules"
16+
node [color="#aaccee"]
17+
"SourceDocsCLITests"
18+
"SourceDocsLibTests"
19+
}
20+
subgraph clusterExternal {
21+
label = "External Dependencies"
22+
node [color="#fafafa"]
23+
"ArgumentParser"
24+
"MarkdownGenerator"
25+
"Rainbow"
26+
"SourceKittenFramework"
27+
"SwiftPM"
28+
"System"
29+
}
30+
31+
"SourceDocsCLI" -> "ArgumentParser"
32+
"SourceDocsCLI" -> "SourceDocsLib"
33+
"SourceDocsCLI" -> "Rainbow"
34+
"SourceDocsLib" -> "SourceKittenFramework"
35+
"SourceDocsLib" -> "SwiftPM"
36+
"SourceDocsLib" -> "MarkdownGenerator"
37+
"SourceDocsLib" -> "Rainbow"
38+
"SourceDocsLib" -> "System"
39+
"SourceDocsCLITests" -> "System"
40+
"SourceDocsLibTests" -> "SourceDocsLib"
41+
}

PackageModules.png

48.8 KB
Loading

0 commit comments

Comments
 (0)