diff --git a/Package.swift b/Package.swift index 752bfda..7b203da 100644 --- a/Package.swift +++ b/Package.swift @@ -6,8 +6,8 @@ import PackageDescription let package = Package( name: "simple-formatting", products: [ - .library(name: "SimpleDurationFormatting", - targets: ["SimpleDurationFormatting"]), + .library(name: "DurationFormatting", + targets: ["DurationFormatting"]), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -49,13 +49,13 @@ let package = Package( // "CICUIO", ]), .target( - name: "SimpleDurationFormatting", + name: "DurationFormatting", dependencies: ["CICUShims"]), .testTarget( - name: "SimpleDurationFormattingTests", + name: "DurationFormattingTests", dependencies: [ "CICUShims", - "SimpleDurationFormatting", + "DurationFormatting", ]), ], cxxLanguageStandard: .cxx14 diff --git a/Package@swift-5.5.swift b/Package@swift-5.5.swift index cfaa620..30d6e2f 100644 --- a/Package@swift-5.5.swift +++ b/Package@swift-5.5.swift @@ -6,8 +6,8 @@ import PackageDescription let package = Package( name: "simple-formatting", products: [ - .library(name: "SimpleDurationFormatting", - targets: ["SimpleDurationFormatting"]), + .library(name: "DurationFormatting", + targets: ["DurationFormatting"]), ], targets: [ // Targets are the basic building blocks of a package. A target can define a module or a test suite. @@ -49,13 +49,13 @@ let package = Package( // "CICUIO", ]), .target( - name: "SimpleDurationFormatting", + name: "DurationFormatting", dependencies: ["CICUShims"]), .testTarget( - name: "SimpleDurationFormattingTests", + name: "DurationFormattingTests", dependencies: [ "CICUShims", - "SimpleDurationFormatting", + "DurationFormatting", ]), ], cxxLanguageStandard: .cxx14 diff --git a/Sources/CICUCommon/CICUCommon.h b/Sources/CICUCommon/CICUCommon.h index 6ce15f6..e864853 100644 --- a/Sources/CICUCommon/CICUCommon.h +++ b/Sources/CICUCommon/CICUCommon.h @@ -4,9 +4,5 @@ //#include //#include //#include -//#include -//#include -//#include -//#include #endif /* CICUCommon_h */ diff --git a/Sources/CICUCommon/module.modulemap b/Sources/CICUCommon/module.modulemap index aea8843..2ff17d2 100644 --- a/Sources/CICUCommon/module.modulemap +++ b/Sources/CICUCommon/module.modulemap @@ -1,4 +1,5 @@ module CICUCommon [system] { + requires cplusplus11 umbrella header "CICUCommon.h" link "icuuc" } diff --git a/Sources/CICUData/CICUData.h b/Sources/CICUData/CICUData.h index 63b30b2..4716691 100644 --- a/Sources/CICUData/CICUData.h +++ b/Sources/CICUData/CICUData.h @@ -1,12 +1,4 @@ #ifndef CICUData_h #define CICUData_h -//#include -//#include -//#include -//#include -//#include -//#include -//#include - #endif /* CICUData_h */ diff --git a/Sources/CICUData/module.modulemap b/Sources/CICUData/module.modulemap index d6d5e4d..d8090ba 100644 --- a/Sources/CICUData/module.modulemap +++ b/Sources/CICUData/module.modulemap @@ -1,4 +1,5 @@ module CICUData [system] { + requires cplusplus11 umbrella header "CICUData.h" link "icudata" } diff --git a/Sources/CICUI18N/CICUI18N.h b/Sources/CICUI18N/CICUI18N.h index f198d56..df6c76c 100644 --- a/Sources/CICUI18N/CICUI18N.h +++ b/Sources/CICUI18N/CICUI18N.h @@ -1,9 +1,6 @@ #ifndef CICUI18N_h #define CICUI18N_h -//#include -//#include -//#include //#include //#include //#include diff --git a/Sources/CICUI18N/module.modulemap b/Sources/CICUI18N/module.modulemap index e4062ab..b305105 100644 --- a/Sources/CICUI18N/module.modulemap +++ b/Sources/CICUI18N/module.modulemap @@ -1,4 +1,5 @@ module CICUI18N [system] { + requires cplusplus11 umbrella header "CICUI18N.h" link "icui18n" } diff --git a/Sources/CICUIO/CICUIO.h b/Sources/CICUIO/CICUIO.h index 99720cc..4362c56 100644 --- a/Sources/CICUIO/CICUIO.h +++ b/Sources/CICUIO/CICUIO.h @@ -1,12 +1,4 @@ #ifndef CICUIO_h #define CICUIO_h -//#include -//#include -//#include -//#include -//#include -//#include -//#include - #endif /* CICUIO_h */ diff --git a/Sources/CICUIO/module.modulemap b/Sources/CICUIO/module.modulemap index a55166d..818846e 100644 --- a/Sources/CICUIO/module.modulemap +++ b/Sources/CICUIO/module.modulemap @@ -1,4 +1,5 @@ module CICUIO [system] { + requires cplusplus11 umbrella header "CICUIO.h" link "icuio" } diff --git a/Sources/CICUShims/DurationFormat.cpp b/Sources/CICUShims/DurationFormat.cpp index de23680..6c084bd 100644 --- a/Sources/CICUShims/DurationFormat.cpp +++ b/Sources/CICUShims/DurationFormat.cpp @@ -21,12 +21,12 @@ _CICUResultTypeImpl(Formatting, const char * CICUNonnull, true); CICUFormattingResult _cicu_makeResultFromUnicodeString(UErrorCode status, icu::UnicodeString str) { if (U_FAILURE(status)) return CICUFormattingResultMakeFailure(status); - // FIXME: Is there a way to use const char directly? + // FIXME: Is there a way to use (const) char directly? std::string outBuf; str.toUTF8String(outBuf); char *coutBuf = (char *)calloc(outBuf.length() + 1, sizeof(char)); auto copied = outBuf.copy(coutBuf, outBuf.length()); - assert(copied == outBuf.length() || "Incomplete string copy!"); + assert(copied == outBuf.length() && "Incomplete string copy!"); return CICUFormattingResultMake(status, coutBuf); } diff --git a/Sources/CICUShims/include/Defines.h b/Sources/CICUShims/include/Defines.h index 736c687..fcadb8e 100644 --- a/Sources/CICUShims/include/Defines.h +++ b/Sources/CICUShims/include/Defines.h @@ -68,7 +68,7 @@ #endif #ifndef cicu_swift_newtype -#if __has_attribute(__swift_newtype__) +#if __has_attribute(__swift_newtype__) && !defined(CICU_NO_SWIFT_ANNOTATIONS) #define cicu_swift_newtype(type) __attribute__((__swift_newtype__(type))) #else #define cicu_swift_newtype(type) diff --git a/Sources/CICUShims/include/TimeComponents.h b/Sources/CICUShims/include/TimeComponents.h index 421ac91..a2b4a6f 100644 --- a/Sources/CICUShims/include/TimeComponents.h +++ b/Sources/CICUShims/include/TimeComponents.h @@ -1,7 +1,7 @@ #ifndef TimeComponents_h #define TimeComponents_h -#include "stdbool.h" +#include #include "Defines.h" #ifdef __cplusplus diff --git a/Sources/SimpleDurationFormatting/SimpleDurationFormatter.swift b/Sources/DurationFormatting/DurationFormatter.swift similarity index 98% rename from Sources/SimpleDurationFormatting/SimpleDurationFormatter.swift rename to Sources/DurationFormatting/DurationFormatter.swift index f07cd05..6fd3fc8 100644 --- a/Sources/SimpleDurationFormatting/SimpleDurationFormatter.swift +++ b/Sources/DurationFormatting/DurationFormatter.swift @@ -34,7 +34,7 @@ public struct TimeComponents { } } -public struct SimpleDurationFormatter { +public struct DurationFormatter { public enum Width { case numeric, short, narrow diff --git a/Tests/SimpleDurationFormattingTests/SimpleDurationFormattingTests.swift b/Tests/DurationFormattingTests/DurationFormattingTests.swift similarity index 97% rename from Tests/SimpleDurationFormattingTests/SimpleDurationFormattingTests.swift rename to Tests/DurationFormattingTests/DurationFormattingTests.swift index 6b4c8b4..9924eb0 100644 --- a/Tests/SimpleDurationFormattingTests/SimpleDurationFormattingTests.swift +++ b/Tests/DurationFormattingTests/DurationFormattingTests.swift @@ -1,10 +1,10 @@ import XCTest import CICUShims -import SimpleDurationFormatting +import DurationFormatting -final class SimpleDurationFormattingTests: XCTestCase { +final class DurationFormattingTests: XCTestCase { private func _testTimeComponents(_ timeComponents: TimeComponents, - with formatter: SimpleDurationFormatter, + with formatter: DurationFormatter, expecting result: String, file: StaticString = #filePath, line: UInt = #line) {