From deda2b39ed5607ec79b560b8084f8e78e8a7bef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Mon, 13 May 2019 10:10:09 +0200 Subject: [PATCH 01/36] Update Homebrew formula to version 4.0.2 --- Formula/bartycrouch.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Formula/bartycrouch.rb b/Formula/bartycrouch.rb index 8beb7c2..649725a 100644 --- a/Formula/bartycrouch.rb +++ b/Formula/bartycrouch.rb @@ -1,7 +1,7 @@ class Bartycrouch < Formula desc "Incrementally update/translate your Strings files" homepage "https://github.com/Flinesoft/BartyCrouch" - url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.0.1", :revision => "b7e940a6383c9d1f013288081dcc2a395c68448b" + url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.0.2", :revision => "7d4cfec9530c7364727a4461712b54909f8d4a90" head "https://github.com/Flinesoft/BartyCrouch.git" depends_on :xcode => ["10.2", :build] From a1033ef250820587186ce63ee7ab183cddb15162 Mon Sep 17 00:00:00 2001 From: Patrick Date: Tue, 11 Jun 2019 10:50:40 +0200 Subject: [PATCH 02/36] Bump version in CLI definition --- Sources/BartyCrouch/main.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/BartyCrouch/main.swift b/Sources/BartyCrouch/main.swift index 764c21c..454b629 100644 --- a/Sources/BartyCrouch/main.swift +++ b/Sources/BartyCrouch/main.swift @@ -7,7 +7,7 @@ import SwiftCLI // MARK: - CLI let cli = CLI( name: "bartycrouch", - version: "4.0.0", + version: "4.0.2", description: "Incrementally update & translate your Strings files from code or interface files." ) From bd454b03fc2113fcd16af91192a3d27b0110ef98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Mon, 29 Jul 2019 10:58:14 +0200 Subject: [PATCH 03/36] Upgrade dependencies --- Package.resolved | 8 ++++---- Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift | 2 +- .../BartyCrouchKit/OldCommandLine/IBToolCommander.swift | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Package.resolved b/Package.resolved index 0d9a537..76ef3ea 100644 --- a/Package.resolved +++ b/Package.resolved @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/onevcat/Rainbow.git", "state": { "branch": null, - "revision": "797a68d0a642609424b08f11eb56974a54d5f6e2", - "version": "3.1.4" + "revision": "9c52c1952e9b2305d4507cf473392ac2d7c9b155", + "version": "3.1.5" } }, { @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/jakeheis/SwiftCLI.git", "state": { "branch": null, - "revision": "5318c37d3cacc8780f50b87a8840a6774320ebdf", - "version": "5.2.2" + "revision": "ba2268e67c07b9f9cfbc0801385e6238b36255eb", + "version": "5.3.2" } } ] diff --git a/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift b/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift index e86fc1e..de945eb 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift @@ -29,7 +29,7 @@ public class CodeCommander { let customFunctionArgs = customFunction != nil ? ["-s", "\(customFunction!)"] : [] let arguments = ["extractLocStrings"] + files + ["-o", stringsFilePath] + customFunctionArgs + ["-q"] - try run("/usr/bin/xcrun", arguments: arguments) + try Task.run("/usr/bin/xcrun", arguments: arguments) } func findFiles(in codeDirectoryPath: String) throws -> [String] { diff --git a/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift b/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift index ca26c88..2934a94 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift @@ -15,6 +15,6 @@ public final class IBToolCommander { // MARK: - Instance Methods public func export(stringsFileToPath stringsFilePath: String, fromIbFileAtPath ibFilePath: String) throws { let arguments = ["--export-strings-file", stringsFilePath, ibFilePath] - try run("/usr/bin/ibtool", arguments: arguments) + try Task.run("/usr/bin/ibtool", arguments: arguments) } } From dc2f0acb37d6d772e2b9d9cd2f1fd19dfa62fd2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Mon, 29 Jul 2019 10:58:57 +0200 Subject: [PATCH 04/36] Ignore InfoPlist.strings files when searching for Strings files See #136 for more information: https://github.com/Flinesoft/BartyCrouch/issues/136 --- .../FileHandling/FilesSearchable.swift | 12 ++++++---- .../FileHandling/StringsFilesSearch.swift | 24 ++++++++++++++----- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift b/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift index 613cce0..2f1ddaa 100644 --- a/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift +++ b/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift @@ -8,20 +8,20 @@ import Foundation protocol FilesSearchable { - func findAllFilePaths(inDirectoryPath baseDirectoryPath: String, matching regularExpression: NSRegularExpression) -> [String] + func findAllFilePaths(inDirectoryPath baseDirectoryPath: String, matching regularExpression: NSRegularExpression, ignoreSuffixes: Set) -> [String] } extension FilesSearchable { - func findAllFilePaths(inDirectoryPath baseDirectoryPath: String, matching regularExpression: NSRegularExpression) -> [String] { + func findAllFilePaths(inDirectoryPath baseDirectoryPath: String, matching regularExpression: NSRegularExpression, ignoreSuffixes: Set = []) -> [String] { let baseDirectoryURL = URL(fileURLWithPath: baseDirectoryPath) guard let enumerator = FileManager.default.enumerator(at: baseDirectoryURL, includingPropertiesForKeys: nil) else { return [] } var filePaths = [String]() - let dirsToIgnore = Set([".git", "Carthage", "Pods", "build", "docs"]) + let dirsToIgnore = Set([".git", "carthage", "pods", "build", ".build", "docs"]) let baseDirectoryAbsolutePath = baseDirectoryURL.path for case let url as URL in enumerator { - if dirsToIgnore.contains(url.lastPathComponent) { + if dirsToIgnore.contains(url.lastPathComponent.lowercased()) { enumerator.skipDescendants() continue } @@ -33,6 +33,8 @@ extension FilesSearchable { } } - return filePaths + return filePaths.filter { filePath in + !ignoreSuffixes.contains { filePath.hasSuffix($0) } + } } } diff --git a/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift b/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift index d2c92b8..d95cf2d 100644 --- a/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift +++ b/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift @@ -3,15 +3,15 @@ import Foundation // NOTE: -// This file was not refactored as port of the work/big-refactoring branch for version 4.0 to prevent unexpected behavior changes. -// A rewrite after writing extensive tests for the expected behavior could improve readebility, extensibility and performance. +// This file was not refactored as part of the work/big-refactoring branch for version 4.0 to prevent unexpected behavior changes. +// A rewrite after writing extensive tests for the expected behavior could improve readability, extensibility and performance. /// Searchs for `.strings` files given a base internationalized Storyboard. public final class StringsFilesSearch: FilesSearchable { // MARK: - Stored Type Properties public static let shared = StringsFilesSearch() - fileprivate static let blacklistedStringFileNames: Set = ["InfoPlist.strings"] + private static let blacklistedStringFileNames: Set = ["InfoPlist.strings"] // MARK: - Instance Methods public func findAllIBFiles(within baseDirectoryPath: String, withLocale locale: String = "Base") -> [String] { @@ -23,19 +23,31 @@ public final class StringsFilesSearch: FilesSearchable { public func findAllStringsFiles(within baseDirectoryPath: String, withLocale locale: String) -> [String] { // swiftlint:disable:next force_try let stringsFileRegex = try! NSRegularExpression(pattern: "^(.*\\/)?\(locale).lproj.*\\.strings\\z", options: .caseInsensitive) - return self.findAllFilePaths(inDirectoryPath: baseDirectoryPath, matching: stringsFileRegex) + return self.findAllFilePaths( + inDirectoryPath: baseDirectoryPath, + matching: stringsFileRegex, + ignoreSuffixes: StringsFilesSearch.blacklistedStringFileNames + ) } public func findAllStringsFiles(within baseDirectoryPath: String, withFileName fileName: String) -> [String] { // swiftlint:disable:next force_try let stringsFileRegex = try! NSRegularExpression(pattern: ".*\\.lproj/\(fileName)\\.strings\\z", options: .caseInsensitive) - return self.findAllFilePaths(inDirectoryPath: baseDirectoryPath, matching: stringsFileRegex) + return self.findAllFilePaths( + inDirectoryPath: baseDirectoryPath, + matching: stringsFileRegex, + ignoreSuffixes: StringsFilesSearch.blacklistedStringFileNames + ) } public func findAllStringsFiles(within baseDirectoryPath: String) -> [String] { // swiftlint:disable:next force_try let stringsFileRegex = try! NSRegularExpression(pattern: ".*\\.lproj/.+\\.strings\\z", options: .caseInsensitive) - return self.findAllFilePaths(inDirectoryPath: baseDirectoryPath, matching: stringsFileRegex) + return self.findAllFilePaths( + inDirectoryPath: baseDirectoryPath, + matching: stringsFileRegex, + ignoreSuffixes: StringsFilesSearch.blacklistedStringFileNames + ) } public func findAllLocalesForStringsFile(sourceFilePath: String) -> [String] { From 5ca171810d266f5b88c0f001ab657265f1e7dd13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Mon, 29 Jul 2019 10:59:13 +0200 Subject: [PATCH 05/36] Update Microsoft Translator test translations --- .../MicrosoftTranslatorApiTests.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/BartyCrouchTranslatorTests/MicrosoftTranslatorApiTests.swift b/Tests/BartyCrouchTranslatorTests/MicrosoftTranslatorApiTests.swift index 0c91139..bbd1b3b 100644 --- a/Tests/BartyCrouchTranslatorTests/MicrosoftTranslatorApiTests.swift +++ b/Tests/BartyCrouchTranslatorTests/MicrosoftTranslatorApiTests.swift @@ -30,7 +30,7 @@ class MicrosoftTranslatorApiTests: XCTestCase { XCTAssertEqual(translateResponses[0].translations[1].text, "Kaç yaşındasınız?") XCTAssertEqual(translateResponses[1].translations[0].to, "de") - XCTAssertEqual(translateResponses[1].translations[0].text, "Liebe") + XCTAssertEqual(translateResponses[1].translations[0].text.lowercased(), "Liebe".lowercased()) XCTAssertEqual(translateResponses[1].translations[1].to, "tr") XCTAssertEqual(translateResponses[1].translations[1].text, "Aşk") From 13af81e951798313b64aaa7c3ba25f7cd13c1c0e Mon Sep 17 00:00:00 2001 From: Kondamon Date: Tue, 3 Sep 2019 14:12:38 +0200 Subject: [PATCH 06/36] Hint that execution time gets faster When keys containing `path` are provided then execution time can get much faster. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6637147..6cd0674 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ emptyValues = true This is the default configuration of BartyCrouch and should work for most projects as is. In order to use BartyCrouch to its extent, it is recommended though to consider making the following changes: -1. Provide more specific paths for any key containing `path` if possible. (e.g. `"App/Sources"` for `codePath`) +1. To speed up execution time provide more specific paths for any key containing `path` if possible (especially in the `update.transform` section, e.g. `"App/Sources"` for `codePath` or `"App/Supporting Files"` for `supportedLanguageEnumPath` ) 2. Remove the `code` task if your project is Swift-only and you use the new [`transform` update task](#localization-workflow-via-transform). 3. If you are using [SwiftGen](https://github.com/SwiftGen/SwiftGen#strings) with the `structured-swift4` template, you will probably want to user the `transform` task and change its `transformer` option to `swiftgenStructured`. 4. If you decided to use the `transform` task, create a new file in your project (e.g. under `SupportingFiles`) named `BartyCrouch.swift` and copy the following code: From a91044d53a1e56d7fddd918b2f8c0c543a819560 Mon Sep 17 00:00:00 2001 From: Kondamon Date: Fri, 6 Sep 2019 17:13:14 +0200 Subject: [PATCH 07/36] Added . --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6cd0674..38034d9 100644 --- a/README.md +++ b/README.md @@ -125,7 +125,7 @@ emptyValues = true This is the default configuration of BartyCrouch and should work for most projects as is. In order to use BartyCrouch to its extent, it is recommended though to consider making the following changes: -1. To speed up execution time provide more specific paths for any key containing `path` if possible (especially in the `update.transform` section, e.g. `"App/Sources"` for `codePath` or `"App/Supporting Files"` for `supportedLanguageEnumPath` ) +1. To speed up execution time provide more specific paths for any key containing `path` if possible. (especially in the `update.transform` section, e.g. `"App/Sources"` for `codePath` or `"App/Supporting Files"` for `supportedLanguageEnumPath` ) 2. Remove the `code` task if your project is Swift-only and you use the new [`transform` update task](#localization-workflow-via-transform). 3. If you are using [SwiftGen](https://github.com/SwiftGen/SwiftGen#strings) with the `structured-swift4` template, you will probably want to user the `transform` task and change its `transformer` option to `swiftgenStructured`. 4. If you decided to use the `transform` task, create a new file in your project (e.g. under `SupportingFiles`) named `BartyCrouch.swift` and copy the following code: From 11033da39e107d44a47b1ad6c902b8b074267dc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Thu, 3 Oct 2019 10:37:41 +0200 Subject: [PATCH 08/36] Add donation section with how to support the project --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 38034d9..dfddd6e 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,15 @@ License: MIT +
+ + PayPal: Donate + + + Patreon: Become a patron +

@@ -29,6 +38,7 @@ • ConfigurationUsageBuild Script + • DonationMigration GuidesIssuesContributing @@ -374,6 +384,12 @@ func updateTimeLabel(minutes: Int) { The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not from Localizable.strings, that's why it should be ignored by BartyCrouch. +## Donation + +BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Dschee) in his free time. If you want to thank me and support the development of this project, please buy me a coffee on [PayPal](https://paypal.me/Dschee). In case you also like my other open source contributions and [articles](https://medium.com/@Dschee), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Dschee). + +Thank you very much for any donation, it really helps out a lot! 💯 + ## Migration Guides See the file [MIGRATION_GUIDES.md](https://github.com/Flinesoft/BartyCrouch/blob/stable/MIGRATION_GUIDES.md). From e68ed6f7692c1557f488b4fb4215d9761d69de06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Thu, 3 Oct 2019 12:55:15 +0200 Subject: [PATCH 09/36] [README] Fix donations links & update description --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dfddd6e..1d21002 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ alt="License: MIT">
- + PayPal: Donate @@ -386,7 +386,7 @@ The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not ## Donation -BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Dschee) in his free time. If you want to thank me and support the development of this project, please buy me a coffee on [PayPal](https://paypal.me/Dschee). In case you also like my other open source contributions and [articles](https://medium.com/@Dschee), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Dschee). +BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Dschee) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other open source contributions and [articles](https://medium.com/@Dschee), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Dschee). Thank you very much for any donation, it really helps out a lot! 💯 From 6b1289719f8845ae3dba0972fbe73292278fb71d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Thu, 3 Oct 2019 13:23:43 +0200 Subject: [PATCH 10/36] [README] Add link to open source contributions --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1d21002..c5bcd57 100644 --- a/README.md +++ b/README.md @@ -386,7 +386,7 @@ The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not ## Donation -BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Dschee) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other open source contributions and [articles](https://medium.com/@Dschee), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Dschee). +BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Dschee) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Dschee), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Dschee). Thank you very much for any donation, it really helps out a lot! 💯 From b1f9da69ffe893a2b1b6040cae55473fb8c01750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Sun, 6 Oct 2019 09:46:04 +0200 Subject: [PATCH 11/36] [podspec] Update social media URL --- BartyCrouch.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BartyCrouch.podspec b/BartyCrouch.podspec index 457f9f6..19ba9e9 100644 --- a/BartyCrouch.podspec +++ b/BartyCrouch.podspec @@ -15,7 +15,7 @@ Pod::Spec.new do |s| s.license = { :type => "MIT", :file => "LICENSE" } s.author = { "Cihat Gündüz" => "cocoapods@cihatguenduez.de" } - s.social_media_url = "https://twitter.com/Dschee" + s.social_media_url = "https://twitter.com/Jeehut" s.source = { :http => "#{s.homepage}/releases/download/#{s.version}/portable_bartycrouch.zip" } s.preserve_paths = "*" From 79b7f8942fcad215a87d557b965f235275e15896 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Sun, 6 Oct 2019 09:46:38 +0200 Subject: [PATCH 12/36] [README] Update links --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index c5bcd57..0735c31 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,7 @@ PayPal: Donate - + Patreon: Become a patron @@ -49,7 +49,7 @@ BartyCrouch **incrementally updates** your Strings files from your Code *and* from Interface Builder files. "Incrementally" means that BartyCrouch will by default **keep** both your already **translated values** and even your altered comments. Additionally you can also use BartyCrouch for **machine translating** from one language to 60+ other languages. Using BartyCrouch is as easy as **running a few simple commands** from the command line what can even be **automated using a [build script](#build-script)** within your project. -Checkout [this blog post](https://medium.com/@Dschee/localization-in-swift-like-a-pro-48164203afe2) to learn how you can effectively use BartyCrouch in your projects. +Checkout [this blog post](https://medium.com/@Jeehut/localization-in-swift-like-a-pro-48164203afe2) to learn how you can effectively use BartyCrouch in your projects. ## Requirements @@ -386,7 +386,7 @@ The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not ## Donation -BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Dschee) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Dschee), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Dschee). +BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Jeehut). Thank you very much for any donation, it really helps out a lot! 💯 From b8770ccdf42286ee94827e967a446c50e88fb5e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Sun, 24 Nov 2019 09:33:22 +0100 Subject: [PATCH 13/36] [README] Add GitHub Sponsors as a donation option --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0735c31..5fe876a 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ PayPal: Donate + + GitHub: Become a sponsor + Patreon: Become a patron @@ -386,7 +390,7 @@ The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not ## Donation -BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by becoming a patron on [Patreon](https://www.patreon.com/Jeehut). +BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut) or a patron on [Patreon](https://www.patreon.com/Jeehut). Thank you very much for any donation, it really helps out a lot! 💯 From d52564851ab77eb8057332d28c7f99c90c073bab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Sun, 24 Nov 2019 09:35:04 +0100 Subject: [PATCH 14/36] [README] Add highlighting to donation section --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fe876a..d2ebf62 100644 --- a/README.md +++ b/README.md @@ -390,7 +390,7 @@ The `%d minute(s) ago` key will be taken from Localizable.stringsdict file, not ## Donation -BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please make a small donation on [PayPal](https://paypal.me/Dschee/5EUR). In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut) or a patron on [Patreon](https://www.patreon.com/Jeehut). +BartyCrouch was brought to you by [Cihat Gündüz](https://github.com/Jeehut) in his free time. If you want to thank me and support the development of this project, please **make a small donation on [PayPal](https://paypal.me/Dschee/5EUR)**. In case you also like my other [open source contributions](https://github.com/Flinesoft) and [articles](https://medium.com/@Jeehut), please consider motivating me by **becoming a sponsor on [GitHub](https://github.com/sponsors/Jeehut)** or a **patron on [Patreon](https://www.patreon.com/Jeehut)**. Thank you very much for any donation, it really helps out a lot! 💯 From 9c7713042f45f9edfef1cd677faa080e7bede89a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20G=C3=BCnd=C3=BCz?= Date: Thu, 9 Apr 2020 08:44:35 +0200 Subject: [PATCH 15/36] [README.md] Fix logo aspect ratio on mobile --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d2ebf62..ca44a9e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@

- +

From 526f0693e615b33fb22e8564973ffd7eff7c501c Mon Sep 17 00:00:00 2001 From: noppefoxwolf Date: Sat, 4 Apr 2020 20:39:52 +0900 Subject: [PATCH 16/36] Update SwiftSyntax dependency --- Package.resolved | 4 +- Package.swift | 2 +- .../FileHandling/CodeFileHandler.swift | 10 +-- .../SupportedLanguagesReader.swift | 4 +- .../FileHandling/TranslateTransformer.swift | 78 ++++++++++++------- 5 files changed, 61 insertions(+), 37 deletions(-) diff --git a/Package.resolved b/Package.resolved index 76ef3ea..7a5d181 100644 --- a/Package.resolved +++ b/Package.resolved @@ -42,8 +42,8 @@ "repositoryURL": "https://github.com/apple/swift-syntax.git", "state": { "branch": null, - "revision": "43aa4a19b8105a803d8149ad2a86aa53a77efef3", - "version": "0.50000.0" + "revision": "0688b9cfc4c3dd234e4f55f1f056b2affc849873", + "version": "0.50200.0" } }, { diff --git a/Package.swift b/Package.swift index a06c733..3664835 100644 --- a/Package.swift +++ b/Package.swift @@ -16,7 +16,7 @@ let package = Package( .package(url: "https://github.com/onevcat/Rainbow.git", .upToNextMajor(from: "3.1.4")), .package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMajor(from: "5.2.0")), .package(url: "https://github.com/jdfergason/swift-toml.git", .upToNextMajor(from: "1.0.0")), - .package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50000.0")) + .package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50200.0")) ], targets: [ .target( diff --git a/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift b/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift index f7483f6..fa34323 100644 --- a/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift +++ b/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift @@ -17,8 +17,8 @@ final class CodeFileHandler { func transform(typeName: String, translateMethodName: String, using transformer: Transformer, caseToLangCode: [String: String]) throws -> [TranslateEntry] { let fileUrl = URL(fileURLWithPath: path) guard try String(contentsOfFile: path).contains("\(typeName).\(translateMethodName)") else { return [] } - - guard let sourceFile = try? SyntaxTreeParser.parse(fileUrl) else { + + guard let sourceFile = try? SyntaxParser.parse(fileUrl) else { print("Could not parse syntax tree of Swift file.", level: .warning, file: path) return [] } @@ -29,7 +29,7 @@ final class CodeFileHandler { translateMethodName: translateMethodName, caseToLangCode: caseToLangCode ) - let transformedFile: SourceFileSyntax = translateTransformer.visit(sourceFile) as! SourceFileSyntax + guard let transformedFile = translateTransformer.visit(sourceFile).as(SourceFileSyntax.self) else { return [] } try transformedFile.description.write(toFile: path, atomically: true, encoding: .utf8) return translateTransformer.translateEntries @@ -38,13 +38,13 @@ final class CodeFileHandler { func findCaseToLangCodeMappings(typeName: String) -> [String: String]? { let fileUrl = URL(fileURLWithPath: path) - guard let sourceFile = try? SyntaxTreeParser.parse(fileUrl) else { + guard let sourceFile = try? SyntaxParser.parse(fileUrl) else { print("Could not parse syntax tree of Swift file.", level: .warning, file: path) return nil } let supportedLanguagesReader = SupportedLanguagesReader(typeName: typeName) - sourceFile.walk(supportedLanguagesReader) + supportedLanguagesReader.walk(sourceFile) guard !supportedLanguagesReader.caseToLangCode.isEmpty else { return nil } return supportedLanguagesReader.caseToLangCode diff --git a/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift b/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift index 2d83ca3..bbac756 100644 --- a/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift +++ b/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift @@ -13,7 +13,7 @@ class SupportedLanguagesReader: SyntaxVisitor { } override func visit(_ enumDeclaration: EnumDeclSyntax) -> SyntaxVisitorContinueKind { - if enumDeclaration.parent is CodeBlockItemSyntax || enumDeclaration.identifier.text == "SupportedLanguage" { + if enumDeclaration.parent?.as(CodeBlockItemSyntax.self) != nil || enumDeclaration.identifier.text == "SupportedLanguage" { return .visitChildren } else { return .skipChildren @@ -21,7 +21,7 @@ class SupportedLanguagesReader: SyntaxVisitor { } override func visit(_ enumCaseElement: EnumCaseElementSyntax) -> SyntaxVisitorContinueKind { - if let langCodeLiteral = enumCaseElement.rawValue?.value as? StringLiteralExprSyntax { + if let langCodeLiteral = enumCaseElement.rawValue?.value.as(StringLiteralExprSyntax.self) { caseToLangCode[enumCaseElement.identifier.text] = langCodeLiteral.text } diff --git a/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift b/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift index 56d1eca..aad64ee 100644 --- a/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift +++ b/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift @@ -20,18 +20,40 @@ class TranslateTransformer: SyntaxRewriter { } override func visit(_ functionCallExpression: FunctionCallExprSyntax) -> ExprSyntax { + var functionCallExpressionIterator = functionCallExpression.children.makeIterator() + guard - let memberAccessExpression = functionCallExpression.child(at: 0) as? MemberAccessExprSyntax, + let memberAccessExpression = functionCallExpressionIterator.next()?.as(MemberAccessExprSyntax.self), // 0 let memberAccessExpressionBase = memberAccessExpression.base, memberAccessExpressionBase.description.stripped() == typeName, - memberAccessExpression.name.text == translateMethodName, - let functionCallArgumentList = functionCallExpression.child(at: 2) as? FunctionCallArgumentListSyntax, - let keyFunctionCallArgument = functionCallArgumentList.child(at: 0) as? FunctionCallArgumentSyntax, + memberAccessExpression.name.text == translateMethodName + else { + return super.visit(functionCallExpression) + } + _ = functionCallExpressionIterator.next() // 1 + guard + let functionCallArgumentList = functionCallExpressionIterator.next()?.as(TupleExprElementListSyntax.self) //2 + else { + return super.visit(functionCallExpression) + } + var functionCallArgumentListIterator = functionCallArgumentList.children.makeIterator() + + guard + let keyFunctionCallArgument = functionCallArgumentListIterator.next()?.as(TupleExprElementSyntax.self), + let keyStringLiteralExpression = keyFunctionCallArgument.expression.as(StringLiteralExprSyntax.self), keyFunctionCallArgument.label?.text == "key", - let keyStringLiteralExpression = keyFunctionCallArgument.expression as? StringLiteralExprSyntax, - let translationsFunctionCallArgument = functionCallArgumentList.child(at: 1) as? FunctionCallArgumentSyntax, - translationsFunctionCallArgument.label?.text == "translations", - let translationsDictionaryExpression = translationsFunctionCallArgument.child(at: 2) as? DictionaryExprSyntax + let translationsFunctionCallArgument = functionCallArgumentListIterator.next()?.as(TupleExprElementSyntax.self), + translationsFunctionCallArgument.label?.text == "translations" + else { + return super.visit(functionCallExpression) + } + + var translationsFunctionCallArgumentIterator = translationsFunctionCallArgument.children.makeIterator() + _ = translationsFunctionCallArgumentIterator.next() // 0 + _ = translationsFunctionCallArgumentIterator.next() // 1 + + guard + let translationsDictionaryExpression = translationsFunctionCallArgumentIterator.next()?.as(DictionaryExprSyntax.self) else { return super.visit(functionCallExpression) } @@ -41,21 +63,24 @@ class TranslateTransformer: SyntaxRewriter { guard !key.isEmpty else { print("Found empty key in translate entry '\(functionCallExpression)'.", level: .warning) - return functionCallExpression + return ExprSyntax(functionCallExpression) } var translations: [CodeFileHandler.TranslationElement] = [] - if let translationsDictionaryElementList = translationsDictionaryExpression.child(at: 1) as? DictionaryElementListSyntax { + var translationsDictionaryExpressionIterator = translationsDictionaryExpression.children.makeIterator() + _ = translationsDictionaryExpressionIterator.next() // 0 + + if let translationsDictionaryElementList = translationsDictionaryExpressionIterator.next()?.as(DictionaryElementListSyntax.self) { for dictionaryElement in translationsDictionaryElementList { guard let langCase = dictionaryElement.keyExpression.description.components(separatedBy: ".").last?.stripped() else { print("LangeCase was not an enum case literal: '\(dictionaryElement.keyExpression)'") - return functionCallExpression + return ExprSyntax(functionCallExpression) } - guard let translationLiteralExpression = dictionaryElement.valueExpression as? StringLiteralExprSyntax else { + guard let translationLiteralExpression = dictionaryElement.valueExpression.as(StringLiteralExprSyntax.self) else { print("Translation for langCase '\(langCase)' was not a String literal: '\(dictionaryElement.valueExpression)'") - return functionCallExpression + return ExprSyntax(functionCallExpression) } let translation = translationLiteralExpression.text @@ -77,9 +102,9 @@ class TranslateTransformer: SyntaxRewriter { var comment: String? if - let commentFunctionCallArgument = functionCallArgumentList.child(at: 2) as? FunctionCallArgumentSyntax, + let commentFunctionCallArgument = functionCallArgumentListIterator.next()?.as(TupleExprElementSyntax.self), commentFunctionCallArgument.label?.text == "comment", - let commentStringLiteralExpression = commentFunctionCallArgument.expression as? StringLiteralExprSyntax + let commentStringLiteralExpression = commentFunctionCallArgument.expression.as(StringLiteralExprSyntax.self) { comment = commentStringLiteralExpression.text } @@ -130,38 +155,37 @@ class TranslateTransformer: SyntaxRewriter { private func buildMemberAccessExpression(components: [String]) -> ExprSyntax { let identifierToken = SyntaxFactory.makeIdentifier(components.last!) - guard components.count > 1 else { return SyntaxFactory.makeIdentifierExpr(identifier: identifierToken, declNameArguments: nil) } - - return SyntaxFactory.makeMemberAccessExpr( + guard components.count > 1 else { return ExprSyntax(SyntaxFactory.makeIdentifierExpr(identifier: identifierToken, declNameArguments: nil)) } + return ExprSyntax(SyntaxFactory.makeMemberAccessExpr( base: buildMemberAccessExpression(components: Array(components.dropLast())), dot: SyntaxFactory.makePeriodToken(), name: identifierToken, declNameArguments: nil - ) + )) } private func buildFoundationExpression(key: String, comment: String?, leadingWhitespace: String) -> ExprSyntax { - let keyArgument = SyntaxFactory.makeFunctionCallArgument( + let keyArgument = SyntaxFactory.makeTupleExprElement( label: nil, colon: nil, - expression: SyntaxFactory.makeStringLiteralExpr(key), + expression: ExprSyntax(SyntaxFactory.makeStringLiteralExpr(key)), trailingComma: SyntaxFactory.makeCommaToken(leadingTrivia: .zero, trailingTrivia: .spaces(1)) ) - let commentArgument = SyntaxFactory.makeFunctionCallArgument( + let commentArgument = SyntaxFactory.makeTupleExprElement( label: SyntaxFactory.makeIdentifier("comment"), colon: SyntaxFactory.makeColonToken(leadingTrivia: .zero, trailingTrivia: .spaces(1)), - expression: SyntaxFactory.makeStringLiteralExpr(comment ?? ""), + expression: ExprSyntax(SyntaxFactory.makeStringLiteralExpr(comment ?? "")), trailingComma: nil ) - return SyntaxFactory.makeFunctionCallExpr( - calledExpression: SyntaxFactory.makeIdentifierExpr(identifier: SyntaxFactory.makeIdentifier("\(leadingWhitespace)NSLocalizedString"), declNameArguments: nil), + return ExprSyntax(SyntaxFactory.makeFunctionCallExpr( + calledExpression: ExprSyntax(SyntaxFactory.makeIdentifierExpr(identifier: SyntaxFactory.makeIdentifier("\(leadingWhitespace)NSLocalizedString"), declNameArguments: nil)), leftParen: SyntaxFactory.makeLeftParenToken(), - argumentList: SyntaxFactory.makeFunctionCallArgumentList([keyArgument, commentArgument]), + argumentList: SyntaxFactory.makeTupleExprElementList([keyArgument, commentArgument]), rightParen: SyntaxFactory.makeRightParenToken(), trailingClosure: nil - ) + )) } } From 3d99773352df353ae77a39cf4b0bf533ecde9415 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 10 Apr 2020 15:17:22 +0200 Subject: [PATCH 17/36] [README.md] Use Codacy & rename stable branch to main --- .gitignore | 89 ++++++++++++++++++++++++++++++++++++++++++------------ README.md | 21 ++++++------- 2 files changed, 79 insertions(+), 31 deletions(-) diff --git a/.gitignore b/.gitignore index 45da600..bc5de1d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,45 @@ +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore -## Build generated +## User settings +xcuserdata/ + +## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9) +*.xcscmblueprint +*.xccheckout + +## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4) build/ DerivedData/ - -## Various settings +*.moved-aside *.pbxuser !default.pbxuser *.mode1v3 @@ -15,16 +48,14 @@ DerivedData/ !default.mode2v3 *.perspectivev3 !default.perspectivev3 -xcuserdata/ - -## Other -*.moved-aside -*.xccheckout -*.xcscmblueprint ## Obj-C/Swift specific *.hmap + +## App packaging *.ipa +*.dSYM.zip +*.dSYM ## Playgrounds timeline.xctimeline @@ -34,6 +65,13 @@ playground.xcworkspace # # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. # Packages/ +# Package.pins +# Package.resolved +# *.xcodeproj +# +# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata +# hence it is not needed unless you have added a package configuration file to your project +.swiftpm .build/ # CocoaPods @@ -43,25 +81,36 @@ playground.xcworkspace # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # # Pods/ +# +# Add this line if you want to avoid checking in source code from the Xcode workspace +# *.xcworkspace # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. -Carthage/Checkouts -Carthage/Build +# Carthage/Checkouts + +Carthage/Build/ + +# Accio dependency management +Dependencies/ +.accio/ # fastlane # -# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the -# screenshots whenever they are needed. +# It is recommended to not store the screenshots in the git repo. +# Instead, use fastlane to re-generate the screenshots whenever they are needed. # For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md +# https://docs.fastlane.tools/best-practices/source-control/#source-control fastlane/report.xml -fastlane/screenshots -*.storyboard.strings -TestExample*.strings -*.strings.tmp +fastlane/Preview.html +fastlane/screenshots/**/*.png +fastlane/test_output -# Swift Package Manager -BartyCrouch.xcodeproj/ \ No newline at end of file +# Code Injection +# +# After new code Injection tools there's a generated folder /iOSInjectionProject +# https://github.com/johnno1962/injectionforxcode + +iOSInjectionProject/ diff --git a/README.md b/README.md index ca44a9e..e6c3449 100644 --- a/README.md +++ b/README.md @@ -1,23 +1,22 @@

- +

- Build Status - - codebeat badge + + Version: 4.0.2 - Swift: 5.0 - + Swift: 5.2 + License: MIT @@ -33,7 +32,7 @@ Patreon: Become a patron - +

@@ -395,11 +394,11 @@ Thank you very much for any donation, it really helps out a lot! 💯 ## Migration Guides -See the file [MIGRATION_GUIDES.md](https://github.com/Flinesoft/BartyCrouch/blob/stable/MIGRATION_GUIDES.md). +See the file [MIGRATION_GUIDES.md](https://github.com/Flinesoft/BartyCrouch/blob/main/MIGRATION_GUIDES.md). ## Contributing -See the file [CONTRIBUTING.md](https://github.com/Flinesoft/BartyCrouch/blob/stable/CONTRIBUTING.md). +See the file [CONTRIBUTING.md](https://github.com/Flinesoft/BartyCrouch/blob/main/CONTRIBUTING.md). ## License This library is released under the [MIT License](http://opensource.org/licenses/MIT). See LICENSE for details. From bb1d41fe1dfb85ba49df15833a81414610c565fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 10 Apr 2020 16:19:22 +0200 Subject: [PATCH 18/36] Fix all SwiftLint warnings --- .swiftlint.yml | 14 +-- Demo/Untouched/Demo/AppDelegate.swift | 2 - Demo/Untouched/Demo/ViewController.swift | 2 - Demo/Untouched/DemoTests/DemoTests.swift | 2 - Demo/Untouched/DemoUITests/DemoUITests.swift | 2 - Sources/BartyCrouch/main.swift | 2 - .../BartyCrouchKit/Commands/InitCommand.swift | 2 - .../BartyCrouchKit/Commands/LintCommand.swift | 2 - .../Commands/UpdateCommand.swift | 2 - .../Configuration/Configuration.swift | 2 - .../Configuration/Options/LintOptions.swift | 2 - .../Configuration/Options/UpdateOptions.swift | 6 +- .../Options/UpdateOptions/CodeOptions.swift | 2 - .../UpdateOptions/InterfacesOptions.swift | 2 - .../UpdateOptions/NormalizeOptions.swift | 2 - .../UpdateOptions/TransformOptions.swift | 7 +- .../UpdateOptions/TranslateOptions.swift | 2 - .../{TomlMakeable.swift => TomlCodable.swift} | 0 .../FileHandling/CodeFileHandler.swift | 4 +- .../FileHandling/CodeFilesSearch.swift | 4 +- .../FileHandling/FilesSearchable.swift | 13 ++- .../FileHandling/StringsFileUpdater.swift | 26 ++++-- .../FileHandling/StringsFilesSearch.swift | 2 - .../SupportedLanguagesReader.swift | 4 +- .../FileHandling/Transformer.swift | 2 - .../FileHandling/TranslateTransformer.swift | 89 ++++++++++--------- .../Globals/CommandExecution.swift | 2 - ...er.swift => CommandLineErrorHandler.swift} | 6 +- Sources/BartyCrouchKit/Globals/Env.swift | 4 +- .../Globals/Extensions/StringExtension.swift | 10 +-- .../Globals/GlobalOptions.swift | 2 - .../BartyCrouchKit/Globals/PrintLevel.swift | 5 +- .../OldCommandLine/CodeCommander.swift | 4 +- .../OldCommandLine/CommandLineActor.swift | 10 ++- .../OldCommandLine/IBToolCommander.swift | 2 - .../TaskHandlers/InitTaskHandler.swift | 2 +- .../TaskHandlers/TransformTaskHandler.swift | 6 +- .../BartyCrouchTranslator.swift | 2 - .../MicrosoftTranslatorApi.swift | 4 +- .../Models/Language.swift | 2 - .../Models/TranslateRequest.swift | 4 +- .../Models/TranslateResponse.swift | 2 - .../CommandLine/CommandLineActorTests.swift | 2 - .../CommandLine/CommandLineParserTests.swift | 2 - .../ExtractLocStringsCommanderTests.swift | 2 - .../CommandLine/FindFilesTests.swift | 2 - .../GenStringsCommanderTests.swift | 2 - .../CommandLine/IBToolCommanderTests.swift | 2 - .../Configuration/ConfigurationTests.swift | 2 + .../DemoTests/DemoData.swift | 12 +-- .../DemoTests/DemoTests.swift | 6 +- .../DemoTests/Directory.swift | 2 - .../FileHandling/CodeFileHandlerTests.swift | 9 +- .../StringsFileUpdaterTests.swift | 2 - .../StringsFilesSearchTests.swift | 2 - .../Helpers/FileManagerExtension.swift | 2 - .../MicrosoftTranslatorApiTests.swift | 7 -- Tests/SupportingFiles/Constants.h | 2 - Tests/SupportingFiles/Constants.m | 2 - 59 files changed, 121 insertions(+), 205 deletions(-) rename Sources/BartyCrouchKit/Configuration/{TomlMakeable.swift => TomlCodable.swift} (100%) rename Sources/BartyCrouchKit/Globals/{MungoHealer.swift => CommandLineErrorHandler.swift} (77%) diff --git a/.swiftlint.yml b/.swiftlint.yml index d01ad60..a4e83e7 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -4,7 +4,6 @@ opt_in_rules: - attributes - closure_end_indentation - closure_spacing -- conditional_returns_on_newline - contains_over_first_not_nil - convenience_type - empty_count @@ -14,8 +13,6 @@ opt_in_rules: - explicit_type_interface - extension_access_modifier - fallthrough -- fatal_error_message -- file_header - file_name - file_types_order - first_where @@ -29,7 +26,6 @@ opt_in_rules: - modifier_order - multiline_arguments - multiline_arguments_brackets -- multiline_function_chains - multiline_literal_brackets - multiline_parameters - multiline_parameters_brackets @@ -76,19 +72,15 @@ included: excluded: - Tests/LinuxMain.swift - Tests/Resources +- Tests/BartyCrouchKitTests/CommandLine +- Tests/BartyCrouchKitTests/FileHandling # Rule Configurations -conditional_returns_on_newline: - if_only: true - explicit_type_interface: allow_redundancy: true excluded: - local -file_header: - required_pattern: \/\/ Created by [^\(\)\d\n]+ on \S{6,10}\. - file_name: suffix_pattern: "Extensions?|\\+.*" @@ -101,6 +93,8 @@ file_types_order: identifier_name: excluded: - id + - db + - to line_length: 160 diff --git a/Demo/Untouched/Demo/AppDelegate.swift b/Demo/Untouched/Demo/AppDelegate.swift index c8635c4..31619e2 100644 --- a/Demo/Untouched/Demo/AppDelegate.swift +++ b/Demo/Untouched/Demo/AppDelegate.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 18.01.19. - import UIKit @UIApplicationMain diff --git a/Demo/Untouched/Demo/ViewController.swift b/Demo/Untouched/Demo/ViewController.swift index de7432f..382ccc1 100644 --- a/Demo/Untouched/Demo/ViewController.swift +++ b/Demo/Untouched/Demo/ViewController.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 18.01.19. - import UIKit class ViewController: UIViewController { diff --git a/Demo/Untouched/DemoTests/DemoTests.swift b/Demo/Untouched/DemoTests/DemoTests.swift index b386daa..e50ee26 100644 --- a/Demo/Untouched/DemoTests/DemoTests.swift +++ b/Demo/Untouched/DemoTests/DemoTests.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 18.01.19. - import XCTest @testable import Demo diff --git a/Demo/Untouched/DemoUITests/DemoUITests.swift b/Demo/Untouched/DemoUITests/DemoUITests.swift index 55c41f6..abcef25 100644 --- a/Demo/Untouched/DemoUITests/DemoUITests.swift +++ b/Demo/Untouched/DemoUITests/DemoUITests.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 18.01.19. - import XCTest class DemoUITests: XCTestCase { diff --git a/Sources/BartyCrouch/main.swift b/Sources/BartyCrouch/main.swift index 454b629..b023430 100644 --- a/Sources/BartyCrouch/main.swift +++ b/Sources/BartyCrouch/main.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 10.02.16. - import BartyCrouchKit import Foundation import SwiftCLI diff --git a/Sources/BartyCrouchKit/Commands/InitCommand.swift b/Sources/BartyCrouchKit/Commands/InitCommand.swift index 462ae00..4a1087e 100644 --- a/Sources/BartyCrouchKit/Commands/InitCommand.swift +++ b/Sources/BartyCrouchKit/Commands/InitCommand.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 13.12.18. - import Foundation import SwiftCLI diff --git a/Sources/BartyCrouchKit/Commands/LintCommand.swift b/Sources/BartyCrouchKit/Commands/LintCommand.swift index ed88ac2..d37e802 100644 --- a/Sources/BartyCrouchKit/Commands/LintCommand.swift +++ b/Sources/BartyCrouchKit/Commands/LintCommand.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 07.11.18. - import Foundation import SwiftCLI diff --git a/Sources/BartyCrouchKit/Commands/UpdateCommand.swift b/Sources/BartyCrouchKit/Commands/UpdateCommand.swift index 6ab560e..cfd9655 100644 --- a/Sources/BartyCrouchKit/Commands/UpdateCommand.swift +++ b/Sources/BartyCrouchKit/Commands/UpdateCommand.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 07.11.18. - import Foundation import SwiftCLI diff --git a/Sources/BartyCrouchKit/Configuration/Configuration.swift b/Sources/BartyCrouchKit/Configuration/Configuration.swift index 605a38d..e157bb1 100644 --- a/Sources/BartyCrouchKit/Configuration/Configuration.swift +++ b/Sources/BartyCrouchKit/Configuration/Configuration.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 08.11.18. - import Foundation import MungoHealer import Toml diff --git a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift index 065def1..bb4abba 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 06.11.18. - import Foundation import MungoHealer import Toml diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions.swift index 5cab0a1..5a7e16f 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 06.11.18. - import Foundation import MungoHealer import Toml @@ -24,7 +22,9 @@ struct UpdateOptions { extension UpdateOptions: TomlCodable { static func make(toml: Toml) throws -> UpdateOptions { let translateOptions: TranslateOptions? = try? TranslateOptions.make(toml: toml) - let defaultTasks: [String] = translateOptions != nil ? ["interfaces", "code", "transform", "translate", "normalize"] : ["interfaces", "code", "transform", "normalize"] + let defaultTasks: [String] = translateOptions != nil + ? ["interfaces", "code", "transform", "translate", "normalize"] + : ["interfaces", "code", "transform", "normalize"] return UpdateOptions( tasks: (toml.array("update", "tasks") ?? defaultTasks).compactMap { Task(rawValue: $0) }, diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift index 2d958bd..173207f 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 06.11.18. - import Foundation import Toml diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift index 927c788..f4463e4 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 06.11.18. - import Foundation import Toml diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift index f883dc3..be0f950 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 06.11.18. - import Foundation import Toml diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift index ff57835..cfb7ef5 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 23.01.19. - import Foundation import MungoHealer import Toml @@ -20,7 +18,10 @@ extension TransformOptions: TomlCodable { let transform: String = "transform" guard let transformer = Transformer(rawValue: toml.string(update, transform, "transformer") ?? Transformer.foundation.rawValue) else { - throw MungoError(source: .invalidUserInput, message: "Unknown `transformer` provided in [update.code.transform]. Supported: \(Transformer.allCases)") + throw MungoError( + source: .invalidUserInput, + message: "Unknown `transformer` provided in [update.code.transform]. Supported: \(Transformer.allCases)" + ) } return TransformOptions( diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift index 21e5c58..746d452 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 06.11.18. - import Foundation import MungoHealer import Toml diff --git a/Sources/BartyCrouchKit/Configuration/TomlMakeable.swift b/Sources/BartyCrouchKit/Configuration/TomlCodable.swift similarity index 100% rename from Sources/BartyCrouchKit/Configuration/TomlMakeable.swift rename to Sources/BartyCrouchKit/Configuration/TomlCodable.swift diff --git a/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift b/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift index fa34323..02370e2 100644 --- a/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift +++ b/Sources/BartyCrouchKit/FileHandling/CodeFileHandler.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 23.01.19. - import Foundation import SwiftSyntax @@ -17,7 +15,7 @@ final class CodeFileHandler { func transform(typeName: String, translateMethodName: String, using transformer: Transformer, caseToLangCode: [String: String]) throws -> [TranslateEntry] { let fileUrl = URL(fileURLWithPath: path) guard try String(contentsOfFile: path).contains("\(typeName).\(translateMethodName)") else { return [] } - + guard let sourceFile = try? SyntaxParser.parse(fileUrl) else { print("Could not parse syntax tree of Swift file.", level: .warning, file: path) return [] diff --git a/Sources/BartyCrouchKit/FileHandling/CodeFilesSearch.swift b/Sources/BartyCrouchKit/FileHandling/CodeFilesSearch.swift index 16e8af5..ccab5b0 100644 --- a/Sources/BartyCrouchKit/FileHandling/CodeFilesSearch.swift +++ b/Sources/BartyCrouchKit/FileHandling/CodeFilesSearch.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 23.01.19. - import Foundation final class CodeFilesSearch: FilesSearchable { @@ -13,7 +11,7 @@ final class CodeFilesSearch: FilesSearchable { guard FileManager.default.fileExists(atPath: baseDirectoryPath) else { return [] } guard !baseDirectoryPath.hasSuffix(".string") else { return [baseDirectoryPath] } - let codeFileRegex = try! NSRegularExpression(pattern: "\\.swift\\z", options: .caseInsensitive) + let codeFileRegex = try! NSRegularExpression(pattern: "\\.swift\\z", options: .caseInsensitive) // swiftlint:disable:this force_try let codeFiles: [String] = findAllFilePaths(inDirectoryPath: baseDirectoryPath, matching: codeFileRegex) return codeFiles } diff --git a/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift b/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift index 2f1ddaa..eb0a179 100644 --- a/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift +++ b/Sources/BartyCrouchKit/FileHandling/FilesSearchable.swift @@ -1,10 +1,3 @@ -// -// FilesSearchable.swift -// BartyCrouchKit -// -// Created by Cihat Gündüz on 24.01.19. -// - import Foundation protocol FilesSearchable { @@ -12,7 +5,11 @@ protocol FilesSearchable { } extension FilesSearchable { - func findAllFilePaths(inDirectoryPath baseDirectoryPath: String, matching regularExpression: NSRegularExpression, ignoreSuffixes: Set = []) -> [String] { + func findAllFilePaths( + inDirectoryPath baseDirectoryPath: String, + matching regularExpression: NSRegularExpression, + ignoreSuffixes: Set = [] + ) -> [String] { let baseDirectoryURL = URL(fileURLWithPath: baseDirectoryPath) guard let enumerator = FileManager.default.enumerator(at: baseDirectoryURL, includingPropertiesForKeys: nil) else { return [] } diff --git a/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift b/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift index 7723373..a23b2d0 100644 --- a/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift +++ b/Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift @@ -1,11 +1,11 @@ -// Created by Cihat Gündüz on 10.02.16. - // swiftlint:disable function_body_length type_body_length file_length +import BartyCrouchTranslator import Foundation import HandySwift import MungoHealer -import BartyCrouchTranslator + +// swiftlint:disable cyclomatic_complexity // NOTE: // This file was not refactored as port of the work/big-refactoring branch for version 4.0 to prevent unexpected behavior changes. @@ -15,6 +15,7 @@ public class StringsFileUpdater { // MARK: - Sub Types typealias TranslationEntry = (key: String, value: String, comment: String?, line: Int) typealias LocaleInfo = (language: String, region: String?) + typealias DuplicateEntry = (String, [TranslationEntry]) // MARK: - Stored Type Properties public static let defaultIgnoreKeys: [String] = ["#bartycrouch-ignore!", "#bc-ignore!", "#i!"] @@ -234,11 +235,17 @@ public class StringsFileUpdater { /// - Returns: The number of values translated successfully. public func translateEmptyValues(usingValuesFromStringsFile sourceStringsFilePath: String, clientSecret: String, override: Bool = false) throws -> Int { guard let (sourceLanguage, sourceRegion) = extractLocale(fromPath: sourceStringsFilePath) else { - throw MungoFatalError(source: .invalidUserInput, message: "Could not obtain source locale from path '\(sourceStringsFilePath)' – format '{locale}.lproj' missing.") + throw MungoFatalError( + source: .invalidUserInput, + message: "Could not obtain source locale from path '\(sourceStringsFilePath)' – format '{locale}.lproj' missing." + ) } guard let (targetLanguage, targetRegion) = extractLocale(fromPath: path) else { - throw MungoFatalError(source: .invalidUserInput, message: "Could not obtain target locale from path '\(sourceStringsFilePath)' – format '{locale}.lproj' missing.") + throw MungoFatalError( + source: .invalidUserInput, + message: "Could not obtain target locale from path '\(sourceStringsFilePath)' – format '{locale}.lproj' missing." + ) } guard let sourceTranslatorLanguage = Language.with(languageCode: sourceLanguage, region: sourceRegion) else { @@ -296,7 +303,12 @@ public class StringsFileUpdater { updatedTargetTranslations[updatedTargetTranslationIndex] = (key, translatedValue.asStringLiteral, comment, line) translatedValuesCount += 1 } else { - print("Resulting translation of '\(sourceValue)' to '\(targetTranslatorLanguage)' was empty.", level: .warning, file: path, line: line) + print( + "Resulting translation of '\(sourceValue)' to '\(targetTranslatorLanguage)' was empty.", + level: .warning, + file: path, + line: line + ) } } else { print("Could not fetch translation for '\(sourceValue)'.", level: .warning, file: path, line: line) @@ -393,8 +405,6 @@ public class StringsFileUpdater { return (path as NSString).substring(with: languageMatch.range(at: 1)) } - typealias DuplicateEntry = (String, [TranslationEntry]) - func findDuplicateEntries() -> [DuplicateEntry] { let translations = findTranslations(inString: oldContentString) let translationsDict = Dictionary(grouping: translations) { $0.key } diff --git a/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift b/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift index d95cf2d..43dfd47 100644 --- a/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift +++ b/Sources/BartyCrouchKit/FileHandling/StringsFilesSearch.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 14.02.16. - import Foundation // NOTE: diff --git a/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift b/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift index bbac756..c6657b9 100644 --- a/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift +++ b/Sources/BartyCrouchKit/FileHandling/SupportedLanguagesReader.swift @@ -1,8 +1,6 @@ -// Created by Cihat Gündüz on 28.01.19. - import Foundation -import SwiftSyntax import HandySwift +import SwiftSyntax class SupportedLanguagesReader: SyntaxVisitor { let typeName: String diff --git a/Sources/BartyCrouchKit/FileHandling/Transformer.swift b/Sources/BartyCrouchKit/FileHandling/Transformer.swift index eed1918..bb388ac 100644 --- a/Sources/BartyCrouchKit/FileHandling/Transformer.swift +++ b/Sources/BartyCrouchKit/FileHandling/Transformer.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 23.01.19. - import Foundation enum Transformer: String, CaseIterable { diff --git a/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift b/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift index aad64ee..0e1471b 100644 --- a/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift +++ b/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift @@ -1,8 +1,6 @@ -// Created by Cihat Gündüz on 24.01.19. - import Foundation -import SwiftSyntax import HandySwift +import SwiftSyntax class TranslateTransformer: SyntaxRewriter { let transformer: Transformer @@ -19,46 +17,44 @@ class TranslateTransformer: SyntaxRewriter { self.caseToLangCode = caseToLangCode } + // swiftlint:disable:next function_body_length cyclomatic_complexity override func visit(_ functionCallExpression: FunctionCallExprSyntax) -> ExprSyntax { - var functionCallExpressionIterator = functionCallExpression.children.makeIterator() - + let functionCallExpressionMap = Array(functionCallExpression.children.lazy.prefix(3)) + guard - let memberAccessExpression = functionCallExpressionIterator.next()?.as(MemberAccessExprSyntax.self), // 0 + let memberAccessExpression = functionCallExpressionMap[0].as(MemberAccessExprSyntax.self), let memberAccessExpressionBase = memberAccessExpression.base, memberAccessExpressionBase.description.stripped() == typeName, memberAccessExpression.name.text == translateMethodName else { - return super.visit(functionCallExpression) + return super.visit(functionCallExpression) } - _ = functionCallExpressionIterator.next() // 1 - guard - let functionCallArgumentList = functionCallExpressionIterator.next()?.as(TupleExprElementListSyntax.self) //2 - else { + + guard let functionCallArgumentList = functionCallExpressionMap[2].as(TupleExprElementListSyntax.self) else { return super.visit(functionCallExpression) } - var functionCallArgumentListIterator = functionCallArgumentList.children.makeIterator() - + + let functionCallArgumentListMap = Array(functionCallArgumentList.children.lazy.prefix(3)) + guard - let keyFunctionCallArgument = functionCallArgumentListIterator.next()?.as(TupleExprElementSyntax.self), + let keyFunctionCallArgument = functionCallArgumentListMap[0].as(TupleExprElementSyntax.self), let keyStringLiteralExpression = keyFunctionCallArgument.expression.as(StringLiteralExprSyntax.self), keyFunctionCallArgument.label?.text == "key", - let translationsFunctionCallArgument = functionCallArgumentListIterator.next()?.as(TupleExprElementSyntax.self), + let translationsFunctionCallArgument = functionCallArgumentListMap[1].as(TupleExprElementSyntax.self), translationsFunctionCallArgument.label?.text == "translations" else { return super.visit(functionCallExpression) } - - var translationsFunctionCallArgumentIterator = translationsFunctionCallArgument.children.makeIterator() - _ = translationsFunctionCallArgumentIterator.next() // 0 - _ = translationsFunctionCallArgumentIterator.next() // 1 - + + let translationsFunctionCallArgumentMap = Array(translationsFunctionCallArgument.children.lazy.prefix(3)) + guard - let translationsDictionaryExpression = translationsFunctionCallArgumentIterator.next()?.as(DictionaryExprSyntax.self) + let translationsDictionaryExpression = translationsFunctionCallArgumentMap[2].as(DictionaryExprSyntax.self) else { return super.visit(functionCallExpression) } - let leadingWhitespace: String = String(memberAccessExpressionBase.description.prefix(memberAccessExpressionBase.description.count - typeName.count)) + let leadingWhitespace = String(memberAccessExpressionBase.description.prefix(memberAccessExpressionBase.description.count - typeName.count)) let key = keyStringLiteralExpression.text guard !key.isEmpty else { @@ -68,10 +64,9 @@ class TranslateTransformer: SyntaxRewriter { var translations: [CodeFileHandler.TranslationElement] = [] - var translationsDictionaryExpressionIterator = translationsDictionaryExpression.children.makeIterator() - _ = translationsDictionaryExpressionIterator.next() // 0 - - if let translationsDictionaryElementList = translationsDictionaryExpressionIterator.next()?.as(DictionaryElementListSyntax.self) { + let translationsDictionaryExpressionMap = Array(translationsDictionaryExpression.children.lazy.prefix(3)) + + if let translationsDictionaryElementList = translationsDictionaryExpressionMap[1].as(DictionaryElementListSyntax.self) { for dictionaryElement in translationsDictionaryElementList { guard let langCase = dictionaryElement.keyExpression.description.components(separatedBy: ".").last?.stripped() else { print("LangeCase was not an enum case literal: '\(dictionaryElement.keyExpression)'") @@ -102,7 +97,8 @@ class TranslateTransformer: SyntaxRewriter { var comment: String? if - let commentFunctionCallArgument = functionCallArgumentListIterator.next()?.as(TupleExprElementSyntax.self), + functionCallArgumentListMap.count > 2, + let commentFunctionCallArgument = functionCallArgumentListMap[2].as(TupleExprElementSyntax.self), commentFunctionCallArgument.label?.text == "comment", let commentStringLiteralExpression = commentFunctionCallArgument.expression.as(StringLiteralExprSyntax.self) { @@ -131,8 +127,8 @@ class TranslateTransformer: SyntaxRewriter { private func buildSwiftgenStructuredExpression(key: String, leadingWhitespace: String) -> ExprSyntax { // e.g. the key could be something like 'ONBOARDING.FIRST_PAGE.HEADER_TITLE' or 'onboarding.first-page.header-title' - let keywordSeparators: CharacterSet = CharacterSet(charactersIn: ".") - let casingSeparators: CharacterSet = CharacterSet(charactersIn: "-_") + let keywordSeparators = CharacterSet(charactersIn: ".") + let casingSeparators = CharacterSet(charactersIn: "-_") // e.g. ["ONBOARDING", "FIRST_PAGE", "HEADER_TITLE"] let keywords: [String] = key.components(separatedBy: keywordSeparators) @@ -156,12 +152,14 @@ class TranslateTransformer: SyntaxRewriter { private func buildMemberAccessExpression(components: [String]) -> ExprSyntax { let identifierToken = SyntaxFactory.makeIdentifier(components.last!) guard components.count > 1 else { return ExprSyntax(SyntaxFactory.makeIdentifierExpr(identifier: identifierToken, declNameArguments: nil)) } - return ExprSyntax(SyntaxFactory.makeMemberAccessExpr( - base: buildMemberAccessExpression(components: Array(components.dropLast())), - dot: SyntaxFactory.makePeriodToken(), - name: identifierToken, - declNameArguments: nil - )) + return ExprSyntax( + SyntaxFactory.makeMemberAccessExpr( + base: buildMemberAccessExpression(components: Array(components.dropLast())), + dot: SyntaxFactory.makePeriodToken(), + name: identifierToken, + declNameArguments: nil + ) + ) } private func buildFoundationExpression(key: String, comment: String?, leadingWhitespace: String) -> ExprSyntax { @@ -179,13 +177,20 @@ class TranslateTransformer: SyntaxRewriter { trailingComma: nil ) - return ExprSyntax(SyntaxFactory.makeFunctionCallExpr( - calledExpression: ExprSyntax(SyntaxFactory.makeIdentifierExpr(identifier: SyntaxFactory.makeIdentifier("\(leadingWhitespace)NSLocalizedString"), declNameArguments: nil)), - leftParen: SyntaxFactory.makeLeftParenToken(), - argumentList: SyntaxFactory.makeTupleExprElementList([keyArgument, commentArgument]), - rightParen: SyntaxFactory.makeRightParenToken(), - trailingClosure: nil - )) + return ExprSyntax( + SyntaxFactory.makeFunctionCallExpr( + calledExpression: ExprSyntax( + SyntaxFactory.makeIdentifierExpr( + identifier: SyntaxFactory.makeIdentifier("\(leadingWhitespace)NSLocalizedString"), + declNameArguments: nil + ) + ), + leftParen: SyntaxFactory.makeLeftParenToken(), + argumentList: SyntaxFactory.makeTupleExprElementList([keyArgument, commentArgument]), + rightParen: SyntaxFactory.makeRightParenToken(), + trailingClosure: nil + ) + ) } } diff --git a/Sources/BartyCrouchKit/Globals/CommandExecution.swift b/Sources/BartyCrouchKit/Globals/CommandExecution.swift index b189db9..f8193d8 100644 --- a/Sources/BartyCrouchKit/Globals/CommandExecution.swift +++ b/Sources/BartyCrouchKit/Globals/CommandExecution.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 29.01.19. - import Foundation final class CommandExecution { diff --git a/Sources/BartyCrouchKit/Globals/MungoHealer.swift b/Sources/BartyCrouchKit/Globals/CommandLineErrorHandler.swift similarity index 77% rename from Sources/BartyCrouchKit/Globals/MungoHealer.swift rename to Sources/BartyCrouchKit/Globals/CommandLineErrorHandler.swift index 24ab9dd..be62bd9 100644 --- a/Sources/BartyCrouchKit/Globals/MungoHealer.swift +++ b/Sources/BartyCrouchKit/Globals/CommandLineErrorHandler.swift @@ -1,7 +1,7 @@ import Foundation import MungoHealer -let mungo: MungoHealer = MungoHealer(errorHandler: CommandLineErrorHandler()) +let mungo = MungoHealer(errorHandler: CommandLineErrorHandler()) struct CommandLineErrorHandler: ErrorHandler { func handle(error: Error) { @@ -17,14 +17,14 @@ struct CommandLineErrorHandler: ErrorHandler { crash() } - func handle(healableError: HealableError) { + func handle(healableError: HealableError) { // swiftlint:disable:this unavailable_function log(healableError, level: .info) fatalError("Healable Errors not supported by \(String(describing: CommandLineErrorHandler.self)).") } private func log(_ error: Error, level: PrintLevel) { if GlobalOptions.verbose.value, let baseError = error as? BaseError, let debugDescription = baseError.debugDescription, !debugDescription.isBlank { - print("\(error.localizedDescription) | Details: \(debugDescription)", level: level) + print("\(error.localizedDescription) | Details: \(debugDescription)", level: level) } else { print(error.localizedDescription, level: level) } diff --git a/Sources/BartyCrouchKit/Globals/Env.swift b/Sources/BartyCrouchKit/Globals/Env.swift index fccbe7a..55f87a6 100644 --- a/Sources/BartyCrouchKit/Globals/Env.swift +++ b/Sources/BartyCrouchKit/Globals/Env.swift @@ -1,8 +1,6 @@ -// Created by Cihat Gündüz on 08.11.18. - import Foundation -let env = Env() +let env = Env() // swiftlint:disable:this file_types_order struct Env { fileprivate init() {} diff --git a/Sources/BartyCrouchKit/Globals/Extensions/StringExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/StringExtension.swift index 6ff99c9..dde08c8 100644 --- a/Sources/BartyCrouchKit/Globals/Extensions/StringExtension.swift +++ b/Sources/BartyCrouchKit/Globals/Extensions/StringExtension.swift @@ -1,15 +1,13 @@ -// Created by Cihat Gündüz on 23.01.19. - import Foundation extension String { + var absolutePath: String { + return URL(fileURLWithPath: self).path + } + func firstCharacterLowercased() -> String { let firstCharacter = prefix(1) let leftoverString = suffix(from: firstCharacter.endIndex) return firstCharacter.lowercased() + leftoverString } - - var absolutePath: String { - return URL(fileURLWithPath: self).path - } } diff --git a/Sources/BartyCrouchKit/Globals/GlobalOptions.swift b/Sources/BartyCrouchKit/Globals/GlobalOptions.swift index 42f0446..e60a29f 100644 --- a/Sources/BartyCrouchKit/Globals/GlobalOptions.swift +++ b/Sources/BartyCrouchKit/Globals/GlobalOptions.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 07.11.18. - import Foundation import SwiftCLI diff --git a/Sources/BartyCrouchKit/Globals/PrintLevel.swift b/Sources/BartyCrouchKit/Globals/PrintLevel.swift index 20f8c72..4e9d8b9 100644 --- a/Sources/BartyCrouchKit/Globals/PrintLevel.swift +++ b/Sources/BartyCrouchKit/Globals/PrintLevel.swift @@ -1,6 +1,4 @@ -// Created by Cihat Gündüz on 12.03.18. - -// swiftlint:disable leveled_print file_types_order +// swiftlint:disable cyclomatic_complexity file_types_order import Foundation import Rainbow @@ -175,4 +173,3 @@ func measure(task: String, _ closure: () throws -> ResultType) rethr print("Task '\(task)' took \(measureTimeFormatter.string(from: passedTimeIntervalNum)!) seconds.") return result } - diff --git a/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift b/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift index de945eb..db74d20 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CodeCommander.swift @@ -1,5 +1,3 @@ -// Created by Fyodor Volchyok on 12/9/16. - import Foundation import SwiftCLI @@ -19,7 +17,7 @@ private enum CodeCommanderConstants { } /// Sends `xcrun extractLocStrings` commands with specified input/output paths to bash. -public class CodeCommander { +public final class CodeCommander { // MARK: - Stored Type Properties public static let shared = CodeCommander() diff --git a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift index 6a263bc..58398d0 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift @@ -1,6 +1,4 @@ -// Created by Cihat Gündüz on 05.05.16. - -// swiftlint:disable function_parameter_count +// swiftlint:disable function_parameter_count type_body_length cyclomatic_complexity import Foundation @@ -330,6 +328,10 @@ public class CommandLineActor { } } - print("Successfully translated \(overallTranslatedValuesCount) values in \(filesWithTranslatedValuesCount) files.", level: .success, file: inputFilePath) + print( + "Successfully translated \(overallTranslatedValuesCount) values in \(filesWithTranslatedValuesCount) files.", + level: .success, + file: inputFilePath + ) } } diff --git a/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift b/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift index 2934a94..4036174 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/IBToolCommander.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 11.02.16. - import Foundation import SwiftCLI diff --git a/Sources/BartyCrouchKit/TaskHandlers/InitTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/InitTaskHandler.swift index 7a45b72..9ec029a 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/InitTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/InitTaskHandler.swift @@ -1,6 +1,6 @@ import Foundation -struct InitTaskHandler {} +struct InitTaskHandler { /* for extension purposes only */ } extension InitTaskHandler: TaskHandler { func perform() { diff --git a/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift index 577aca2..cbb90a0 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift @@ -22,7 +22,11 @@ extension TransformTaskHandler: TaskHandler { } guard let caseToLangCode = caseToLangCodeOptional else { - print("Could not find 'SupportedLanguage' enum within '\(options.typeName)' enum within path.", level: .warning, file: options.supportedLanguageEnumPath.absolutePath) + print( + "Could not find 'SupportedLanguage' enum within '\(options.typeName)' enum within path.", + level: .warning, + file: options.supportedLanguageEnumPath.absolutePath + ) return } diff --git a/Sources/BartyCrouchTranslator/BartyCrouchTranslator.swift b/Sources/BartyCrouchTranslator/BartyCrouchTranslator.swift index ba9becb..99796da 100644 --- a/Sources/BartyCrouchTranslator/BartyCrouchTranslator.swift +++ b/Sources/BartyCrouchTranslator/BartyCrouchTranslator.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 18.01.19. - import Foundation import Microya import MungoHealer diff --git a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/MicrosoftTranslatorApi.swift b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/MicrosoftTranslatorApi.swift index 6dfb1b2..745f28c 100644 --- a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/MicrosoftTranslatorApi.swift +++ b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/MicrosoftTranslatorApi.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 14.01.19. - import Foundation import Microya @@ -77,7 +75,7 @@ extension MicrosoftTranslatorApi: JsonApi { var bodyData: Data? { switch self { case let .translate(texts, _, _, _): - return try! encoder.encode(texts.map { TranslateRequest(Text: $0) }) + return try? encoder.encode(texts.map { TranslateRequest(Text: $0) }) } } diff --git a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/Language.swift b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/Language.swift index 3e0a3a8..a2c97c2 100644 --- a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/Language.swift +++ b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/Language.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 14.01.19. - import Foundation /// The languages supported. diff --git a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateRequest.swift b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateRequest.swift index 1f247e3..684f730 100644 --- a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateRequest.swift +++ b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateRequest.swift @@ -1,7 +1,7 @@ -// Created by Cihat Gündüz on 14.01.19. - import Foundation +// swiftlint:disable identifier_name + struct TranslateRequest: Encodable { let Text: String } diff --git a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateResponse.swift b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateResponse.swift index f500c6d..4a29d46 100644 --- a/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateResponse.swift +++ b/Sources/BartyCrouchTranslator/MicrosoftTranslatorApi/Models/TranslateResponse.swift @@ -1,5 +1,3 @@ -// Created by Cihat Gündüz on 14.01.19. - import Foundation struct TranslateResponse: Decodable { diff --git a/Tests/BartyCrouchKitTests/CommandLine/CommandLineActorTests.swift b/Tests/BartyCrouchKitTests/CommandLine/CommandLineActorTests.swift index c961060..18e20b1 100644 --- a/Tests/BartyCrouchKitTests/CommandLine/CommandLineActorTests.swift +++ b/Tests/BartyCrouchKitTests/CommandLine/CommandLineActorTests.swift @@ -1,5 +1,3 @@ -//// Created by Cihat Gündüz on 05.05.16. -// //@testable import BartyCrouchKit //import XCTest // diff --git a/Tests/BartyCrouchKitTests/CommandLine/CommandLineParserTests.swift b/Tests/BartyCrouchKitTests/CommandLine/CommandLineParserTests.swift index a674012..0c746d2 100644 --- a/Tests/BartyCrouchKitTests/CommandLine/CommandLineParserTests.swift +++ b/Tests/BartyCrouchKitTests/CommandLine/CommandLineParserTests.swift @@ -1,5 +1,3 @@ -//// Created by Cihat Gündüz on 05.05.16. -// //@testable import BartyCrouchKit //import XCTest // diff --git a/Tests/BartyCrouchKitTests/CommandLine/ExtractLocStringsCommanderTests.swift b/Tests/BartyCrouchKitTests/CommandLine/ExtractLocStringsCommanderTests.swift index 89cd1f6..1da3708 100644 --- a/Tests/BartyCrouchKitTests/CommandLine/ExtractLocStringsCommanderTests.swift +++ b/Tests/BartyCrouchKitTests/CommandLine/ExtractLocStringsCommanderTests.swift @@ -1,5 +1,3 @@ -//// Created by Fyodor Volchyok on 12/9/16. -// //@testable import BartyCrouchKit //import XCTest // diff --git a/Tests/BartyCrouchKitTests/CommandLine/FindFilesTests.swift b/Tests/BartyCrouchKitTests/CommandLine/FindFilesTests.swift index cff769c..425f0b0 100644 --- a/Tests/BartyCrouchKitTests/CommandLine/FindFilesTests.swift +++ b/Tests/BartyCrouchKitTests/CommandLine/FindFilesTests.swift @@ -1,5 +1,3 @@ -//// Created by Tom Kraina on 28.6.2018. -// //@testable import BartyCrouchKit //import XCTest // diff --git a/Tests/BartyCrouchKitTests/CommandLine/GenStringsCommanderTests.swift b/Tests/BartyCrouchKitTests/CommandLine/GenStringsCommanderTests.swift index 1f9458b..672e536 100644 --- a/Tests/BartyCrouchKitTests/CommandLine/GenStringsCommanderTests.swift +++ b/Tests/BartyCrouchKitTests/CommandLine/GenStringsCommanderTests.swift @@ -1,5 +1,3 @@ -//// Created by Cihat Gündüz on 03.05.16. -// //@testable import BartyCrouchKit //import XCTest // diff --git a/Tests/BartyCrouchKitTests/CommandLine/IBToolCommanderTests.swift b/Tests/BartyCrouchKitTests/CommandLine/IBToolCommanderTests.swift index 9122b22..3323682 100644 --- a/Tests/BartyCrouchKitTests/CommandLine/IBToolCommanderTests.swift +++ b/Tests/BartyCrouchKitTests/CommandLine/IBToolCommanderTests.swift @@ -1,5 +1,3 @@ -//// Created by Cihat Gündüz on 11.02.16. -// //@testable import BartyCrouchKit //import XCTest // diff --git a/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift b/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift index 0149ad7..204223e 100644 --- a/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift +++ b/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift @@ -2,6 +2,8 @@ import Toml import XCTest +// swiftlint:disable force_try function_body_length + class ConfigurationTests: XCTestCase { func testConfigurationMakeDefault() { do { diff --git a/Tests/BartyCrouchKitTests/DemoTests/DemoData.swift b/Tests/BartyCrouchKitTests/DemoTests/DemoData.swift index afac702..d55dd08 100644 --- a/Tests/BartyCrouchKitTests/DemoTests/DemoData.swift +++ b/Tests/BartyCrouchKitTests/DemoTests/DemoData.swift @@ -1,8 +1,12 @@ -// Created by Cihat Gündüz on 18.01.19. - import Foundation +// swiftlint:disable force_try too_much_indentation line_length too_much_unindentation + enum DemoData { + static let untouchedDemoDirectoryJson: String = """ + {"files":[{"contents":"\\/\\/ !$*UTF8*$!\\n{\\n\\tarchiveVersion = 1;\\n\\tclasses = {\\n\\t};\\n\\tobjectVersion = 50;\\n\\tobjects = {\\n\\n\\/* Begin PBXBuildFile section *\\/\\n\\t\\t8264FFB521F1EDB500C9756D \\/* AppDelegate.swift in Sources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFB421F1EDB500C9756D \\/* AppDelegate.swift *\\/; };\\n\\t\\t8264FFB721F1EDB500C9756D \\/* ViewController.swift in Sources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFB621F1EDB500C9756D \\/* ViewController.swift *\\/; };\\n\\t\\t8264FFBA21F1EDB500C9756D \\/* Main.storyboard in Resources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFB821F1EDB500C9756D \\/* Main.storyboard *\\/; };\\n\\t\\t8264FFBC21F1EDB600C9756D \\/* Assets.xcassets in Resources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFBB21F1EDB600C9756D \\/* Assets.xcassets *\\/; };\\n\\t\\t8264FFBF21F1EDB600C9756D \\/* LaunchScreen.storyboard in Resources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFBD21F1EDB600C9756D \\/* LaunchScreen.storyboard *\\/; };\\n\\t\\t8264FFCA21F1EDB700C9756D \\/* DemoTests.swift in Sources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFC921F1EDB700C9756D \\/* DemoTests.swift *\\/; };\\n\\t\\t8264FFD521F1EDB700C9756D \\/* DemoUITests.swift in Sources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFD421F1EDB700C9756D \\/* DemoUITests.swift *\\/; };\\n\\t\\t8264FFE821F1EECE00C9756D \\/* Localizable.strings in Resources *\\/ = {isa = PBXBuildFile; fileRef = 8264FFEA21F1EECE00C9756D \\/* Localizable.strings *\\/; };\\n\\t\\t826B898E21F9DBFE004B14E0 \\/* BartyCrouch.swift in Sources *\\/ = {isa = PBXBuildFile; fileRef = 826B898D21F9DBFE004B14E0 \\/* BartyCrouch.swift *\\/; };\\n\\/* End PBXBuildFile section *\\/\\n\\n\\/* Begin PBXContainerItemProxy section *\\/\\n\\t\\t8264FFC621F1EDB700C9756D \\/* PBXContainerItemProxy *\\/ = {\\n\\t\\t\\tisa = PBXContainerItemProxy;\\n\\t\\t\\tcontainerPortal = 8264FFA921F1EDB500C9756D \\/* Project object *\\/;\\n\\t\\t\\tproxyType = 1;\\n\\t\\t\\tremoteGlobalIDString = 8264FFB021F1EDB500C9756D;\\n\\t\\t\\tremoteInfo = Demo;\\n\\t\\t};\\n\\t\\t8264FFD121F1EDB700C9756D \\/* PBXContainerItemProxy *\\/ = {\\n\\t\\t\\tisa = PBXContainerItemProxy;\\n\\t\\t\\tcontainerPortal = 8264FFA921F1EDB500C9756D \\/* Project object *\\/;\\n\\t\\t\\tproxyType = 1;\\n\\t\\t\\tremoteGlobalIDString = 8264FFB021F1EDB500C9756D;\\n\\t\\t\\tremoteInfo = Demo;\\n\\t\\t};\\n\\/* End PBXContainerItemProxy section *\\/\\n\\n\\/* Begin PBXFileReference section *\\/\\n\\t\\t8264FFB121F1EDB500C9756D \\/* Demo.app *\\/ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Demo.app; sourceTree = BUILT_PRODUCTS_DIR; };\\n\\t\\t8264FFB421F1EDB500C9756D \\/* AppDelegate.swift *\\/ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = \\"\\"; };\\n\\t\\t8264FFB621F1EDB500C9756D \\/* ViewController.swift *\\/ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = \\"\\"; };\\n\\t\\t8264FFB921F1EDB500C9756D \\/* Base *\\/ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj\\/Main.storyboard; sourceTree = \\"\\"; };\\n\\t\\t8264FFBB21F1EDB600C9756D \\/* Assets.xcassets *\\/ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = \\"\\"; };\\n\\t\\t8264FFBE21F1EDB600C9756D \\/* Base *\\/ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj\\/LaunchScreen.storyboard; sourceTree = \\"\\"; };\\n\\t\\t8264FFC021F1EDB600C9756D \\/* Info.plist *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \\"\\"; };\\n\\t\\t8264FFC521F1EDB700C9756D \\/* DemoTests.xctest *\\/ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\\n\\t\\t8264FFC921F1EDB700C9756D \\/* DemoTests.swift *\\/ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoTests.swift; sourceTree = \\"\\"; };\\n\\t\\t8264FFCB21F1EDB700C9756D \\/* Info.plist *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \\"\\"; };\\n\\t\\t8264FFD021F1EDB700C9756D \\/* DemoUITests.xctest *\\/ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = DemoUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };\\n\\t\\t8264FFD421F1EDB700C9756D \\/* DemoUITests.swift *\\/ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DemoUITests.swift; sourceTree = \\"\\"; };\\n\\t\\t8264FFD621F1EDB700C9756D \\/* Info.plist *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = \\"\\"; };\\n\\t\\t8264FFE421F1EE0300C9756D \\/* de *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj\\/Main.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFE521F1EE0300C9756D \\/* de *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj\\/LaunchScreen.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFE621F1EE0800C9756D \\/* tr *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj\\/Main.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFE721F1EE0900C9756D \\/* tr *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj\\/LaunchScreen.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFE921F1EECE00C9756D \\/* en *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj\\/Localizable.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFEB21F1EECF00C9756D \\/* de *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj\\/Localizable.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFEC21F1EED000C9756D \\/* tr *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = tr; path = tr.lproj\\/Localizable.strings; sourceTree = \\"\\"; };\\n\\t\\t8264FFEE21F1EF0F00C9756D \\/* en *\\/ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj\\/Main.strings; sourceTree = \\"\\"; };\\n\\t\\t826B898D21F9DBFE004B14E0 \\/* BartyCrouch.swift *\\/ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BartyCrouch.swift; sourceTree = \\"\\"; };\\n\\/* End PBXFileReference section *\\/\\n\\n\\/* Begin PBXFrameworksBuildPhase section *\\/\\n\\t\\t8264FFAE21F1EDB500C9756D \\/* Frameworks *\\/ = {\\n\\t\\t\\tisa = PBXFrameworksBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\t\\t8264FFC221F1EDB700C9756D \\/* Frameworks *\\/ = {\\n\\t\\t\\tisa = PBXFrameworksBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\t\\t8264FFCD21F1EDB700C9756D \\/* Frameworks *\\/ = {\\n\\t\\t\\tisa = PBXFrameworksBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\/* End PBXFrameworksBuildPhase section *\\/\\n\\n\\/* Begin PBXGroup section *\\/\\n\\t\\t8264FFA821F1EDB500C9756D = {\\n\\t\\t\\tisa = PBXGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFB321F1EDB500C9756D \\/* Demo *\\/,\\n\\t\\t\\t\\t8264FFC821F1EDB700C9756D \\/* DemoTests *\\/,\\n\\t\\t\\t\\t8264FFD321F1EDB700C9756D \\/* DemoUITests *\\/,\\n\\t\\t\\t\\t8264FFB221F1EDB500C9756D \\/* Products *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\t\\t8264FFB221F1EDB500C9756D \\/* Products *\\/ = {\\n\\t\\t\\tisa = PBXGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFB121F1EDB500C9756D \\/* Demo.app *\\/,\\n\\t\\t\\t\\t8264FFC521F1EDB700C9756D \\/* DemoTests.xctest *\\/,\\n\\t\\t\\t\\t8264FFD021F1EDB700C9756D \\/* DemoUITests.xctest *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tname = Products;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\t\\t8264FFB321F1EDB500C9756D \\/* Demo *\\/ = {\\n\\t\\t\\tisa = PBXGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFB421F1EDB500C9756D \\/* AppDelegate.swift *\\/,\\n\\t\\t\\t\\t8264FFB621F1EDB500C9756D \\/* ViewController.swift *\\/,\\n\\t\\t\\t\\t8264FFB821F1EDB500C9756D \\/* Main.storyboard *\\/,\\n\\t\\t\\t\\t8264FFBB21F1EDB600C9756D \\/* Assets.xcassets *\\/,\\n\\t\\t\\t\\t8264FFBD21F1EDB600C9756D \\/* LaunchScreen.storyboard *\\/,\\n\\t\\t\\t\\t8264FFC021F1EDB600C9756D \\/* Info.plist *\\/,\\n\\t\\t\\t\\t8264FFEA21F1EECE00C9756D \\/* Localizable.strings *\\/,\\n\\t\\t\\t\\t826B898D21F9DBFE004B14E0 \\/* BartyCrouch.swift *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tpath = Demo;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\t\\t8264FFC821F1EDB700C9756D \\/* DemoTests *\\/ = {\\n\\t\\t\\tisa = PBXGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFC921F1EDB700C9756D \\/* DemoTests.swift *\\/,\\n\\t\\t\\t\\t8264FFCB21F1EDB700C9756D \\/* Info.plist *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tpath = DemoTests;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\t\\t8264FFD321F1EDB700C9756D \\/* DemoUITests *\\/ = {\\n\\t\\t\\tisa = PBXGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFD421F1EDB700C9756D \\/* DemoUITests.swift *\\/,\\n\\t\\t\\t\\t8264FFD621F1EDB700C9756D \\/* Info.plist *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tpath = DemoUITests;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\/* End PBXGroup section *\\/\\n\\n\\/* Begin PBXNativeTarget section *\\/\\n\\t\\t8264FFB021F1EDB500C9756D \\/* Demo *\\/ = {\\n\\t\\t\\tisa = PBXNativeTarget;\\n\\t\\t\\tbuildConfigurationList = 8264FFD921F1EDB700C9756D \\/* Build configuration list for PBXNativeTarget \\"Demo\\" *\\/;\\n\\t\\t\\tbuildPhases = (\\n\\t\\t\\t\\t8264FFAD21F1EDB500C9756D \\/* Sources *\\/,\\n\\t\\t\\t\\t8264FFAE21F1EDB500C9756D \\/* Frameworks *\\/,\\n\\t\\t\\t\\t8264FFAF21F1EDB500C9756D \\/* Resources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tbuildRules = (\\n\\t\\t\\t);\\n\\t\\t\\tdependencies = (\\n\\t\\t\\t);\\n\\t\\t\\tname = Demo;\\n\\t\\t\\tproductName = Demo;\\n\\t\\t\\tproductReference = 8264FFB121F1EDB500C9756D \\/* Demo.app *\\/;\\n\\t\\t\\tproductType = \\"com.apple.product-type.application\\";\\n\\t\\t};\\n\\t\\t8264FFC421F1EDB700C9756D \\/* DemoTests *\\/ = {\\n\\t\\t\\tisa = PBXNativeTarget;\\n\\t\\t\\tbuildConfigurationList = 8264FFDC21F1EDB700C9756D \\/* Build configuration list for PBXNativeTarget \\"DemoTests\\" *\\/;\\n\\t\\t\\tbuildPhases = (\\n\\t\\t\\t\\t8264FFC121F1EDB700C9756D \\/* Sources *\\/,\\n\\t\\t\\t\\t8264FFC221F1EDB700C9756D \\/* Frameworks *\\/,\\n\\t\\t\\t\\t8264FFC321F1EDB700C9756D \\/* Resources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tbuildRules = (\\n\\t\\t\\t);\\n\\t\\t\\tdependencies = (\\n\\t\\t\\t\\t8264FFC721F1EDB700C9756D \\/* PBXTargetDependency *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tname = DemoTests;\\n\\t\\t\\tproductName = DemoTests;\\n\\t\\t\\tproductReference = 8264FFC521F1EDB700C9756D \\/* DemoTests.xctest *\\/;\\n\\t\\t\\tproductType = \\"com.apple.product-type.bundle.unit-test\\";\\n\\t\\t};\\n\\t\\t8264FFCF21F1EDB700C9756D \\/* DemoUITests *\\/ = {\\n\\t\\t\\tisa = PBXNativeTarget;\\n\\t\\t\\tbuildConfigurationList = 8264FFDF21F1EDB700C9756D \\/* Build configuration list for PBXNativeTarget \\"DemoUITests\\" *\\/;\\n\\t\\t\\tbuildPhases = (\\n\\t\\t\\t\\t8264FFCC21F1EDB700C9756D \\/* Sources *\\/,\\n\\t\\t\\t\\t8264FFCD21F1EDB700C9756D \\/* Frameworks *\\/,\\n\\t\\t\\t\\t8264FFCE21F1EDB700C9756D \\/* Resources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tbuildRules = (\\n\\t\\t\\t);\\n\\t\\t\\tdependencies = (\\n\\t\\t\\t\\t8264FFD221F1EDB700C9756D \\/* PBXTargetDependency *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tname = DemoUITests;\\n\\t\\t\\tproductName = DemoUITests;\\n\\t\\t\\tproductReference = 8264FFD021F1EDB700C9756D \\/* DemoUITests.xctest *\\/;\\n\\t\\t\\tproductType = \\"com.apple.product-type.bundle.ui-testing\\";\\n\\t\\t};\\n\\/* End PBXNativeTarget section *\\/\\n\\n\\/* Begin PBXProject section *\\/\\n\\t\\t8264FFA921F1EDB500C9756D \\/* Project object *\\/ = {\\n\\t\\t\\tisa = PBXProject;\\n\\t\\t\\tattributes = {\\n\\t\\t\\t\\tLastSwiftUpdateCheck = 1010;\\n\\t\\t\\t\\tLastUpgradeCheck = 1010;\\n\\t\\t\\t\\tORGANIZATIONNAME = Flinesoft;\\n\\t\\t\\t\\tTargetAttributes = {\\n\\t\\t\\t\\t\\t8264FFB021F1EDB500C9756D = {\\n\\t\\t\\t\\t\\t\\tCreatedOnToolsVersion = 10.1;\\n\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t8264FFC421F1EDB700C9756D = {\\n\\t\\t\\t\\t\\t\\tCreatedOnToolsVersion = 10.1;\\n\\t\\t\\t\\t\\t\\tTestTargetID = 8264FFB021F1EDB500C9756D;\\n\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t\\t8264FFCF21F1EDB700C9756D = {\\n\\t\\t\\t\\t\\t\\tCreatedOnToolsVersion = 10.1;\\n\\t\\t\\t\\t\\t\\tTestTargetID = 8264FFB021F1EDB500C9756D;\\n\\t\\t\\t\\t\\t};\\n\\t\\t\\t\\t};\\n\\t\\t\\t};\\n\\t\\t\\tbuildConfigurationList = 8264FFAC21F1EDB500C9756D \\/* Build configuration list for PBXProject \\"Demo\\" *\\/;\\n\\t\\t\\tcompatibilityVersion = \\"Xcode 9.3\\";\\n\\t\\t\\tdevelopmentRegion = en;\\n\\t\\t\\thasScannedForEncodings = 0;\\n\\t\\t\\tknownRegions = (\\n\\t\\t\\t\\ten,\\n\\t\\t\\t\\tBase,\\n\\t\\t\\t\\tde,\\n\\t\\t\\t\\ttr,\\n\\t\\t\\t);\\n\\t\\t\\tmainGroup = 8264FFA821F1EDB500C9756D;\\n\\t\\t\\tproductRefGroup = 8264FFB221F1EDB500C9756D \\/* Products *\\/;\\n\\t\\t\\tprojectDirPath = \\"\\";\\n\\t\\t\\tprojectRoot = \\"\\";\\n\\t\\t\\ttargets = (\\n\\t\\t\\t\\t8264FFB021F1EDB500C9756D \\/* Demo *\\/,\\n\\t\\t\\t\\t8264FFC421F1EDB700C9756D \\/* DemoTests *\\/,\\n\\t\\t\\t\\t8264FFCF21F1EDB700C9756D \\/* DemoUITests *\\/,\\n\\t\\t\\t);\\n\\t\\t};\\n\\/* End PBXProject section *\\/\\n\\n\\/* Begin PBXResourcesBuildPhase section *\\/\\n\\t\\t8264FFAF21F1EDB500C9756D \\/* Resources *\\/ = {\\n\\t\\t\\tisa = PBXResourcesBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t\\t8264FFBF21F1EDB600C9756D \\/* LaunchScreen.storyboard in Resources *\\/,\\n\\t\\t\\t\\t8264FFE821F1EECE00C9756D \\/* Localizable.strings in Resources *\\/,\\n\\t\\t\\t\\t8264FFBC21F1EDB600C9756D \\/* Assets.xcassets in Resources *\\/,\\n\\t\\t\\t\\t8264FFBA21F1EDB500C9756D \\/* Main.storyboard in Resources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\t\\t8264FFC321F1EDB700C9756D \\/* Resources *\\/ = {\\n\\t\\t\\tisa = PBXResourcesBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\t\\t8264FFCE21F1EDB700C9756D \\/* Resources *\\/ = {\\n\\t\\t\\tisa = PBXResourcesBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\/* End PBXResourcesBuildPhase section *\\/\\n\\n\\/* Begin PBXSourcesBuildPhase section *\\/\\n\\t\\t8264FFAD21F1EDB500C9756D \\/* Sources *\\/ = {\\n\\t\\t\\tisa = PBXSourcesBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t\\t8264FFB721F1EDB500C9756D \\/* ViewController.swift in Sources *\\/,\\n\\t\\t\\t\\t8264FFB521F1EDB500C9756D \\/* AppDelegate.swift in Sources *\\/,\\n\\t\\t\\t\\t826B898E21F9DBFE004B14E0 \\/* BartyCrouch.swift in Sources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\t\\t8264FFC121F1EDB700C9756D \\/* Sources *\\/ = {\\n\\t\\t\\tisa = PBXSourcesBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t\\t8264FFCA21F1EDB700C9756D \\/* DemoTests.swift in Sources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\t\\t8264FFCC21F1EDB700C9756D \\/* Sources *\\/ = {\\n\\t\\t\\tisa = PBXSourcesBuildPhase;\\n\\t\\t\\tbuildActionMask = 2147483647;\\n\\t\\t\\tfiles = (\\n\\t\\t\\t\\t8264FFD521F1EDB700C9756D \\/* DemoUITests.swift in Sources *\\/,\\n\\t\\t\\t);\\n\\t\\t\\trunOnlyForDeploymentPostprocessing = 0;\\n\\t\\t};\\n\\/* End PBXSourcesBuildPhase section *\\/\\n\\n\\/* Begin PBXTargetDependency section *\\/\\n\\t\\t8264FFC721F1EDB700C9756D \\/* PBXTargetDependency *\\/ = {\\n\\t\\t\\tisa = PBXTargetDependency;\\n\\t\\t\\ttarget = 8264FFB021F1EDB500C9756D \\/* Demo *\\/;\\n\\t\\t\\ttargetProxy = 8264FFC621F1EDB700C9756D \\/* PBXContainerItemProxy *\\/;\\n\\t\\t};\\n\\t\\t8264FFD221F1EDB700C9756D \\/* PBXTargetDependency *\\/ = {\\n\\t\\t\\tisa = PBXTargetDependency;\\n\\t\\t\\ttarget = 8264FFB021F1EDB500C9756D \\/* Demo *\\/;\\n\\t\\t\\ttargetProxy = 8264FFD121F1EDB700C9756D \\/* PBXContainerItemProxy *\\/;\\n\\t\\t};\\n\\/* End PBXTargetDependency section *\\/\\n\\n\\/* Begin PBXVariantGroup section *\\/\\n\\t\\t8264FFB821F1EDB500C9756D \\/* Main.storyboard *\\/ = {\\n\\t\\t\\tisa = PBXVariantGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFB921F1EDB500C9756D \\/* Base *\\/,\\n\\t\\t\\t\\t8264FFE421F1EE0300C9756D \\/* de *\\/,\\n\\t\\t\\t\\t8264FFE621F1EE0800C9756D \\/* tr *\\/,\\n\\t\\t\\t\\t8264FFEE21F1EF0F00C9756D \\/* en *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tname = Main.storyboard;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\t\\t8264FFBD21F1EDB600C9756D \\/* LaunchScreen.storyboard *\\/ = {\\n\\t\\t\\tisa = PBXVariantGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFBE21F1EDB600C9756D \\/* Base *\\/,\\n\\t\\t\\t\\t8264FFE521F1EE0300C9756D \\/* de *\\/,\\n\\t\\t\\t\\t8264FFE721F1EE0900C9756D \\/* tr *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tname = LaunchScreen.storyboard;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\t\\t8264FFEA21F1EECE00C9756D \\/* Localizable.strings *\\/ = {\\n\\t\\t\\tisa = PBXVariantGroup;\\n\\t\\t\\tchildren = (\\n\\t\\t\\t\\t8264FFE921F1EECE00C9756D \\/* en *\\/,\\n\\t\\t\\t\\t8264FFEB21F1EECF00C9756D \\/* de *\\/,\\n\\t\\t\\t\\t8264FFEC21F1EED000C9756D \\/* tr *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tname = Localizable.strings;\\n\\t\\t\\tsourceTree = \\"\\";\\n\\t\\t};\\n\\/* End PBXVariantGroup section *\\/\\n\\n\\/* Begin XCBuildConfiguration section *\\/\\n\\t\\t8264FFD721F1EDB700C9756D \\/* Debug *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tALWAYS_SEARCH_USER_PATHS = NO;\\n\\t\\t\\t\\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\\n\\t\\t\\t\\tCLANG_ANALYZER_NONNULL = YES;\\n\\t\\t\\t\\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\\n\\t\\t\\t\\tCLANG_CXX_LANGUAGE_STANDARD = \\"gnu++14\\";\\n\\t\\t\\t\\tCLANG_CXX_LIBRARY = \\"libc++\\";\\n\\t\\t\\t\\tCLANG_ENABLE_MODULES = YES;\\n\\t\\t\\t\\tCLANG_ENABLE_OBJC_ARC = YES;\\n\\t\\t\\t\\tCLANG_ENABLE_OBJC_WEAK = YES;\\n\\t\\t\\t\\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\\n\\t\\t\\t\\tCLANG_WARN_BOOL_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_COMMA = YES;\\n\\t\\t\\t\\tCLANG_WARN_CONSTANT_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\\n\\t\\t\\t\\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\\n\\t\\t\\t\\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\\n\\t\\t\\t\\tCLANG_WARN_EMPTY_BODY = YES;\\n\\t\\t\\t\\tCLANG_WARN_ENUM_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_INFINITE_RECURSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_INT_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\\n\\t\\t\\t\\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\\n\\t\\t\\t\\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\\n\\t\\t\\t\\tCLANG_WARN_STRICT_PROTOTYPES = YES;\\n\\t\\t\\t\\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\\n\\t\\t\\t\\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\\n\\t\\t\\t\\tCLANG_WARN_UNREACHABLE_CODE = YES;\\n\\t\\t\\t\\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\\n\\t\\t\\t\\tCODE_SIGN_IDENTITY = \\"iPhone Developer\\";\\n\\t\\t\\t\\tCOPY_PHASE_STRIP = NO;\\n\\t\\t\\t\\tDEBUG_INFORMATION_FORMAT = dwarf;\\n\\t\\t\\t\\tENABLE_STRICT_OBJC_MSGSEND = YES;\\n\\t\\t\\t\\tENABLE_TESTABILITY = YES;\\n\\t\\t\\t\\tGCC_C_LANGUAGE_STANDARD = gnu11;\\n\\t\\t\\t\\tGCC_DYNAMIC_NO_PIC = NO;\\n\\t\\t\\t\\tGCC_NO_COMMON_BLOCKS = YES;\\n\\t\\t\\t\\tGCC_OPTIMIZATION_LEVEL = 0;\\n\\t\\t\\t\\tGCC_PREPROCESSOR_DEFINITIONS = (\\n\\t\\t\\t\\t\\t\\"DEBUG=1\\",\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\\n\\t\\t\\t\\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\\n\\t\\t\\t\\tGCC_WARN_UNDECLARED_SELECTOR = YES;\\n\\t\\t\\t\\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\\n\\t\\t\\t\\tGCC_WARN_UNUSED_FUNCTION = YES;\\n\\t\\t\\t\\tGCC_WARN_UNUSED_VARIABLE = YES;\\n\\t\\t\\t\\tIPHONEOS_DEPLOYMENT_TARGET = 12.1;\\n\\t\\t\\t\\tMTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;\\n\\t\\t\\t\\tMTL_FAST_MATH = YES;\\n\\t\\t\\t\\tONLY_ACTIVE_ARCH = YES;\\n\\t\\t\\t\\tSDKROOT = iphoneos;\\n\\t\\t\\t\\tSWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;\\n\\t\\t\\t\\tSWIFT_OPTIMIZATION_LEVEL = \\"-Onone\\";\\n\\t\\t\\t};\\n\\t\\t\\tname = Debug;\\n\\t\\t};\\n\\t\\t8264FFD821F1EDB700C9756D \\/* Release *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tALWAYS_SEARCH_USER_PATHS = NO;\\n\\t\\t\\t\\tCLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;\\n\\t\\t\\t\\tCLANG_ANALYZER_NONNULL = YES;\\n\\t\\t\\t\\tCLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;\\n\\t\\t\\t\\tCLANG_CXX_LANGUAGE_STANDARD = \\"gnu++14\\";\\n\\t\\t\\t\\tCLANG_CXX_LIBRARY = \\"libc++\\";\\n\\t\\t\\t\\tCLANG_ENABLE_MODULES = YES;\\n\\t\\t\\t\\tCLANG_ENABLE_OBJC_ARC = YES;\\n\\t\\t\\t\\tCLANG_ENABLE_OBJC_WEAK = YES;\\n\\t\\t\\t\\tCLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;\\n\\t\\t\\t\\tCLANG_WARN_BOOL_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_COMMA = YES;\\n\\t\\t\\t\\tCLANG_WARN_CONSTANT_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;\\n\\t\\t\\t\\tCLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;\\n\\t\\t\\t\\tCLANG_WARN_DOCUMENTATION_COMMENTS = YES;\\n\\t\\t\\t\\tCLANG_WARN_EMPTY_BODY = YES;\\n\\t\\t\\t\\tCLANG_WARN_ENUM_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_INFINITE_RECURSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_INT_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;\\n\\t\\t\\t\\tCLANG_WARN_OBJC_LITERAL_CONVERSION = YES;\\n\\t\\t\\t\\tCLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;\\n\\t\\t\\t\\tCLANG_WARN_RANGE_LOOP_ANALYSIS = YES;\\n\\t\\t\\t\\tCLANG_WARN_STRICT_PROTOTYPES = YES;\\n\\t\\t\\t\\tCLANG_WARN_SUSPICIOUS_MOVE = YES;\\n\\t\\t\\t\\tCLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;\\n\\t\\t\\t\\tCLANG_WARN_UNREACHABLE_CODE = YES;\\n\\t\\t\\t\\tCLANG_WARN__DUPLICATE_METHOD_MATCH = YES;\\n\\t\\t\\t\\tCODE_SIGN_IDENTITY = \\"iPhone Developer\\";\\n\\t\\t\\t\\tCOPY_PHASE_STRIP = NO;\\n\\t\\t\\t\\tDEBUG_INFORMATION_FORMAT = \\"dwarf-with-dsym\\";\\n\\t\\t\\t\\tENABLE_NS_ASSERTIONS = NO;\\n\\t\\t\\t\\tENABLE_STRICT_OBJC_MSGSEND = YES;\\n\\t\\t\\t\\tGCC_C_LANGUAGE_STANDARD = gnu11;\\n\\t\\t\\t\\tGCC_NO_COMMON_BLOCKS = YES;\\n\\t\\t\\t\\tGCC_WARN_64_TO_32_BIT_CONVERSION = YES;\\n\\t\\t\\t\\tGCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;\\n\\t\\t\\t\\tGCC_WARN_UNDECLARED_SELECTOR = YES;\\n\\t\\t\\t\\tGCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;\\n\\t\\t\\t\\tGCC_WARN_UNUSED_FUNCTION = YES;\\n\\t\\t\\t\\tGCC_WARN_UNUSED_VARIABLE = YES;\\n\\t\\t\\t\\tIPHONEOS_DEPLOYMENT_TARGET = 12.1;\\n\\t\\t\\t\\tMTL_ENABLE_DEBUG_INFO = NO;\\n\\t\\t\\t\\tMTL_FAST_MATH = YES;\\n\\t\\t\\t\\tSDKROOT = iphoneos;\\n\\t\\t\\t\\tSWIFT_COMPILATION_MODE = wholemodule;\\n\\t\\t\\t\\tSWIFT_OPTIMIZATION_LEVEL = \\"-O\\";\\n\\t\\t\\t\\tVALIDATE_PRODUCT = YES;\\n\\t\\t\\t};\\n\\t\\t\\tname = Release;\\n\\t\\t};\\n\\t\\t8264FFDA21F1EDB700C9756D \\/* Debug *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\\n\\t\\t\\t\\tCODE_SIGN_STYLE = Automatic;\\n\\t\\t\\t\\tINFOPLIST_FILE = Demo\\/Info.plist;\\n\\t\\t\\t\\tLD_RUNPATH_SEARCH_PATHS = (\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t\\t\\"@executable_path\\/Frameworks\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tPRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.Demo;\\n\\t\\t\\t\\tPRODUCT_NAME = \\"$(TARGET_NAME)\\";\\n\\t\\t\\t\\tSWIFT_VERSION = 4.2;\\n\\t\\t\\t\\tTARGETED_DEVICE_FAMILY = \\"1,2\\";\\n\\t\\t\\t};\\n\\t\\t\\tname = Debug;\\n\\t\\t};\\n\\t\\t8264FFDB21F1EDB700C9756D \\/* Release *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;\\n\\t\\t\\t\\tCODE_SIGN_STYLE = Automatic;\\n\\t\\t\\t\\tINFOPLIST_FILE = Demo\\/Info.plist;\\n\\t\\t\\t\\tLD_RUNPATH_SEARCH_PATHS = (\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t\\t\\"@executable_path\\/Frameworks\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tPRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.Demo;\\n\\t\\t\\t\\tPRODUCT_NAME = \\"$(TARGET_NAME)\\";\\n\\t\\t\\t\\tSWIFT_VERSION = 4.2;\\n\\t\\t\\t\\tTARGETED_DEVICE_FAMILY = \\"1,2\\";\\n\\t\\t\\t};\\n\\t\\t\\tname = Release;\\n\\t\\t};\\n\\t\\t8264FFDD21F1EDB700C9756D \\/* Debug *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\\n\\t\\t\\t\\tBUNDLE_LOADER = \\"$(TEST_HOST)\\";\\n\\t\\t\\t\\tCODE_SIGN_STYLE = Automatic;\\n\\t\\t\\t\\tINFOPLIST_FILE = DemoTests\\/Info.plist;\\n\\t\\t\\t\\tLD_RUNPATH_SEARCH_PATHS = (\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t\\t\\"@executable_path\\/Frameworks\\",\\n\\t\\t\\t\\t\\t\\"@loader_path\\/Frameworks\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tPRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.DemoTests;\\n\\t\\t\\t\\tPRODUCT_NAME = \\"$(TARGET_NAME)\\";\\n\\t\\t\\t\\tSWIFT_VERSION = 4.2;\\n\\t\\t\\t\\tTARGETED_DEVICE_FAMILY = \\"1,2\\";\\n\\t\\t\\t\\tTEST_HOST = \\"$(BUILT_PRODUCTS_DIR)\\/Demo.app\\/Demo\\";\\n\\t\\t\\t};\\n\\t\\t\\tname = Debug;\\n\\t\\t};\\n\\t\\t8264FFDE21F1EDB700C9756D \\/* Release *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\\n\\t\\t\\t\\tBUNDLE_LOADER = \\"$(TEST_HOST)\\";\\n\\t\\t\\t\\tCODE_SIGN_STYLE = Automatic;\\n\\t\\t\\t\\tINFOPLIST_FILE = DemoTests\\/Info.plist;\\n\\t\\t\\t\\tLD_RUNPATH_SEARCH_PATHS = (\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t\\t\\"@executable_path\\/Frameworks\\",\\n\\t\\t\\t\\t\\t\\"@loader_path\\/Frameworks\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tPRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.DemoTests;\\n\\t\\t\\t\\tPRODUCT_NAME = \\"$(TARGET_NAME)\\";\\n\\t\\t\\t\\tSWIFT_VERSION = 4.2;\\n\\t\\t\\t\\tTARGETED_DEVICE_FAMILY = \\"1,2\\";\\n\\t\\t\\t\\tTEST_HOST = \\"$(BUILT_PRODUCTS_DIR)\\/Demo.app\\/Demo\\";\\n\\t\\t\\t};\\n\\t\\t\\tname = Release;\\n\\t\\t};\\n\\t\\t8264FFE021F1EDB700C9756D \\/* Debug *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\\n\\t\\t\\t\\tCODE_SIGN_STYLE = Automatic;\\n\\t\\t\\t\\tINFOPLIST_FILE = DemoUITests\\/Info.plist;\\n\\t\\t\\t\\tLD_RUNPATH_SEARCH_PATHS = (\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t\\t\\"@executable_path\\/Frameworks\\",\\n\\t\\t\\t\\t\\t\\"@loader_path\\/Frameworks\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tPRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.DemoUITests;\\n\\t\\t\\t\\tPRODUCT_NAME = \\"$(TARGET_NAME)\\";\\n\\t\\t\\t\\tSWIFT_VERSION = 4.2;\\n\\t\\t\\t\\tTARGETED_DEVICE_FAMILY = \\"1,2\\";\\n\\t\\t\\t\\tTEST_TARGET_NAME = Demo;\\n\\t\\t\\t};\\n\\t\\t\\tname = Debug;\\n\\t\\t};\\n\\t\\t8264FFE121F1EDB700C9756D \\/* Release *\\/ = {\\n\\t\\t\\tisa = XCBuildConfiguration;\\n\\t\\t\\tbuildSettings = {\\n\\t\\t\\t\\tALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES;\\n\\t\\t\\t\\tCODE_SIGN_STYLE = Automatic;\\n\\t\\t\\t\\tINFOPLIST_FILE = DemoUITests\\/Info.plist;\\n\\t\\t\\t\\tLD_RUNPATH_SEARCH_PATHS = (\\n\\t\\t\\t\\t\\t\\"$(inherited)\\",\\n\\t\\t\\t\\t\\t\\"@executable_path\\/Frameworks\\",\\n\\t\\t\\t\\t\\t\\"@loader_path\\/Frameworks\\",\\n\\t\\t\\t\\t);\\n\\t\\t\\t\\tPRODUCT_BUNDLE_IDENTIFIER = com.flinesoft.DemoUITests;\\n\\t\\t\\t\\tPRODUCT_NAME = \\"$(TARGET_NAME)\\";\\n\\t\\t\\t\\tSWIFT_VERSION = 4.2;\\n\\t\\t\\t\\tTARGETED_DEVICE_FAMILY = \\"1,2\\";\\n\\t\\t\\t\\tTEST_TARGET_NAME = Demo;\\n\\t\\t\\t};\\n\\t\\t\\tname = Release;\\n\\t\\t};\\n\\/* End XCBuildConfiguration section *\\/\\n\\n\\/* Begin XCConfigurationList section *\\/\\n\\t\\t8264FFAC21F1EDB500C9756D \\/* Build configuration list for PBXProject \\"Demo\\" *\\/ = {\\n\\t\\t\\tisa = XCConfigurationList;\\n\\t\\t\\tbuildConfigurations = (\\n\\t\\t\\t\\t8264FFD721F1EDB700C9756D \\/* Debug *\\/,\\n\\t\\t\\t\\t8264FFD821F1EDB700C9756D \\/* Release *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tdefaultConfigurationIsVisible = 0;\\n\\t\\t\\tdefaultConfigurationName = Release;\\n\\t\\t};\\n\\t\\t8264FFD921F1EDB700C9756D \\/* Build configuration list for PBXNativeTarget \\"Demo\\" *\\/ = {\\n\\t\\t\\tisa = XCConfigurationList;\\n\\t\\t\\tbuildConfigurations = (\\n\\t\\t\\t\\t8264FFDA21F1EDB700C9756D \\/* Debug *\\/,\\n\\t\\t\\t\\t8264FFDB21F1EDB700C9756D \\/* Release *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tdefaultConfigurationIsVisible = 0;\\n\\t\\t\\tdefaultConfigurationName = Release;\\n\\t\\t};\\n\\t\\t8264FFDC21F1EDB700C9756D \\/* Build configuration list for PBXNativeTarget \\"DemoTests\\" *\\/ = {\\n\\t\\t\\tisa = XCConfigurationList;\\n\\t\\t\\tbuildConfigurations = (\\n\\t\\t\\t\\t8264FFDD21F1EDB700C9756D \\/* Debug *\\/,\\n\\t\\t\\t\\t8264FFDE21F1EDB700C9756D \\/* Release *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tdefaultConfigurationIsVisible = 0;\\n\\t\\t\\tdefaultConfigurationName = Release;\\n\\t\\t};\\n\\t\\t8264FFDF21F1EDB700C9756D \\/* Build configuration list for PBXNativeTarget \\"DemoUITests\\" *\\/ = {\\n\\t\\t\\tisa = XCConfigurationList;\\n\\t\\t\\tbuildConfigurations = (\\n\\t\\t\\t\\t8264FFE021F1EDB700C9756D \\/* Debug *\\/,\\n\\t\\t\\t\\t8264FFE121F1EDB700C9756D \\/* Release *\\/,\\n\\t\\t\\t);\\n\\t\\t\\tdefaultConfigurationIsVisible = 0;\\n\\t\\t\\tdefaultConfigurationName = Release;\\n\\t\\t};\\n\\/* End XCConfigurationList section *\\/\\n\\t};\\n\\trootObject = 8264FFA921F1EDB500C9756D \\/* Project object *\\/;\\n}\\n","relativePath":"Demo.xcodeproj\\/project.pbxproj"},{"contents":"\\n\\n\\n\\n\\tSchemeUserState<\\/key>\\n\\t\\n\\t\\tDemo.xcscheme_^#shared#^_<\\/key>\\n\\t\\t\\n\\t\\t\\torderHint<\\/key>\\n\\t\\t\\t0<\\/integer>\\n\\t\\t<\\/dict>\\n\\t<\\/dict>\\n<\\/dict>\\n<\\/plist>\\n","relativePath":"Demo.xcodeproj\\/xcuserdata\\/Arbeit.xcuserdatad\\/xcschemes\\/xcschememanagement.plist"},{"contents":"\\n\\n \\n <\\/FileRef>\\n<\\/Workspace>\\n","relativePath":"Demo.xcodeproj\\/project.xcworkspace\\/contents.xcworkspacedata"},{"contents":"\\n\\n\\n\\n\\tIDEDidComputeMac32BitWarning<\\/key>\\n\\t\\n<\\/dict>\\n<\\/plist>\\n","relativePath":"Demo.xcodeproj\\/project.xcworkspace\\/xcshareddata\\/IDEWorkspaceChecks.plist"},{"contents":"\\n","relativePath":"Demo\\/de.lproj\\/LaunchScreen.strings"},{"contents":"\\n","relativePath":"Demo\\/de.lproj\\/Main.strings"},{"contents":"\\/* \\n Localizable.strings\\n Demo\\n\\n Created by Cihat Gündüz on 18.01.19.\\n Copyright © 2019 Flinesoft. All rights reserved.\\n*\\/\\n\\n\\"Existing Translation Key\\" = \\"Existing Value\\";\\n\\n\\"Existing Duplicate Key\\" = \\"Value 1\\";\\n\\n\\"Existing Duplicate Key\\" = \\"Value 2\\";\\n\\n\\"Existing Empty Value Key\\" = \\"\\";\\n","relativePath":"Demo\\/de.lproj\\/Localizable.strings"},{"contents":"\\/\\/ Created by Cihat Gündüz on 18.01.19.\\n\\nimport UIKit\\n\\nclass ViewController: UIViewController {\\n override func viewDidLoad() {\\n super.viewDidLoad()\\n\\n NSLocalizedString(\\"Love\\", comment: \\"Comment for Love\\")\\n NSLocalizedString(\\"How are you?\\", comment: \\"\\")\\n NSLocalizedString(\\"I'm fine\\", comment: \\"Comment for I'm fine - #bc-ignore!\\")\\n\\n title = BartyCrouch.translate(key: \\"onboarding.first-page.header-title\\", translations: [.english: \\"Page Title\\", .german: \\"Seitentitel\\"])\\n let lines: Int = (0 ..< 10).map { \\"\\\\($0 + 1): \\\\(BartyCrouch.translate(key: \\"onboarding.first-page.line\\", translations: [:], comment: \\"Line Comment\\"))\\" }.count\\n\\n BartyCrouch\\n .translate(\\n key : \\"ShortKey\\",\\n translations : [\\n BartyCrouch.SupportedLanguage.english :\\n \\"Some Translation\\"\\n ]\\n )\\n }\\n}\\n","relativePath":"Demo\\/ViewController.swift"},{"contents":"\\n\\/* Class = \\"UILabel\\"; text = \\"Label to Ignore\\\\n(see Comment for Localizer)\\"; ObjectID = \\"Ibu-xm-woE\\"; Note = \\"#bc-ignore!\\"; *\\/\\n\\"Ibu-xm-woE.text\\" = \\"Label to Ignore\\\\n(see Comment for Localizer)\\";\\n\\n\\/* Class = \\"UILabel\\"; text = \\"Label to Translate\\"; ObjectID = \\"cGW-hC-L0h\\"; *\\/\\n\\"cGW-hC-L0h.text\\" = \\"Label to Translate\\";\\n\\n\\/* Class = \\"UILabel\\"; text = \\"Label to Ignore #bc-ignore!\\"; ObjectID = \\"dgI-jn-hzN\\"; *\\/\\n\\"dgI-jn-hzN.text\\" = \\"Label to Ignore #bc-ignore!\\";\\n","relativePath":"Demo\\/en.lproj\\/Main.strings"},{"contents":"\\/* \\n Localizable.strings\\n Demo\\n\\n Created by Cihat Gündüz on 18.01.19.\\n Copyright © 2019 Flinesoft. All rights reserved.\\n*\\/\\n\\n\\"Existing Translation Key\\" = \\"Existing Value\\";\\n\\n\\"Existing Duplicate Key\\" = \\"Value 1\\";\\n\\n\\"Existing Duplicate Key\\" = \\"Value 2\\";\\n\\n\\"Existing Empty Value Key\\" = \\"\\";\\n\\n\\"Existing Only in English Key\\" = \\"Existing Value\\";\\n","relativePath":"Demo\\/en.lproj\\/Localizable.strings"},{"contents":"{\\n \\"images\\" : [\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"20x20\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"20x20\\",\\n \\"scale\\" : \\"3x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"29x29\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"29x29\\",\\n \\"scale\\" : \\"3x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"40x40\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"40x40\\",\\n \\"scale\\" : \\"3x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"60x60\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"iphone\\",\\n \\"size\\" : \\"60x60\\",\\n \\"scale\\" : \\"3x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"20x20\\",\\n \\"scale\\" : \\"1x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"20x20\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"29x29\\",\\n \\"scale\\" : \\"1x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"29x29\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"40x40\\",\\n \\"scale\\" : \\"1x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"40x40\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"76x76\\",\\n \\"scale\\" : \\"1x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"76x76\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"ipad\\",\\n \\"size\\" : \\"83.5x83.5\\",\\n \\"scale\\" : \\"2x\\"\\n },\\n {\\n \\"idiom\\" : \\"ios-marketing\\",\\n \\"size\\" : \\"1024x1024\\",\\n \\"scale\\" : \\"1x\\"\\n }\\n ],\\n \\"info\\" : {\\n \\"version\\" : 1,\\n \\"author\\" : \\"xcode\\"\\n }\\n}","relativePath":"Demo\\/Assets.xcassets\\/AppIcon.appiconset\\/Contents.json"},{"contents":"{\\n \\"info\\" : {\\n \\"version\\" : 1,\\n \\"author\\" : \\"xcode\\"\\n }\\n}","relativePath":"Demo\\/Assets.xcassets\\/Contents.json"},{"contents":"\\n\\n \\n \\n <\\/device>\\n \\n \\n \\n \\n \\n <\\/dependencies>\\n \\n \\n \\n \\n \\n \\n \\n \\n \\n

+Formatting Rules for Entries +Each entry should use the following format: + +```markdown +- Summary of what was changed in a single line using past tense & followed by two whitespaces. + Issue: [#0](https://github.com/Flinesoft/HandySwift/issues/0) | PR: [#0](https://github.com/Flinesoft/HandySwift/pull/0) | Author: [Cihat Gündüz](https://github.com/Jeehut) +``` + +Note that at the end of the summary line, you need to add two whitespaces (` `) for correct rendering on GitHub. + +If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries separated by `, `. Also, remove entries not needed in the second line. +
## [Unreleased] ### Added - None. ### Changed -- None. +- Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. + Issue: [#170](https://github.com/Flinesoft/BartyCrouch/issues/170) | PRs: [#171](https://github.com/Flinesoft/BartyCrouch/pull/171), [#172](https://github.com/Flinesoft/BartyCrouch/pull/172), [#173](https://github.com/Flinesoft/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) +- Updated all dependencies to their latest versions to prevent warnings. + PR: [#172](https://github.com/Flinesoft/BartyCrouch/pull/172) | Author: [Cihat Gündüz](https://github.com/Jeehut) ### Deprecated - None. ### Removed diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index d98a718..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,19 +0,0 @@ -# Contributing - -Bug reports and pull requests are welcome on GitHub at https://github.com/Flinesoft/BartyCrouch. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. - -## Getting Started - -This section will tell you how you can get started contributing to BartyCrouch. - -### Prerequisites - -Before you start developing, please make sure you have the following tools installed on your machine: - -- Xcode 10.1+ -- [SwiftLint](https://github.com/realm/SwiftLint) -- [Beak](https://github.com/yonaskolb/Beak) - -### Commit Messages - -Please also try to follow the same syntax and semantic in your **commit messages** (see rationale [here](http://chris.beams.io/posts/git-commit/)). diff --git a/Package.resolved b/Package.resolved index 7a5d181..390120e 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,8 +6,8 @@ "repositoryURL": "https://github.com/Flinesoft/HandySwift.git", "state": { "branch": null, - "revision": "f736ec0ab264269cd4df91d6a685b4c78292cd76", - "version": "2.8.0" + "revision": "80a9697f586cba84278a48539c58b1b1afc61e13", + "version": "3.2.0" } }, { @@ -48,11 +48,11 @@ }, { "package": "Toml", - "repositoryURL": "https://github.com/jdfergason/swift-toml.git", + "repositoryURL": "https://github.com/Jeehut/swift-toml.git", "state": { - "branch": null, - "revision": "f4a3d9fbd94a855d6f85989c7e4c29e0ad75999c", - "version": "1.0.0" + "branch": "master", + "revision": "e0f7f568de4a9ae760a3b2d495616e180fafa5ac", + "version": null } }, { @@ -60,8 +60,8 @@ "repositoryURL": "https://github.com/jakeheis/SwiftCLI.git", "state": { "branch": null, - "revision": "ba2268e67c07b9f9cfbc0801385e6238b36255eb", - "version": "5.3.2" + "revision": "c72c4564f8c0a24700a59824880536aca45a4cae", + "version": "6.0.1" } } ] diff --git a/Package.swift b/Package.swift index 3664835..2fb7c5a 100644 --- a/Package.swift +++ b/Package.swift @@ -10,12 +10,12 @@ let package = Package( .library(name: "BartyCrouchTranslator", targets: ["BartyCrouchTranslator"]) ], dependencies: [ - .package(url: "https://github.com/Flinesoft/HandySwift.git", .upToNextMajor(from: "2.6.0")), - .package(url: "https://github.com/Flinesoft/Microya.git", .upToNextMajor(from: "0.1.1")), - .package(url: "https://github.com/JamitLabs/MungoHealer.git", .upToNextMajor(from: "0.3.0")), - .package(url: "https://github.com/onevcat/Rainbow.git", .upToNextMajor(from: "3.1.4")), - .package(url: "https://github.com/jakeheis/SwiftCLI.git", .upToNextMajor(from: "5.2.0")), - .package(url: "https://github.com/jdfergason/swift-toml.git", .upToNextMajor(from: "1.0.0")), + .package(url: "https://github.com/Flinesoft/HandySwift.git", from: "3.2.0"), + .package(url: "https://github.com/Flinesoft/Microya.git", from: "0.1.1"), + .package(url: "https://github.com/JamitLabs/MungoHealer.git", from: "0.3.2"), + .package(url: "https://github.com/onevcat/Rainbow.git", from: "3.1.5"), + .package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.1"), + .package(url: "https://github.com/Jeehut/swift-toml.git", .branch("master")), .package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50200.0")) ], targets: [ diff --git a/README.md b/README.md index e6c3449..77c50f6 100644 --- a/README.md +++ b/README.md @@ -398,7 +398,7 @@ See the file [MIGRATION_GUIDES.md](https://github.com/Flinesoft/BartyCrouch/blob ## Contributing -See the file [CONTRIBUTING.md](https://github.com/Flinesoft/BartyCrouch/blob/main/CONTRIBUTING.md). +Contributions are welcome. Feel free to open an issue on GitHub with your ideas or implement an idea yourself and post a pull request. If you want to contribute code, please try to follow the same syntax and semantic in your **commit messages** (see rationale [here](http://chris.beams.io/posts/git-commit/)). Also, please make sure to add an entry to the `CHANGELOG.md` file which explains your change. ## License This library is released under the [MIT License](http://opensource.org/licenses/MIT). See LICENSE for details. From f8f46fe3e65a9033bcc7f78019b5039dc54bf6f6 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Fri, 14 Feb 2020 23:40:41 +0100 Subject: [PATCH 20/36] Allow multiple paths in options --- .../Configuration/Options/LintOptions.swift | 6 +++--- .../Options/UpdateOptions/CodeOptions.swift | 12 ++++++------ .../Options/UpdateOptions/InterfacesOptions.swift | 6 +++--- .../Options/UpdateOptions/NormalizeOptions.swift | 6 +++--- .../Options/UpdateOptions/TransformOptions.swift | 12 ++++++------ .../Options/UpdateOptions/TranslateOptions.swift | 8 ++++---- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift index bb4abba..5d56984 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift @@ -3,7 +3,7 @@ import MungoHealer import Toml struct LintOptions { - let path: String + let paths: [String] let duplicateKeys: Bool let emptyValues: Bool } @@ -13,7 +13,7 @@ extension LintOptions: TomlCodable { let lint: String = "lint" return LintOptions( - path: toml.string(lint, "path") ?? ".", + paths: toml.array(lint, "paths") ?? [toml.string(lint, "path") ?? "."], duplicateKeys: toml.bool(lint, "duplicateKeys") ?? true, emptyValues: toml.bool(lint, "emptyValues") ?? true ) @@ -22,7 +22,7 @@ extension LintOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[lint]"] - lines.append("path = \"\(path)\"") + lines.append("paths = \"\(paths)\"") lines.append("duplicateKeys = \(duplicateKeys)") lines.append("emptyValues = \(emptyValues)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift index 173207f..2a44c33 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift @@ -2,8 +2,8 @@ import Foundation import Toml struct CodeOptions { - let codePath: String - let localizablePath: String + let codePaths: [String] + let localizablePaths: [String] let defaultToKeys: Bool let additive: Bool let customFunction: String? @@ -17,8 +17,8 @@ extension CodeOptions: TomlCodable { let code: String = "code" return CodeOptions( - codePath: toml.string(update, code, "codePath") ?? ".", - localizablePath: toml.string(update, code, "localizablePath") ?? ".", + codePaths: toml.array(update, code, "codePaths") ?? [toml.string(update, code, "codePath") ?? "."], + localizablePaths: toml.array(update, code, "localizablePaths") ?? [toml.string(update, code, "localizablePath") ?? "."], defaultToKeys: toml.bool(update, code, "defaultToKeys") ?? false, additive: toml.bool(update, code, "additive") ?? true, customFunction: toml.string(update, code, "customFunction"), @@ -30,8 +30,8 @@ extension CodeOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.code]"] - lines.append("codePath = \"\(codePath)\"") - lines.append("localizablePath = \"\(localizablePath)\"") + lines.append("codePaths = \"\(codePaths)\"") + lines.append("localizablePaths = \"\(localizablePaths)\"") lines.append("defaultToKeys = \(defaultToKeys)") lines.append("additive = \(additive)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift index f4463e4..4e39572 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift @@ -2,7 +2,7 @@ import Foundation import Toml struct InterfacesOptions { - let path: String + let paths: [String] let defaultToBase: Bool let ignoreEmptyStrings: Bool let unstripped: Bool @@ -14,7 +14,7 @@ extension InterfacesOptions: TomlCodable { let interfaces: String = "interfaces" return InterfacesOptions( - path: toml.string(update, interfaces, "path") ?? ".", + paths: toml.array(update, interfaces, "paths") ?? [toml.string(update, interfaces, "path") ?? "."], defaultToBase: toml.bool(update, interfaces, "defaultToBase") ?? false, ignoreEmptyStrings: toml.bool(update, interfaces, "ignoreEmptyStrings") ?? false, unstripped: toml.bool(update, interfaces, "unstripped") ?? false @@ -24,7 +24,7 @@ extension InterfacesOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.interfaces]"] - lines.append("path = \"\(path)\"") + lines.append("paths = \"\(paths)\"") lines.append("defaultToBase = \(defaultToBase)") lines.append("ignoreEmptyStrings = \(ignoreEmptyStrings)") lines.append("unstripped = \(unstripped)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift index be0f950..b6b3daa 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift @@ -2,7 +2,7 @@ import Foundation import Toml struct NormalizeOptions { - let path: String + let paths: [String] let sourceLocale: String let harmonizeWithSource: Bool let sortByKeys: Bool @@ -14,7 +14,7 @@ extension NormalizeOptions: TomlCodable { let normalize: String = "normalize" return NormalizeOptions( - path: toml.string(update, normalize, "path") ?? ".", + paths: toml.array(update, normalize, "paths") ?? [toml.string(update, normalize, "path") ?? "."], sourceLocale: toml.string(update, normalize, "sourceLocale") ?? "en", harmonizeWithSource: toml.bool(update, normalize, "harmonizeWithSource") ?? true, sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true @@ -24,7 +24,7 @@ extension NormalizeOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.normalize]"] - lines.append("path = \"\(path)\"") + lines.append("paths = \"\(paths)\"") lines.append("sourceLocale = \"\(sourceLocale)\"") lines.append("harmonizeWithSource = \(harmonizeWithSource)") lines.append("sortByKeys = \(sortByKeys)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift index cfb7ef5..904f5a8 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift @@ -3,8 +3,8 @@ import MungoHealer import Toml struct TransformOptions { - let codePath: String - let localizablePath: String + let codePaths: [String] + let localizablePaths: [String] let transformer: Transformer let supportedLanguageEnumPath: String let typeName: String @@ -25,8 +25,8 @@ extension TransformOptions: TomlCodable { } return TransformOptions( - codePath: toml.string(update, transform, "codePath") ?? ".", - localizablePath: toml.string(update, transform, "localizablePath") ?? ".", + codePaths: toml.array(update, transform, "codePaths") ?? [toml.string(update, transform, "codePath") ?? "."], + localizablePaths: toml.array(update, transform, "localizablePaths") ?? [toml.string(update, transform, "localizablePath") ?? "."], transformer: transformer, supportedLanguageEnumPath: toml.string(update, transform, "supportedLanguageEnumPath") ?? ".", typeName: toml.string(update, transform, "typeName") ?? "BartyCrouch", @@ -38,8 +38,8 @@ extension TransformOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.transform]"] - lines.append("codePath = \"\(codePath)\"") - lines.append("localizablePath = \"\(localizablePath)\"") + lines.append("codePaths = \"\(codePaths)\"") + lines.append("localizablePaths = \"\(localizablePaths)\"") lines.append("transformer = \"\(transformer.rawValue)\"") lines.append("supportedLanguageEnumPath = \"\(supportedLanguageEnumPath)\"") lines.append("typeName = \"\(typeName)\"") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift index 746d452..eb6ffe4 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift @@ -3,7 +3,7 @@ import MungoHealer import Toml struct TranslateOptions { - let path: String + let paths: [String] let secret: String let sourceLocale: String } @@ -14,9 +14,9 @@ extension TranslateOptions: TomlCodable { let translate: String = "translate" if let secret: String = toml.string(update, translate, "secret") { - let path = toml.string(update, translate, "path") ?? "." + let paths = toml.array(update, translate, "paths") ?? [toml.string(update, translate, "path") ?? "."] let sourceLocale: String = toml.string(update, translate, "sourceLocale") ?? "en" - return TranslateOptions(path: path, secret: secret, sourceLocale: sourceLocale) + return TranslateOptions(paths: paths, secret: secret, sourceLocale: sourceLocale) } else { throw MungoError(source: .invalidUserInput, message: "Incomplete [update.translate] options provided, ignoring them all.") } @@ -25,7 +25,7 @@ extension TranslateOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.translate]"] - lines.append("path = \"\(path)\"") + lines.append("paths = \"\(paths)\"") lines.append("secret = \"\(secret)\"") lines.append("sourceLocale = \"\(sourceLocale)\"") From 05aab0355c5f5460eaa0c50c9a7ee9f036354a92 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 15 Feb 2020 00:08:40 +0100 Subject: [PATCH 21/36] Add logic for multiple paths --- .../OldCommandLine/CommandLineActor.swift | 116 +++++++++--------- .../TaskHandlers/CodeTaskHandler.swift | 4 +- .../TaskHandlers/InterfacesTaskHandler.swift | 2 +- .../TaskHandlers/LintTaskHandler.swift | 2 +- .../TaskHandlers/NormalizeTaskHandler.swift | 2 +- .../TaskHandlers/TransformTaskHandler.swift | 14 ++- .../TaskHandlers/TranslateTaskHandler.swift | 2 +- 7 files changed, 75 insertions(+), 67 deletions(-) diff --git a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift index 58398d0..d241c2d 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift @@ -16,10 +16,10 @@ public class CommandLineActor { public init() {} func actOnCode( - path: String, + paths: [String], override: Bool, verbose: Bool, - localizable: String, + localizables: [String], defaultToKeys: Bool, additive: Bool, overrideComments: Bool, @@ -28,7 +28,7 @@ public class CommandLineActor { customLocalizableName: String? ) { let localizableFileName = customLocalizableName ?? "Localizable" - let allLocalizableStringsFilePaths = StringsFilesSearch.shared.findAllStringsFiles(within: localizable, withFileName: localizableFileName) + let allLocalizableStringsFilePaths = Array(Set(localizables.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withFileName: localizableFileName) })) guard !allLocalizableStringsFilePaths.isEmpty else { print("No `\(localizableFileName).strings` file found for output.\nTo fix this, please add a `\(localizableFileName).strings` file to your project and click the localize button for the file in Xcode. Alternatively remove the line beginning with `bartycrouch code` in your build script to remove this feature entirely if you don't need it.\nSee https://github.com/Flinesoft/BartyCrouch/issues/11 for further information.", level: .error) // swiftlint:disable:this line_length @@ -36,7 +36,7 @@ public class CommandLineActor { } self.incrementalCodeUpdate( - inputDirectoryPath: path, + inputDirectoryPaths: paths, allLocalizableStringsFilePaths, override: override, verbose: verbose, @@ -49,8 +49,8 @@ public class CommandLineActor { ) } - func actOnInterfaces(path: String, override: Bool, verbose: Bool, defaultToBase: Bool, unstripped: Bool, ignoreEmptyStrings: Bool) { - let inputFilePaths = StringsFilesSearch.shared.findAllIBFiles(within: path, withLocale: "Base") + func actOnInterfaces(paths: [String], override: Bool, verbose: Bool, defaultToBase: Bool, unstripped: Bool, ignoreEmptyStrings: Bool) { + let inputFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllIBFiles(within: $0, withLocale: "Base") } )) guard !inputFilePaths.isEmpty else { print("No input files found.", level: .warning); return } @@ -72,8 +72,8 @@ public class CommandLineActor { } } - func actOnTranslate(path: String, override: Bool, verbose: Bool, secret: String, locale: String) { - let inputFilePaths = StringsFilesSearch.shared.findAllStringsFiles(within: path, withLocale: locale) + func actOnTranslate(paths: [String], override: Bool, verbose: Bool, secret: String, locale: String) { + let inputFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withLocale: locale) } )) guard !inputFilePaths.isEmpty else { print("No input files found.", level: .warning); return } @@ -88,14 +88,14 @@ public class CommandLineActor { } func actOnNormalize( - path: String, + paths: [String], override: Bool, verbose: Bool, locale: String, sortByKeys: Bool, harmonizeWithSource: Bool ) { - let sourceFilePaths = StringsFilesSearch.shared.findAllStringsFiles(within: path, withLocale: locale) + let sourceFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withLocale: locale) })) guard !sourceFilePaths.isEmpty else { print("No source language files found.", level: .warning); return } for sourceFilePath in sourceFilePaths { @@ -134,14 +134,14 @@ public class CommandLineActor { } } - func actOnLint(path: String, duplicateKeys: Bool, emptyValues: Bool) { - let stringsFilePaths = StringsFilesSearch.shared.findAllStringsFiles(within: path) + func actOnLint(paths: [String], duplicateKeys: Bool, emptyValues: Bool) { + let stringsFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0) })) guard !stringsFilePaths.isEmpty else { print("No Strings files found.", level: .warning); return } let totalChecks: Int = [duplicateKeys, emptyValues].filter { $0 }.count if totalChecks <= 0 { - print("No checks specified. Run `bartycrouch lint` to see all available linting options.", level: .warning, file: path) + print("No checks specified. Run `bartycrouch lint` to see all available linting options.", level: .warning, file: paths.first) } var failedFilePaths: [String] = [] @@ -194,14 +194,14 @@ public class CommandLineActor { if !failedFilePaths.isEmpty { // swiftlint:disable:next line_length - print("\(totalFails) issue(s) found in \(failedFilePaths.count) file(s). Executed \(totalChecks) checks in \(stringsFilePaths.count) Strings file(s) in total.", level: .warning, file: path) + print("\(totalFails) issue(s) found in \(failedFilePaths.count) file(s). Executed \(totalChecks) checks in \(stringsFilePaths.count) Strings file(s) in total.", level: .warning, file: paths.first) } else { - print("\(totalChecks) check(s) passed for \(stringsFilePaths.count) Strings file(s).", level: .success, file: path) + print("\(totalChecks) check(s) passed for \(stringsFilePaths.count) Strings file(s).", level: .success, file: paths.first) } } private func incrementalCodeUpdate( - inputDirectoryPath: String, + inputDirectoryPaths: [String], _ outputStringsFilePaths: [String], override: Bool, verbose: Bool, @@ -212,55 +212,57 @@ public class CommandLineActor { customFunction: String?, localizableFileName: String ) { - let extractedStringsFileDirectory = inputDirectoryPath + "/tmpstrings/" - - do { - try FileManager.default.createDirectory(atPath: extractedStringsFileDirectory, withIntermediateDirectories: true, attributes: nil) - } catch { - print(error.localizedDescription, level: .error) - return - } + for inputDirectoryPath in inputDirectoryPaths { + let extractedStringsFileDirectory = inputDirectoryPath + "/tmpstrings/" + + do { + try FileManager.default.createDirectory(atPath: extractedStringsFileDirectory, withIntermediateDirectories: true, attributes: nil) + } catch { + print(error.localizedDescription, level: .error) + return + } - do { - try CodeCommander.shared.export( - stringsFilesToPath: extractedStringsFileDirectory, - fromCodeInDirectoryPath: inputDirectoryPath, - customFunction: customFunction - ) - } catch { - print("Could not extract strings from Code in directory '\(inputDirectoryPath)'.", level: .error) - return - } + do { + try CodeCommander.shared.export( + stringsFilesToPath: extractedStringsFileDirectory, + fromCodeInDirectoryPath: inputDirectoryPath, + customFunction: customFunction + ) + } catch { + print("Could not extract strings from Code in directory '\(inputDirectoryPath)'.", level: .error) + return + } - let extractedLocalizableStringsFilePath = extractedStringsFileDirectory + "Localizable.strings" - guard FileManager.default.fileExists(atPath: extractedLocalizableStringsFilePath) else { - print("No localizations extracted from Code in directory '\(inputDirectoryPath)'.", level: .warning) - return // NOTE: Expecting to see this only for empty project situations. - } + let extractedLocalizableStringsFilePath = extractedStringsFileDirectory + "Localizable.strings" + guard FileManager.default.fileExists(atPath: extractedLocalizableStringsFilePath) else { + print("No localizations extracted from Code in directory '\(inputDirectoryPath)'.", level: .warning) + return // NOTE: Expecting to see this only for empty project situations. + } - for outputStringsFilePath in outputStringsFilePaths { - guard let stringsFileUpdater = StringsFileUpdater(path: outputStringsFilePath) else { continue } + for outputStringsFilePath in outputStringsFilePaths { + guard let stringsFileUpdater = StringsFileUpdater(path: outputStringsFilePath) else { continue } - stringsFileUpdater.incrementallyUpdateKeys( - withStringsFileAtPath: extractedLocalizableStringsFilePath, - addNewValuesAsEmpty: !defaultToKeys, - override: override, - keepExistingKeys: additive, - overrideComments: overrideComments, - keepWhitespaceSurroundings: unstripped - ) + stringsFileUpdater.incrementallyUpdateKeys( + withStringsFileAtPath: extractedLocalizableStringsFilePath, + addNewValuesAsEmpty: !defaultToKeys, + override: override, + keepExistingKeys: additive, + overrideComments: overrideComments, + keepWhitespaceSurroundings: unstripped + ) - if verbose { print("Incrementally updated keys of file '\(outputStringsFilePath)'.", level: .info) } - } + if verbose { print("Incrementally updated keys of file '\(outputStringsFilePath)'.", level: .info) } + } - do { - try FileManager.default.removeItem(atPath: extractedStringsFileDirectory) - } catch { - print("Temporary strings files couldn't be deleted at path '\(extractedStringsFileDirectory)'", level: .error) - return + do { + try FileManager.default.removeItem(atPath: extractedStringsFileDirectory) + } catch { + print("Temporary strings files couldn't be deleted at path '\(extractedStringsFileDirectory)'", level: .error) + return + } } - print("Successfully updated strings file(s) of Code files.", level: .success, file: inputDirectoryPath) + print("Successfully updated strings file(s) of Code files.", level: .success, file: inputDirectoryPaths.first) } private func incrementalInterfacesUpdate( diff --git a/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift index 0285ba3..56bd9ab 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift @@ -13,10 +13,10 @@ extension CodeTaskHandler: TaskHandler { measure(task: "Update Code") { mungo.do { CommandLineActor().actOnCode( - path: options.codePath, + paths: options.codePaths, override: false, verbose: GlobalOptions.verbose.value, - localizable: options.localizablePath, + localizables: options.localizablePaths, defaultToKeys: options.defaultToKeys, additive: options.additive, overrideComments: false, diff --git a/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift index 78f53f4..d509695 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/InterfacesTaskHandler.swift @@ -13,7 +13,7 @@ extension InterfacesTaskHandler: TaskHandler { measure(task: "Update Interfaces") { mungo.do { CommandLineActor().actOnInterfaces( - path: options.path, + paths: options.paths, override: false, verbose: GlobalOptions.verbose.value, defaultToBase: options.defaultToBase, diff --git a/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift index ce6ef20..027d168 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/LintTaskHandler.swift @@ -13,7 +13,7 @@ extension LintTaskHandler: TaskHandler { measure(task: "Lint") { mungo.do { CommandLineActor().actOnLint( - path: options.path, + paths: options.paths, duplicateKeys: options.duplicateKeys, emptyValues: options.emptyValues ) diff --git a/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift index 6147793..e392a57 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/NormalizeTaskHandler.swift @@ -13,7 +13,7 @@ extension NormalizeTaskHandler: TaskHandler { measure(task: "Normalize") { mungo.do { CommandLineActor().actOnNormalize( - path: options.path, + paths: options.paths, override: false, verbose: GlobalOptions.verbose.value, locale: options.sourceLocale, diff --git a/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift index cbb90a0..a8c8a3e 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/TransformTaskHandler.swift @@ -32,7 +32,7 @@ extension TransformTaskHandler: TaskHandler { var translateEntries: [CodeFileHandler.TranslateEntry] = [] - for codeFile in CodeFilesSearch(baseDirectoryPath: options.codePath.absolutePath).findCodeFiles() { + for codeFile in Set(options.codePaths.flatMap { CodeFilesSearch(baseDirectoryPath: $0.absolutePath).findCodeFiles() }) { let codeFileHandler = CodeFileHandler(path: codeFile) translateEntries += try codeFileHandler.transform( @@ -43,9 +43,15 @@ extension TransformTaskHandler: TaskHandler { ) } - let stringsFiles: [String] = StringsFilesSearch.shared.findAllStringsFiles( - within: options.localizablePath.absolutePath, - withFileName: options.customLocalizableName ?? "Localizable" + let stringsFiles: [String] = Array( + Set( + options.localizablePaths.flatMap { + StringsFilesSearch.shared.findAllStringsFiles( + within: $0.absolutePath, + withFileName: options.customLocalizableName ?? "Localizable" + ) + } + ) ) for stringsFile in stringsFiles { diff --git a/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift b/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift index dfbef67..4be4641 100644 --- a/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift +++ b/Sources/BartyCrouchKit/TaskHandlers/TranslateTaskHandler.swift @@ -15,7 +15,7 @@ extension TranslateTaskHandler: TaskHandler { measure(task: "Translate") { mungo.do { CommandLineActor().actOnTranslate( - path: options.path, + paths: options.paths, override: false, verbose: GlobalOptions.verbose.value, secret: options.secret, From 9ef23ff6b8d5e155dd4b8c00f2ff6d81ed8d0e74 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 15 Feb 2020 14:59:39 +0100 Subject: [PATCH 22/36] Adjust tests for multiple paths --- .../Configuration/Options/LintOptions.swift | 4 +- .../Options/UpdateOptions/CodeOptions.swift | 8 +-- .../UpdateOptions/InterfacesOptions.swift | 4 +- .../UpdateOptions/NormalizeOptions.swift | 4 +- .../UpdateOptions/TransformOptions.swift | 8 +-- .../UpdateOptions/TranslateOptions.swift | 4 +- .../Globals/Extensions/ArrayExtension.swift | 10 +++ .../Globals/Extensions/TomlExtension.swift | 14 +++++ .../OldCommandLine/CommandLineActor.swift | 18 +++--- .../Configuration/ConfigurationTests.swift | 62 +++++++++---------- .../DemoTests/DemoTests.swift | 7 ++- 11 files changed, 84 insertions(+), 59 deletions(-) create mode 100644 Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift create mode 100644 Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift diff --git a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift index 5d56984..08cd8bf 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift @@ -13,7 +13,7 @@ extension LintOptions: TomlCodable { let lint: String = "lint" return LintOptions( - paths: toml.array(lint, "paths") ?? [toml.string(lint, "path") ?? "."], + paths: toml.array(lint, "paths") ?? [toml.string(lint, "path") ?? toml.string(lint, "paths") ?? "."], duplicateKeys: toml.bool(lint, "duplicateKeys") ?? true, emptyValues: toml.bool(lint, "emptyValues") ?? true ) @@ -22,7 +22,7 @@ extension LintOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[lint]"] - lines.append("paths = \"\(paths)\"") + lines.append("paths = \"\(Toml.convertToString(paths))\"") lines.append("duplicateKeys = \(duplicateKeys)") lines.append("emptyValues = \(emptyValues)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift index 2a44c33..a502866 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift @@ -17,8 +17,8 @@ extension CodeOptions: TomlCodable { let code: String = "code" return CodeOptions( - codePaths: toml.array(update, code, "codePaths") ?? [toml.string(update, code, "codePath") ?? "."], - localizablePaths: toml.array(update, code, "localizablePaths") ?? [toml.string(update, code, "localizablePath") ?? "."], + codePaths: toml.array(update, code, "codePaths") ?? [toml.string(update, code, "codePath") ?? toml.string(update, code, "codePaths") ?? "."], + localizablePaths: toml.array(update, code, "localizablePaths") ?? [toml.string(update, code, "localizablePath") ?? toml.string(update, code, "localizablePaths") ?? "."], defaultToKeys: toml.bool(update, code, "defaultToKeys") ?? false, additive: toml.bool(update, code, "additive") ?? true, customFunction: toml.string(update, code, "customFunction"), @@ -30,8 +30,8 @@ extension CodeOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.code]"] - lines.append("codePaths = \"\(codePaths)\"") - lines.append("localizablePaths = \"\(localizablePaths)\"") + lines.append("codePaths = \"\(Toml.convertToString(codePaths))\"") + lines.append("localizablePaths = \"\(Toml.convertToString(localizablePaths))\"") lines.append("defaultToKeys = \(defaultToKeys)") lines.append("additive = \(additive)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift index 4e39572..d1060fe 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift @@ -14,7 +14,7 @@ extension InterfacesOptions: TomlCodable { let interfaces: String = "interfaces" return InterfacesOptions( - paths: toml.array(update, interfaces, "paths") ?? [toml.string(update, interfaces, "path") ?? "."], + paths: toml.array(update, interfaces, "paths") ?? [toml.string(update, interfaces, "path") ?? toml.string(update, interfaces, "paths") ?? "."], defaultToBase: toml.bool(update, interfaces, "defaultToBase") ?? false, ignoreEmptyStrings: toml.bool(update, interfaces, "ignoreEmptyStrings") ?? false, unstripped: toml.bool(update, interfaces, "unstripped") ?? false @@ -24,7 +24,7 @@ extension InterfacesOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.interfaces]"] - lines.append("paths = \"\(paths)\"") + lines.append("paths = \"\(Toml.convertToString(paths))\"") lines.append("defaultToBase = \(defaultToBase)") lines.append("ignoreEmptyStrings = \(ignoreEmptyStrings)") lines.append("unstripped = \(unstripped)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift index b6b3daa..0be1664 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift @@ -14,7 +14,7 @@ extension NormalizeOptions: TomlCodable { let normalize: String = "normalize" return NormalizeOptions( - paths: toml.array(update, normalize, "paths") ?? [toml.string(update, normalize, "path") ?? "."], + paths: toml.array(update, normalize, "paths") ?? [toml.string(update, normalize, "path") ?? toml.string(update, normalize, "paths") ?? "."], sourceLocale: toml.string(update, normalize, "sourceLocale") ?? "en", harmonizeWithSource: toml.bool(update, normalize, "harmonizeWithSource") ?? true, sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true @@ -24,7 +24,7 @@ extension NormalizeOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.normalize]"] - lines.append("paths = \"\(paths)\"") + lines.append("paths = \"\(Toml.convertToString(paths))\"") lines.append("sourceLocale = \"\(sourceLocale)\"") lines.append("harmonizeWithSource = \(harmonizeWithSource)") lines.append("sortByKeys = \(sortByKeys)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift index 904f5a8..e1ad922 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift @@ -25,8 +25,8 @@ extension TransformOptions: TomlCodable { } return TransformOptions( - codePaths: toml.array(update, transform, "codePaths") ?? [toml.string(update, transform, "codePath") ?? "."], - localizablePaths: toml.array(update, transform, "localizablePaths") ?? [toml.string(update, transform, "localizablePath") ?? "."], + codePaths: toml.array(update, transform, "codePaths") ?? [toml.string(update, transform, "codePath") ?? toml.string(update, transform, "codePaths") ?? "."], + localizablePaths: toml.array(update, transform, "localizablePaths") ?? [toml.string(update, transform, "localizablePath") ?? toml.string(update, transform, "localizablePaths") ?? "."], transformer: transformer, supportedLanguageEnumPath: toml.string(update, transform, "supportedLanguageEnumPath") ?? ".", typeName: toml.string(update, transform, "typeName") ?? "BartyCrouch", @@ -38,8 +38,8 @@ extension TransformOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.transform]"] - lines.append("codePaths = \"\(codePaths)\"") - lines.append("localizablePaths = \"\(localizablePaths)\"") + lines.append("codePaths = \"\(Toml.convertToString(codePaths))\"") + lines.append("localizablePaths = \"\(Toml.convertToString(localizablePaths))\"") lines.append("transformer = \"\(transformer.rawValue)\"") lines.append("supportedLanguageEnumPath = \"\(supportedLanguageEnumPath)\"") lines.append("typeName = \"\(typeName)\"") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift index eb6ffe4..2537c56 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift @@ -14,7 +14,7 @@ extension TranslateOptions: TomlCodable { let translate: String = "translate" if let secret: String = toml.string(update, translate, "secret") { - let paths = toml.array(update, translate, "paths") ?? [toml.string(update, translate, "path") ?? "."] + let paths = toml.array(update, translate, "paths") ?? [toml.string(update, translate, "path") ?? toml.string(update, translate, "paths") ?? "."] let sourceLocale: String = toml.string(update, translate, "sourceLocale") ?? "en" return TranslateOptions(paths: paths, secret: secret, sourceLocale: sourceLocale) } else { @@ -25,7 +25,7 @@ extension TranslateOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.translate]"] - lines.append("paths = \"\(paths)\"") + lines.append("paths = \"\(Toml.convertToString(paths))\"") lines.append("secret = \"\(secret)\"") lines.append("sourceLocale = \"\(sourceLocale)\"") diff --git a/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift new file mode 100644 index 0000000..b063792 --- /dev/null +++ b/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift @@ -0,0 +1,10 @@ +// Created by Frederick Pietschmann on 15.02.20. + +import Foundation + +extension Array where Element: Hashable { + func withoutDuplicates() -> Self { + var seen = [Element: Bool]() + return filter { seen.updateValue(true, forKey: $0) == nil } + } +} diff --git a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift new file mode 100644 index 0000000..62b120b --- /dev/null +++ b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift @@ -0,0 +1,14 @@ +// Created by Frederick Pietschmann on 15.02.20. + +import Foundation +import Toml + +extension Toml { + static func convertToString(_ array: [String]) -> String { + if array.count == 1, let first = array.first { + return first + } + + return "\(array)" + } +} diff --git a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift index d241c2d..9e8033b 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift @@ -28,7 +28,7 @@ public class CommandLineActor { customLocalizableName: String? ) { let localizableFileName = customLocalizableName ?? "Localizable" - let allLocalizableStringsFilePaths = Array(Set(localizables.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withFileName: localizableFileName) })) + let allLocalizableStringsFilePaths = localizables.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withFileName: localizableFileName) }.withoutDuplicates() guard !allLocalizableStringsFilePaths.isEmpty else { print("No `\(localizableFileName).strings` file found for output.\nTo fix this, please add a `\(localizableFileName).strings` file to your project and click the localize button for the file in Xcode. Alternatively remove the line beginning with `bartycrouch code` in your build script to remove this feature entirely if you don't need it.\nSee https://github.com/Flinesoft/BartyCrouch/issues/11 for further information.", level: .error) // swiftlint:disable:this line_length @@ -50,7 +50,7 @@ public class CommandLineActor { } func actOnInterfaces(paths: [String], override: Bool, verbose: Bool, defaultToBase: Bool, unstripped: Bool, ignoreEmptyStrings: Bool) { - let inputFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllIBFiles(within: $0, withLocale: "Base") } )) + let inputFilePaths = paths.flatMap { StringsFilesSearch.shared.findAllIBFiles(within: $0, withLocale: "Base") }.withoutDuplicates() guard !inputFilePaths.isEmpty else { print("No input files found.", level: .warning); return } @@ -73,7 +73,7 @@ public class CommandLineActor { } func actOnTranslate(paths: [String], override: Bool, verbose: Bool, secret: String, locale: String) { - let inputFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withLocale: locale) } )) + let inputFilePaths = paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withLocale: locale) }.withoutDuplicates() guard !inputFilePaths.isEmpty else { print("No input files found.", level: .warning); return } @@ -95,7 +95,7 @@ public class CommandLineActor { sortByKeys: Bool, harmonizeWithSource: Bool ) { - let sourceFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withLocale: locale) })) + let sourceFilePaths = paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withLocale: locale) }.withoutDuplicates() guard !sourceFilePaths.isEmpty else { print("No source language files found.", level: .warning); return } for sourceFilePath in sourceFilePaths { @@ -135,13 +135,13 @@ public class CommandLineActor { } func actOnLint(paths: [String], duplicateKeys: Bool, emptyValues: Bool) { - let stringsFilePaths = Array(Set(paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0) })) + let stringsFilePaths = paths.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0) }.withoutDuplicates() guard !stringsFilePaths.isEmpty else { print("No Strings files found.", level: .warning); return } let totalChecks: Int = [duplicateKeys, emptyValues].filter { $0 }.count if totalChecks <= 0 { - print("No checks specified. Run `bartycrouch lint` to see all available linting options.", level: .warning, file: paths.first) + print("No checks specified. Run `bartycrouch lint` to see all available linting options.", level: .warning, file: paths.last) } var failedFilePaths: [String] = [] @@ -194,9 +194,9 @@ public class CommandLineActor { if !failedFilePaths.isEmpty { // swiftlint:disable:next line_length - print("\(totalFails) issue(s) found in \(failedFilePaths.count) file(s). Executed \(totalChecks) checks in \(stringsFilePaths.count) Strings file(s) in total.", level: .warning, file: paths.first) + print("\(totalFails) issue(s) found in \(failedFilePaths.count) file(s). Executed \(totalChecks) checks in \(stringsFilePaths.count) Strings file(s) in total.", level: .warning, file: paths.last) } else { - print("\(totalChecks) check(s) passed for \(stringsFilePaths.count) Strings file(s).", level: .success, file: paths.first) + print("\(totalChecks) check(s) passed for \(stringsFilePaths.count) Strings file(s).", level: .success, file: paths.last) } } @@ -262,7 +262,7 @@ public class CommandLineActor { } } - print("Successfully updated strings file(s) of Code files.", level: .success, file: inputDirectoryPaths.first) + print("Successfully updated strings file(s) of Code files.", level: .success, file: inputDirectoryPaths.last) } private func incrementalInterfacesUpdate( diff --git a/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift b/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift index 204223e..3b8098c 100644 --- a/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift +++ b/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift @@ -11,34 +11,34 @@ class ConfigurationTests: XCTestCase { XCTAssertEqual(configuration.updateOptions.tasks, [.interfaces, .code, .transform, .normalize]) - XCTAssertEqual(configuration.updateOptions.interfaces.path, ".") + XCTAssertEqual(configuration.updateOptions.interfaces.paths, ["."]) XCTAssertEqual(configuration.updateOptions.interfaces.defaultToBase, false) XCTAssertEqual(configuration.updateOptions.interfaces.ignoreEmptyStrings, false) XCTAssertEqual(configuration.updateOptions.interfaces.unstripped, false) - XCTAssertEqual(configuration.updateOptions.code.codePath, ".") - XCTAssertEqual(configuration.updateOptions.code.localizablePath, ".") + XCTAssertEqual(configuration.updateOptions.code.codePaths, ["."]) + XCTAssertEqual(configuration.updateOptions.code.localizablePaths, ["."]) XCTAssertEqual(configuration.updateOptions.code.additive, true) XCTAssertEqual(configuration.updateOptions.code.customFunction, nil) XCTAssertEqual(configuration.updateOptions.code.customLocalizableName, nil) XCTAssertEqual(configuration.updateOptions.code.defaultToKeys, false) XCTAssertEqual(configuration.updateOptions.code.unstripped, false) - XCTAssertEqual(configuration.updateOptions.transform.codePath, ".") - XCTAssertEqual(configuration.updateOptions.transform.localizablePath, ".") + XCTAssertEqual(configuration.updateOptions.transform.codePaths, ["."]) + XCTAssertEqual(configuration.updateOptions.transform.localizablePaths, ["."]) XCTAssertEqual(configuration.updateOptions.transform.transformer, .foundation) XCTAssertEqual(configuration.updateOptions.transform.typeName, "BartyCrouch") XCTAssertEqual(configuration.updateOptions.transform.translateMethodName, "translate") XCTAssertEqual(configuration.updateOptions.transform.customLocalizableName, nil) - XCTAssertEqual(configuration.updateOptions.normalize.path, ".") + XCTAssertEqual(configuration.updateOptions.normalize.paths, ["."]) XCTAssertEqual(configuration.updateOptions.normalize.sourceLocale, "en") XCTAssertEqual(configuration.updateOptions.normalize.harmonizeWithSource, true) XCTAssertEqual(configuration.updateOptions.normalize.sortByKeys, true) XCTAssertNil(configuration.updateOptions.translate) - XCTAssertEqual(configuration.lintOptions.path, ".") + XCTAssertEqual(configuration.lintOptions.paths, ["."]) XCTAssertEqual(configuration.lintOptions.duplicateKeys, true) XCTAssertEqual(configuration.lintOptions.emptyValues, true) } catch { @@ -53,14 +53,14 @@ class ConfigurationTests: XCTestCase { tasks = ["interfaces", "transform", "normalize"] [update.interfaces] - path = "Sources" + paths = ["Sources/ViewA", "Sources/ViewB"] defaultToBase = true ignoreEmptyStrings = true unstripped = true [update.code] - codePath = "Sources" - localizablePath = "Sources/SupportingFiles" + codePaths = "Sources" + localizablePaths = "Sources/SupportingFiles" defaultToKeys = true additive = false customFunction = "MyOwnLocalizedString" @@ -68,8 +68,8 @@ class ConfigurationTests: XCTestCase { unstripped = true [update.transform] - codePath = "Sources" - localizablePath = "Sources/SupportingFiles" + codePaths = "Sources" + localizablePaths = "Sources/SupportingFiles" transformer = "swiftgenStructured" supportedLanguageEnumPath = "Sources/SupportingFiles" typeName = "BC" @@ -77,20 +77,20 @@ class ConfigurationTests: XCTestCase { customLocalizableName = "MyOwnLocalizable" [update.normalize] - path = "Sources" + paths = "Sources" sourceLocale = "de" harmonizeWithSource = false sortByKeys = false [update.translate] - path = "Sources" + paths = "Sources" api = "bing" id = "bingId" secret = "bingSecret" sourceLocale = "de" [lint] - path = "Sources" + paths = "Sources" duplicateKeys = false emptyValues = false @@ -102,37 +102,37 @@ class ConfigurationTests: XCTestCase { XCTAssertEqual(configuration.updateOptions.tasks, [.interfaces, .transform, .normalize]) - XCTAssertEqual(configuration.updateOptions.interfaces.path, "Sources") + XCTAssertEqual(configuration.updateOptions.interfaces.paths, ["Sources/ViewA", "Sources/ViewB"]) XCTAssertEqual(configuration.updateOptions.interfaces.defaultToBase, true) XCTAssertEqual(configuration.updateOptions.interfaces.ignoreEmptyStrings, true) XCTAssertEqual(configuration.updateOptions.interfaces.unstripped, true) - XCTAssertEqual(configuration.updateOptions.code.codePath, "Sources") - XCTAssertEqual(configuration.updateOptions.code.localizablePath, "Sources/SupportingFiles") + XCTAssertEqual(configuration.updateOptions.code.codePaths, ["Sources"]) + XCTAssertEqual(configuration.updateOptions.code.localizablePaths, ["Sources/SupportingFiles"]) XCTAssertEqual(configuration.updateOptions.code.additive, false) XCTAssertEqual(configuration.updateOptions.code.customFunction, "MyOwnLocalizedString") XCTAssertEqual(configuration.updateOptions.code.customLocalizableName, "MyOwnLocalizable") XCTAssertEqual(configuration.updateOptions.code.defaultToKeys, true) XCTAssertEqual(configuration.updateOptions.code.unstripped, true) - XCTAssertEqual(configuration.updateOptions.transform.codePath, "Sources") - XCTAssertEqual(configuration.updateOptions.transform.localizablePath, "Sources/SupportingFiles") + XCTAssertEqual(configuration.updateOptions.transform.codePaths, ["Sources"]) + XCTAssertEqual(configuration.updateOptions.transform.localizablePaths, ["Sources/SupportingFiles"]) XCTAssertEqual(configuration.updateOptions.transform.transformer, .swiftgenStructured) XCTAssertEqual(configuration.updateOptions.transform.supportedLanguageEnumPath, "Sources/SupportingFiles") XCTAssertEqual(configuration.updateOptions.transform.typeName, "BC") XCTAssertEqual(configuration.updateOptions.transform.translateMethodName, "t") XCTAssertEqual(configuration.updateOptions.transform.customLocalizableName, "MyOwnLocalizable") - XCTAssertEqual(configuration.updateOptions.normalize.path, "Sources") + XCTAssertEqual(configuration.updateOptions.normalize.paths, ["Sources"]) XCTAssertEqual(configuration.updateOptions.normalize.sourceLocale, "de") XCTAssertEqual(configuration.updateOptions.normalize.harmonizeWithSource, false) XCTAssertEqual(configuration.updateOptions.normalize.sortByKeys, false) - XCTAssertEqual(configuration.updateOptions.translate!.path, "Sources") + XCTAssertEqual(configuration.updateOptions.translate!.paths, ["Sources"]) XCTAssertEqual(configuration.updateOptions.translate!.secret, "bingSecret") XCTAssertEqual(configuration.updateOptions.translate!.sourceLocale, "de") - XCTAssertEqual(configuration.lintOptions.path, "Sources") + XCTAssertEqual(configuration.lintOptions.paths, ["Sources"]) XCTAssertEqual(configuration.lintOptions.duplicateKeys, false) XCTAssertEqual(configuration.lintOptions.emptyValues, false) } catch { @@ -146,14 +146,14 @@ class ConfigurationTests: XCTestCase { tasks = ["interfaces", "code", "transform"] [update.interfaces] - path = "Sources" + paths = "Sources" defaultToBase = true ignoreEmptyStrings = true unstripped = true [update.code] - codePath = "Sources" - localizablePath = "Sources/SupportingFiles" + codePaths = "Sources" + localizablePaths = "Sources/SupportingFiles" defaultToKeys = true additive = false customFunction = "MyOwnLocalizedString" @@ -161,26 +161,26 @@ class ConfigurationTests: XCTestCase { unstripped = true [update.transform] - codePath = "." - localizablePath = "." + codePaths = "." + localizablePaths = "." transformer = "foundation" supportedLanguageEnumPath = "." typeName = "BartyCrouch" translateMethodName = "translate" [update.translate] - path = "Sources" + paths = "Sources" secret = "bingSecret" sourceLocale = "de" [update.normalize] - path = "Sources" + paths = "Sources" sourceLocale = "de" harmonizeWithSource = false sortByKeys = false [lint] - path = "Sources" + paths = "Sources" duplicateKeys = false emptyValues = false diff --git a/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift b/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift index 1a4ed9f..ac863ac 100644 --- a/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift +++ b/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift @@ -53,6 +53,7 @@ class DemoTests: XCTestCase { } for (indices, langCode) in [([0, 1, 2], "de"), ([3, 4, 5], "en"), ([6, 7, 8], "tr")] { + print(TestHelper.shared.printOutputs) XCTAssertEqual(TestHelper.shared.printOutputs[indices[0]].message, "Found 2 translations for key 'Existing Duplicate Key'. Other entries at: [13]") XCTAssertEqual(TestHelper.shared.printOutputs[indices[0]].line, 11) @@ -140,7 +141,7 @@ class DemoTests: XCTestCase { let microsoftSubscriptionKey = "" // TODO: load from environment variable guard !microsoftSubscriptionKey.isEmpty else { return } - let translateOptions = TranslateOptions(path: ".", secret: microsoftSubscriptionKey, sourceLocale: "en") + let translateOptions = TranslateOptions(paths: ["."], secret: microsoftSubscriptionKey, sourceLocale: "en") TranslateTaskHandler(options: translateOptions).perform() let expectedMessages: [String] = [ @@ -215,8 +216,8 @@ class DemoTests: XCTestCase { func testTransformTaskHandlerWithSwiftgenStructuredTransformer() { let transformOptions = TransformOptions( - codePath: ".", - localizablePath: ".", + codePaths: ["."], + localizablePaths: ["."], transformer: .swiftgenStructured, supportedLanguageEnumPath: ".", typeName: "BartyCrouch", From 47834739864be9dd55ea04d6bc85b3455c607cb9 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 15 Feb 2020 15:11:47 +0100 Subject: [PATCH 23/36] Allow both String array / single String for both singular / plural key --- .../BartyCrouchKit/Configuration/Options/LintOptions.swift | 2 +- .../Configuration/Options/UpdateOptions/CodeOptions.swift | 4 ++-- .../Options/UpdateOptions/InterfacesOptions.swift | 2 +- .../Options/UpdateOptions/NormalizeOptions.swift | 2 +- .../Options/UpdateOptions/TransformOptions.swift | 4 ++-- .../Options/UpdateOptions/TranslateOptions.swift | 2 +- Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift | 4 ++++ 7 files changed, 12 insertions(+), 8 deletions(-) diff --git a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift index 08cd8bf..df26443 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift @@ -13,7 +13,7 @@ extension LintOptions: TomlCodable { let lint: String = "lint" return LintOptions( - paths: toml.array(lint, "paths") ?? [toml.string(lint, "path") ?? toml.string(lint, "paths") ?? "."], + paths: toml.stringArray(lint, "paths") ?? toml.stringArray(lint, "path") ?? ["."], duplicateKeys: toml.bool(lint, "duplicateKeys") ?? true, emptyValues: toml.bool(lint, "emptyValues") ?? true ) diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift index a502866..411daf5 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift @@ -17,8 +17,8 @@ extension CodeOptions: TomlCodable { let code: String = "code" return CodeOptions( - codePaths: toml.array(update, code, "codePaths") ?? [toml.string(update, code, "codePath") ?? toml.string(update, code, "codePaths") ?? "."], - localizablePaths: toml.array(update, code, "localizablePaths") ?? [toml.string(update, code, "localizablePath") ?? toml.string(update, code, "localizablePaths") ?? "."], + codePaths: toml.stringArray(update, code, "codePaths") ?? toml.stringArray(update, code, "codePath") ?? ["."], + localizablePaths: toml.stringArray(update, code, "localizablePaths") ?? toml.stringArray(update, code, "localizablePath") ?? ["."], defaultToKeys: toml.bool(update, code, "defaultToKeys") ?? false, additive: toml.bool(update, code, "additive") ?? true, customFunction: toml.string(update, code, "customFunction"), diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift index d1060fe..13497b2 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift @@ -14,7 +14,7 @@ extension InterfacesOptions: TomlCodable { let interfaces: String = "interfaces" return InterfacesOptions( - paths: toml.array(update, interfaces, "paths") ?? [toml.string(update, interfaces, "path") ?? toml.string(update, interfaces, "paths") ?? "."], + paths: toml.stringArray(update, interfaces, "paths") ?? toml.stringArray(update, interfaces, "path") ?? ["."], defaultToBase: toml.bool(update, interfaces, "defaultToBase") ?? false, ignoreEmptyStrings: toml.bool(update, interfaces, "ignoreEmptyStrings") ?? false, unstripped: toml.bool(update, interfaces, "unstripped") ?? false diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift index 0be1664..88dd4d0 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift @@ -14,7 +14,7 @@ extension NormalizeOptions: TomlCodable { let normalize: String = "normalize" return NormalizeOptions( - paths: toml.array(update, normalize, "paths") ?? [toml.string(update, normalize, "path") ?? toml.string(update, normalize, "paths") ?? "."], + paths: toml.stringArray(update, normalize, "paths") ?? toml.stringArray(update, normalize, "path") ?? ["."], sourceLocale: toml.string(update, normalize, "sourceLocale") ?? "en", harmonizeWithSource: toml.bool(update, normalize, "harmonizeWithSource") ?? true, sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift index e1ad922..11f2cc2 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift @@ -25,8 +25,8 @@ extension TransformOptions: TomlCodable { } return TransformOptions( - codePaths: toml.array(update, transform, "codePaths") ?? [toml.string(update, transform, "codePath") ?? toml.string(update, transform, "codePaths") ?? "."], - localizablePaths: toml.array(update, transform, "localizablePaths") ?? [toml.string(update, transform, "localizablePath") ?? toml.string(update, transform, "localizablePaths") ?? "."], + codePaths: toml.stringArray(update, transform, "codePaths") ?? toml.stringArray(update, transform, "codePath") ?? ["."], + localizablePaths: toml.stringArray(update, transform, "localizablePaths") ?? toml.stringArray(update, transform, "localizablePath") ?? ["."], transformer: transformer, supportedLanguageEnumPath: toml.string(update, transform, "supportedLanguageEnumPath") ?? ".", typeName: toml.string(update, transform, "typeName") ?? "BartyCrouch", diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift index 2537c56..e6ad947 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift @@ -14,7 +14,7 @@ extension TranslateOptions: TomlCodable { let translate: String = "translate" if let secret: String = toml.string(update, translate, "secret") { - let paths = toml.array(update, translate, "paths") ?? [toml.string(update, translate, "path") ?? toml.string(update, translate, "paths") ?? "."] + let paths = toml.stringArray(update, translate, "paths") ?? toml.stringArray(update, translate, "path") ?? ["."] let sourceLocale: String = toml.string(update, translate, "sourceLocale") ?? "en" return TranslateOptions(paths: paths, secret: secret, sourceLocale: sourceLocale) } else { diff --git a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift index 62b120b..9f08c13 100644 --- a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift +++ b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift @@ -11,4 +11,8 @@ extension Toml { return "\(array)" } + + public func stringArray(_ path: String...) -> [String]? { + return array(path) ?? string(path).map { [$0] } + } } From 3a7bc7f54f7084c10d5558633be6834536ba047e Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 15 Feb 2020 15:11:58 +0100 Subject: [PATCH 24/36] Update README --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 77c50f6..e39edee 100644 --- a/README.md +++ b/README.md @@ -103,34 +103,34 @@ Now you should have a file named `.bartycrouch.toml` with the following contents tasks = ["interfaces", "code", "transform", "normalize"] [update.interfaces] -path = "." +paths = "." defaultToBase = false ignoreEmptyStrings = false unstripped = false [update.code] -codePath = "." -localizablePath = "." +codePaths = "." +localizablePaths = "." defaultToKeys = false additive = true unstripped = false [update.transform] -codePath = "." -localizablePath = "." +codePaths = "." +localizablePaths = "." transformer = "foundation" supportedLanguageEnumPath = "." typeName = "BartyCrouch" translateMethodName = "translate" [update.normalize] -path = "." +paths = "." sourceLocale = "en" harmonizeWithSource = true sortByKeys = true [lint] -path = "." +paths = "." duplicateKeys = true emptyValues = true ``` @@ -191,7 +191,7 @@ enum BartyCrouch { ```toml [update.translate] -path = "." +paths = "." secret = "<#Subscription Key#>" sourceLocale = "en" ``` @@ -232,7 +232,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
Options for `interfaces` -- `path`: The directory to search for Storyboards & XIB files. +- `paths`: The directory / directories to search for Storyboards & XIB files. - `defaultToBase`: Add Base translation as value to new keys. - `ignoreEmptyStrings`: Doesn't add views with empty values. - `unstripped`: Keeps whitespaces at beginning & end of Strings files. @@ -241,8 +241,8 @@ tasks = ["interfaces", "code", "transform", "normalize"]
Options for `code` -- `codePath`: The directory to search for Swift code files. -- `localizablePath`: The enclosing path containing the localized `Localizable.strings` files. +- `codePaths`: The directory / directories to search for Swift code files. +- `localizablePaths`: The enclosing path(s) containing the localized `Localizable.strings` files. - `defaultsToKeys`: Add new keys both as key and value. - `additive`: Prevents cleaning up keys not found in code. - `customFunction`: Use alternative name to `NSLocalizedString`. @@ -253,8 +253,8 @@ tasks = ["interfaces", "code", "transform", "normalize"]
Options for `transform` -- `codePath`: The directory to search for Swift code files. -- `localizablePath`: The enclosing path containing the localized `Localizable.strings` files. +- `codePaths`: The directory / directories to search for Swift code files. +- `localizablePaths`: The enclosing path(s) containing the localized `Localizable.strings` files. - `transformer`: Specifies the replacement code. Use `foundation` for `NSLocalizedString` or `swiftgenStructured` for `L10n` entries. - `supportedLanguageEnumPath`: The enclosing path containing the `SupportedLanguage` enum. - `typeName`: The name of the type enclosing the `SupportedLanguage` enum and translate method. @@ -265,7 +265,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
Options for `translate` -- `path`: The directory to search for Strings files. +- `paths`: The directory / directories to search for Strings files. - `secret`: Your [Microsoft Translator Text API Subscription Key](https://docs.microsoft.com/en-us/azure/cognitive-services/translator/translator-text-how-to-signup#authentication-key). - `sourceLocale`: The source language to translate from. @@ -273,7 +273,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
Options for `normalize` -- `path`: The directory to search for Strings files. +- `paths`: The directory / directories to search for Strings files. - `sourceLocale`: The source language to harmonize keys of other languages with. - `harmonizeWithSource`: Synchronizes keys with source language. - `sortByKeys`: Alphabetically sorts translations by their keys. From 68c59ac7bdd1da01be8bc8622ffe17c746d2ab01 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 15 Feb 2020 15:13:47 +0100 Subject: [PATCH 25/36] Add changelog entry --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c08a49..947308a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,8 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [Unreleased] ### Added -- None. +- Add support for specifying multiple paths. Fixes [#155](https://github.com/Flinesoft/BartyCrouch/issues/155). By [Frederick Pietschmann](https://github.com/fredpi). + ### Changed - Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. Issue: [#170](https://github.com/Flinesoft/BartyCrouch/issues/170) | PRs: [#171](https://github.com/Flinesoft/BartyCrouch/pull/171), [#172](https://github.com/Flinesoft/BartyCrouch/pull/172), [#173](https://github.com/Flinesoft/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) From 721850c47470cdaccb1e7d89932a49194925aa8e Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 15 Feb 2020 15:15:36 +0100 Subject: [PATCH 26/36] Remove unnecessary print statement --- Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift b/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift index ac863ac..c0e67ce 100644 --- a/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift +++ b/Tests/BartyCrouchKitTests/DemoTests/DemoTests.swift @@ -53,7 +53,6 @@ class DemoTests: XCTestCase { } for (indices, langCode) in [([0, 1, 2], "de"), ([3, 4, 5], "en"), ([6, 7, 8], "tr")] { - print(TestHelper.shared.printOutputs) XCTAssertEqual(TestHelper.shared.printOutputs[indices[0]].message, "Found 2 translations for key 'Existing Duplicate Key'. Other entries at: [13]") XCTAssertEqual(TestHelper.shared.printOutputs[indices[0]].line, 11) From 2c698fd57b844130ae1a4e4dcfece0764f7d0a8e Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 14 Mar 2020 18:05:15 +0100 Subject: [PATCH 27/36] Adjust changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 947308a..ccca734 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,7 +19,7 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [Unreleased] ### Added -- Add support for specifying multiple paths. Fixes [#155](https://github.com/Flinesoft/BartyCrouch/issues/155). By [Frederick Pietschmann](https://github.com/fredpi). +- Add support for specifying multiple paths. Fixes [#155](https://github.com/Flinesoft/BartyCrouch/issues/155) by [Frederick Pietschmann](https://github.com/fredpi). ### Changed - Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. From f45b6856ffbf2336eac629f9f64a71f25043e50c Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Sat, 14 Mar 2020 18:05:40 +0100 Subject: [PATCH 28/36] Don't allow multiple paths when using singular key --- README.md | 14 ++++----- .../Configuration/Options/LintOptions.swift | 4 +-- .../Options/UpdateOptions/CodeOptions.swift | 8 ++--- .../UpdateOptions/InterfacesOptions.swift | 4 +-- .../UpdateOptions/NormalizeOptions.swift | 4 +-- .../UpdateOptions/TransformOptions.swift | 8 ++--- .../UpdateOptions/TranslateOptions.swift | 4 +-- .../Globals/Extensions/TomlExtension.swift | 12 ++------ .../Configuration/ConfigurationTests.swift | 30 +++++++++---------- 9 files changed, 40 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index e39edee..4b8ca36 100644 --- a/README.md +++ b/README.md @@ -103,34 +103,34 @@ Now you should have a file named `.bartycrouch.toml` with the following contents tasks = ["interfaces", "code", "transform", "normalize"] [update.interfaces] -paths = "." +paths = ["."] defaultToBase = false ignoreEmptyStrings = false unstripped = false [update.code] -codePaths = "." -localizablePaths = "." +codePaths = ["."] +localizablePaths = ["."] defaultToKeys = false additive = true unstripped = false [update.transform] -codePaths = "." -localizablePaths = "." +codePaths = ["."] +localizablePaths = ["."] transformer = "foundation" supportedLanguageEnumPath = "." typeName = "BartyCrouch" translateMethodName = "translate" [update.normalize] -paths = "." +paths = ["."] sourceLocale = "en" harmonizeWithSource = true sortByKeys = true [lint] -paths = "." +paths = ["."] duplicateKeys = true emptyValues = true ``` diff --git a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift index df26443..8b13b7f 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/LintOptions.swift @@ -13,7 +13,7 @@ extension LintOptions: TomlCodable { let lint: String = "lint" return LintOptions( - paths: toml.stringArray(lint, "paths") ?? toml.stringArray(lint, "path") ?? ["."], + paths: toml.filePaths(lint, singularKey: "path", pluralKey: "paths"), duplicateKeys: toml.bool(lint, "duplicateKeys") ?? true, emptyValues: toml.bool(lint, "emptyValues") ?? true ) @@ -22,7 +22,7 @@ extension LintOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[lint]"] - lines.append("paths = \"\(Toml.convertToString(paths))\"") + lines.append("paths = \(paths)") lines.append("duplicateKeys = \(duplicateKeys)") lines.append("emptyValues = \(emptyValues)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift index 411daf5..0eff5bd 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/CodeOptions.swift @@ -17,8 +17,8 @@ extension CodeOptions: TomlCodable { let code: String = "code" return CodeOptions( - codePaths: toml.stringArray(update, code, "codePaths") ?? toml.stringArray(update, code, "codePath") ?? ["."], - localizablePaths: toml.stringArray(update, code, "localizablePaths") ?? toml.stringArray(update, code, "localizablePath") ?? ["."], + codePaths: toml.filePaths(update, code, singularKey: "codePath", pluralKey: "codePaths"), + localizablePaths: toml.filePaths(update, code, singularKey: "localizablePath", pluralKey: "localizablePaths"), defaultToKeys: toml.bool(update, code, "defaultToKeys") ?? false, additive: toml.bool(update, code, "additive") ?? true, customFunction: toml.string(update, code, "customFunction"), @@ -30,8 +30,8 @@ extension CodeOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.code]"] - lines.append("codePaths = \"\(Toml.convertToString(codePaths))\"") - lines.append("localizablePaths = \"\(Toml.convertToString(localizablePaths))\"") + lines.append("codePaths = \(codePaths)") + lines.append("localizablePaths = \(localizablePaths)") lines.append("defaultToKeys = \(defaultToKeys)") lines.append("additive = \(additive)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift index 13497b2..1606c49 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/InterfacesOptions.swift @@ -14,7 +14,7 @@ extension InterfacesOptions: TomlCodable { let interfaces: String = "interfaces" return InterfacesOptions( - paths: toml.stringArray(update, interfaces, "paths") ?? toml.stringArray(update, interfaces, "path") ?? ["."], + paths: toml.filePaths(update, interfaces, singularKey: "path", pluralKey: "paths"), defaultToBase: toml.bool(update, interfaces, "defaultToBase") ?? false, ignoreEmptyStrings: toml.bool(update, interfaces, "ignoreEmptyStrings") ?? false, unstripped: toml.bool(update, interfaces, "unstripped") ?? false @@ -24,7 +24,7 @@ extension InterfacesOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.interfaces]"] - lines.append("paths = \"\(Toml.convertToString(paths))\"") + lines.append("paths = \(paths)") lines.append("defaultToBase = \(defaultToBase)") lines.append("ignoreEmptyStrings = \(ignoreEmptyStrings)") lines.append("unstripped = \(unstripped)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift index 88dd4d0..d0a6c44 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/NormalizeOptions.swift @@ -14,7 +14,7 @@ extension NormalizeOptions: TomlCodable { let normalize: String = "normalize" return NormalizeOptions( - paths: toml.stringArray(update, normalize, "paths") ?? toml.stringArray(update, normalize, "path") ?? ["."], + paths: toml.filePaths(update, normalize, singularKey: "path", pluralKey: "paths"), sourceLocale: toml.string(update, normalize, "sourceLocale") ?? "en", harmonizeWithSource: toml.bool(update, normalize, "harmonizeWithSource") ?? true, sortByKeys: toml.bool(update, normalize, "sortByKeys") ?? true @@ -24,7 +24,7 @@ extension NormalizeOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.normalize]"] - lines.append("paths = \"\(Toml.convertToString(paths))\"") + lines.append("paths = \(paths)") lines.append("sourceLocale = \"\(sourceLocale)\"") lines.append("harmonizeWithSource = \(harmonizeWithSource)") lines.append("sortByKeys = \(sortByKeys)") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift index 11f2cc2..d5f7465 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TransformOptions.swift @@ -25,8 +25,8 @@ extension TransformOptions: TomlCodable { } return TransformOptions( - codePaths: toml.stringArray(update, transform, "codePaths") ?? toml.stringArray(update, transform, "codePath") ?? ["."], - localizablePaths: toml.stringArray(update, transform, "localizablePaths") ?? toml.stringArray(update, transform, "localizablePath") ?? ["."], + codePaths: toml.filePaths(update, transform, singularKey: "codePath", pluralKey: "codePaths"), + localizablePaths: toml.filePaths(update, transform, singularKey: "localizablePath", pluralKey: "localizablePaths"), transformer: transformer, supportedLanguageEnumPath: toml.string(update, transform, "supportedLanguageEnumPath") ?? ".", typeName: toml.string(update, transform, "typeName") ?? "BartyCrouch", @@ -38,8 +38,8 @@ extension TransformOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.transform]"] - lines.append("codePaths = \"\(Toml.convertToString(codePaths))\"") - lines.append("localizablePaths = \"\(Toml.convertToString(localizablePaths))\"") + lines.append("codePaths = \(codePaths)") + lines.append("localizablePaths = \(localizablePaths)") lines.append("transformer = \"\(transformer.rawValue)\"") lines.append("supportedLanguageEnumPath = \"\(supportedLanguageEnumPath)\"") lines.append("typeName = \"\(typeName)\"") diff --git a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift index e6ad947..6000e45 100644 --- a/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift +++ b/Sources/BartyCrouchKit/Configuration/Options/UpdateOptions/TranslateOptions.swift @@ -14,7 +14,7 @@ extension TranslateOptions: TomlCodable { let translate: String = "translate" if let secret: String = toml.string(update, translate, "secret") { - let paths = toml.stringArray(update, translate, "paths") ?? toml.stringArray(update, translate, "path") ?? ["."] + let paths = toml.filePaths(update, translate, singularKey: "path", pluralKey: "paths") let sourceLocale: String = toml.string(update, translate, "sourceLocale") ?? "en" return TranslateOptions(paths: paths, secret: secret, sourceLocale: sourceLocale) } else { @@ -25,7 +25,7 @@ extension TranslateOptions: TomlCodable { func tomlContents() -> String { var lines: [String] = ["[update.translate]"] - lines.append("paths = \"\(Toml.convertToString(paths))\"") + lines.append("paths = \(paths)") lines.append("secret = \"\(secret)\"") lines.append("sourceLocale = \"\(sourceLocale)\"") diff --git a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift index 9f08c13..b66bab9 100644 --- a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift +++ b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift @@ -4,15 +4,7 @@ import Foundation import Toml extension Toml { - static func convertToString(_ array: [String]) -> String { - if array.count == 1, let first = array.first { - return first - } - - return "\(array)" - } - - public func stringArray(_ path: String...) -> [String]? { - return array(path) ?? string(path).map { [$0] } + public func filePaths(_ path: String..., singularKey: String, pluralKey: String) -> [String] { + return array(path + [pluralKey]) ?? string(path + [singularKey]).map { [$0] } ?? ["."] } } diff --git a/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift b/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift index 3b8098c..76a3686 100644 --- a/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift +++ b/Tests/BartyCrouchKitTests/Configuration/ConfigurationTests.swift @@ -59,8 +59,8 @@ class ConfigurationTests: XCTestCase { unstripped = true [update.code] - codePaths = "Sources" - localizablePaths = "Sources/SupportingFiles" + codePaths = ["Sources"] + localizablePaths = ["Sources/SupportingFiles"] defaultToKeys = true additive = false customFunction = "MyOwnLocalizedString" @@ -68,8 +68,8 @@ class ConfigurationTests: XCTestCase { unstripped = true [update.transform] - codePaths = "Sources" - localizablePaths = "Sources/SupportingFiles" + codePaths = ["Sources"] + localizablePaths = ["Sources/SupportingFiles"] transformer = "swiftgenStructured" supportedLanguageEnumPath = "Sources/SupportingFiles" typeName = "BC" @@ -77,20 +77,20 @@ class ConfigurationTests: XCTestCase { customLocalizableName = "MyOwnLocalizable" [update.normalize] - paths = "Sources" + paths = ["Sources"] sourceLocale = "de" harmonizeWithSource = false sortByKeys = false [update.translate] - paths = "Sources" + paths = ["Sources"] api = "bing" id = "bingId" secret = "bingSecret" sourceLocale = "de" [lint] - paths = "Sources" + paths = ["Sources"] duplicateKeys = false emptyValues = false @@ -146,14 +146,14 @@ class ConfigurationTests: XCTestCase { tasks = ["interfaces", "code", "transform"] [update.interfaces] - paths = "Sources" + paths = ["Sources"] defaultToBase = true ignoreEmptyStrings = true unstripped = true [update.code] - codePaths = "Sources" - localizablePaths = "Sources/SupportingFiles" + codePaths = ["Sources"] + localizablePaths = ["Sources/SupportingFiles"] defaultToKeys = true additive = false customFunction = "MyOwnLocalizedString" @@ -161,26 +161,26 @@ class ConfigurationTests: XCTestCase { unstripped = true [update.transform] - codePaths = "." - localizablePaths = "." + codePaths = ["."] + localizablePaths = ["."] transformer = "foundation" supportedLanguageEnumPath = "." typeName = "BartyCrouch" translateMethodName = "translate" [update.translate] - paths = "Sources" + paths = ["Sources"] secret = "bingSecret" sourceLocale = "de" [update.normalize] - paths = "Sources" + paths = ["Sources"] sourceLocale = "de" harmonizeWithSource = false sortByKeys = false [lint] - paths = "Sources" + paths = ["Sources"] duplicateKeys = false emptyValues = false From 21a57660761edccb7ef839930dad2b41482d30d8 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Mon, 30 Mar 2020 12:21:46 +0200 Subject: [PATCH 29/36] Fix tests for Swift < 5.1 --- Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift index b063792..376b297 100644 --- a/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift +++ b/Sources/BartyCrouchKit/Globals/Extensions/ArrayExtension.swift @@ -3,7 +3,7 @@ import Foundation extension Array where Element: Hashable { - func withoutDuplicates() -> Self { + func withoutDuplicates() -> Array { var seen = [Element: Bool]() return filter { seen.updateValue(true, forKey: $0) == nil } } From bfa82fe52ff7772c04a3b9123df27583af960737 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Mon, 30 Mar 2020 12:25:42 +0200 Subject: [PATCH 30/36] Fix printing --- Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift index 9e8033b..061dccf 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift @@ -260,9 +260,9 @@ public class CommandLineActor { print("Temporary strings files couldn't be deleted at path '\(extractedStringsFileDirectory)'", level: .error) return } - } - print("Successfully updated strings file(s) of Code files.", level: .success, file: inputDirectoryPaths.last) + print("Successfully updated strings file(s) of Code files.", level: .success, file: inputDirectoryPath) + } } private func incrementalInterfacesUpdate( From 0d73145c7b303a3522b51ba72f2fe5029dad56d0 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Fri, 10 Apr 2020 17:38:00 +0200 Subject: [PATCH 31/36] Fix license year --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index 561a6c8..d3de1ab 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2018 Flinesoft +Copyright (c) 2016-2020 Flinesoft Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 830dbaa2f37387b76b584f4d0c35750d1695f002 Mon Sep 17 00:00:00 2001 From: Frederick Pietschmann <19194800+fredpi@users.noreply.github.com> Date: Fri, 10 Apr 2020 17:54:34 +0200 Subject: [PATCH 32/36] Fix SwiftLint warnings --- .swiftlint.yml | 1 - Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift | 4 ++-- Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift | 4 +++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index a4e83e7..3e530b5 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -30,7 +30,6 @@ opt_in_rules: - multiline_parameters - multiline_parameters_brackets - nimble_operator -- no_extension_access_modifier - number_separator - object_literal - operator_usage_whitespace diff --git a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift index b66bab9..b3e21ae 100644 --- a/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift +++ b/Sources/BartyCrouchKit/Globals/Extensions/TomlExtension.swift @@ -3,8 +3,8 @@ import Foundation import Toml -extension Toml { - public func filePaths(_ path: String..., singularKey: String, pluralKey: String) -> [String] { +public extension Toml { + func filePaths(_ path: String..., singularKey: String, pluralKey: String) -> [String] { return array(path + [pluralKey]) ?? string(path + [singularKey]).map { [$0] } ?? ["."] } } diff --git a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift index 061dccf..2365629 100644 --- a/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift +++ b/Sources/BartyCrouchKit/OldCommandLine/CommandLineActor.swift @@ -28,7 +28,9 @@ public class CommandLineActor { customLocalizableName: String? ) { let localizableFileName = customLocalizableName ?? "Localizable" - let allLocalizableStringsFilePaths = localizables.flatMap { StringsFilesSearch.shared.findAllStringsFiles(within: $0, withFileName: localizableFileName) }.withoutDuplicates() + let allLocalizableStringsFilePaths = localizables.flatMap { + StringsFilesSearch.shared.findAllStringsFiles(within: $0, withFileName: localizableFileName) + }.withoutDuplicates() guard !allLocalizableStringsFilePaths.isEmpty else { print("No `\(localizableFileName).strings` file found for output.\nTo fix this, please add a `\(localizableFileName).strings` file to your project and click the localize button for the file in Xcode. Alternatively remove the line beginning with `bartycrouch code` in your build script to remove this feature entirely if you don't need it.\nSee https://github.com/Flinesoft/BartyCrouch/issues/11 for further information.", level: .error) // swiftlint:disable:this line_length From 8e5e5f2dafa00120fa033f41571c2f07b29b5bd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 10 Apr 2020 18:50:02 +0200 Subject: [PATCH 33/36] Adjust Changelog & License file formats --- CHANGELOG.md | 6 +++--- LICENSE | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ccca734..d769fd8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ Each entry should use the following format: ```markdown - Summary of what was changed in a single line using past tense & followed by two whitespaces. - Issue: [#0](https://github.com/Flinesoft/HandySwift/issues/0) | PR: [#0](https://github.com/Flinesoft/HandySwift/pull/0) | Author: [Cihat Gündüz](https://github.com/Jeehut) + Issue: [#0](https://github.com/Flinesoft/BartyCrouch/issues/0) | PR: [#0](https://github.com/Flinesoft/BartyCrouch/pull/0) | Author: [Cihat Gündüz](https://github.com/Jeehut) ``` Note that at the end of the summary line, you need to add two whitespaces (` `) for correct rendering on GitHub. @@ -19,8 +19,8 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [Unreleased] ### Added -- Add support for specifying multiple paths. Fixes [#155](https://github.com/Flinesoft/BartyCrouch/issues/155) by [Frederick Pietschmann](https://github.com/fredpi). - +- Add support for specifying multiple paths for all `path` options. + Issue: [#155](https://github.com/Flinesoft/BartyCrouch/issues/155) | PR: [#167](https://github.com/Flinesoft/HandySwift/pull/167) | Author: [Frederick Pietschmann](https://github.com/fredpi) ### Changed - Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. Issue: [#170](https://github.com/Flinesoft/BartyCrouch/issues/170) | PRs: [#171](https://github.com/Flinesoft/BartyCrouch/pull/171), [#172](https://github.com/Flinesoft/BartyCrouch/pull/172), [#173](https://github.com/Flinesoft/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) diff --git a/LICENSE b/LICENSE index d3de1ab..d7d735a 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2016-2020 Flinesoft +Copyright (c) 2016-2020 Flinesoft (alias Cihat Gündüz) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From c74ea0d860feca5971355609639c2d75a58a7685 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 10 Apr 2020 19:01:50 +0200 Subject: [PATCH 34/36] Apply any leftover changes from PR #173 --- .../FileHandling/TranslateTransformer.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift b/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift index 0e1471b..928e37c 100644 --- a/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift +++ b/Sources/BartyCrouchKit/FileHandling/TranslateTransformer.swift @@ -19,7 +19,7 @@ class TranslateTransformer: SyntaxRewriter { // swiftlint:disable:next function_body_length cyclomatic_complexity override func visit(_ functionCallExpression: FunctionCallExprSyntax) -> ExprSyntax { - let functionCallExpressionMap = Array(functionCallExpression.children.lazy.prefix(3)) + let functionCallExpressionMap = Array(functionCallExpression.children.makeIterator().lazy.prefix(3)) guard let memberAccessExpression = functionCallExpressionMap[0].as(MemberAccessExprSyntax.self), @@ -34,7 +34,7 @@ class TranslateTransformer: SyntaxRewriter { return super.visit(functionCallExpression) } - let functionCallArgumentListMap = Array(functionCallArgumentList.children.lazy.prefix(3)) + let functionCallArgumentListMap = Array(functionCallArgumentList.children.makeIterator().lazy.prefix(3)) guard let keyFunctionCallArgument = functionCallArgumentListMap[0].as(TupleExprElementSyntax.self), @@ -46,7 +46,7 @@ class TranslateTransformer: SyntaxRewriter { return super.visit(functionCallExpression) } - let translationsFunctionCallArgumentMap = Array(translationsFunctionCallArgument.children.lazy.prefix(3)) + let translationsFunctionCallArgumentMap = Array(translationsFunctionCallArgument.children.makeIterator().lazy.prefix(3)) guard let translationsDictionaryExpression = translationsFunctionCallArgumentMap[2].as(DictionaryExprSyntax.self) @@ -64,7 +64,7 @@ class TranslateTransformer: SyntaxRewriter { var translations: [CodeFileHandler.TranslationElement] = [] - let translationsDictionaryExpressionMap = Array(translationsDictionaryExpression.children.lazy.prefix(3)) + let translationsDictionaryExpressionMap = Array(translationsDictionaryExpression.children.makeIterator().lazy.prefix(3)) if let translationsDictionaryElementList = translationsDictionaryExpressionMap[1].as(DictionaryElementListSyntax.self) { for dictionaryElement in translationsDictionaryElementList { From e7ab113dbe46b8831bdabd433db44537c8824e83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 10 Apr 2020 19:06:37 +0200 Subject: [PATCH 35/36] Bump version num & finalize new Changelog section --- BartyCrouch.podspec | 2 +- CHANGELOG.md | 18 ++++++++++++------ README.md | 6 +++--- Sources/BartyCrouch/main.swift | 2 +- Sources/SupportingFiles/Info.plist | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/BartyCrouch.podspec b/BartyCrouch.podspec index 19ba9e9..ffff219 100644 --- a/BartyCrouch.podspec +++ b/BartyCrouch.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "BartyCrouch" - s.version = "4.0.2" + s.version = "4.1.0" s.summary = "Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files." s.description = <<-DESC diff --git a/CHANGELOG.md b/CHANGELOG.md index d769fd8..6ce0e7f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,13 +19,9 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ## [Unreleased] ### Added -- Add support for specifying multiple paths for all `path` options. - Issue: [#155](https://github.com/Flinesoft/BartyCrouch/issues/155) | PR: [#167](https://github.com/Flinesoft/HandySwift/pull/167) | Author: [Frederick Pietschmann](https://github.com/fredpi) +- None. ### Changed -- Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. - Issue: [#170](https://github.com/Flinesoft/BartyCrouch/issues/170) | PRs: [#171](https://github.com/Flinesoft/BartyCrouch/pull/171), [#172](https://github.com/Flinesoft/BartyCrouch/pull/172), [#173](https://github.com/Flinesoft/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) -- Updated all dependencies to their latest versions to prevent warnings. - PR: [#172](https://github.com/Flinesoft/BartyCrouch/pull/172) | Author: [Cihat Gündüz](https://github.com/Jeehut) +- None. ### Deprecated - None. ### Removed @@ -35,6 +31,16 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se ### Security - None. +## [4.1.0] - 2020-04-10 +### Added +- Added support for specifying multiple paths for all `path` options. + Issue: [#155](https://github.com/Flinesoft/BartyCrouch/issues/155) | PR: [#167](https://github.com/Flinesoft/HandySwift/pull/167) | Author: [Frederick Pietschmann](https://github.com/fredpi) +### Changed +- Upgraded SwiftSyntax to Swift 5.2 version `0.50200.0`. + Issue: [#170](https://github.com/Flinesoft/BartyCrouch/issues/170) | PRs: [#171](https://github.com/Flinesoft/BartyCrouch/pull/171), [#172](https://github.com/Flinesoft/BartyCrouch/pull/172), [#173](https://github.com/Flinesoft/BartyCrouch/pull/173) | Authors: [Tomoya Hirano](https://github.com/noppefoxwolf), [Cihat Gündüz](https://github.com/Jeehut) +- Updated all dependencies to their latest versions to prevent warnings. + PR: [#172](https://github.com/Flinesoft/BartyCrouch/pull/172) | Author: [Cihat Gündüz](https://github.com/Jeehut) + ## [4.0.2] - 2019-05-13 ### Fixed - Make Code Transform, Normalize & Lint fast again (up to 50x faster). Fixes [#128](https://github.com/Flinesoft/BartyCrouch/issues/128) by [Frederick Pietschmann](https://github.com/fredpi). diff --git a/README.md b/README.md index 4b8ca36..f8f9b42 100644 --- a/README.md +++ b/README.md @@ -11,8 +11,8 @@ - Version: 4.0.2 + Version: 4.1.0 Swift: 5.2 @@ -330,7 +330,7 @@ self.title = L10n.Onboarding.FirstPage.headerTitle * Xcode will mark the freshly transformed code as errors (but build will succeed anyways) until next build. * Not as fast as `code` since [SwiftSyntax](https://github.com/apple/swift-syntax) currently isn't [particularly fast](https://www.jpsim.com/evaluating-swiftsyntax-for-use-in-swiftlint/). (But this should improve over time!) -NOTE: As of version 4.0.x of BartyCrouch *formatted* localized Strings are not supported by this automatic feature. +NOTE: As of version 4.x of BartyCrouch *formatted* localized Strings are not supported by this automatic feature. ### Build Script diff --git a/Sources/BartyCrouch/main.swift b/Sources/BartyCrouch/main.swift index b023430..b6f5381 100644 --- a/Sources/BartyCrouch/main.swift +++ b/Sources/BartyCrouch/main.swift @@ -5,7 +5,7 @@ import SwiftCLI // MARK: - CLI let cli = CLI( name: "bartycrouch", - version: "4.0.2", + version: "4.1.0", description: "Incrementally update & translate your Strings files from code or interface files." ) diff --git a/Sources/SupportingFiles/Info.plist b/Sources/SupportingFiles/Info.plist index 36639bf..cda1a3d 100644 --- a/Sources/SupportingFiles/Info.plist +++ b/Sources/SupportingFiles/Info.plist @@ -15,7 +15,7 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 4.0.2 + 4.1.0 CFBundleVersion $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright From 05f754bdcb390a9cfc20c021b885fb76624fedfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cihat=20Gu=CC=88ndu=CC=88z?= Date: Fri, 10 Apr 2020 19:29:26 +0200 Subject: [PATCH 36/36] Update Package manifest to use Swift 5.2 --- Package.swift | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Package.swift b/Package.swift index 2fb7c5a..0ec10f5 100644 --- a/Package.swift +++ b/Package.swift @@ -1,4 +1,4 @@ -// swift-tools-version:5.0 +// swift-tools-version:5.2 import PackageDescription let package = Package( @@ -7,16 +7,16 @@ let package = Package( products: [ .executable(name: "bartycrouch", targets: ["BartyCrouch"]), .library(name: "BartyCrouchKit", targets: ["BartyCrouchKit"]), - .library(name: "BartyCrouchTranslator", targets: ["BartyCrouchTranslator"]) + .library(name: "BartyCrouchTranslator", targets: ["BartyCrouchTranslator"]), ], dependencies: [ - .package(url: "https://github.com/Flinesoft/HandySwift.git", from: "3.2.0"), - .package(url: "https://github.com/Flinesoft/Microya.git", from: "0.1.1"), - .package(url: "https://github.com/JamitLabs/MungoHealer.git", from: "0.3.2"), - .package(url: "https://github.com/onevcat/Rainbow.git", from: "3.1.5"), - .package(url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.1"), - .package(url: "https://github.com/Jeehut/swift-toml.git", .branch("master")), - .package(url: "https://github.com/apple/swift-syntax.git", .exact("0.50200.0")) + .package(name: "HandySwift", url: "https://github.com/Flinesoft/HandySwift.git", from: "3.2.0"), + .package(name: "Microya", url: "https://github.com/Flinesoft/Microya.git", from: "0.1.1"), + .package(name: "MungoHealer", url: "https://github.com/JamitLabs/MungoHealer.git", from: "0.3.2"), + .package(name: "Rainbow", url: "https://github.com/onevcat/Rainbow.git", from: "3.1.5"), + .package(name: "SwiftCLI", url: "https://github.com/jakeheis/SwiftCLI.git", from: "6.0.1"), + .package(name: "Toml", url: "https://github.com/Jeehut/swift-toml.git", .branch("master")), + .package(name: "SwiftSyntax", url: "https://github.com/apple/swift-syntax.git", .exact("0.50200.0")), ], targets: [ .target( @@ -33,7 +33,7 @@ let package = Package( "Rainbow", "SwiftCLI", "SwiftSyntax", - "Toml" + "Toml", ], path: "Sources/BartyCrouchKit" ),