Skip to content

Commit 2e439e5

Browse files
Merge pull request #3613 from NativeScript/vladimirov/integrate-doctor
feat: Validate Java compiler version based on runtime version
2 parents 7069672 + 58f4654 commit 2e439e5

File tree

8 files changed

+17
-17
lines changed

8 files changed

+17
-17
lines changed

lib/definitions/platform.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,5 +381,5 @@ interface IUpdateAppOptions extends IOptionalFilesToSync, IOptionalFilesToRemove
381381
}
382382

383383
interface IPlatformEnvironmentRequirements {
384-
checkEnvironmentRequirements(platform?: string): Promise<boolean>;
384+
checkEnvironmentRequirements(platform?: string, projectDir?: string): Promise<boolean>;
385385
}

lib/services/android-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
133133
this.validatePackageName(projectData.projectId);
134134
this.validateProjectName(projectData.projectName);
135135

136-
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName);
136+
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName, projectData.projectDir);
137137
this.$androidToolsInfo.validateTargetSdk({ showWarningsAsErrors: true });
138138
}
139139

lib/services/doctor-service.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ class DoctorService implements IDoctorService {
1717
private $terminalSpinnerService: ITerminalSpinnerService,
1818
private $versionsService: IVersionsService) { }
1919

20-
public async printWarnings(configOptions?: { trackResult: boolean }): Promise<void> {
20+
public async printWarnings(configOptions?: { trackResult: boolean , projectDir?: string }): Promise<void> {
2121
const infos = await this.$terminalSpinnerService.execute<NativeScriptDoctor.IInfo[]>({
2222
text: `Getting environment information ${EOL}`
23-
}, () => doctor.getInfos());
23+
}, () => doctor.getInfos({ projectDir: configOptions && configOptions.projectDir }));
2424

2525
const warnings = infos.filter(info => info.type === constants.WARNING_TYPE_NAME);
2626
const hasWarnings = warnings.length > 0;
@@ -48,7 +48,7 @@ class DoctorService implements IDoctorService {
4848
this.$logger.error("Cannot get the latest versions information from npm. Please try again later.");
4949
}
5050

51-
await this.$injector.resolve("platformEnvironmentRequirements").checkEnvironmentRequirements(null);
51+
await this.$injector.resolve("platformEnvironmentRequirements").checkEnvironmentRequirements(null, configOptions && configOptions.projectDir);
5252
}
5353

5454
public async runSetupScript(): Promise<ISpawnResult> {
@@ -81,12 +81,12 @@ class DoctorService implements IDoctorService {
8181
});
8282
}
8383

84-
public async canExecuteLocalBuild(platform?: string): Promise<boolean> {
84+
public async canExecuteLocalBuild(platform?: string, projectDir?: string): Promise<boolean> {
8585
await this.$analyticsService.trackEventActionInGoogleAnalytics({
8686
action: TrackActionNames.CheckLocalBuildSetup,
8787
additionalData: "Starting",
8888
});
89-
const infos = await doctor.getInfos({ platform });
89+
const infos = await doctor.getInfos({ platform, projectDir });
9090

9191
const warnings = this.filterInfosByType(infos, constants.WARNING_TYPE_NAME);
9292
const hasWarnings = warnings.length > 0;

lib/services/ios-project-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
139139
return;
140140
}
141141

142-
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName);
142+
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName, projectData.projectDir);
143143

144144
const xcodeBuildVersion = await this.getXcodeVersion();
145145
if (helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) {

lib/services/platform-environment-requirements.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
3030
"deploy": "tns cloud deploy"
3131
};
3232

33-
public async checkEnvironmentRequirements(platform?: string): Promise<boolean> {
33+
public async checkEnvironmentRequirements(platform?: string, projectDir?: string): Promise<boolean> {
3434
if (process.env.NS_SKIP_ENV_CHECK) {
3535
await this.$analyticsService.trackEventActionInGoogleAnalytics({
3636
action: TrackActionNames.CheckEnvironmentRequirements,
@@ -39,7 +39,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
3939
return true;
4040
}
4141

42-
const canExecute = await this.$doctorService.canExecuteLocalBuild(platform);
42+
const canExecute = await this.$doctorService.canExecuteLocalBuild(platform, projectDir);
4343
if (!canExecute) {
4444
if (!isInteractive()) {
4545
await this.$analyticsService.trackEventActionInGoogleAnalytics({
@@ -71,7 +71,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
7171
if (selectedOption === PlatformEnvironmentRequirements.LOCAL_SETUP_OPTION_NAME) {
7272
await this.$doctorService.runSetupScript();
7373

74-
if (await this.$doctorService.canExecuteLocalBuild(platform)) {
74+
if (await this.$doctorService.canExecuteLocalBuild(platform, projectDir)) {
7575
return true;
7676
}
7777

@@ -102,7 +102,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
102102

103103
if (selectedOption === PlatformEnvironmentRequirements.BOTH_CLOUD_SETUP_AND_LOCAL_SETUP_OPTION_NAME) {
104104
await this.processBothCloudBuildsAndSetupScript();
105-
if (await this.$doctorService.canExecuteLocalBuild(platform)) {
105+
if (await this.$doctorService.canExecuteLocalBuild(platform, projectDir)) {
106106
return true;
107107
}
108108

npm-shrinkwrap.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"minimatch": "3.0.2",
5454
"mkdirp": "0.5.1",
5555
"mute-stream": "0.0.5",
56-
"nativescript-doctor": "1.0.0",
56+
"nativescript-doctor": "1.1.0",
5757
"open": "0.0.5",
5858
"ora": "2.0.0",
5959
"osenv": "0.1.3",

0 commit comments

Comments
 (0)