diff --git a/generate_appcast/FeedXML.swift b/generate_appcast/FeedXML.swift index 42734c24..1d45c601 100644 --- a/generate_appcast/FeedXML.swift +++ b/generate_appcast/FeedXML.swift @@ -49,7 +49,7 @@ func extractVersion(parent: XMLNode) -> String? { return nil } -func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set?, maxNewVersionsInFeed: Int, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) { +func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set?, maxNewVersionsInFeed: Int, fullReleaseNotesLink: String?, link: String?, newChannel: String?, majorVersion: String?, phasedRolloutInterval: Int?, criticalUpdateVersion: String?, informationalUpdateVersions: [String]?) throws -> (numNewUpdates: Int, numExistingUpdates: Int) { let appBaseName = updates[0].appPath.deletingPathExtension().lastPathComponent let sparkleNS = "http://www.andymatuschak.org/xml-namespaces/sparkle" @@ -168,6 +168,12 @@ func writeAppcast(appcastDestPath: URL, updates: [ArchiveItem], newVersions: Set item.addChild(linkElement) } + if let fullReleaseNotesLink = fullReleaseNotesLink, + let fullReleaseNotesElement = XMLElement.element(withName: SUAppcastElementFullReleaseNotesLink, uri: sparkleNS) as? XMLElement { + fullReleaseNotesElement.setChildren([text(fullReleaseNotesLink)]) + item.addChild(fullReleaseNotesElement) + } + // Set new channel name if let newChannelName = newChannel, let channelNameElement = XMLElement.element(withName: SUAppcastElementChannel, uri: sparkleNS) as? XMLElement { diff --git a/generate_appcast/main.swift b/generate_appcast/main.swift index ee9c5150..293c0162 100644 --- a/generate_appcast/main.swift +++ b/generate_appcast/main.swift @@ -72,6 +72,9 @@ struct GenerateAppcast: ParsableCommand { @Option(name: .customLong("release-notes-url-prefix"), help: ArgumentHelp("A URL that will be used as prefix for constructing URLs for release notes.", valueName: "url"), transform: { URL(string: $0) }) var releaseNotesURLPrefix : URL? + @Option(name: .customLong("full-release-notes-url"), help: ArgumentHelp("A URL that will be used for the full release notes.", valueName: "url")) + var fullReleaseNotesURL: String? + @Option(name: .long, help: ArgumentHelp("A URL to the application's website which Sparkle may use for directing users to if they cannot download a new update from within the application. This will be used for new generated update items. By default, no product link is used.", valueName: "link")) var link: String? @@ -220,7 +223,7 @@ struct GenerateAppcast: ParsableCommand { relativeTo: archivesSourceDir) // Write the appcast - let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions) + let (numNewUpdates, numExistingUpdates) = try writeAppcast(appcastDestPath: appcastDestPath, updates: updates, newVersions: versions, maxNewVersionsInFeed: maxNewVersionsInFeed, fullReleaseNotesLink: fullReleaseNotesURL, link: link, newChannel: channel, majorVersion: majorVersion, phasedRolloutInterval: phasedRolloutInterval, criticalUpdateVersion: criticalUpdateVersion, informationalUpdateVersions: informationalUpdateVersions) // Inform the user, pluralizing "update" if necessary let pluralizeUpdates = { $0 == 1 ? "update" : "updates" }