Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions playground/swift/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions scripts/buildLanguages.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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:
}
Expand Down
6 changes: 5 additions & 1 deletion scripts/config.ts
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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.
*/
Expand Down
13 changes: 8 additions & 5 deletions scripts/cts/runCts.ts
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -115,10 +115,13 @@ async function runCtsOne(language: Language, suites: Record<CTSType, boolean>):
});
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`);
Expand Down
6 changes: 5 additions & 1 deletion scripts/playground.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
switch (language) {
Expand Down Expand Up @@ -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:
}
Expand Down