-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #112 from aminya/bazel [skip ci]
- Loading branch information
Showing
11 changed files
with
113 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { setupBazel } from "../bazel" | ||
import { testBin } from "../../utils/tests/test-helpers" | ||
import { InstallationInfo } from "../../utils/setup/setupBin" | ||
|
||
jest.setTimeout(300000) | ||
describe("setup-bazel", () => { | ||
it("should setup bazel", async () => { | ||
const installInfo = await setupBazel("", "", process.arch) | ||
|
||
await testBin("bazel", ["--version"], (installInfo as InstallationInfo | undefined)?.binDir) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { addAptKeyViaDownload, setupAptPack } from "../utils/setup/setupAptPack" | ||
import { setupBrewPack } from "../utils/setup/setupBrewPack" | ||
import { setupChocoPack } from "../utils/setup/setupChocoPack" | ||
import { isArch } from "../utils/env/isArch" | ||
import { hasDnf } from "../utils/env/hasDnf" | ||
import { setupDnfPack } from "../utils/setup/setupDnfPack" | ||
import { isUbuntu } from "../utils/env/isUbuntu" | ||
import { execSudo } from "../utils/exec/sudo" | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
export async function setupBazel(version: string, _setupDir: string, _arch: string) { | ||
switch (process.platform) { | ||
case "win32": { | ||
// install bazelisk because it contains both | ||
return setupChocoPack("bazelisk", version) | ||
} | ||
case "darwin": { | ||
// install bazelisk because it contains both | ||
return setupBrewPack("bazelisk", version) | ||
} | ||
case "linux": { | ||
if (isArch()) { | ||
throw new Error("installing bazel on Arch linux is not supported yet") | ||
} else if (hasDnf()) { | ||
// https://bazel.build/install/redhat | ||
setupDnfPack("dnf-plugins-core", undefined) | ||
execSudo("dnf", ["copr", "enable", "vbatts/bazel"]) | ||
return setupDnfPack("bazel4", undefined) | ||
} else if (isUbuntu()) { | ||
// https://bazel.build/install/ubuntu | ||
const keyFileName = await addAptKeyViaDownload( | ||
"bazel-archive-keyring.gpg", | ||
"https://bazel.build/bazel-release.pub.gpg" | ||
) | ||
execSudo("bash", [ | ||
"-c", | ||
`echo "deb [arch=amd64 signed-by=${keyFileName}] https://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list`, | ||
]) | ||
return setupAptPack("bazel", version, [], true) | ||
} | ||
throw new Error(`Unsupported linux distribution`) | ||
} | ||
default: { | ||
throw new Error(`Unsupported platform`) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters