Skip to content
This repository was archived by the owner on Feb 2, 2021. It is now read-only.

Commit 24f02d3

Browse files
committed
Merge pull request #333 from telerik/detect-mono
Detect mono version
2 parents 02541a8 + b432e37 commit 24f02d3

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

commands/post-install.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import options = require("../options");
55
import hostInfo = require("../host-info");
66
import util = require("util");
77
import os = require("os");
8-
import HostInfo = require("host-info");
8+
import helpers = require("../helpers");
99

1010
export class PostInstallCommand implements ICommand {
1111
private static SEVEN_ZIP_ERROR_MESSAGE = "It looks like there's a problem with your system configuration. " +
@@ -135,6 +135,12 @@ export class PostInstallCommand implements ICommand {
135135
+ "described in http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_overview.html (for JDK 8)" + os.EOL
136136
+ "or http://docs.oracle.com/javase/7/docs/webnotes/install/ (for JDK 7)." + os.EOL);
137137
}
138+
if(hostInfo.isDarwin() && (!sysInfo.monoVer || helpers.versionCompare(sysInfo.monoVer, "3.12.0") < 0)) {
139+
this.$logger.warn("WARNING: Mono 3.12 or later is not installed or not configured properly.");
140+
this.$logger.out("You will not be able to work with Android devices in the device simulator or debug on connected Android devices." + os.EOL
141+
+ "To be able to work with Android in the device simulator and debug on connected Android devices," + os.EOL
142+
+ "download and install Mono 3.12 or later from http://www.mono-project.com/download/" + os.EOL);
143+
}
138144
}
139145
}
140146
$injector.registerCommand("dev-post-install", PostInstallCommand);

declarations.d.ts

+2
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,8 @@ interface ISysInfoData {
294294
itunesInstalled: boolean;
295295
/** Whether `android` executable can be run */
296296
androidInstalled: boolean;
297+
/** mono version, relevant on Mac only **/
298+
monoVer: string;
297299
}
298300

299301
interface ISysInfo {

sysinfo.ts

+9
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class SysInfo implements ISysInfo {
1212
private $iTunesValidator: Mobile.IiTunesValidator,
1313
private $logger: ILogger) { }
1414

15+
private static monoVerRegExp = /version (\d+[.]\d+[.]\d+) /gm;
1516
private sysInfoCache: ISysInfoData = undefined;
1617

1718
getSysInfo(): ISysInfoData {
@@ -55,6 +56,14 @@ export class SysInfo implements ISysInfo {
5556
procOutput = this.execAndroidH();
5657
res.androidInstalled = procOutput ? _.contains(procOutput, "android") : false;
5758

59+
procOutput = this.exec("mono --version");
60+
if (!!procOutput) {
61+
let match = SysInfo.monoVerRegExp.exec(procOutput);
62+
res.monoVer = match ? match[1] : null;
63+
} else {
64+
res.monoVer = null;
65+
}
66+
5867
this.sysInfoCache = res;
5968
}
6069

0 commit comments

Comments
 (0)