Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring SourcePackagesNotfoundError #19

Merged
merged 1 commit into from
Oct 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions Plugins/PrepareLicenseList/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,14 @@ import PackagePlugin

@main
struct PrepareLicenseList: BuildToolPlugin {
var sourcePackagesNotFoundError: Error {
return NSError(
domain: "com.cybozu.PrepareLicenseList",
code: 1,
userInfo: ["message": "SourcePackages not found"]
)
struct SourcePackagesNotFoundError: Error & CustomStringConvertible {
let description: String = "SourcePackages not found"
}

func sourcePackages(_ pluginWorkDirectory: Path) throws -> Path {
var tmpPath = pluginWorkDirectory
guard pluginWorkDirectory.string.contains("SourcePackages") else {
throw sourcePackagesNotFoundError
throw SourcePackagesNotFoundError()
}
while tmpPath.lastComponent != "SourcePackages" {
tmpPath = tmpPath.removingLastComponent()
Expand All @@ -44,7 +40,7 @@ struct PrepareLicenseList: BuildToolPlugin {
sourcePackagesPath.string
],
outputFiles: [
outputPath.appending(["license-list.plist"]),
outputPath.appending(["license-list.plist"])
]
)
]
Expand Down