Safer workaround for Android SDK detection with Java 9/10
Summary: Safer workaround for Android SDK detection with Java 9/10 Reviewed By: mweststrate Differential Revision: D19158381 fbshipit-source-id: 8c4ce456543712204423f14abe8a1840308c8bf9
This commit is contained in:
committed by
Facebook Github Bot
parent
db721e94a6
commit
b716b50729
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "flipper-doctor",
|
"name": "flipper-doctor",
|
||||||
"version": "0.2.3",
|
"version": "0.2.4",
|
||||||
"description": "Utility for checking for issues with a flipper installation",
|
"description": "Utility for checking for issues with a flipper installation",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|||||||
@@ -31,14 +31,39 @@ export type EnvironmentInfo = {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function getEnvInfo(): Promise<EnvironmentInfo> {
|
async function retrieveAndParseEnvInfo(): Promise<any> {
|
||||||
return JSON.parse(
|
return JSON.parse(
|
||||||
await run(
|
await run(
|
||||||
{
|
{
|
||||||
SDKs: ['iOS SDK', 'Android SDK'],
|
SDKs: ['iOS SDK', 'Android SDK'],
|
||||||
IDEs: ['Xcode'],
|
IDEs: ['Xcode'],
|
||||||
|
Languages: ['Java'],
|
||||||
},
|
},
|
||||||
{json: true, showNotFound: true},
|
{json: true, showNotFound: true},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Temporary workaround for https://github.com/facebook/flipper/issues/667 until it properly fixed in 'envinfo'.
|
||||||
|
async function workaroundForNewerJavaVersions(envInfo: any) {
|
||||||
|
try {
|
||||||
|
if (envInfo.Languages.Java && envInfo.Languages.Java.version) {
|
||||||
|
const [majorVersion] = envInfo.Languages.Java.version
|
||||||
|
.split('.')
|
||||||
|
.slice(0, 1)
|
||||||
|
.map((x: string) => parseInt(x, 10));
|
||||||
|
if (8 < majorVersion && majorVersion < 11) {
|
||||||
|
process.env.JAVA_OPTS =
|
||||||
|
'-XX:+IgnoreUnrecognizedVMOptions --add-modules java.se.ee';
|
||||||
|
return await retrieveAndParseEnvInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
}
|
||||||
|
return envInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function getEnvInfo(): Promise<EnvironmentInfo> {
|
||||||
|
return workaroundForNewerJavaVersions(await retrieveAndParseEnvInfo());
|
||||||
|
}
|
||||||
|
|||||||
@@ -136,7 +136,7 @@
|
|||||||
"emotion": "^10.0.23",
|
"emotion": "^10.0.23",
|
||||||
"expand-tilde": "^2.0.2",
|
"expand-tilde": "^2.0.2",
|
||||||
"express": "^4.15.2",
|
"express": "^4.15.2",
|
||||||
"flipper-doctor": "^0.2.3",
|
"flipper-doctor": "^0.2.4",
|
||||||
"fs-extra": "^8.0.1",
|
"fs-extra": "^8.0.1",
|
||||||
"immer": "^5.0.1",
|
"immer": "^5.0.1",
|
||||||
"immutable": "^4.0.0-rc.12",
|
"immutable": "^4.0.0-rc.12",
|
||||||
|
|||||||
@@ -4147,10 +4147,10 @@ flatted@^2.0.0:
|
|||||||
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
|
resolved "https://registry.yarnpkg.com/flatted/-/flatted-2.0.1.tgz#69e57caa8f0eacbc281d2e2cb458d46fdb449e08"
|
||||||
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
|
integrity sha512-a1hQMktqW9Nmqr5aktAux3JMNqaucxGcjtjWnZLHX7yyPCmlSV3M54nGYbqT8K+0GhF3NBgmJCc3ma+WOgX8Jg==
|
||||||
|
|
||||||
flipper-doctor@^0.2.3:
|
flipper-doctor@^0.2.4:
|
||||||
version "0.2.3"
|
version "0.2.4"
|
||||||
resolved "https://registry.yarnpkg.com/flipper-doctor/-/flipper-doctor-0.2.3.tgz#2678c3dc924c1dd69cda65aef9f43040f3b8e085"
|
resolved "https://registry.yarnpkg.com/flipper-doctor/-/flipper-doctor-0.2.4.tgz#907c14282a9f65737f96505dfb0c5022109a10fe"
|
||||||
integrity sha512-61BJUid7yWu/LzuYYuwdOgakQXWoEXV9+PwKPWwwup73u4k80nUdf+Hx4Ev0dMS/mjQuZ3KwmmxFdFhV/3iWTQ==
|
integrity sha512-MjX66Yd1dPSLcnOXIfqPaB5KXmd+A7f+99ashGhbRV+2Y8bXadN4kvYrUZ4gD177LmtMdNjISjm87kBt5t9pnw==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@types/node" "^12.12.12"
|
"@types/node" "^12.12.12"
|
||||||
envinfo "^7.4.0"
|
envinfo "^7.4.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user