From 476ff08bef1ccb6ba9446b996411cd15f27d2e6a Mon Sep 17 00:00:00 2001 From: Boris Buegling Date: Mon, 29 Jan 2024 14:58:45 -0800 Subject: [PATCH] Small cleanup to non-block based `FileLock` API It doesn't seem like we should be giving access to the arbitrary initializer and instead vend `prepareLock` publicly. --- Sources/TSCBasic/Lock.swift | 4 ++-- Tests/TSCBasicTests/LockTests.swift | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Sources/TSCBasic/Lock.swift b/Sources/TSCBasic/Lock.swift index edb93858..d51048bd 100644 --- a/Sources/TSCBasic/Lock.swift +++ b/Sources/TSCBasic/Lock.swift @@ -77,7 +77,7 @@ public final class FileLock { /// Create an instance of FileLock at the path specified /// /// Note: The parent directory path should be a valid directory. - public init(at lockFile: AbsolutePath) { + internal init(at lockFile: AbsolutePath) { self.lockFile = lockFile } @@ -191,7 +191,7 @@ public final class FileLock { return try await body() } - private static func prepareLock( + public static func prepareLock( fileToLock: AbsolutePath, at lockFilesDirectory: AbsolutePath? = nil ) throws -> FileLock { diff --git a/Tests/TSCBasicTests/LockTests.swift b/Tests/TSCBasicTests/LockTests.swift index 3b354180..41217bab 100644 --- a/Tests/TSCBasicTests/LockTests.swift +++ b/Tests/TSCBasicTests/LockTests.swift @@ -10,7 +10,7 @@ import XCTest -import TSCBasic +@testable import TSCBasic import TSCTestSupport class LockTests: XCTestCase {