1 | import { Platform } from "@xmcl/core";
|
2 | import { Task } from "@xmcl/task";
|
3 | import { DownloadTask } from "./downloadTask";
|
4 | import { DownloadBaseOptions } from "./http/download";
|
5 | export interface JavaInfo {
|
6 | |
7 |
|
8 |
|
9 | path: string;
|
10 | |
11 |
|
12 |
|
13 | version: string;
|
14 | |
15 |
|
16 |
|
17 | majorVersion: number;
|
18 | }
|
19 | export interface InstallJavaOptions extends DownloadBaseOptions {
|
20 | |
21 |
|
22 |
|
23 | destination: string;
|
24 | |
25 |
|
26 |
|
27 |
|
28 | cacheDir?: string;
|
29 | |
30 |
|
31 |
|
32 |
|
33 | platform?: Platform;
|
34 | |
35 |
|
36 |
|
37 | unpackLZMA: UnpackLZMAFunction;
|
38 | }
|
39 | export declare type UnpackLZMAFunction = ((src: string, dest: string) => Promise<void>) | ((src: string, dest: string) => Task<void>);
|
40 | export declare class DownloadJRETask extends DownloadTask {
|
41 | constructor(jre: DownloadInfo, dir: string, options: InstallJavaOptions);
|
42 | }
|
43 | interface DownloadInfo {
|
44 | sha1: string;
|
45 | url: string;
|
46 | version: string;
|
47 | }
|
48 | /**
|
49 | * Install JRE from Mojang offical resource. It should install jdk 8.
|
50 | * @param options The install options
|
51 | */
|
52 | export declare function installJreFromMojangTask(options: InstallJavaOptions): import("@xmcl/task").TaskRoutine<void>;
|
53 | /**
|
54 | * Install JRE from Mojang offical resource. It should install jdk 8.
|
55 | * @param options The install options
|
56 | */
|
57 | export declare function installJreFromMojang(options: InstallJavaOptions): Promise<void>;
|
58 | /**
|
59 | * Try to resolve a java info at this path. This will call `java -version`
|
60 | * @param path The java exectuable path.
|
61 | */
|
62 | export declare function resolveJava(path: string): Promise<JavaInfo | undefined>;
|
63 | /**
|
64 | * Parse version string and major version number from stderr of java process.
|
65 | *
|
66 | * @param versionText The stderr for `java -version`
|
67 | */
|
68 | export declare function parseJavaVersion(versionText: string): {
|
69 | version: string;
|
70 | majorVersion: number;
|
71 | } | undefined;
|
72 | /**
|
73 | * Get all potential java locations for Minecraft.
|
74 | *
|
75 | * On mac/linux, it will perform `which java`. On win32, it will perform `where java`
|
76 | *
|
77 | * @returns The absolute java locations path
|
78 | */
|
79 | export declare function getPotentialJavaLocations(): Promise<string[]>;
|
80 | /**
|
81 | * Scan local java version on the disk.
|
82 | *
|
83 | * It will check if the passed `locations` are the home of java.
|
84 | * Notice that the locations should not be the executable, but the path of java installation, like JAVA_HOME.
|
85 | *
|
86 | * This will call `getPotentialJavaLocations` and then `resolveJava`
|
87 | *
|
88 | * @param locations The location (like java_home) want to check.
|
89 | * @returns All validate java info
|
90 | */
|
91 | export declare function scanLocalJava(locations: string[]): Promise<JavaInfo[]>;
|
92 | export {};
|
93 | //# sourceMappingURL=java.d.ts.map |
\ | No newline at end of file |