Skip to content

Commit

Permalink
Merge branch 'release/4.13.0' into versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeehut committed Oct 7, 2022
2 parents f2515c0 + 3a3e55d commit 36cc463
Show file tree
Hide file tree
Showing 13 changed files with 37 additions and 21 deletions.
2 changes: 1 addition & 1 deletion BartyCrouch.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "BartyCrouch"
s.version = "4.12.1"
s.version = "4.13.0"
s.summary = "Localization/I18n: Incrementally update/translate your Strings files from .swift, .h, .m(m), .storyboard or .xib files."

s.description = <<-DESC
Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,14 @@ If needed, pluralize to `Tasks`, `PRs` or `Authors` and list multiple entries se
### Security
- None.

## [4.13.0] - 2022-10-07
### Added
- Re-implement option `overrideComments` for code update (see README).
Issues: [#261](https://github.com/FlineDev/BartyCrouch/issues/261) | Author: [Cihat Gündüz](https://github.com/Jeehut)

## [4.12.1] - 2022-10-06
### Fixed
- Fixes an issue with linking of SwiftSyntaxParser. See [here](https://github.com/apple/swift-syntax/commit/4f33e361829415ab913778a582eda3ad682f81c1).
- Fixes an issue with linking of SwiftSyntaxParser which prevented from making a new Homebrew release for 4.12.0. See [here](https://github.com/apple/swift-syntax/commit/4f33e361829415ab913778a582eda3ad682f81c1).

## [4.12.0] - 2022-09-25
### Changed
Expand Down
2 changes: 1 addition & 1 deletion Formula/bartycrouch.rb
Original file line number Diff line number Diff line change
@@ -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.12.0", :revision => "cccf0b38109f70ef0c84ad419dfb25c5b297a868"
url "https://github.com/Flinesoft/BartyCrouch.git", :tag => "4.12.1", :revision => "f2515c0e78b35681602a7b48bc6b08a8d19bf864"
head "https://github.com/Flinesoft/BartyCrouch.git"

depends_on :xcode => ["14.0", :build]
Expand Down
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ bartycrouch: $(SOURCES)
@swift build \
-c release \
--disable-sandbox \
--build-path "$(BUILDDIR)"
--scratch-path "$(BUILDDIR)" \
-Xlinker -dead_strip_dylibs

bartycrouch_universal: $(SOURCES)
@swift build \
-c release \
--arch arm64 --arch x86_64 \
--disable-sandbox \
--build-path "$(BUILDDIR)"
--scratch-path "$(BUILDDIR)" \
-Xlinker -dead_strip_dylibs

.PHONY: install
install: bartycrouch
Expand Down
6 changes: 6 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ let package = Package(
.package(url: "https://github.com/pointfreeco/swift-custom-dump.git", from: "0.3.0"),
],
targets: [
.binaryTarget(
name: "lib_InternalSwiftSyntaxParser",
url: "https://github.com/keith/StaticInternalSwiftSyntaxParser/releases/download/5.7/lib_InternalSwiftSyntaxParser.xcframework.zip",
checksum: "99803975d10b2664fc37cc223a39b4e37fe3c79d3d6a2c44432007206d49db15"
),
.executableTarget(
name: "BartyCrouch",
dependencies: ["BartyCrouchKit"]
Expand All @@ -38,6 +43,7 @@ let package = Package(
"SwiftCLI",
.product(name: "SwiftSyntaxParser", package: "swift-syntax"),
.product(name: "SwiftSyntax", package: "swift-syntax"),
"lib_InternalSwiftSyntaxParser",
"BartyCrouchUtility",
]
),
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<img src="https://api.codacy.com/project/badge/Coverage/7b34ad9193c2438aa32aa29a0490451f"/>
</a>
<a href="https://github.com/FlineDev/BartyCrouch/releases">
<img src="https://img.shields.io/badge/Version-4.12.1-blue.svg"
alt="Version: 4.12.1">
<img src="https://img.shields.io/badge/Version-4.13.0-blue.svg"
alt="Version: 4.13.0">
</a>
<img src="https://img.shields.io/badge/Swift-5.7-FFAC45.svg"
alt="Swift: 5.7">
Expand Down Expand Up @@ -263,6 +263,7 @@ tasks = ["interfaces", "code", "transform", "normalize"]
- `unstripped`: Keeps whitespaces at beginning & end of Strings files.
- `plistArguments`: Use a plist file to store all the code files for the ExtractLocStrings tool. (Recommended for large projects.)
- `ignoreKeys`: Keys (e.g. in the comment) indicating that specific translation entries should be ignored when generating String files.
- `overrideComments`: Always overrides the comment with the keys new translation, useful for IB files.

</details>

Expand Down
2 changes: 1 addition & 1 deletion Sources/BartyCrouch/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import SwiftCLI
// MARK: - CLI
let cli = CLI(
name: "bartycrouch",
version: "4.12.1",
version: "4.13.0",
description: "Incrementally update & translate your Strings files from code or interface files."
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public struct CodeOptions {
public let unstripped: Bool
public let plistArguments: Bool
public let ignoreKeys: [String]
public let overrideComments: Bool
}

extension CodeOptions: TomlCodable {
Expand All @@ -30,7 +31,8 @@ extension CodeOptions: TomlCodable {
customLocalizableName: toml.string(update, code, "customLocalizableName"),
unstripped: toml.bool(update, code, "unstripped") ?? false,
plistArguments: toml.bool(update, code, "plistArguments") ?? true,
ignoreKeys: toml.array(update, code, "ignoreKeys") ?? Constants.defaultIgnoreKeys
ignoreKeys: toml.array(update, code, "ignoreKeys") ?? Constants.defaultIgnoreKeys,
overrideComments: toml.bool(update, code, "overrideComments") ?? false
)
}

Expand All @@ -54,6 +56,7 @@ extension CodeOptions: TomlCodable {
lines.append("unstripped = \(unstripped)")
lines.append("plistArguments = \(plistArguments)")
lines.append("ignoreKeys = \(Constants.defaultIgnoreKeys)")
lines.append("overrideComments = \(overrideComments)")

return lines.joined(separator: "\n")
}
Expand Down
12 changes: 5 additions & 7 deletions Sources/BartyCrouchKit/FileHandling/CodeFilesSearch.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ extension Array where Element == String {
func containsCaseInsensitive(subarray: [Element]) -> Bool {
guard let firstSubArrayElement = subarray.first else { return false }

for (index, element) in enumerated() {
// sample: this = [a, b, c], subarray = [b, c], firstIndex = 1, subRange = 1 ..< 3
if element.lowercased() == firstSubArrayElement.lowercased() {
let subRange = index..<index + subarray.count
let subRangeElements = self[subRange]
return subRangeElements.map { $0.lowercased() } == subarray.map { $0.lowercased() }
}
// sample: this = [a, b, c], subarray = [b, c], firstIndex = 1, subRange = 1 ..< 3
for (index, element) in enumerated() where element.lowercased() == firstSubArrayElement.lowercased() {
let subRange = index..<index + subarray.count
let subRangeElements = self[subRange]
return subRangeElements.map { $0.lowercased() } == subarray.map { $0.lowercased() }
}

return false
Expand Down
4 changes: 2 additions & 2 deletions Sources/BartyCrouchKit/FileHandling/StringsFileUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ extension String {
}

func containsAny(of substrings: [String]) -> Bool {
for substring in substrings { // swiftlint:disable:this if_as_guard
if contains(substring) { return true }
for substring in substrings where contains(substring) {
return true
}

return false
Expand Down
2 changes: 1 addition & 1 deletion Sources/BartyCrouchKit/TaskHandlers/CodeTaskHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ extension CodeTaskHandler: TaskHandler {
localizables: options.localizablePaths,
defaultToKeys: options.defaultToKeys,
additive: options.additive,
overrideComments: false,
overrideComments: options.overrideComments,
unstripped: options.unstripped,
customFunction: options.customFunction,
customLocalizableName: options.customLocalizableName,
Expand Down
2 changes: 1 addition & 1 deletion Sources/SupportingFiles/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.12.1</string>
<string>4.13.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>
Expand Down
3 changes: 2 additions & 1 deletion build-script.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash
set -euxo pipefail

swift-format --recursive Sources Tests Package.swift --in-place
# turned off due to Swift 5.7 update issue
#swift-format --recursive Sources Tests Package.swift --in-place

swiftlint --strict

0 comments on commit 36cc463

Please sign in to comment.