Skip to content

Commit f214044

Browse files
authored
Merge pull request #1857 from NativeScript/getSysInfo
Separate methods used instead getSysInfo()
2 parents 9235971 + 14b598c commit f214044

File tree

4 files changed

+7
-10
lines changed

4 files changed

+7
-10
lines changed

lib/services/android-project-service.ts

+4-7
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,6 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
2323
{ name: "lazy", version: "^1.0.11" }
2424
];
2525

26-
private get sysInfoData(): ISysInfoData {
27-
return this.$sysInfo.getSysInfo(path.join(__dirname, "..", "..", "package.json")).wait();
28-
}
29-
3026
private _androidProjectPropertiesManagers: IDictionary<IAndroidProjectPropertiesManager>;
3127

3228
constructor(private $androidEmulatorServices: Mobile.IEmulatorPlatformServices,
@@ -99,7 +95,8 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
9995

10096
// this call will fail in case `android` is not set correctly.
10197
this.$androidToolsInfo.getPathToAndroidExecutable({ showWarningsAsErrors: true }).wait();
102-
this.$androidToolsInfo.validateJavacVersion(this.sysInfoData.javacVersion, { showWarningsAsErrors: true }).wait();
98+
let javaCompilerVersion = this.$sysInfo.getJavaCompilerVersion().wait();
99+
this.$androidToolsInfo.validateJavacVersion(javaCompilerVersion, { showWarningsAsErrors: true }).wait();
103100
}).future<void>()();
104101
}
105102

@@ -167,14 +164,14 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
167164
}
168165
});
169166
} else {
170-
this.$logger.printMarkdown(` As you are using Node.js \`${this.sysInfoData.nodeVer}\` Static Binding Generator will be turned off.` +
167+
this.$logger.printMarkdown(` As you are using Node.js \`${process.version}\` Static Binding Generator will be turned off.` +
171168
`Upgrade your Node.js to ${AndroidProjectService.MIN_REQUIRED_NODEJS_VERSION_FOR_STATIC_BINDINGS} or later, so you can use this feature.`);
172169
}
173170
}).future<any>()();
174171
}
175172

176173
private canUseStaticBindingGenerator(): boolean {
177-
return semver.gte(this.sysInfoData.nodeVer, AndroidProjectService.MIN_REQUIRED_NODEJS_VERSION_FOR_STATIC_BINDINGS);
174+
return semver.gte(process.version, AndroidProjectService.MIN_REQUIRED_NODEJS_VERSION_FOR_STATIC_BINDINGS);
178175
}
179176

180177
private useGradleWrapper(frameworkDir: string): boolean {

lib/services/platform-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export class PlatformService implements IPlatformService {
218218
if (platform === "ios") {
219219
_.each(this.$pluginsService.getAllInstalledPlugins().wait(), (pluginData: IPluginData) => {
220220
if (this.$fs.exists(path.join(pluginData.pluginPlatformsFolderPath(platform), "Podfile")).wait() &&
221-
!this.$sysInfo.getSysInfo(this.$staticConfig.pathToPackageJson).wait().cocoapodVer) {
221+
!this.$sysInfo.getCocoapodVersion().wait()) {
222222
this.$errors.failWithoutHelp(`${pluginData.name} has Podfile and you don't have Cocoapods installed or it is not configured correctly. Please verify Cocoapods can work on your machine.`);
223223
}
224224
});

lib/services/xcproj-service.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class XcprojService implements IXcprojService {
3434
public getXcprojInfo(): IFuture<IXcprojInfo> {
3535
return ((): IXcprojInfo => {
3636
if (!this.xcprojInfoCache) {
37-
let cocoapodVer = this.$sysInfo.getSysInfo(this.$staticConfig.pathToPackageJson).wait().cocoapodVer,
37+
let cocoapodVer = this.$sysInfo.getCocoapodVersion().wait(),
3838
xcodeVersion = this.$xcodeSelectService.getXcodeVersion().wait();
3939

4040
if(cocoapodVer && !semver.valid(cocoapodVer)) {

0 commit comments

Comments
 (0)