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

GH-34 Allow more flexible slicing #35

Merged
merged 25 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
65e8f9a
Upgrade dependencies
henrik-dmg Mar 7, 2024
be6fb44
Upgrade Swift tools version
henrik-dmg Mar 7, 2024
41f9044
Remove obsolete properties
henrik-dmg Mar 7, 2024
14058cd
Create slice size calculation logic and add tests
henrik-dmg Mar 7, 2024
ad23539
Revert some changes to reduce diff
henrik-dmg Mar 7, 2024
a3566d0
Nicer names for tests and more useful tests for DeviceData
henrik-dmg Mar 7, 2024
c792021
Remove a bunch of unused code and reduce access levels
henrik-dmg Mar 7, 2024
61452ad
More easy tests
henrik-dmg Mar 7, 2024
3025001
A lot more cleanup
henrik-dmg Mar 7, 2024
c6c0475
Remove unused method
henrik-dmg Mar 7, 2024
22bd938
Update example config files
henrik-dmg Mar 7, 2024
ef848b4
Use safer shebang in install script
henrik-dmg Mar 7, 2024
836c2e6
Make benchmark script independent of external libs
henrik-dmg Mar 7, 2024
a225d45
Remove accidentaly committed periphery file
henrik-dmg Mar 7, 2024
c0ee0fa
Fix GH Actions
henrik-dmg Mar 7, 2024
683498b
Upgrade to Swift 5.9
henrik-dmg Mar 7, 2024
5ba29bf
Set Xcode version instead of Swift version
henrik-dmg Mar 7, 2024
1262765
Use specif Xcode version
henrik-dmg Mar 7, 2024
0f722b4
Maybe using Swift 5.7 it works
henrik-dmg Mar 7, 2024
017ab5b
Fix Swift 5.7 incompatible syntax
henrik-dmg Mar 7, 2024
052763b
Revert Regex changes to hopefully fix GH Actions
henrik-dmg Mar 7, 2024
e4f193b
Use newest checkout version and also pin Xcode version
henrik-dmg Mar 11, 2024
8c2949e
Reapply all the changes made to satisfy GH Actions
henrik-dmg Mar 11, 2024
b6c1749
Even safer validation of slice size
henrik-dmg Mar 11, 2024
7938466
Simplify error printing
henrik-dmg Mar 26, 2024
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
Prev Previous commit
Next Next commit
Remove obsolete properties
Signed-off-by: Henrik Panhans <[email protected]>
  • Loading branch information
henrik-dmg committed Mar 7, 2024
commit 41f90446c99b2890ce2322f38b61dfbb0ec521d7
25 changes: 0 additions & 25 deletions Sources/SwiftFrameCore/Config/ConfigData.swift
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ struct ConfigData: Decodable, ConfigValidateable {
let textColorSource: ColorSource
let outputFormat: FileFormat
let localesRegex: String?
let clearDirectories: Bool?
let outputWholeImage: Bool?

@DecodableDefault.EmptyList var textGroups: [TextGroup]

Expand All @@ -31,8 +29,6 @@ struct ConfigData: Decodable, ConfigValidateable {
// MARK: - Coding Keys

enum CodingKeys: String, CodingKey {
case clearDirectories
case outputWholeImage
case deviceData
case textGroups
case stringsPath
Expand All @@ -54,8 +50,6 @@ struct ConfigData: Decodable, ConfigValidateable {
fontSource: FontSource,
textColorSource: ColorSource,
outputFormat: FileFormat,
clearDirectories: Bool?,
outputWholeImage: Bool?,
deviceData: [DeviceData],
localesRegex: String? = nil)
{
Expand All @@ -66,8 +60,6 @@ struct ConfigData: Decodable, ConfigValidateable {
self.fontSource = fontSource
self.textColorSource = textColorSource
self.outputFormat = outputFormat
self.clearDirectories = clearDirectories
self.outputWholeImage = outputWholeImage
self.deviceData = deviceData
self.localesRegex = localesRegex
}
Expand All @@ -92,22 +84,6 @@ struct ConfigData: Decodable, ConfigValidateable {
// MARK: - ConfigValidateable

public func validate() throws {
if clearDirectories != nil {
let warningMessage = """
Specifying clearDirectories in the config file is deprecated and will be ignored in a future version.
Please use the CLI argument --clear-directories instead.
"""
print(CommandLineFormatter.formatWarning(text: warningMessage))
}

if outputWholeImage != nil {
let warningMessage = """
Specifying outputWholeImage in the config file is deprecated and will be ignored in a future version.
Please use the CLI argument --output-whole-image instead.
"""
print(CommandLineFormatter.formatWarning(text: warningMessage))
}

guard !deviceData.isEmpty else {
throw NSError(
description: "No screenshot data was supplied",
Expand All @@ -125,7 +101,6 @@ struct ConfigData: Decodable, ConfigValidateable {

public func printSummary(insetByTabs tabs: Int) {
ky_print("### Config Summary Start", insetByTabs: tabs)
CommandLineFormatter.printKeyValue("Outputs whole image as well in addition to slices", value: outputWholeImage)
CommandLineFormatter.printKeyValue("Title Color", value: textColorSource.hexString, insetBy: tabs)
CommandLineFormatter.printKeyValue("Title Font", value: try? fontSource.font().fontName, insetBy: tabs)
CommandLineFormatter.printKeyValue("Title Max Font Size", value: maxFontSize, insetBy: tabs)
Expand Down
14 changes: 0 additions & 14 deletions Sources/SwiftFrameCore/Workers/ConfigProcessor.swift
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ public class ConfigProcessor: VerbosePrintable {
public func validate() throws {
try process()
try data.validate()

if data.outputWholeImage != nil {
printDeprecationWarning(for: "ouputWholeImage")
}
if data.clearDirectories != nil {
printDeprecationWarning(for: "clearDirectories")
}
}

private func process() throws {
Expand Down Expand Up @@ -146,11 +139,4 @@ public class ConfigProcessor: VerbosePrintable {
group.wait()
}

// MARK: - Helpers

private func printDeprecationWarning(for configProperty: String) {
let warningMessage = "\(configProperty) was specified in the config file, which is deprecated. The value will be ignored"
print(CommandLineFormatter.formatWarning(text: warningMessage))
}

}
8 changes: 0 additions & 8 deletions Tests/SwiftFrameTests/Utility/ConfigDataFixtures.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ extension ConfigData {
fontSource: .nsFont(.systemFont(ofSize: 20)),
textColorSource: try! ColorSource(hexString: "#ff00ff"),
outputFormat: .png,
clearDirectories: true,
outputWholeImage: true,
deviceData: [.goodData]
)

Expand All @@ -25,8 +23,6 @@ extension ConfigData {
fontSource: .nsFont(.systemFont(ofSize: 20)),
textColorSource: try! ColorSource(hexString: "#ff00ff"),
outputFormat: .png,
clearDirectories: true,
outputWholeImage: true,
deviceData: [.goodData],
localesRegex: "^(?!en|fr$)\\w*$"
)
Expand All @@ -39,8 +35,6 @@ extension ConfigData {
fontSource: .nsFont(.systemFont(ofSize: 20)),
textColorSource: try! ColorSource(hexString: "#ff00ff"),
outputFormat: .png,
clearDirectories: true,
outputWholeImage: true,
deviceData: [.goodData],
localesRegex: "en"
)
Expand All @@ -53,8 +47,6 @@ extension ConfigData {
fontSource: .nsFont(.systemFont(ofSize: 20)),
textColorSource: try! ColorSource(hexString: "#ff00ff"),
outputFormat: .png,
clearDirectories: true,
outputWholeImage: true,
deviceData: [.invalidData]
)

Expand Down