-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmono-selector.ts
54 lines (46 loc) · 1.79 KB
/
mono-selector.ts
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
50
51
52
53
54
import * as fs from "fs";
import * as path from "path";
import * as core from "@actions/core";
import { XamarinSelector } from "./xamarin-selector";
import { VersionUtils } from "./version-utils";
export class MonoToolSelector extends XamarinSelector {
protected get basePath(): string {
return "/Library/Frameworks/Mono.framework";
}
public get toolName(): string {
return "Mono";
}
public getAllVersions(): string[] {
const versionsFolders = super.getAllVersions();
// we have to look into '/Mono.Framework/Versions/<version_folder>/Version' file for Mono to determine full version with 4 digits
return versionsFolders.map(version => {
const versionFile = path.join(this.versionsDirectoryPath, version, "Version");
const realVersion = fs.readFileSync(versionFile).toString();
return realVersion.trim();
});
}
public setVersion(version: string): void {
// for Mono, version folder contains only 3 digits instead of full version
version = VersionUtils.cutVersionLength(version, 3);
super.setVersion(version);
const versionDirectory = this.getVersionPath(version);
core.exportVariable(
"DYLD_LIBRARY_FALLBACK_PATH",
[
`${versionDirectory}/lib`,
"/lib",
"/usr/lib",
process.env["DYLD_LIBRARY_FALLBACK_PATH"]
].join(path.delimiter)
);
core.exportVariable(
"PKG_CONFIG_PATH",
[
`${versionDirectory}/lib/pkgconfig`,
process.env["PKG_CONFIG_PATH"]
].join(path.delimiter)
);
core.debug(`Add '${versionDirectory}/bin' to PATH`);
core.addPath(`${versionDirectory}/bin`);
}
}