Skip to content

Commit 426ae44

Browse files
committed
fix swift and playground build
1 parent 40072eb commit 426ae44

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

config/generation.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export const patterns = [
66
'clients/**',
77
'docs/**',
88
'docs/**/.*',
9+
'docs/**/.*/**',
910
'!docs/README.md',
1011
'!clients/README.md',
1112
'!clients/**/.openapi-generator-ignore',

generators/src/main/java/com/algolia/codegen/cts/manager/SwiftCTSManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ public void addSnippetsSupportingFiles(List<SupportingFile> supportingFiles, Str
4545
supportingFiles.add(new SupportingFile("snippets/.swiftformat.mustache", output + "/swift", ".swiftformat"));
4646
supportingFiles.add(new SupportingFile("snippets/.gitignore.mustache", output + "/swift", ".gitignore"));
4747

48-
if (output.equals("snippets")) {
48+
if (output.equals("docs/snippets")) {
4949
supportingFiles.add(new SupportingFile("snippets/Package.mustache", output + "/swift", "Package.swift"));
50-
} else if (output.equals("guides")) {
50+
} else if (output.equals("docs/guides")) {
5151
supportingFiles.add(new SupportingFile("guides/Package.mustache", output + "/swift", "Package.swift"));
5252
}
5353
}

scripts/buildLanguages.ts

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,26 @@ import type { Generator, Language } from './types.js';
77

88
type BuildType = 'client' | 'guides' | 'playground' | 'snippets';
99

10+
function getFolder(buildType: BuildType, language: Language): string {
11+
switch (buildType) {
12+
case 'client':
13+
return getLanguageFolder(language);
14+
case 'guides':
15+
return `docs/guides/${language}`;
16+
case 'playground':
17+
return `playground/${language}`;
18+
case 'snippets':
19+
return `docs/snippets/${language}`;
20+
default:
21+
throw new Error(`Unknown build type: ${buildType}`);
22+
}
23+
}
24+
1025
/**
1126
* Build code for a specific language.
1227
*/
1328
async function buildLanguage(language: Language, gens: Generator[], buildType: BuildType): Promise<void> {
14-
const baseCwd = buildType === 'playground' ? '.' : './docs';
15-
const cwd = buildType === 'client' ? getLanguageFolder(language) : `${baseCwd}/${buildType}/${language}`;
29+
const cwd = getFolder(buildType, language);
1630
const spinner = createSpinner(`building ${buildType} for '${language}'`);
1731
switch (language) {
1832
case 'csharp':

templates/swift/guides/Package.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let package = Package(
1212
.watchOS(.v6),
1313
],
1414
dependencies: [
15-
.package(path: "../../clients/algoliasearch-client-swift")
15+
.package(path: "../../../clients/algoliasearch-client-swift")
1616
],
1717
targets: [
1818
.executableTarget(

0 commit comments

Comments
 (0)