Skip to content

Commit 54bbf50

Browse files
committed
rm findOpam()
1 parent b6a30f6 commit 54bbf50

File tree

2 files changed

+8
-35
lines changed

2 files changed

+8
-35
lines changed

dist/index.cjs

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -103942,15 +103942,6 @@ async function getLatestOpamRelease() {
103942103942
browserDownloadUrl: matchedAssets.browser_download_url
103943103943
};
103944103944
}
103945-
async function findOpam() {
103946-
if (PLATFORM === "win32") {
103947-
const opamPath = await io.which("opam.exe");
103948-
return opamPath;
103949-
} else {
103950-
const opamPath = await io.which("opam");
103951-
return opamPath;
103952-
}
103953-
}
103954103945
async function acquireOpamUnix() {
103955103946
const { version: version3, browserDownloadUrl } = await getLatestOpamRelease();
103956103947
const cachedPath = toolCache.find("opam", version3, ARCHITECTURE);
@@ -104165,19 +104156,17 @@ async function installOcaml(ocamlCompiler) {
104165104156
}
104166104157
async function pin(fpaths) {
104167104158
await core2.group("Pin local packages", async () => {
104168-
const opam = await findOpam();
104169104159
for (const fpath of fpaths) {
104170104160
const fname = path4__namespace.basename(fpath, ".opam");
104171104161
const dname = path4__namespace.dirname(fpath);
104172-
await (0, import_exec2.exec)(opam, ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
104162+
await (0, import_exec2.exec)("opam", ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
104173104163
cwd: dname
104174104164
});
104175104165
}
104176104166
});
104177104167
}
104178104168
async function repositoryAdd(name, address) {
104179-
const opam = await findOpam();
104180-
await (0, import_exec2.exec)(opam, [
104169+
await (0, import_exec2.exec)("opam", [
104181104170
"repository",
104182104171
"add",
104183104172
name,
@@ -104220,13 +104209,11 @@ async function repositoryAddAll(repositories) {
104220104209
});
104221104210
}
104222104211
async function repositoryRemove(name) {
104223-
const opam = await findOpam();
104224-
await (0, import_exec2.exec)(opam, ["repository", "remove", name, "--all-switches"]);
104212+
await (0, import_exec2.exec)("opam", ["repository", "remove", name, "--all-switches"]);
104225104213
}
104226104214
async function repositoryList() {
104227-
const opam = await findOpam();
104228104215
const repositoryList2 = await (0, import_exec2.getExecOutput)(
104229-
opam,
104216+
"opam",
104230104217
["repository", "list", "--all-switches", "--short"],
104231104218
{ ignoreReturnCode: true }
104232104219
);

packages/setup-ocaml/src/opam.ts

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,6 @@ export async function getLatestOpamRelease() {
6565
};
6666
}
6767

68-
async function findOpam() {
69-
if (PLATFORM === "win32") {
70-
const opamPath = await io.which("opam.exe");
71-
return opamPath;
72-
} else {
73-
const opamPath = await io.which("opam");
74-
return opamPath;
75-
}
76-
}
77-
7868
async function acquireOpamUnix() {
7969
const { version, browserDownloadUrl } = await getLatestOpamRelease();
8070
const cachedPath = toolCache.find("opam", version, ARCHITECTURE);
@@ -303,20 +293,18 @@ export async function installOcaml(ocamlCompiler: string) {
303293

304294
export async function pin(fpaths: string[]) {
305295
await core.group("Pin local packages", async () => {
306-
const opam = await findOpam();
307296
for (const fpath of fpaths) {
308297
const fname = path.basename(fpath, ".opam");
309298
const dname = path.dirname(fpath);
310-
await exec(opam, ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
299+
await exec("opam", ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
311300
cwd: dname,
312301
});
313302
}
314303
});
315304
}
316305

317306
async function repositoryAdd(name: string, address: string) {
318-
const opam = await findOpam();
319-
await exec(opam, [
307+
await exec("opam", [
320308
"repository",
321309
"add",
322310
name,
@@ -365,14 +353,12 @@ export async function repositoryAddAll(repositories: [string, string][]) {
365353
}
366354

367355
async function repositoryRemove(name: string) {
368-
const opam = await findOpam();
369-
await exec(opam, ["repository", "remove", name, "--all-switches"]);
356+
await exec("opam", ["repository", "remove", name, "--all-switches"]);
370357
}
371358

372359
async function repositoryList() {
373-
const opam = await findOpam();
374360
const repositoryList = await getExecOutput(
375-
opam,
361+
"opam",
376362
["repository", "list", "--all-switches", "--short"],
377363
{ ignoreReturnCode: true },
378364
);

0 commit comments

Comments
 (0)