Skip to content

Commit

Permalink
fix: freeze Cursor implementation (#53)
Browse files Browse the repository at this point in the history
  • Loading branch information
bednar authored Aug 23, 2022
1 parent d61204c commit a8ce9a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ generate-sources: ## Generate Models and APIs from swagger
-v "${PWD}":/code \
-v "${PWD}/Scripts/.m2":/root/.m2 \
-w /code \
maven:3.6-slim /code/Scripts/generate-sources.sh
maven:3-openjdk-8 /code/Scripts/generate-sources.sh
$(MAKE) build

generate-test: ## Generate LinuxMain.swift entries for the package
Expand Down
14 changes: 3 additions & 11 deletions Scripts/generate-sources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ mkdir "${SCRIPT_PATH}"/../Sources/InfluxDBSwiftApis/Generated/Models/ || true
mkdir "${SCRIPT_PATH}"/../Sources/InfluxDBSwiftApis/Generated/APIs/ || true

## delete old sources
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/*.swift
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/APIHelper.swift
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/CodableHelper.swift
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/OpenISO8601DateFormatter.swift
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Models/*.swift
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwiftApis/Generated/*.swift
rm -f "${SCRIPT_PATH}"/../Sources/InfluxDBSwiftApis/Generated/Models/*.swift
Expand Down Expand Up @@ -167,14 +169,4 @@ sed -i '/public var extern: File?/d' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/G
sed -i 's/Set<Annotations>/Array<Annotations>/' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Models/Dialect.swift
sed -i 's/Any/String/' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Models/ScriptInvocationParams.swift

# Download Cursor implementation
curl -s -o "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift https://raw.githubusercontent.com/groue/GRDB.swift/master/GRDB/Core/Cursor.swift
printf '\n@inlinable\nfunc GRDBPrecondition(_ condition: @autoclosure () -> Bool,\n _ message: @autoclosure () -> String = "",\n file: StaticString = #file,\n line: UInt = #line) {\n if !condition() {\n fatalError(message(), file: file, line: line)\n }\n}\n' >> "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift
sed -i 's/GRDBPrecondition/CursorPrecondition/' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift
sed -i 's/try ! predicate/try !predicate/' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift
sed -i '/fetchCursor/d' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift
sed -i '/foo/d' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift
sed -i '/bar/d' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift
sed -i '1i//===----------------------------------------------------------------------===//\n//\n// This file are derived from the GRDB.swift open source project: https://github.com/groue/GRDB.swift\n//\n// Copyright (C) 2015-2020 Gwendal Roué\n//\n// See https://github.com/groue/GRDB.swift/blob/master/LICENSE for license information\n//\n//===----------------------------------------------------------------------===//' "${SCRIPT_PATH}"/../Sources/InfluxDBSwift/Generated/Cursor.swift

rm -rf "${SCRIPT_PATH}"/generated

0 comments on commit a8ce9a2

Please sign in to comment.