Skip to content

feat: Validate Java compiler version based on runtime version #3613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/common
2 changes: 1 addition & 1 deletion lib/definitions/platform.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,5 +381,5 @@ interface IUpdateAppOptions extends IOptionalFilesToSync, IOptionalFilesToRemove
}

interface IPlatformEnvironmentRequirements {
checkEnvironmentRequirements(platform?: string): Promise<boolean>;
checkEnvironmentRequirements(platform?: string, projectDir?: string): Promise<boolean>;
}
2 changes: 1 addition & 1 deletion lib/services/android-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
this.validatePackageName(projectData.projectId);
this.validateProjectName(projectData.projectName);

await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName);
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName, projectData.projectDir);
this.$androidToolsInfo.validateTargetSdk({ showWarningsAsErrors: true });
}

Expand Down
10 changes: 5 additions & 5 deletions lib/services/doctor-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ class DoctorService implements IDoctorService {
private $terminalSpinnerService: ITerminalSpinnerService,
private $versionsService: IVersionsService) { }

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

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

await this.$injector.resolve("platformEnvironmentRequirements").checkEnvironmentRequirements(null);
await this.$injector.resolve("platformEnvironmentRequirements").checkEnvironmentRequirements(null, configOptions && configOptions.projectDir);
}

public async runSetupScript(): Promise<ISpawnResult> {
Expand Down Expand Up @@ -81,12 +81,12 @@ class DoctorService implements IDoctorService {
});
}

public async canExecuteLocalBuild(platform?: string): Promise<boolean> {
public async canExecuteLocalBuild(platform?: string, projectDir?: string): Promise<boolean> {
await this.$analyticsService.trackEventActionInGoogleAnalytics({
action: TrackActionNames.CheckLocalBuildSetup,
additionalData: "Starting",
});
const infos = await doctor.getInfos({ platform });
const infos = await doctor.getInfos({ platform, projectDir });

const warnings = this.filterInfosByType(infos, constants.WARNING_TYPE_NAME);
const hasWarnings = warnings.length > 0;
Expand Down
2 changes: 1 addition & 1 deletion lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
return;
}

await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName);
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(this.getPlatformData(projectData).normalizedPlatformName, projectData.projectDir);

const xcodeBuildVersion = await this.getXcodeVersion();
if (helpers.versionCompare(xcodeBuildVersion, IOSProjectService.XCODEBUILD_MIN_VERSION) < 0) {
Expand Down
8 changes: 4 additions & 4 deletions lib/services/platform-environment-requirements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
"deploy": "tns cloud deploy"
};

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

const canExecute = await this.$doctorService.canExecuteLocalBuild(platform);
const canExecute = await this.$doctorService.canExecuteLocalBuild(platform, projectDir);
if (!canExecute) {
if (!isInteractive()) {
await this.$analyticsService.trackEventActionInGoogleAnalytics({
Expand Down Expand Up @@ -71,7 +71,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ
if (selectedOption === PlatformEnvironmentRequirements.LOCAL_SETUP_OPTION_NAME) {
await this.$doctorService.runSetupScript();

if (await this.$doctorService.canExecuteLocalBuild(platform)) {
if (await this.$doctorService.canExecuteLocalBuild(platform, projectDir)) {
return true;
}

Expand Down Expand Up @@ -102,7 +102,7 @@ export class PlatformEnvironmentRequirements implements IPlatformEnvironmentRequ

if (selectedOption === PlatformEnvironmentRequirements.BOTH_CLOUD_SETUP_AND_LOCAL_SETUP_OPTION_NAME) {
await this.processBothCloudBuildsAndSetupScript();
if (await this.$doctorService.canExecuteLocalBuild(platform)) {
if (await this.$doctorService.canExecuteLocalBuild(platform, projectDir)) {
return true;
}

Expand Down
6 changes: 3 additions & 3 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"minimatch": "3.0.2",
"mkdirp": "0.5.1",
"mute-stream": "0.0.5",
"nativescript-doctor": "1.0.0",
"nativescript-doctor": "1.1.0",
"open": "0.0.5",
"ora": "2.0.0",
"osenv": "0.1.3",
Expand Down