Skip to content

chore: Merge release in master #3627

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 14 commits into from
May 28, 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
11 changes: 7 additions & 4 deletions lib/commands/platform-clean.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export class CleanCommand implements ICommand {
private $projectData: IProjectData,
private $platformService: IPlatformService,
private $errors: IErrors,
private $platformsData: IPlatformsData) {
private $platformEnvironmentRequirements: IPlatformEnvironmentRequirements) {
this.$projectData.initializeProjectData();
}

Expand All @@ -18,12 +18,15 @@ export class CleanCommand implements ICommand {
this.$errors.fail("No platform specified. Please specify a platform to clean");
}

_.each(args, platform => {
this.$platformService.validatePlatform(platform, this.$projectData);
});

for (const platform of args) {
this.$platformService.validatePlatformInstalled(platform, this.$projectData);

const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
const platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);
const currentRuntimeVersion = this.$platformService.getCurrentPlatformVersion(platform, this.$projectData);
await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(platform, this.$projectData.projectDir, currentRuntimeVersion);
}

return true;
Expand Down
12 changes: 4 additions & 8 deletions lib/commands/remove-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ export class RemovePlatformCommand implements ICommand {

constructor(private $platformService: IPlatformService,
private $projectData: IProjectData,
private $errors: IErrors,
private $platformsData: IPlatformsData) {
private $errors: IErrors) {
this.$projectData.initializeProjectData();
}

Expand All @@ -17,12 +16,9 @@ export class RemovePlatformCommand implements ICommand {
this.$errors.fail("No platform specified. Please specify a platform to remove");
}

for (const platform of args) {
this.$platformService.validatePlatformInstalled(platform, this.$projectData);
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
const platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);
}
_.each(args, platform => {
this.$platformService.validatePlatform(platform, this.$projectData);
});

return true;
}
Expand Down
24 changes: 18 additions & 6 deletions lib/commands/update-platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export class UpdatePlatformCommand implements ICommand {
constructor(private $options: IOptions,
private $projectData: IProjectData,
private $platformService: IPlatformService,
private $errors: IErrors,
private $platformsData: IPlatformsData) {
private $platformEnvironmentRequirements: IPlatformEnvironmentRequirements,
private $errors: IErrors) {
this.$projectData.initializeProjectData();
}

Expand All @@ -18,12 +18,24 @@ export class UpdatePlatformCommand implements ICommand {
this.$errors.fail("No platform specified. Please specify platforms to update.");
}

for (const arg of args) {
_.each(args, arg => {
const platform = arg.split("@")[0];
this.$platformService.validatePlatform(platform, this.$projectData);
const platformData = this.$platformsData.getPlatformData(platform, this.$projectData);
const platformProjectService = platformData.platformProjectService;
await platformProjectService.validate(this.$projectData);
});

for (const arg of args) {
const [ platform, versionToBeInstalled ] = arg.split("@");
this.$platformService.validatePlatformInstalled(platform, this.$projectData);
const argsToCheckEnvironmentRequirements: string[] = [ platform ];
// If version is not specified, we know the command will install the latest compatible Android runtime.
// The latest compatible Android runtime supports Java version, so we do not need to pass it here.
// Passing projectDir to the nativescript-doctor validation will cause it to check the runtime from the current package.json
// So in this case, where we do not want to validate the runtime, just do not pass both projectDir and runtimeVersion.
if (versionToBeInstalled) {
argsToCheckEnvironmentRequirements.push(this.$projectData.projectDir, versionToBeInstalled);
}

await this.$platformEnvironmentRequirements.checkEnvironmentRequirements(...argsToCheckEnvironmentRequirements);
}

return true;
Expand Down
2 changes: 1 addition & 1 deletion lib/common
Submodule common updated 2 files
+2 −2 declarations.d.ts
+1 −1 package.json
12 changes: 10 additions & 2 deletions lib/definitions/platform.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ interface IPlatformService extends IBuildPlatformAction, NodeJS.EventEmitter {
* @returns {void}
*/
saveBuildInfoFile(platform: string, projectDir: string, buildInfoFileDirname: string): void;

/**
* Gives information for the current version of the runtime.
* @param {string} platform The platform to be checked.
* @param {IProjectData} projectData The data describing the project
* @returns {string} Runtime version
*/
getCurrentPlatformVersion(platform: string, projectData: IProjectData): string;
}

interface IPlatformOptions extends IPlatformSpecificData, ICreateProjectOptions { }
Expand Down Expand Up @@ -381,5 +389,5 @@ interface IUpdateAppOptions extends IOptionalFilesToSync, IOptionalFilesToRemove
}

interface IPlatformEnvironmentRequirements {
checkEnvironmentRequirements(platform?: string, projectDir?: string): Promise<boolean>;
}
checkEnvironmentRequirements(platform?: string, projectDir?: string, runtimeVersion?: string): Promise<boolean>;
}
11 changes: 5 additions & 6 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 , projectDir?: string }): Promise<void> {
public async printWarnings(configOptions?: { trackResult: boolean , projectDir?: string, runtimeVersion?: string }): Promise<void> {
const infos = await this.$terminalSpinnerService.execute<NativeScriptDoctor.IInfo[]>({
text: `Getting environment information ${EOL}`
}, () => doctor.getInfos({ projectDir: configOptions && configOptions.projectDir }));
}, () => doctor.getInfos({ projectDir: configOptions && configOptions.projectDir, androidRuntimeVersion: configOptions && configOptions.runtimeVersion }));

const warnings = infos.filter(info => info.type === constants.WARNING_TYPE_NAME);
const hasWarnings = warnings.length > 0;
Expand All @@ -34,12 +34,11 @@ class DoctorService implements IDoctorService {
await this.$analyticsService.track("DoctorEnvironmentSetup", hasWarnings ? "incorrect" : "correct");
}

this.printInfosCore(infos);

if (hasWarnings) {
this.$logger.info("There seem to be issues with your configuration.");
} else {
this.$logger.out("No issues were detected.".bold);
this.printInfosCore(infos);
}

try {
Expand Down Expand Up @@ -81,12 +80,12 @@ class DoctorService implements IDoctorService {
});
}

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

const warnings = this.filterInfosByType(infos, constants.WARNING_TYPE_NAME);
const hasWarnings = warnings.length > 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, projectDir?: string): Promise<boolean> {
public async checkEnvironmentRequirements(platform?: string, projectDir?: string, runtimeVersion?: 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, projectDir);
const canExecute = await this.$doctorService.canExecuteLocalBuild(platform, projectDir, runtimeVersion);
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, projectDir)) {
if (await this.$doctorService.canExecuteLocalBuild(platform, projectDir, runtimeVersion)) {
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, projectDir)) {
if (await this.$doctorService.canExecuteLocalBuild(platform, projectDir, runtimeVersion)) {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/services/platform-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class PlatformService extends EventEmitter implements IPlatformService {
}
}

private getCurrentPlatformVersion(platform: string, projectData: IProjectData): string {
public getCurrentPlatformVersion(platform: string, projectData: IProjectData): string {
const platformData = this.$platformsData.getPlatformData(platform, projectData);
const currentPlatformData: any = this.$projectDataService.getNSValue(projectData.projectDir, platformData.frameworkPackageName);
let version: string;
Expand Down
15 changes: 8 additions & 7 deletions lib/services/versions-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,15 @@ class VersionsService implements IVersionsService {
allComponents.push(nativescriptCliInformation);
}

const nativescriptCoreModulesInformation: IVersionInformation = await this.getTnsCoreModulesVersion();
if (nativescriptCoreModulesInformation) {
allComponents.push(nativescriptCoreModulesInformation);
}

const runtimesVersions: IVersionInformation[] = await this.getRuntimesVersions();
if (this.projectData) {
const nativescriptCoreModulesInformation: IVersionInformation = await this.getTnsCoreModulesVersion();
if (nativescriptCoreModulesInformation) {
allComponents.push(nativescriptCoreModulesInformation);
}

allComponents = allComponents.concat(runtimesVersions);
const runtimesVersions: IVersionInformation[] = await this.getRuntimesVersions();
allComponents = allComponents.concat(runtimesVersions);
}

return allComponents
.map(componentInformation => {
Expand Down
40 changes: 20 additions & 20 deletions npm-shrinkwrap.json

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

Loading