Adding gyb discrepancy check to sanity script. (#13)

* 1) Adding gyb to scripts
2) Adding warning in gyb files about gyb overwritting manual edits to gyb generated swift files
3) Updated README with gyb instructions
4) Adding script for running all gyb generation
5) Adding CI check for discrepancies in gyb generated files

* Updating Dockerfile
This commit is contained in:
Alexander Cyon authored and GitHub committed 2020-02-05 17:44:21 +00:00
1 parent 36ea42cbb3
commit de232cbd67
15 files changed
+1366 -20

No files matched your search

+5 -1
View File
@@ -14,6 +14,9 @@
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
@_exported import CryptoKit
#else
// MARK: - Generated file, do NOT edit
// any edits of this file WILL be overwritten and thus discarded
// see section `gyb` in `README` for details.
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct SHA256Digest: DigestPrivate {
@@ -61,6 +64,7 @@ public struct SHA256Digest: DigestPrivate {
}
}
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct SHA384Digest: DigestPrivate {
let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
@@ -109,6 +113,7 @@ public struct SHA384Digest: DigestPrivate {
}
}
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct SHA512Digest: DigestPrivate {
let bytes: (UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64, UInt64)
@@ -205,7 +210,6 @@ public struct SHA1Digest: DigestPrivate {
}
}
}
extension Insecure {
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct MD5Digest: DigestPrivate {
+5 -6
View File
@@ -14,27 +14,26 @@
#if (os(macOS) || os(iOS) || os(watchOS) || os(tvOS)) && CRYPTO_IN_SWIFTPM && !CRYPTO_IN_SWIFTPM_FORCE_BUILD_API
@_exported import CryptoKit
#else
// MARK: - Generated file, do NOT edit
// any edits of this file WILL be overwritten and thus discarded
// see section `gyb` in `README` for details.
%{
digests_and_length = [{"name": "SHA256", "count": 32},{"name": "SHA384","count":48},{"name":"SHA512", "count": 64},{"name":"SHA1", "count":20, "prefix":"Insecure"},{"name":"MD5", "count":16, "prefix":"Insecure"}]
}%
% for HF in digests_and_length:
%{
name = HF["name"]
byteCount = HF["count"]
wordsCount = (byteCount*8)/64 + (0 if ((byteCount*8)%64) == 0 else 1)
}%
%{
if "prefix" in HF.keys():
protocol_prefix = "extension " + HF["prefix"] + "{"
protocol_prefix = "extension " + HF["prefix"] + " {"
protocol_suffix = "}"
else:
protocol_prefix = ""
protocol_suffix = ""
}%
${protocol_prefix}
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, macCatalyst 13.0, *)
public struct ${name}Digest: DigestPrivate {
@@ -78,7 +77,7 @@ public struct ${name}Digest: DigestPrivate {
}
public func hash(into hasher: inout Hasher) {
self.withUnsafeBytes {hasher.combine(bytes: $0)}
self.withUnsafeBytes { hasher.combine(bytes: $0) }
}
}
${protocol_suffix}