From 5152c98350fc75f2bcfa6f0eaa9c0ae8e8d66c51 Mon Sep 17 00:00:00 2001 From: Bruno Berisso Date: Mon, 15 Apr 2019 12:04:55 +0100 Subject: [PATCH 1/4] Set Swift version to 4.2 and fix AVAudioSession incompatibilitie --- TLSphinx.xcodeproj/project.pbxproj | 8 ++++---- TLSphinx/Decoder.swift | 16 +++++++++++----- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/TLSphinx.xcodeproj/project.pbxproj b/TLSphinx.xcodeproj/project.pbxproj index 0388588..af398dd 100644 --- a/TLSphinx.xcodeproj/project.pbxproj +++ b/TLSphinx.xcodeproj/project.pbxproj @@ -395,7 +395,7 @@ SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = Sphinx/include; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -428,7 +428,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = Sphinx/include; - SWIFT_VERSION = 4.0; + SWIFT_VERSION = 4.2; }; name = Release; }; @@ -454,7 +454,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.tryolabs.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Debug; }; @@ -476,7 +476,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.tryolabs.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 3.0; + SWIFT_VERSION = 4.2; }; name = Release; }; diff --git a/TLSphinx/Decoder.swift b/TLSphinx/Decoder.swift index e95a8c0..f544b2c 100644 --- a/TLSphinx/Decoder.swift +++ b/TLSphinx/Decoder.swift @@ -168,11 +168,17 @@ public final class Decoder { public func startDecodingSpeech (_ utteranceComplete: @escaping (Hypothesis?) -> ()) throws { - do { - try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryRecord) - } catch let error as NSError { - print("Error setting the shared AVAudioSession: \(error)") - throw DecodeErrors.CantSetAudioSession(error) + if #available(iOS 10.0, *) { + do { + try AVAudioSession.sharedInstance().setCategory(.playback, mode: .moviePlayback) + } catch let error as NSError { + print("Error setting the shared AVAudioSession: \(error)") + throw DecodeErrors.CantSetAudioSession(error) + } + } else { + // Workaround until https://forums.swift.org/t/using-methods-marked-unavailable-in-swift-4-2/14949 isn't fixed + AVAudioSession.sharedInstance().perform( + NSSelectorFromString("setCategory:error:"), with: AVAudioSession.Category.playback) } engine = AVAudioEngine() From 4aa8e7d4f266a43976f5f86a354f25070aae1d64 Mon Sep 17 00:00:00 2001 From: Bruno Berisso Date: Mon, 15 Apr 2019 12:43:54 +0100 Subject: [PATCH 2/4] Migrate settings for Xcode 10.2 --- TLSphinx.xcodeproj/project.pbxproj | 31 +++++++++++++++---- .../xcshareddata/xcschemes/TLSphinx.xcscheme | 2 +- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/TLSphinx.xcodeproj/project.pbxproj b/TLSphinx.xcodeproj/project.pbxproj index af398dd..b3ab5db 100644 --- a/TLSphinx.xcodeproj/project.pbxproj +++ b/TLSphinx.xcodeproj/project.pbxproj @@ -187,7 +187,7 @@ attributes = { LastSwiftMigration = 0720; LastSwiftUpdateCheck = 0720; - LastUpgradeCheck = 0800; + LastUpgradeCheck = 1020; ORGANIZATIONNAME = "Bruno Berisso"; TargetAttributes = { 9B5187AE1B18E1E80000E78D = { @@ -202,10 +202,11 @@ }; buildConfigurationList = 9B5187A91B18E1E80000E78D /* Build configuration list for PBXProject "TLSphinx" */; compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 0; knownRegions = ( en, + Base, ); mainGroup = 9B5187A51B18E1E80000E78D; productRefGroup = 9B5187B01B18E1E80000E78D /* Products */; @@ -272,18 +273,27 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -324,18 +334,27 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; CLANG_WARN_SUSPICIOUS_MOVE = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -395,7 +414,7 @@ SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = Sphinx/include; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -428,7 +447,7 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SKIP_INSTALL = YES; SWIFT_INCLUDE_PATHS = Sphinx/include; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; @@ -454,7 +473,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.tryolabs.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -476,7 +495,7 @@ ); PRODUCT_BUNDLE_IDENTIFIER = "com.tryolabs.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; }; name = Release; }; diff --git a/TLSphinx.xcodeproj/xcshareddata/xcschemes/TLSphinx.xcscheme b/TLSphinx.xcodeproj/xcshareddata/xcschemes/TLSphinx.xcscheme index 088983e..c87defe 100644 --- a/TLSphinx.xcodeproj/xcshareddata/xcschemes/TLSphinx.xcscheme +++ b/TLSphinx.xcodeproj/xcshareddata/xcschemes/TLSphinx.xcscheme @@ -1,6 +1,6 @@ Date: Thu, 18 Apr 2019 13:10:11 +0100 Subject: [PATCH 3/4] Reference Carthage site for installation instructions --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 470bcf3..ee83afd 100644 --- a/README.md +++ b/README.md @@ -138,7 +138,9 @@ In your `Cartfile` add a reference to the last version of `TLSphinx`: github "Tryolabs/TLSphinx" ~> 0.0.4 ```` -Then run `carthage update`, this should fetch and build the last version of `TLSphinx`. Once it's done, drag the _TLSphinx.framewok_ bundle to the XCode _Linked Frameworks and Libraries_. You must tell XCode where to find `Sphinx` module that is located in the Carthage checkout. To do so: +Then run `carthage update` and follow the standar [installation instructions] described on the Carthage site. + +You must also tell XCode where to find `Sphinx` module that is located in the Carthage checkout. To do so: - add `$(SRCROOT)/Carthage/Checkouts/TLSphinx/Sphinx/include` to _Header Search Paths_ recursive - add `$(SRCROOT)/Carthage/Checkouts/TLSphinx/Sphinx/lib` to _Library Search Paths_ recursive - in _Swift Compiler - Search Paths_ add `$(SRCROOT)/Carthage/Checkouts/TLSphinx/Sphinx/include` to _Import Paths_ @@ -162,3 +164,4 @@ TLSphinx is available under the MIT license. See the LICENSE file for more info. [Sphinx docs]: http://cmusphinx.sourceforge.net/wiki/ [Tryolabs Blog]: http://blog.tryolabs.com/ [Carthage]: https://github.com/Carthage/Carthage +[installation instructions]: https://github.com/Carthage/Carthage#getting-started From f776f5fcead3380fde6ff3eae099ff739a744389 Mon Sep 17 00:00:00 2001 From: Bruno Berisso Date: Mon, 22 Apr 2019 12:47:40 +0100 Subject: [PATCH 4/4] Update readme to point to latest version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ee83afd..d409f40 100644 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ The easiest way to integrate `TLSphinx` is using [Carthage] or a similar method In your `Cartfile` add a reference to the last version of `TLSphinx`: ```` -github "Tryolabs/TLSphinx" ~> 0.0.4 +github "Tryolabs/TLSphinx" ~> 1.0.1 ```` Then run `carthage update` and follow the standar [installation instructions] described on the Carthage site.