Skip to content

Commit 5d7a1f5

Browse files
committed
Remove fonts cache sub dir
1 parent f0b1f08 commit 5d7a1f5

File tree

5 files changed

+32
-44
lines changed

5 files changed

+32
-44
lines changed

Example/Example.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"kind" : "remoteSourceControl",
77
"location" : "https://github.com/pointfreeco/combine-schedulers",
88
"state" : {
9-
"revision" : "487a4d151e795a5e076a7e7aedcd13c2ebff6c31",
10-
"version" : "1.0.1"
9+
"revision" : "9fa31f4403da54855f1e2aeaeff478f4f0e40b13",
10+
"version" : "1.0.2"
1111
}
1212
},
1313
{
@@ -29,21 +29,21 @@
2929
}
3030
},
3131
{
32-
"identity" : "swift-issue-reporting",
32+
"identity" : "swift-libass",
3333
"kind" : "remoteSourceControl",
34-
"location" : "https://github.com/pointfreeco/swift-issue-reporting",
34+
"location" : "https://github.com/mihai8804858/swift-libass",
3535
"state" : {
36-
"revision" : "c85092304cda8cb38d2d68454b29609a8013620b",
37-
"version" : "1.2.1"
36+
"revision" : "a097db001228834c57ffb8c5245f3bccc8df8124",
37+
"version" : "1.3.1"
3838
}
3939
},
4040
{
41-
"identity" : "swift-libass",
41+
"identity" : "xctest-dynamic-overlay",
4242
"kind" : "remoteSourceControl",
43-
"location" : "https://github.com/mihai8804858/swift-libass",
43+
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
4444
"state" : {
45-
"revision" : "a097db001228834c57ffb8c5245f3bccc8df8124",
46-
"version" : "1.3.1"
45+
"revision" : "357ca1e5dd31f613a1d43320870ebc219386a495",
46+
"version" : "1.2.2"
4747
}
4848
}
4949
],

Sources/SwiftAssRenderer/FontConfig/FontConfig.swift

+1-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ public struct FontConfig: FontConfigType {
2929
private let defaultFontName: String?
3030
private let defaultFontFamily: String?
3131
private let fontProvider: FontProvider
32-
private let fontsCacheSubDirName: String
3332

3433
/// - Parameters:
3534
/// - fontsPath: URL path to fonts directory. Can be read-only.
@@ -50,7 +49,6 @@ public struct FontConfig: FontConfigType {
5049
fontProvider: FontProvider = .fontConfig
5150
) {
5251
self.init(
53-
uuid: UUID.init,
5452
fileManager: FileManager.default,
5553
moduleBundle: Bundle.module,
5654
libraryWrapper: LibraryWrapper.self,
@@ -63,7 +61,6 @@ public struct FontConfig: FontConfigType {
6361
}
6462

6563
init(
66-
uuid: @escaping () -> UUID,
6764
fileManager: FileManagerType,
6865
moduleBundle: BundleType,
6966
libraryWrapper: LibraryWrapperType.Type,
@@ -81,7 +78,6 @@ public struct FontConfig: FontConfigType {
8178
self.defaultFontName = defaultFontName
8279
self.defaultFontFamily = defaultFontFamily
8380
self.fontProvider = fontProvider
84-
self.fontsCacheSubDirName = uuid().uuidString
8581
}
8682

8783
func configure(library: OpaquePointer, renderer: OpaquePointer) throws {
@@ -99,9 +95,7 @@ public struct FontConfig: FontConfigType {
9995
}
10096

10197
private var cachePath: URL {
102-
(fontsCachePath ?? fileManager.cachesDirectory)
103-
.appendingPathComponent(fontsCacheSubDirName)
104-
.appendingPathComponent(FontConfig.fontsCacheDirName)
98+
(fontsCachePath ?? fileManager.cachesDirectory).appendingPathComponent(FontConfig.fontsCacheDirName)
10599
}
106100

107101
private func makeFontsCacheDirectory() throws {

SwiftAssRenderer.xcworkspace/xcshareddata/swiftpm/Package.resolved

+14-14
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"kind" : "remoteSourceControl",
66
"location" : "https://github.com/pointfreeco/combine-schedulers",
77
"state" : {
8-
"revision" : "487a4d151e795a5e076a7e7aedcd13c2ebff6c31",
9-
"version" : "1.0.1"
8+
"revision" : "9fa31f4403da54855f1e2aeaeff478f4f0e40b13",
9+
"version" : "1.0.2"
1010
}
1111
},
1212
{
@@ -27,15 +27,6 @@
2727
"version" : "1.1.0"
2828
}
2929
},
30-
{
31-
"identity" : "swift-issue-reporting",
32-
"kind" : "remoteSourceControl",
33-
"location" : "https://github.com/pointfreeco/swift-issue-reporting",
34-
"state" : {
35-
"revision" : "c85092304cda8cb38d2d68454b29609a8013620b",
36-
"version" : "1.2.1"
37-
}
38-
},
3930
{
4031
"identity" : "swift-libass",
4132
"kind" : "remoteSourceControl",
@@ -51,16 +42,25 @@
5142
"location" : "https://github.com/mihai8804858/swift-snapshot-testing",
5243
"state" : {
5344
"branch" : "main",
54-
"revision" : "472017f0c1bc500a495af5801dadcb343a37d57b"
45+
"revision" : "a3650f05218407222aed2f5a632c43e4973378cc"
5546
}
5647
},
5748
{
5849
"identity" : "swift-syntax",
5950
"kind" : "remoteSourceControl",
6051
"location" : "https://github.com/swiftlang/swift-syntax",
6152
"state" : {
62-
"revision" : "4c6cc0a3b9e8f14b3ae2307c5ccae4de6167ac2c",
63-
"version" : "600.0.0-prerelease-2024-06-12"
53+
"revision" : "06b5cdc432e93b60e3bdf53aff2857c6b312991a",
54+
"version" : "600.0.0-prerelease-2024-07-30"
55+
}
56+
},
57+
{
58+
"identity" : "xctest-dynamic-overlay",
59+
"kind" : "remoteSourceControl",
60+
"location" : "https://github.com/pointfreeco/xctest-dynamic-overlay",
61+
"state" : {
62+
"revision" : "357ca1e5dd31f613a1d43320870ebc219386a495",
63+
"version" : "1.2.2"
6464
}
6565
}
6666
],

Tests/FontConfig/FontConfigTests.swift

+3-13
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ final class FontConfigTests: XCTestCase {
77
private var mockFileManager: MockFileManager!
88
private var mockBundle: MockBundle!
99
private var mockLibraryWrapper: MockLibraryWrapper.Type!
10-
private var mockUUID: UUID!
1110

1211
private var cachesDirectory: URL {
1312
if #available(iOS 16.0, tvOS 16.0, visionOS 1.0, macOS 13.0, *) {
@@ -41,7 +40,6 @@ final class FontConfigTests: XCTestCase {
4140
mockFileManager = MockFileManager()
4241
mockBundle = MockBundle()
4342
mockLibraryWrapper = MockLibraryWrapper.self
44-
mockUUID = UUID()
4543
}
4644

4745
func createConfig(
@@ -52,7 +50,6 @@ final class FontConfigTests: XCTestCase {
5250
fontProvider: FontProvider = .fontConfig
5351
) -> FontConfig {
5452
FontConfig(
55-
uuid: { self.mockUUID },
5653
fileManager: mockFileManager,
5754
moduleBundle: mockBundle,
5855
libraryWrapper: mockLibraryWrapper,
@@ -76,9 +73,7 @@ final class FontConfigTests: XCTestCase {
7673
try config.configure(library: library, renderer: renderer)
7774

7875
// THEN
79-
let expectedURL = defaultFontsCachePath
80-
.appendingPathComponent(mockUUID.uuidString)
81-
.appendingPathComponent("fonts-cache")
76+
let expectedURL = defaultFontsCachePath.appendingPathComponent("fonts-cache")
8277
XCTAssert(mockFileManager.createDirectoryFunc.wasCalled(with: expectedURL))
8378
}
8479

@@ -107,9 +102,7 @@ final class FontConfigTests: XCTestCase {
107102
try config.configure(library: library, renderer: renderer)
108103

109104
// THEN
110-
let expectedURL = fontsCachePath
111-
.appendingPathComponent(mockUUID.uuidString)
112-
.appendingPathComponent("fonts-cache")
105+
let expectedURL = fontsCachePath.appendingPathComponent("fonts-cache")
113106
XCTAssert(mockFileManager.createDirectoryFunc.wasCalled(with: expectedURL))
114107
}
115108

@@ -126,10 +119,7 @@ final class FontConfigTests: XCTestCase {
126119
// THEN
127120
let createFileArgument = try XCTUnwrap(mockFileManager.createItemFunc.argument)
128121
let expectedDir = fontsPath.path
129-
let expectedCacheDir = fontsCachePath
130-
.appendingPathComponent(mockUUID.uuidString)
131-
.appendingPathComponent("fonts-cache")
132-
.path
122+
let expectedCacheDir = fontsCachePath.appendingPathComponent("fonts-cache").path
133123
let expectedConfFile = cachesDirectory.appendingPathComponent("fonts.conf")
134124
let expectedContents = """
135125
<?xml version="1.0"?>

Tests/Wrapper/LibraryWrapperTests.swift

+4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import XCTest
22
@testable import SwiftAssRenderer
33

4+
#if hasAttribute(retroactive)
5+
extension OpaquePointer: @unchecked @retroactive Sendable {}
6+
#endif
7+
48
final class LibraryWrapperTests: XCTestCase {
59
private let iterations = 10_000
610

0 commit comments

Comments
 (0)