diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 94f2000270b..282e3a6ac34 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -187,7 +187,6 @@ runs: with: path: | clients/algoliasearch-client-swift/.build - tests/output/swift/.build key: swift-build-${{ inputs.version }}-${{ runner.os }} - name: Set swiftformat version diff --git a/clients/algoliasearch-client-swift/Sources/Core/Helpers/APIHelper.swift b/clients/algoliasearch-client-swift/Sources/Core/Helpers/APIHelper.swift index d7f561a83b7..a680e66eb04 100644 --- a/clients/algoliasearch-client-swift/Sources/Core/Helpers/APIHelper.swift +++ b/clients/algoliasearch-client-swift/Sources/Core/Helpers/APIHelper.swift @@ -36,21 +36,6 @@ public enum APIHelper { } } - public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? { - guard let source else { - return nil - } - - return source.reduce(into: [String: Any]()) { result, item in - switch item.value { - case let x as Bool: - result[item.key] = x.description - default: - result[item.key] = item.value - } - } - } - public static func convertAnyToString(_ value: Any?) -> String? { guard let value else { return nil } if let value = value as? any RawRepresentable { diff --git a/playground/swift/Package.resolved b/playground/swift/Package.resolved index 94057e8ce85..5f71f8aa0a2 100644 --- a/playground/swift/Package.resolved +++ b/playground/swift/Package.resolved @@ -14,8 +14,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-asn1.git", "state" : { - "revision" : "ae33e5941bb88d88538d0a6b19ca0b01e6c76dcf", - "version" : "1.3.1" + "revision" : "a54383ada6cecde007d374f58f864e29370ba5c3", + "version" : "1.3.2" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-crypto.git", "state" : { - "revision" : "45305d32cfb830faebcaa9a7aea66ad342637518", - "version" : "3.11.1" + "revision" : "d79c573e1b400d670ed12c0cb29d33f2c0f5ab70", + "version" : "3.12.5" } }, { @@ -50,8 +50,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/apple/swift-log.git", "state" : { - "revision" : "96a2f8a0fa41e9e09af4585e2724c4e825410b91", - "version" : "1.6.2" + "revision" : "ce592ae52f982c847a4efc0dd881cc9eb32d29f2", + "version" : "1.6.4" } }, { diff --git a/scripts/buildLanguages.ts b/scripts/buildLanguages.ts index b7759f468b4..c6783fbb7a6 100644 --- a/scripts/buildLanguages.ts +++ b/scripts/buildLanguages.ts @@ -1,7 +1,7 @@ import { existsSync } from 'node:fs'; import { createClientName, run, toAbsolutePath } from './common.ts'; -import { getLanguageFolder } from './config.ts'; +import { getLanguageFolder, getSwiftBuildFolder } from './config.ts'; import { formatter } from './formatter.ts'; import { createSpinner } from './spinners.ts'; import type { Generator, Language } from './types.ts'; @@ -91,10 +91,7 @@ async function buildLanguage(language: Language, gens: Generator[], buildType: B await run('sbt --batch -Dsbt.server.forcestart=true +compile', { cwd, language }); break; case 'swift': - // make this work in the playground - if (buildType !== 'playground') { - await run('swift build -Xswiftc -suppress-warnings', { cwd, language }); - } + await run(`swift build -Xswiftc -suppress-warnings --build-path ${getSwiftBuildFolder()}`, { cwd, language }); break; default: } diff --git a/scripts/config.ts b/scripts/config.ts index e8d704c3bb9..5d638ae06bc 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -1,6 +1,6 @@ import clientsConfig from '../config/clients.config.json' with { type: 'json' }; -import { CI, createClientName } from './common.ts'; +import { CI, createClientName, toAbsolutePath } from './common.ts'; import type { Generator, Language, LanguageConfig } from './types.ts'; export function getClientsConfigField( @@ -57,6 +57,10 @@ export function getDockerImage(language?: Language): string | undefined { return getClientsConfigField(language, 'dockerImage', false); } +export function getSwiftBuildFolder(): string { + return toAbsolutePath(getLanguageFolder('swift') + '/.build'); +} + /** * Returns the version of the package from clients.config.json, except for JavaScript where it returns the version of javascript-search. */ diff --git a/scripts/cts/runCts.ts b/scripts/cts/runCts.ts index 3e0314c83ec..4395a595896 100644 --- a/scripts/cts/runCts.ts +++ b/scripts/cts/runCts.ts @@ -1,7 +1,7 @@ import fsp from 'fs/promises'; import { exists, isVerbose, run, runComposerInstall, toAbsolutePath } from '../common.ts'; -import { getTestOutputFolder } from '../config.ts'; +import { getSwiftBuildFolder, getTestOutputFolder } from '../config.ts'; import { createSpinner } from '../spinners.ts'; import type { Language } from '../types.ts'; @@ -115,10 +115,13 @@ async function runCtsOne(language: Language, suites: Record): }); break; case 'swift': - await run(`swift test -Xswiftc -suppress-warnings --parallel ${filter((f) => `--filter "${f}.*"`)}`, { - cwd, - language, - }); + await run( + `swift test -Xswiftc -suppress-warnings --build-path ${getSwiftBuildFolder()} --parallel ${filter((f) => `--filter "${f}.*"`)}`, + { + cwd, + language, + }, + ); break; default: spinner.warn(`skipping unknown language '${language}' to run the CTS`); diff --git a/scripts/playground.ts b/scripts/playground.ts index 8601989a9a4..68b3b178572 100644 --- a/scripts/playground.ts +++ b/scripts/playground.ts @@ -1,5 +1,6 @@ import type { AllLanguage } from './cli/utils.ts'; import { createClientName, run, runComposerInstall } from './common.ts'; +import { getSwiftBuildFolder } from './config.ts'; export async function playground({ language, client }: { language: AllLanguage; client: string }): Promise { switch (language) { @@ -56,7 +57,10 @@ export async function playground({ language, client }: { language: AllLanguage; await run(`sbt \\"runMain ${createClientName(client, 'scala')}\\"`, { cwd: 'playground/scala', language }); break; case 'swift': - await run(`swift run ${client}-playground`, { cwd: 'playground/swift', language }); + await run(`swift run --build-path ${getSwiftBuildFolder()} ${client}-playground`, { + cwd: 'playground/swift', + language, + }); break; default: }