Skip to content

Commit 898559b

Browse files
committed
Update version mechanism
1 parent 36541a9 commit 898559b

File tree

11 files changed

+72
-244
lines changed

11 files changed

+72
-244
lines changed

packages/cmake-file-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"!*.test.d.ts.map"
1717
],
1818
"exports": {
19-
".": "./"
19+
".": "./dist/index.js"
2020
},
2121
"repository": {
2222
"type": "git",

packages/cmake-file-api/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ export {
22
createSharedStatelessQuery,
33
createClientStatelessQuery,
44
createClientStatefulQuery,
5-
createQuery, // deprecated alias
65
type VersionSpec,
76
type QueryRequest,
87
type StatefulQuery,

packages/cmake-file-api/src/query.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,3 @@ export async function createClientStatefulQuery(
9191
await fs.promises.mkdir(path.dirname(queryPath), { recursive: true });
9292
await fs.promises.writeFile(queryPath, JSON.stringify(query, null, 2));
9393
}
94-
95-
/**
96-
* @deprecated Use createSharedStatelessQuery instead
97-
*/
98-
export const createQuery = createSharedStatelessQuery;

packages/cmake-file-api/src/reply.test.ts

Lines changed: 12 additions & 219 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,6 @@ import {
1717
isReplyErrorIndexPath,
1818
readReplyErrorIndex,
1919
} from "./reply.js";
20-
import {
21-
TargetV2_0,
22-
TargetV2_1,
23-
TargetV2_2,
24-
TargetV2_5,
25-
TargetV2_6,
26-
TargetV2_7,
27-
TargetV2_8,
28-
CmakeFilesV1_0,
29-
CmakeFilesV1_1,
30-
} from "./schemas.js";
3120

3221
function createTempDir(context: TestContext, prefix = "test-") {
3322
const tmpPath = fs.mkdtempSync(path.join(os.tmpdir(), prefix));
@@ -261,158 +250,6 @@ describe("readCodeModel", () => {
261250
});
262251

263252
describe("readTarget", () => {
264-
it("reads a well-formed target file", async function (context) {
265-
const mockTarget = {
266-
name: "MyExecutable",
267-
id: "MyExecutable::@6890a9b7b1a1a2e4d6b9",
268-
type: "EXECUTABLE",
269-
backtrace: 1,
270-
folder: {
271-
name: "Executables",
272-
},
273-
paths: {
274-
source: ".",
275-
build: ".",
276-
},
277-
nameOnDisk: "MyExecutable",
278-
artifacts: [
279-
{
280-
path: "MyExecutable",
281-
},
282-
],
283-
isGeneratorProvided: false,
284-
install: {
285-
prefix: {
286-
path: "/usr/local",
287-
},
288-
destinations: [
289-
{
290-
path: "bin",
291-
backtrace: 2,
292-
},
293-
],
294-
},
295-
launchers: [
296-
{
297-
command: "/usr/bin/gdb",
298-
arguments: ["--args"],
299-
type: "test",
300-
},
301-
],
302-
link: {
303-
language: "CXX",
304-
commandFragments: [
305-
{
306-
fragment: "-O3",
307-
role: "flags",
308-
backtrace: 3,
309-
},
310-
],
311-
lto: false,
312-
sysroot: {
313-
path: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
314-
},
315-
},
316-
dependencies: [
317-
{
318-
id: "MyLibrary::@6890a9b7b1a1a2e4d6b9",
319-
backtrace: 4,
320-
},
321-
],
322-
fileSets: [
323-
{
324-
name: "HEADERS",
325-
type: "HEADERS",
326-
visibility: "PUBLIC",
327-
baseDirectories: ["."],
328-
},
329-
],
330-
sources: [
331-
{
332-
path: "main.cpp",
333-
compileGroupIndex: 0,
334-
sourceGroupIndex: 0,
335-
isGenerated: false,
336-
fileSetIndex: 0,
337-
backtrace: 5,
338-
},
339-
],
340-
sourceGroups: [
341-
{
342-
name: "Source Files",
343-
sourceIndexes: [0],
344-
},
345-
],
346-
compileGroups: [
347-
{
348-
sourceIndexes: [0],
349-
language: "CXX",
350-
languageStandard: {
351-
backtraces: [6],
352-
standard: "17",
353-
},
354-
compileCommandFragments: [
355-
{
356-
fragment: "-std=c++17",
357-
backtrace: 7,
358-
},
359-
],
360-
includes: [
361-
{
362-
path: "/usr/include",
363-
isSystem: true,
364-
backtrace: 8,
365-
},
366-
],
367-
frameworks: [
368-
{
369-
path: "/System/Library/Frameworks/Foundation.framework",
370-
isSystem: true,
371-
backtrace: 9,
372-
},
373-
],
374-
precompileHeaders: [
375-
{
376-
header: "pch.h",
377-
backtrace: 10,
378-
},
379-
],
380-
defines: [
381-
{
382-
define: "NDEBUG",
383-
backtrace: 11,
384-
},
385-
],
386-
sysroot: {
387-
path: "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
388-
},
389-
},
390-
],
391-
backtraceGraph: {
392-
nodes: [
393-
{
394-
file: 0,
395-
line: 1,
396-
command: 0,
397-
parent: null,
398-
},
399-
],
400-
commands: ["add_executable"],
401-
files: ["CMakeLists.txt"],
402-
},
403-
};
404-
405-
const tmpPath = createMockReplyDirectory(context, [
406-
["target-MyExecutable.json", mockTarget],
407-
]);
408-
const result = await readTarget(
409-
path.join(tmpPath, "target-MyExecutable.json"),
410-
);
411-
412-
// Verify the entire structure matches our mock data
413-
assert.deepStrictEqual(result, mockTarget);
414-
});
415-
416253
// Base objects for reusable test data
417254
const baseTarget = {
418255
name: "MyTarget",
@@ -461,7 +298,7 @@ describe("readTarget", () => {
461298
]);
462299
const result = await readTarget(
463300
path.join(tmpPath, "target-v2_0.json"),
464-
TargetV2_0,
301+
"2.0",
465302
);
466303

467304
assert.deepStrictEqual(result, targetV2_0);
@@ -489,7 +326,7 @@ describe("readTarget", () => {
489326
]);
490327
const result = await readTarget(
491328
path.join(tmpPath, "target-v2_1.json"),
492-
TargetV2_1,
329+
"2.1",
493330
);
494331

495332
assert.deepStrictEqual(result, targetV2_1);
@@ -521,7 +358,7 @@ describe("readTarget", () => {
521358
]);
522359
const result = await readTarget(
523360
path.join(tmpPath, "target-v2_2.json"),
524-
TargetV2_2,
361+
"2.2",
525362
);
526363

527364
assert.deepStrictEqual(result, targetV2_2);
@@ -566,7 +403,7 @@ describe("readTarget", () => {
566403
]);
567404
const result = await readTarget(
568405
path.join(tmpPath, "target-v2_5.json"),
569-
TargetV2_5,
406+
"2.5",
570407
);
571408

572409
assert.deepStrictEqual(result, targetV2_5);
@@ -618,7 +455,7 @@ describe("readTarget", () => {
618455
]);
619456
const result = await readTarget(
620457
path.join(tmpPath, "target-v2_6.json"),
621-
TargetV2_6,
458+
"2.6",
622459
);
623460

624461
assert.deepStrictEqual(result, targetV2_6);
@@ -677,7 +514,7 @@ describe("readTarget", () => {
677514
]);
678515
const result = await readTarget(
679516
path.join(tmpPath, "target-v2_7.json"),
680-
TargetV2_7,
517+
"2.7",
681518
);
682519

683520
assert.deepStrictEqual(result, targetV2_7);
@@ -739,7 +576,7 @@ describe("readTarget", () => {
739576
]);
740577
const result = await readTarget(
741578
path.join(tmpPath, "target-v2_8.json"),
742-
TargetV2_8,
579+
"2.8",
743580
);
744581

745582
assert.deepStrictEqual(result, targetV2_8);
@@ -780,60 +617,14 @@ describe("readCache", () => {
780617
const tmpPath = createMockReplyDirectory(context, [
781618
["cache-v2.json", mockCache],
782619
]);
783-
const result = await readCache(path.join(tmpPath, "cache-v2.json"));
620+
const result = await readCache(path.join(tmpPath, "cache-v2.json"), "2.0");
784621

785622
// Verify the entire structure matches our mock data
786623
assert.deepStrictEqual(result, mockCache);
787624
});
788625
});
789626

790627
describe("readCmakeFiles", () => {
791-
it("reads a well-formed cmakeFiles file", async function (context) {
792-
const mockCmakeFiles = {
793-
kind: "cmakeFiles",
794-
version: { major: 1, minor: 1 },
795-
paths: {
796-
build: "/path/to/top-level-build-dir",
797-
source: "/path/to/top-level-source-dir",
798-
},
799-
inputs: [
800-
{
801-
path: "CMakeLists.txt",
802-
},
803-
{
804-
isGenerated: true,
805-
path: "/path/to/top-level-build-dir/.../CMakeSystem.cmake",
806-
},
807-
{
808-
isExternal: true,
809-
path: "/path/to/external/third-party/module.cmake",
810-
},
811-
{
812-
isCMake: true,
813-
isExternal: true,
814-
path: "/path/to/cmake/Modules/CMakeGenericSystem.cmake",
815-
},
816-
],
817-
globsDependent: [
818-
{
819-
expression: "src/*.cxx",
820-
recurse: true,
821-
paths: ["src/foo.cxx", "src/bar.cxx"],
822-
},
823-
],
824-
};
825-
826-
const tmpPath = createMockReplyDirectory(context, [
827-
["cmakeFiles-v1.json", mockCmakeFiles],
828-
]);
829-
const result = await readCmakeFiles(
830-
path.join(tmpPath, "cmakeFiles-v1.json"),
831-
);
832-
833-
// Verify the entire structure matches our mock data
834-
assert.deepStrictEqual(result, mockCmakeFiles);
835-
});
836-
837628
// Base objects for reusable test data
838629
const baseCmakeFiles = {
839630
kind: "cmakeFiles" as const,
@@ -863,7 +654,7 @@ describe("readCmakeFiles", () => {
863654
]);
864655
const result = await readCmakeFiles(
865656
path.join(tmpPath, "cmakeFiles-v1_0.json"),
866-
CmakeFilesV1_0,
657+
"1.0",
867658
);
868659

869660
assert.deepStrictEqual(result, cmakeFilesV1_0);
@@ -887,7 +678,7 @@ describe("readCmakeFiles", () => {
887678
]);
888679
const result = await readCmakeFiles(
889680
path.join(tmpPath, "cmakeFiles-v1_1.json"),
890-
CmakeFilesV1_1,
681+
"1.1",
891682
);
892683

893684
assert.deepStrictEqual(result, cmakeFilesV1_1);
@@ -980,6 +771,7 @@ describe("readToolchains", () => {
980771
]);
981772
const result = await readToolchains(
982773
path.join(tmpPath, "toolchains-v1.json"),
774+
"1.0",
983775
);
984776

985777
// Verify the entire structure matches our mock data
@@ -1007,6 +799,7 @@ describe("readConfigureLog", () => {
1007799
]);
1008800
const result = await readConfigureLog(
1009801
path.join(tmpPath, "configureLog-v1.json"),
802+
"1.0",
1010803
);
1011804
assert.deepStrictEqual(result, mockConfigureLog);
1012805
});

0 commit comments

Comments
 (0)