-
Notifications
You must be signed in to change notification settings - Fork 31
/
tool_cache.dart
49 lines (43 loc) · 1.51 KB
/
tool_cache.dart
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'dart:js_interop';
@JS()
external ToolCache get toolCache;
@JS()
inline class ToolCache {
/// Finds the path to a tool version in the local installed tool cache.
///
/// @param toolName name of the tool
/// @param versionSpec version of the tool
/// @param arch optional arch. defaults to arch of computer
external JSString find(
JSString toolName,
JSString versionSpec, [
JSString arch,
]);
/// Download a tool from an url and stream it into a file.
///
/// @param url url of tool to download
/// @returns path to downloaded tool
// JSPromise<String>
external JSPromise downloadTool(JSString url);
/// Extract a zip.
///
/// @param file path to the zip
/// @returns path to the destination directory
external JSPromise extractZip(JSString file);
/// Caches a directory and installs it into the tool cacheDir
///
/// @param sourceDir the directory to cache into tools
/// @param tool tool name
/// @param version version of the tool. semver format
/// @param arch architecture of the tool. Optional.
/// Defaults to machine architecture
external JSPromise cacheDir(
JSString sourceDir,
JSString tool,
JSString version, [
JSString arch,
]);
}