Skip to content

Commit

Permalink
rm findOpam()
Browse files Browse the repository at this point in the history
  • Loading branch information
kit-ty-kate committed May 15, 2024
1 parent b6a30f6 commit 54bbf50
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 35 deletions.
21 changes: 4 additions & 17 deletions dist/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -103942,15 +103942,6 @@ async function getLatestOpamRelease() {
browserDownloadUrl: matchedAssets.browser_download_url
};
}
async function findOpam() {
if (PLATFORM === "win32") {
const opamPath = await io.which("opam.exe");
return opamPath;
} else {
const opamPath = await io.which("opam");
return opamPath;
}
}
async function acquireOpamUnix() {
const { version: version3, browserDownloadUrl } = await getLatestOpamRelease();
const cachedPath = toolCache.find("opam", version3, ARCHITECTURE);
Expand Down Expand Up @@ -104165,19 +104156,17 @@ async function installOcaml(ocamlCompiler) {
}
async function pin(fpaths) {
await core2.group("Pin local packages", async () => {
const opam = await findOpam();
for (const fpath of fpaths) {
const fname = path4__namespace.basename(fpath, ".opam");
const dname = path4__namespace.dirname(fpath);
await (0, import_exec2.exec)(opam, ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
await (0, import_exec2.exec)("opam", ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
cwd: dname
});
}
});
}
async function repositoryAdd(name, address) {
const opam = await findOpam();
await (0, import_exec2.exec)(opam, [
await (0, import_exec2.exec)("opam", [
"repository",
"add",
name,
Expand Down Expand Up @@ -104220,13 +104209,11 @@ async function repositoryAddAll(repositories) {
});
}
async function repositoryRemove(name) {
const opam = await findOpam();
await (0, import_exec2.exec)(opam, ["repository", "remove", name, "--all-switches"]);
await (0, import_exec2.exec)("opam", ["repository", "remove", name, "--all-switches"]);
}
async function repositoryList() {
const opam = await findOpam();
const repositoryList2 = await (0, import_exec2.getExecOutput)(
opam,
"opam",
["repository", "list", "--all-switches", "--short"],
{ ignoreReturnCode: true }
);
Expand Down
22 changes: 4 additions & 18 deletions packages/setup-ocaml/src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,6 @@ export async function getLatestOpamRelease() {
};
}

async function findOpam() {
if (PLATFORM === "win32") {
const opamPath = await io.which("opam.exe");
return opamPath;
} else {
const opamPath = await io.which("opam");
return opamPath;
}
}

async function acquireOpamUnix() {
const { version, browserDownloadUrl } = await getLatestOpamRelease();
const cachedPath = toolCache.find("opam", version, ARCHITECTURE);
Expand Down Expand Up @@ -303,20 +293,18 @@ export async function installOcaml(ocamlCompiler: string) {

export async function pin(fpaths: string[]) {
await core.group("Pin local packages", async () => {
const opam = await findOpam();
for (const fpath of fpaths) {
const fname = path.basename(fpath, ".opam");
const dname = path.dirname(fpath);
await exec(opam, ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
await exec("opam", ["pin", "add", `${fname}.dev`, ".", "--no-action"], {
cwd: dname,
});
}
});
}

async function repositoryAdd(name: string, address: string) {
const opam = await findOpam();
await exec(opam, [
await exec("opam", [
"repository",
"add",
name,
Expand Down Expand Up @@ -365,14 +353,12 @@ export async function repositoryAddAll(repositories: [string, string][]) {
}

async function repositoryRemove(name: string) {
const opam = await findOpam();
await exec(opam, ["repository", "remove", name, "--all-switches"]);
await exec("opam", ["repository", "remove", name, "--all-switches"]);
}

async function repositoryList() {
const opam = await findOpam();
const repositoryList = await getExecOutput(
opam,
"opam",
["repository", "list", "--all-switches", "--short"],
{ ignoreReturnCode: true },
);
Expand Down

0 comments on commit 54bbf50

Please sign in to comment.