-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathresolve-asset-url.ts
More file actions
32 lines (29 loc) · 1012 Bytes
/
Copy pathresolve-asset-url.ts
File metadata and controls
32 lines (29 loc) · 1012 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* @file `resolveBazelAssetUrl(version, platformArch)` — builds the upstream
* GitHub Releases download URL for a Bazel binary. Returns `undefined` if the
* platform-arch isn't in our asset map. Bazel publishes to
* https://github.com/bazelbuild/bazel/releases/download/<X.Y.Z>/bazel-<X.Y.Z>-<suffix>
* where `<suffix>` is one of `darwin-arm64`, `darwin-x86_64`, `linux-arm64`,
* `linux-x86_64`, `windows-x86_64.exe`.
*/
import { getBazelAssetEntry } from './asset-names'
export interface BazelAssetUrl {
readonly url: string
readonly filename: string
readonly native: boolean
}
export function resolveBazelAssetUrl(
version: string,
platformArch: string,
): BazelAssetUrl | undefined {
const entry = getBazelAssetEntry(platformArch)
if (!entry) {
return undefined
}
const filename = `bazel-${version}-${entry.suffix}`
return {
url: `https://github.com/bazelbuild/bazel/releases/download/${version}/${filename}`,
filename,
native: entry.native,
}
}