mirror of
https://github.com/expo/turtle.git
synced 2026-11-14 19:12:55 -10:00
Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2555e45062 | ||
|
|
1cae1cbc79 |
No files matched your search
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## Unreleased
|
## Unreleased
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Enforce Java 8 when using turtle-cli.
|
||||||
|
|
||||||
## [0.12.7] - 2019-10-25
|
## [0.12.7] - 2019-10-25
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ import { PLATFORMS } from 'turtle/constants';
|
|||||||
import logger from 'turtle/logger';
|
import logger from 'turtle/logger';
|
||||||
|
|
||||||
const which = util.promisify(_which);
|
const which = util.promisify(_which);
|
||||||
|
const JAVA_REQUIRED_VERSION = 8;
|
||||||
const REQUIRED_TOOLS: IToolDefinition[] = [
|
const REQUIRED_TOOLS: IToolDefinition[] = [
|
||||||
{
|
{
|
||||||
command: 'bash',
|
command: 'bash',
|
||||||
@@ -22,16 +23,27 @@ const REQUIRED_TOOLS: IToolDefinition[] = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
command: 'javac',
|
command: 'javac',
|
||||||
missingDescription: 'Please install JDK (version 8 or newer) - check https://jdk.java.net/',
|
missingDescription: `Please install JDK (version ${JAVA_REQUIRED_VERSION}) - check https://jdk.java.net/`,
|
||||||
testFn: async () => {
|
testFn: async () => {
|
||||||
const { status, stdout } = await ExponentTools.spawnAsyncThrowError(
|
const { status, stdout, stderr } = await ExponentTools.spawnAsyncThrowError(
|
||||||
'javac',
|
'java',
|
||||||
['-version'],
|
['-version'],
|
||||||
{ stdio: 'pipe' },
|
{ stdio: 'pipe' },
|
||||||
);
|
);
|
||||||
if (stdout.match(/no java runtime present/i)) {
|
if (stdout.match(/no java runtime present/i)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const matchResult = stderr.match(/.*version ".*\.(.*)\..*"/);
|
||||||
|
if (matchResult) {
|
||||||
|
const [, currentJavaVersion] = matchResult;
|
||||||
|
if (Number(currentJavaVersion) !== JAVA_REQUIRED_VERSION) {
|
||||||
|
throw new Error(`You're using a wrong Java version, please install version ${JAVA_REQUIRED_VERSION}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
logger.warn(`Couldn't find Java version number, assuming you're on Java ${JAVA_REQUIRED_VERSION}...`);
|
||||||
|
}
|
||||||
|
|
||||||
return status === 0;
|
return status === 0;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in new issue
Block a user