Skip to content

Commit

Permalink
support multiple license files (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
MattKiazyk authored Apr 26, 2024
1 parent 036b167 commit 9a87c13
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Sources/AckGenCLI/AckGen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ struct AckGenCLI {
static func main() {
print("Generating Acknowledgements file")

let licenseFiles: [String] = ["LICENSE", "LICENSE.txt"]

let arguments: [String] = Array(CommandLine.arguments.dropFirst())

guard let srcRoot = ProcessInfo.processInfo.environment["SRCROOT"] else {
Expand All @@ -36,9 +38,11 @@ struct AckGenCLI {
var acknowledgements = [Acknowledgement]()

for pkgDir in packageDirectories where pkgDir.prefix(1) != "." {
guard let data = fman.contents(atPath: "\(packageCachePath)/\(pkgDir)/LICENSE") else { continue }
let new = Acknowledgement(title: pkgDir, license: String(data: data, encoding: .utf8)!)
acknowledgements.append(new)
for file in licenseFiles {
guard let data = fman.contents(atPath: "\(packageCachePath)/\(pkgDir)/\(file)") else { continue }
let new = Acknowledgement(title: pkgDir, license: String(data: data, encoding: .utf8)!)
acknowledgements.append(new)
}
}

let encoder = PropertyListEncoder()
Expand Down

0 comments on commit 9a87c13

Please sign in to comment.