Skip to content

Commit

Permalink
Merge pull request #36 from KishoreIthadi/develop
Browse files Browse the repository at this point in the history
Develop to Master for release 0.0.6
  • Loading branch information
KishoreIthadi authored Jan 28, 2019
2 parents aedc971 + 9674578 commit de3b160
Show file tree
Hide file tree
Showing 33 changed files with 1,549 additions and 1,848 deletions.
2,878 changes: 1,175 additions & 1,703 deletions package-lock.json

Large diffs are not rendered by default.

90 changes: 85 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dotnet-core-essentials",
"displayName": "Dotnet Core Essentials",
"description": "Create, debug, run and publish .Net core/standard applications",
"version": "0.0.5",
"version": "0.0.6",
"publisher": "KishoreIthadi",
"author": {
"name": "Kishore Ithadi",
Expand Down Expand Up @@ -151,6 +151,86 @@
{
"command": "extension.removeDllReference",
"when": "resourceExtname == .csproj"
},
{
"command": "extension.build",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.addProjectReference",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.addDllReference",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.clean",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.startup",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.publish",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.addNugetPackage",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.removeProjectReference",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.removeNugetPackage",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.removeDllReference",
"when": "resourceExtname == .vbproj"
},
{
"command": "extension.build",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.addProjectReference",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.addDllReference",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.clean",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.startup",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.publish",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.addNugetPackage",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.removeProjectReference",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.removeNugetPackage",
"when": "resourceExtname == .fsproj"
},
{
"command": "extension.removeDllReference",
"when": "resourceExtname == .fsproj"
}
]
}
Expand All @@ -163,15 +243,15 @@
},
"devDependencies": {
"@types/mocha": "^2.2.32",
"mocha": "^2.3.3",
"vscode": "^1.1.8",
"@types/node": "^6.0.40",
"typescript": "^2.0.3"
"mocha": "^2.3.3",
"typescript": "^2.0.3",
"vscode": "^1.1.28"
},
"dependencies": {
"fs-extra": "^4.0.2",
"path": "^0.12.7",
"vsce": "^1.36.1",
"vsce": "^1.54.0",
"xml-mapping": "^1.7.1"
}
}
3 changes: 2 additions & 1 deletion src/DCECommands/AddDllRef.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

import { AddReferenceDTO } from '../DTO/AddReferenceDTO';
import { MessageUtility } from '../Utilities/MessageUtility';
import { StringUtility } from '../Utilities/StringUtility';
Expand All @@ -15,7 +17,6 @@ export class AddDllRef {
referenceDTO.ReferenceType = DataSource.GetReferenceTypes()[1];
obj.ExecuteAddRefCmd(referenceDTO);
}

else {
referenceDTO.CSProjName = args.fsPath.substring(args.fsPath.lastIndexOf(StringUtility.PathSeperator) + 1);
referenceDTO.Path = args.fsPath.substring(0, args.fsPath.lastIndexOf(StringUtility.PathSeperator));
Expand Down
5 changes: 3 additions & 2 deletions src/DCECommands/AddProjectRef.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

import { AddReferenceDTO } from '../DTO/AddReferenceDTO';
import { MessageUtility } from '../Utilities/MessageUtility';
import { StringUtility } from '../Utilities/StringUtility';
import { FileUtility } from '../Utilities/FileUtility';
import { QuickPickUtility } from '../Utilities/QuickPickUtility';
import { MessageTypeEnum } from '../Enums/MessageTypeEnum';
import { UserOptionsEnum } from '../Enums/UserOptionsEnum';
import { AddRefCmd } from './AddRefCmd';
import { DataSource } from '../DataSource';
import { FileTypeEnum } from '../Enums/FileTypeEnum';
Expand All @@ -29,7 +30,7 @@ export class AddProjectRef {
if (typeof slnName != StringUtility.Undefined) {
referenceDTO.Path = SolutionsList.get(slnName);
referenceDTO.SlnName = slnName;
referenceDTO.FileType = FileTypeEnum.Csproj;
referenceDTO.FileType = projName.substring(projName.lastIndexOf('.') + 1)
AddRefCmd.BrowseProject(referenceDTO, projName);
}
});
Expand Down
28 changes: 12 additions & 16 deletions src/DCECommands/AddRefCmd.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

import * as vscode from 'vscode';
import * as fs from 'fs';

import { ChildProcessUtility } from '../Utilities/ChildProcessUtility';
Expand All @@ -16,19 +15,12 @@ import { CLITypeEnum } from '../Enums/CLITypeEnum';
import { FileTypeEnum } from '../Enums/FileTypeEnum';
import { MessageTypeEnum } from '../Enums/MessageTypeEnum';
import { UserOptionsEnum } from '../Enums/UserOptionsEnum';

import { AddReferenceDTO } from '../DTO/AddReferenceDTO';
import { DataSource } from '../DataSource';

import * as fs_extra from 'fs-extra';
import * as XMLMapping from 'xml-mapping';
import * as path from 'path';

export class AddRefCmd {

constructor() {
}

public ExecuteAddRefCmd(referenceDTO): void {
if (ValidationUtility.WorkspaceValidation()) {
let rootFolders = ValidationUtility.SelectRootPath();
Expand All @@ -51,10 +43,10 @@ export class AddRefCmd {
// Lists reference types.
public static SelectReferenceType(referenceDTO) {
referenceDTO.ReferenceType == DataSource.GetReferenceTypes()[0]
? referenceDTO.FileType = FileTypeEnum.Csproj
? referenceDTO.FileType = FileTypeEnum.Proj
: referenceDTO.FileType = FileTypeEnum.Dll;

referenceDTO.FileType == FileTypeEnum.Csproj
referenceDTO.FileType == FileTypeEnum.Proj
? AddRefCmd.SolutionSelecter(referenceDTO)
: AddRefCmd.GetPaths(referenceDTO);
}
Expand Down Expand Up @@ -90,7 +82,7 @@ export class AddRefCmd {

// Get the list of projects under given path.
let sourcecsprojList: Map<string, string> = FileUtility.GetFilesbyExtension(referenceDTO.Path,
FileTypeEnum.Csproj, new Map<string, string>());
FileTypeEnum.Proj, new Map<string, string>());

if (sourcecsprojList.size > 0) {

Expand All @@ -100,10 +92,10 @@ export class AddRefCmd {
.then(sourceCSprojName => {
if (typeof sourceCSprojName != StringUtility.Undefined) {

referenceDTO.SourcePath = sourcecsprojList.get(sourceCSprojName) + StringUtility.PathSeperator + sourceCSprojName;
referenceDTO.SourcePath = sourcecsprojList.get(sourceCSprojName) + StringUtility.PathBackSlash + sourceCSprojName;
referenceDTO.CSProjName = sourceCSprojName.substring(0, sourceCSprojName.lastIndexOf('.'));
// Check whether the project is valid project or not.
let SourceCsprojJsonObj: any = XMLMapping.load(fs.readFileSync(referenceDTO.SourcePath).toString(), { comments: false });
let SourceCsprojJsonObj: any = XMLMapping.load(fs.readFileSync(referenceDTO.SourcePath).toString(), { comments: false, nested: true });
if (ValidationUtility.ValidateProjectType(SourceCsprojJsonObj)) {
// Checking for dotnet 2.x cli version.
if (ValidationUtility.CheckCliVersion(sourcecsprojList.get(sourceCSprojName))) {
Expand Down Expand Up @@ -144,14 +136,15 @@ export class AddRefCmd {
* Copy Project to current working folder if doesn't exist.
*/
public static BrowseProject(referenceDTO, sourceCSprojName) {
referenceDTO.FileType = sourceCSprojName.substring(sourceCSprojName.lastIndexOf('.'));
let destcsprojList: Map<string, string> = FileUtility.GetFilesbyExtension(referenceDTO.Path,
referenceDTO.FileType, new Map<string, string>());
FileTypeEnum.Proj, new Map<string, string>());

// Adding browse option to the list.
destcsprojList.set(UserOptionsEnum.Browse, UserOptionsEnum.Browse);

// Removing the selected source project name to avoid circular dependency.
if (referenceDTO.FileType == FileTypeEnum.Csproj) {
if (referenceDTO.FileType !== FileTypeEnum.Dll) {
destcsprojList.delete(sourceCSprojName);
}

Expand All @@ -164,7 +157,10 @@ export class AddRefCmd {
referenceDTO.DestinationPath = destcsprojList.get(fileName) + StringUtility.PathSeperator + fileName;
referenceDTO.DLLName = fileName.substring(0, fileName.lastIndexOf('.'));
// Check Whether the project selected is csproj or not.
let DestCsprojJsonObj: any = XMLMapping.load(fs.readFileSync(referenceDTO.DestinationPath).toString());
let DestCsprojJsonObj: any;
let cleanedString = fs.readFileSync(referenceDTO.DestinationPath).toString().replace("\ufeff", "");
DestCsprojJsonObj = XMLMapping.tojson(cleanedString, { comments: false, nested: true });

ValidationUtility.ValidateProjectType(DestCsprojJsonObj)
? AddRefCmd.AddProjectReference(referenceDTO)
: MessageUtility.ShowMessage(MessageTypeEnum.Error, StringUtility.NotProject, []);
Expand Down
10 changes: 3 additions & 7 deletions src/DCECommands/BuildCmd.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict';

import { FileUtility } from '../Utilities/FileUtility';
import { MessageUtility } from '../Utilities/MessageUtility';
import { QuickPickUtility } from '../Utilities/QuickPickUtility';
Expand All @@ -6,14 +8,8 @@ import { ValidationUtility } from '../Utilities/ValidationUtility';

import { FileTypeEnum } from '../Enums/FileTypeEnum';
import { MessageTypeEnum } from '../Enums/MessageTypeEnum';

import { ChildProcessUtility } from '../Utilities/ChildProcessUtility';
import { CLITypeEnum } from '../Enums/CLITypeEnum';
import { OutputChannelUtility } from '../Utilities/OutputChannelUtility';
import { TerminalUtility } from '../Utilities/TerminalUtility';

import * as vscode from 'vscode';

export class BuildCmd {

public ExecuteBuildCmd(args) {
Expand Down Expand Up @@ -49,7 +45,7 @@ export class BuildCmd {
public static ValidateProject(rootPath) {

let csprojNameNPathList: Map<string, string> = FileUtility.GetFilesbyExtension(rootPath,
FileTypeEnum.Csproj, new Map<string, string>());
FileTypeEnum.Proj, new Map<string, string>());

let slnNameNPathList: Map<string, string> = FileUtility.GetFilesbyExtension(rootPath,
FileTypeEnum.SLN, new Map<string, string>());
Expand Down
5 changes: 4 additions & 1 deletion src/DCECommands/CleanCmd.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

'use strict';

import { FileUtility } from '../Utilities/FileUtility';
import { MessageUtility } from '../Utilities/MessageUtility';
import { QuickPickUtility } from '../Utilities/QuickPickUtility';
Expand Down Expand Up @@ -39,7 +42,7 @@ export class CleanCmd {
public static ValidateProject(rootPath) {

let csprojNameNPathList: Map<string, string> = FileUtility.GetFilesbyExtension(rootPath,
FileTypeEnum.Csproj, new Map<string, string>());
FileTypeEnum.Proj, new Map<string, string>());

let slnNameNPathList: Map<string, string> = FileUtility.GetFilesbyExtension(rootPath,
FileTypeEnum.SLN, new Map<string, string>());
Expand Down
70 changes: 51 additions & 19 deletions src/DCECommands/GenerateCmd.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

import * as vscode from 'vscode';
import * as fs from 'fs';

import { FileUtility } from '../Utilities/FileUtility';
Expand Down Expand Up @@ -55,39 +54,74 @@ export class GenerateCmd {
if (typeof frameWork != StringUtility.Undefined) {

GenerateCmdObj.FrameWork = frameWork;
GenerateCmd.SelectVersion(GenerateCmdObj);
GenerateCmd.SelectLangugae(GenerateCmdObj);
}
});
}

private static SelectVersion(GenerateCmdObj: GenerateCmdDTO) {
let versionsMap: Map<string, string> = DataSource.GetVersions(GenerateCmdObj.FrameWork);
// Lists available versions.
private static SelectLangugae(GenerateCmdObj) {
// Lists Framework types.
QuickPickUtility
.ShowQuickPick(Array.from(versionsMap.keys()), StringUtility.SelectVersion)
.then(fwVersion => {
if (typeof fwVersion != StringUtility.Undefined) {
GenerateCmdObj.Version = versionsMap.get(fwVersion);
if (GenerateCmdObj.FrameWork == FrameworkTypeEnum.NetStandard) {
GenerateCmdObj.AppType = ProjectTypeEnum.Classlib;
GenerateCmd.SlnFinder(GenerateCmdObj);
}
else {
GenerateCmd.SelectApplicationType(GenerateCmdObj);
}
.ShowQuickPick(DataSource.GetLanguageList(), StringUtility.SelectLanguage)
.then(language => {
if (typeof language != StringUtility.Undefined) {

GenerateCmdObj.Language = language;
GenerateCmd.SelectVersion(GenerateCmdObj);
}
});
}

private static SelectVersion(GenerateCmdObj: GenerateCmdDTO) {
if (GenerateCmdObj.FrameWork !== FrameworkTypeEnum.NetCore) {
GenerateCmdObj.AppType = ProjectTypeEnum.Classlib;
GenerateCmd.SlnFinder(GenerateCmdObj);
}
else {
GenerateCmdObj.Version = DataSource.GetVersion(GenerateCmdObj.RootPath);
GenerateCmd.SelectApplicationType(GenerateCmdObj);
}
// let versionsMap: Map<string, string> = DataSource.GetVersions(GenerateCmdObj.FrameWork, GenerateCmdObj.RootPath);
// Lists available versions.
// QuickPickUtility
// .ShowQuickPick(Array.from(versionsMap.keys()), StringUtility.SelectVersion)
// .then(fwVersion => {
// if (typeof fwVersion != StringUtility.Undefined) {
// GenerateCmdObj.Version = versionsMap.get(fwVersion);
// if (GenerateCmdObj.FrameWork == FrameworkTypeEnum.NetStandard) {
// GenerateCmdObj.AppType = ProjectTypeEnum.Classlib;
// GenerateCmd.SlnFinder(GenerateCmdObj);
// }
// else {
// GenerateCmd.SelectApplicationType(GenerateCmdObj);
// }
// }
// });
}

private static SelectApplicationType(GenerateCmdObj: GenerateCmdDTO) {
let applicationTypeMap: Map<string, string> = DataSource.GetApplicationTypes();
let applicationTypeMap: Map<string, string> = DataSource.GetApplicationTypes(GenerateCmdObj.Language);

// Displays types of application.
QuickPickUtility
.ShowQuickPick(Array.from(applicationTypeMap.keys()), StringUtility.SelectAppType)
.then(fwAppType => {
if (typeof fwAppType != StringUtility.Undefined) {
GenerateCmdObj.AppType = applicationTypeMap.get(fwAppType);
// if(DataSource.GetOptionAppType().indexOf(GenerateCmdObj.AppType)!=-1){
// let optionsTypeMap:Map<string,string>=DataSource.GetOptions(GenerateCmdObj.AppType);
// QuickPickUtility
// .ShowQuickPick(Array.from(optionsTypeMap.keys()), StringUtility.SelectAppType)
// .then( option => {
// if(option){
// GenerateCmdObj.AppType=GenerateCmdObj.AppType+optionsTypeMap.get(option);
// GenerateCmd.SlnFinder(GenerateCmdObj);
// }
// });
// }
// else{
GenerateCmd.SlnFinder(GenerateCmdObj);
//}
}
});
}
Expand All @@ -101,8 +135,6 @@ export class GenerateCmd {
// Adding "Create New Solution" at last in the list.
slnNPathList.set(StringUtility.CreateSln, StringUtility.CreateSln);

let slnNameList: string[] = Array.from(slnNPathList.keys());

if (slnNPathList.size > 1) {

// Lists all sln files and asks for app name if selected.
Expand Down
Loading

0 comments on commit de3b160

Please sign in to comment.