Skip to content

Commit 819d829

Browse files
committed
feat: store default versions in a json version file
1 parent e0e749b commit 819d829

13 files changed

+273
-121
lines changed

dist/legacy/setup-cpp.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/setup-cpp.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/legacy/versions.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ninja":"1.12.1","cmake":"3.30.4","task":"3.39.2","powershell":"7.4.5","pip":"22.2.0","python":"3.7.9","meson":{"linux":{"ubuntu":{"20":"1.5.2","18":"0.61.4","else":"0.61.4"},"else":"1.5.2"},"else":"1.5.2"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"}},"else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"}},"else":""},"nala":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"}},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"}}

dist/modern/assets/actions_python-DZNSVoc3.mjs dist/modern/assets/actions_python-56soSduK.mjs

+2-2
Large diffs are not rendered by default.

dist/modern/assets/actions_python-DZNSVoc3.mjs.map dist/modern/assets/actions_python-56soSduK.mjs.map

+1-1
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs

+1-1
Large diffs are not rendered by default.

dist/modern/setup-cpp.mjs.map

+1-1
Large diffs are not rendered by default.

dist/modern/versions.json

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"ninja":"1.12.1","cmake":"3.30.4","task":"3.39.2","powershell":"7.4.5","pip":"22.2.0","python":"3.7.9","meson":{"linux":{"ubuntu":{"20":"1.5.2","18":"0.61.4","else":"0.61.4"},"else":"1.5.2"},"else":"1.5.2"},"kcov":{"linux":{"ubuntu":{"22":"42-binary","20":"40-binary","14":"40","else":"42"},"else":"42"},"else":"42"},"doxygen":{"linux":{"archlinux":"1.12.0-2","ubuntu":{"22":"1.12.0","18":"1.10.0","else":"1.10.0"},"else":"1.12.0"},"else":"1.12.0"},"gcc":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","else":""},"mingw":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"8.0.0-1","20":"7.0.0-2","else":"7.0.0-2"}},"else":""},"gcovr":{"linux":{"ubuntu":{"20":"","18":"5.0","else":"5.0"}},"else":""},"nala":{"win32":"14.2.0posix-18.1.8-12.0.0-ucrt-r1","linux":{"ubuntu":{"22":"","21":"legacy","else":"legacy"}},"else":""},"llvm":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang++":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-tidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangtidy":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clang-format":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"},"clangformat":{"darwin":{"else":{"else":{"x64":"15.0.7","else":"18.1.8"}}},"else":"18.1.8"}}

src/__tests__/main.test.ts

+3-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { parseArgs } from "../cli-options.js"
22
import { getCompilerInfo } from "../compilers.js"
33
import { type Inputs, llvmTools } from "../tool.js"
4-
import { DefaultUbuntuVersion, DefaultVersions } from "../versions/default_versions.js"
54
import { getVersion, syncVersions } from "../versions/versions.js"
65

76
jest.setTimeout(300000)
@@ -90,18 +89,13 @@ describe("getVersion", () => {
9089
it("gcovr", () => {
9190
expect(getVersion("gcovr", "5.0")).toBe("5.0")
9291
if (process.platform === "linux") {
93-
expect(getVersion("gcovr", "true", [22, 4])).toBe(DefaultUbuntuVersion.gcovr![22])
94-
expect(getVersion("gcovr", "true", [20, 4])).toBe(DefaultUbuntuVersion.gcovr![20])
95-
expect(getVersion("gcovr", "true", [18, 4])).toBe(DefaultUbuntuVersion.gcovr![18])
92+
expect(getVersion("gcovr", "true", [22, 4])).toBe("")
93+
expect(getVersion("gcovr", "true", [20, 4])).toBe("")
94+
expect(getVersion("gcovr", "true", [18, 4])).toBe("5.0")
9695
}
9796
})
9897

9998
it("llvm", () => {
10099
expect(getVersion("llvm", "13.0.0")).toBe("13.0.0")
101-
if (process.platform === "linux") {
102-
expect(getVersion("llvm", "true", [20, 4])).toBe(DefaultVersions.llvm)
103-
expect(getVersion("llvm", "true", [18, 4])).toBe(DefaultVersions.llvm)
104-
expect(getVersion("llvm", "true", [16, 4])).toBe(DefaultVersions.llvm)
105-
}
106100
})
107101
})

src/python/python.ts

+8-4
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { setupPacmanPack } from "../utils/setup/setupPacmanPack.js"
2525
import { hasPipx, setupPipPackSystem, setupPipPackWithPython } from "../utils/setup/setupPipPack.js"
2626
import { isBinUptoDate } from "../utils/setup/version.js"
2727
import { unique } from "../utils/std/index.js"
28-
import { MinVersions } from "../versions/default_versions.js"
28+
import { getVersionDefault } from "../versions/versions.js"
2929

3030
export async function setupPython(
3131
version: string,
@@ -214,17 +214,19 @@ async function findPython(binDir?: string) {
214214

215215
async function isPythonUpToDate(candidate: string, binDir?: string) {
216216
try {
217+
const targetVersion = getVersionDefault("python")
218+
217219
if (binDir !== undefined) {
218220
const pythonBinPath = join(binDir, addExeExt(candidate))
219-
if (await pathExists(pythonBinPath) && await isBinUptoDate(pythonBinPath, MinVersions.python!)) {
221+
if (await pathExists(pythonBinPath) && await isBinUptoDate(pythonBinPath, targetVersion!)) {
220222
return pythonBinPath
221223
}
222224
}
223225
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
224226
const pythonBinPaths = (await which(candidate, { nothrow: true, all: true })) ?? []
225227
for (const pythonBinPath of pythonBinPaths) {
226228
// eslint-disable-next-line no-await-in-loop
227-
if (await isBinUptoDate(pythonBinPath, MinVersions.python!)) {
229+
if (await isBinUptoDate(pythonBinPath, targetVersion!)) {
228230
return pythonBinPath
229231
}
230232
}
@@ -260,11 +262,13 @@ async function findPip() {
260262

261263
async function isPipUptoDate(pip: string) {
262264
try {
265+
const targetVersion = getVersionDefault("pip")
266+
263267
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
264268
const pipPaths = (await which(pip, { nothrow: true, all: true })) ?? []
265269
for (const pipPath of pipPaths) {
266270
// eslint-disable-next-line no-await-in-loop
267-
if (await isBinUptoDate(pipPath, MinVersions.pip!)) {
271+
if (await isBinUptoDate(pipPath, targetVersion!)) {
268272
return pipPath
269273
}
270274
}

src/versions/default_versions.ts

-83
This file was deleted.

src/versions/versions.json

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
{
2+
"ninja": "1.12.1",
3+
"cmake": "3.30.4",
4+
"task": "3.39.2",
5+
"powershell": "7.4.5",
6+
"pip": "22.2.0",
7+
"python": "3.7.9",
8+
"meson": {
9+
"linux": {
10+
"ubuntu": {
11+
"20": "1.5.2",
12+
"18": "0.61.4",
13+
"else": "0.61.4"
14+
},
15+
"else": "1.5.2"
16+
},
17+
"else": "1.5.2"
18+
},
19+
"kcov": {
20+
"linux": {
21+
"ubuntu": {
22+
"22": "42-binary",
23+
"20": "40-binary",
24+
"14": "40",
25+
"else": "42"
26+
},
27+
"else": "42"
28+
},
29+
"else": "42"
30+
},
31+
"doxygen": {
32+
"linux": {
33+
"archlinux": "1.12.0-2",
34+
"ubuntu": {
35+
"22": "1.12.0",
36+
"18": "1.10.0",
37+
"else": "1.10.0"
38+
},
39+
"else": "1.12.0"
40+
},
41+
"else": "1.12.0"
42+
},
43+
"gcc": {
44+
"win32": "14.2.0posix-18.1.8-12.0.0-ucrt-r1",
45+
"else": ""
46+
},
47+
"mingw": {
48+
"win32": "14.2.0posix-18.1.8-12.0.0-ucrt-r1",
49+
"linux": {
50+
"ubuntu": {
51+
"22": "8.0.0-1",
52+
"20": "7.0.0-2",
53+
"else": "7.0.0-2"
54+
}
55+
},
56+
"else": ""
57+
},
58+
"gcovr": {
59+
"linux": {
60+
"ubuntu": {
61+
"20": "",
62+
"18": "5.0",
63+
"else": "5.0"
64+
}
65+
},
66+
"else": ""
67+
},
68+
"nala": {
69+
"win32": "14.2.0posix-18.1.8-12.0.0-ucrt-r1",
70+
"linux": {
71+
"ubuntu": {
72+
"22": "",
73+
"21": "legacy",
74+
"else": "legacy"
75+
}
76+
},
77+
"else": ""
78+
},
79+
"llvm": {
80+
"darwin": {
81+
"else": {
82+
"else": {
83+
"x64": "15.0.7",
84+
"else": "18.1.8"
85+
}
86+
}
87+
},
88+
"else": "18.1.8"
89+
},
90+
"clang": {
91+
"darwin": {
92+
"else": {
93+
"else": {
94+
"x64": "15.0.7",
95+
"else": "18.1.8"
96+
}
97+
}
98+
},
99+
"else": "18.1.8"
100+
},
101+
"clang++": {
102+
"darwin": {
103+
"else": {
104+
"else": {
105+
"x64": "15.0.7",
106+
"else": "18.1.8"
107+
}
108+
}
109+
},
110+
"else": "18.1.8"
111+
},
112+
"clang-tidy": {
113+
"darwin": {
114+
"else": {
115+
"else": {
116+
"x64": "15.0.7",
117+
"else": "18.1.8"
118+
}
119+
}
120+
},
121+
"else": "18.1.8"
122+
},
123+
"clangtidy": {
124+
"darwin": {
125+
"else": {
126+
"else": {
127+
"x64": "15.0.7",
128+
"else": "18.1.8"
129+
}
130+
}
131+
},
132+
"else": "18.1.8"
133+
},
134+
"clang-format": {
135+
"darwin": {
136+
"else": {
137+
"else": {
138+
"x64": "15.0.7",
139+
"else": "18.1.8"
140+
}
141+
}
142+
},
143+
"else": "18.1.8"
144+
},
145+
"clangformat": {
146+
"darwin": {
147+
"else": {
148+
"else": {
149+
"x64": "15.0.7",
150+
"else": "18.1.8"
151+
}
152+
}
153+
},
154+
"else": "18.1.8"
155+
}
156+
}

0 commit comments

Comments
 (0)