@@ -40,39 +40,52 @@ enum Main
40
40
41
41
let edition : PackageBuildStatus . Edition
42
42
43
- if package . release . graphs == 0
43
+ if options . build
44
44
{
45
- edition = package . release
46
- }
47
- else if
48
- let prerelease: PackageBuildStatus . Edition = package . prerelease,
49
- prerelease. graphs == 0
50
- {
51
- edition = prerelease
52
- }
53
- else
54
- {
55
- print ( " No new documentation to build " )
56
- return
57
- }
45
+ if package . release. graphs == 0 || options. force
46
+ {
47
+ edition = package . release
48
+ }
49
+ else if
50
+ let prerelease: PackageBuildStatus . Edition = package . prerelease,
51
+ prerelease. graphs == 0
52
+ {
53
+ edition = prerelease
54
+ }
55
+ else
56
+ {
57
+ print ( " No new documentation to build " )
58
+ return
59
+ }
60
+
61
+ let build : PackageBuild = try await . remote(
62
+ package : options. package ,
63
+ from: package . repo,
64
+ at: edition. tag,
65
+ in: workspace,
66
+ clean: true )
58
67
59
- let build : PackageBuild = try await . remote(
60
- package : options. package ,
61
- from: package . repo,
62
- at: edition. tag,
63
- in: workspace,
64
- clean: true )
68
+ let snapshot : Snapshot = . init(
69
+ package : package . coordinate,
70
+ version: edition. coordinate,
71
+ archive: try await toolchain. generateDocs ( for: build, pretty: options. pretty) )
65
72
66
- let snapshot : Snapshot = . init(
67
- package : package . coordinate,
68
- version: edition. coordinate,
69
- archive: try await toolchain. generateDocs ( for: build, pretty: options. pretty) )
73
+ let bson : BSON . Document = . init( encoding: consume snapshot)
70
74
71
- let bson : BSON . Document = . init ( encoding : consume snapshot )
75
+ print ( " Uploading symbol graph... " )
72
76
73
- try await $0. put ( bson: bson, to: " /api/symbolgraph " )
77
+ try await $0. put ( bson: bson, to: " /api/symbolgraph " )
74
78
75
- print ( " Successfully uploaded symbol graph (tag: \( edition. tag) ) " )
79
+ print ( " Successfully uploaded symbol graph (tag: \( edition. tag) ) " )
80
+ }
81
+ else
82
+ {
83
+ edition = package . release
84
+ }
85
+
86
+ try await $0. post (
87
+ urlencoded: " package= \( package . coordinate) &version= \( edition. coordinate) " ,
88
+ to: " /api/uplink " )
76
89
}
77
90
}
78
91
}
@@ -85,6 +98,8 @@ extension Main
85
98
var cookie : String
86
99
var remote : String
87
100
var pretty : Bool
101
+ var build : Bool
102
+ var force : Bool
88
103
89
104
private
90
105
init ( package : PackageIdentifier )
@@ -93,6 +108,8 @@ extension Main
93
108
self . cookie = " "
94
109
self . remote = " swiftinit.org "
95
110
self . pretty = false
111
+ self . build = true
112
+ self . force = false
96
113
}
97
114
}
98
115
}
@@ -139,6 +156,12 @@ extension Main.Options
139
156
case " --pretty " , " -p " :
140
157
options. pretty = true
141
158
159
+ case " --force " , " -f " :
160
+ options. force = true
161
+
162
+ case " --uplink-only " , " -u " :
163
+ options. build = false
164
+
142
165
case let option:
143
166
fatalError ( " Unknown option ' \( option) ' " )
144
167
}
0 commit comments