Skip to content

Commit

Permalink
Revert "feat: Service client release notes (#1780)" (#1782)
Browse files Browse the repository at this point in the history
This reverts commit bfb7379.
  • Loading branch information
sichanyoo authored Oct 4, 2024
1 parent bfb7379 commit ff7e703
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 300 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ struct PrepareRelease {
) throws {
let commits = try Process.git.listOfCommitsBetween("HEAD", "\(previousVersion)")

let releaseNotes = try ReleaseNotesBuilder(
let releaseNotes = ReleaseNotesBuilder(
previousVersion: previousVersion,
newVersion: newVersion,
repoOrg: repoOrg,
Expand Down
50 changes: 0 additions & 50 deletions AWSSDKSwiftCLI/Sources/AWSSDKSwiftCLI/Models/Features.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,62 +15,24 @@ struct ReleaseNotesBuilder {
let repoOrg: PrepareRelease.Org
let repoType: PrepareRelease.Repo
let commits: [String]
var featuresReader: FeaturesReader = FeaturesReader()


// MARK: - Build

func build() throws -> String {
let sdkChanges: [String] = buildSDKChangeSection()
let serviceClientChanges = repoType == .awsSdkSwift ? (try buildServiceChangeSection()) : []
let fullCommitLogLink = [
"\n**Full Changelog**: https://github.com/\(repoOrg.rawValue)/\(repoType.rawValue)/compare/\(previousVersion)...\(newVersion)"

func build() -> String {
let contents = [
"## What's Changed",
buildCommits(),
.newline,
"**Full Changelog**: https://github.com/\(repoOrg.rawValue)/\(repoType.rawValue)/compare/\(previousVersion)...\(newVersion)"
]
let contents = ["## What's Changed"] + serviceClientChanges + sdkChanges + fullCommitLogLink
return contents.joined(separator: .newline)
}

func buildSDKChangeSection() -> [String] {
let formattedCommits = commits
.filter { $0.hasPrefix("feat") || $0.hasPrefix("fix") }
.map { "* \($0)" }
.joined(separator: .newline)
if (!formattedCommits.isEmpty) {
return ["### Miscellaneous", formattedCommits]
}
return []
}

func buildServiceChangeSection() throws -> [String] {
let features = try featuresReader.getFeaturesFromFile()
let mapping = try featuresReader.getFeaturesIDToServiceNameDictFromFile()
return buildServiceFeatureSection(features, mapping) + buildServiceDocSection(features, mapping)
}

private func buildServiceFeatureSection(
_ features: Features,
_ mapping: [String: String]
) -> [String] {
let formattedFeatures = features.features
.filter { $0.featureMetadata.trebuchet.featureType == "NEW_FEATURE" }
.map { "* **AWS \(mapping[$0.featureMetadata.trebuchet.featureId]!)**: \($0.releaseNotes)" }
.joined(separator: .newline)
if (!formattedFeatures.isEmpty) {
return ["### Service Features", formattedFeatures]
}
return []
}

private func buildServiceDocSection(
_ features: Features,
_ mapping: [String: String]
) -> [String] {
let formattedDocUpdates = features.features
.filter { $0.featureMetadata.trebuchet.featureType == "DOC_UPDATE" }
.map { "* **AWS \(mapping[$0.featureMetadata.trebuchet.featureId]!)**: \($0.releaseNotes)" }

// Adds a preceding `*` to each commit string
// This renders the list of commits as a list in markdown
func buildCommits() -> String {
commits
.map { "* \($0)"}
.joined(separator: .newline)
if (!formattedDocUpdates.isEmpty) {
return ["### Service Documentation", formattedDocUpdates]
}
return []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,6 @@ class PrepareReleaseTests: CLITestCase {
createPackageVersion(previousVersion)
createNextPackageVersion(newVersion)

let buildRequest = """
{
"features": []
}
"""
FileManager.default.createFile(atPath: "build-request.json", contents: Data(buildRequest.utf8))

let mapping = "{}"
FileManager.default.createFile(atPath: "feature-service-id.json", contents: Data(mapping.utf8))

let subject = PrepareRelease.mock(repoType: .awsSdkSwift, diffChecker: { _,_ in true })
try! subject.run()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class PackageManifestBuilderTests: XCTestCase {

let expected = """
<contents of prefix>
// MARK: - Dynamic Content
let clientRuntimeVersion: Version = "1.2.3"
Expand Down

This file was deleted.

0 comments on commit ff7e703

Please sign in to comment.