Skip to content
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
6 changes: 3 additions & 3 deletions extension/src/client/command/TriggerCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ export class TriggerCollection extends Command<void> {
let status = await languageClient.sendRequest(remote.server.giveVroCollectionStatus)

while (status && !status.finished) {
this.logger.debug("Collection status:", status)
this.logger.info("Collection status:", status)
progress.report(status)
await sleep(500)
await sleep(1000)
status = await languageClient.sendRequest(remote.server.giveVroCollectionStatus)
}

this.logger.debug("Collection finished:", status)
this.logger.info("Collection finished:", status)

if (status.error !== undefined) {
await vscode.commands.executeCommand(Commands.EventCollectionError, status.error)
Expand Down
3 changes: 2 additions & 1 deletion extension/src/client/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,5 +107,6 @@ export enum ProjectArchetypes {
Actions = "com.vmware.pscoe.o11n:actions-package",
Xml = "com.vmware.pscoe.o11n:xml-package",
Vra = "com.vmware.pscoe.vra:vra-package",
VraNg = "com.vmware.pscoe.vra-ng:vra-ng-package"
VraNg = "com.vmware.pscoe.vra-ng:vra-ng-package",
Polyglot = "com.vmware.pscoe.polyglot:polyglot-project"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we are listing all supported, we are missing vrops, vcd, vrli - basically all supported are defined here: https://github.com/vmware/build-tools-for-vmware-aria/tree/main/maven/base-package

}
4 changes: 2 additions & 2 deletions extension/src/client/lang/LanguageServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { remote } from "@vmware/vro-language-server"
import * as vscode from "vscode"
import * as client from "vscode-languageclient"

import { OutputChannels, ProjectArchetypes } from "../constants"
import { OutputChannels } from "../constants"
import { Registrable } from "../Registrable"
import { ConfigurationManager, EnvironmentManager } from "../system"

Expand Down Expand Up @@ -56,7 +56,7 @@ export class LanguageServices implements Registrable, vscode.Disposable {
}

initialize(): Promise<void> {
if (!this.env.hasRelevantProject(prj => prj.is(ProjectArchetypes.Actions))) {
if (!this.env.hasRelevantProject()) {
return Promise.resolve()
}

Expand Down
4 changes: 2 additions & 2 deletions extension/src/client/provider/content/RemoteDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class RemoteDocument {
const fileBuffer = new AdmZip(filePath).readFile("action-content")

if (!fileBuffer) {
throw new Error(`Could not extact action content from $filePath`)
throw new Error(`Could not extract action content from $filePath`)
}

this.source = fileBuffer // content is in UTF-16BE
Expand All @@ -61,7 +61,7 @@ export class RemoteDocument {
const fileBuffer = new AdmZip(filePath).readFile("workflow-content")

if (!fileBuffer) {
throw new Error(`Could not extact action content from $filePath`)
throw new Error(`Could not extract action content from $filePath`)
}

this.source = fileBuffer // content is in UTF-16BE
Expand Down
16 changes: 16 additions & 0 deletions extension/src/client/provider/task/DefaultTasksJson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,5 +133,21 @@ export const TASKS_BY_TOOLCHAIN_PARENT: Record<ProjectArchetypes, VrealizeTaskCo
label: "Pull",
command: "mvn vra-ng:pull -P${config:vrdev.maven.profile}"
}
],

[ProjectArchetypes.Polyglot]: [
{
label: "Push",
windows: {
command:
'mvn clean package vrealize:push -DincludeDependencies=true -DskipTests -P${config:vrdev.maven.profile} -D"vro.packageImportConfigurationAttributeValues=false"'
},
command:
"mvn clean package vrealize:push -DincludeDependencies=true -DskipTests -P${config:vrdev.maven.profile} -Dvro.packageImportConfigurationAttributeValues=false"
},
{
label: "Build",
command: "mvn clean package"
}
]
}
6 changes: 3 additions & 3 deletions extension/src/client/system/ConfigurationManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,17 +101,17 @@ export class ConfigurationManager extends BaseConfiguration implements Registrab

if (settingsXmlContent.length < 1) {
this.logger.warn(`Got no content from ${this.settingsXmlPath}`)
this.allProfiles = undefined
this.allProfiles = {}
return
}

const settingsJson = xmlParser.parse(settingsXmlContent.toString("utf8"))
const allProfiles = settingsJson?.settings?.profiles?.profile
const vroProfiles: MavenProfilesMap = {}

if (!allProfiles) {
if (Object.keys(allProfiles).length < 1) {
this.logger.warn(`No profiles found in ${this.settingsXmlPath}`)
this.allProfiles = undefined
this.allProfiles = {}
return
}

Expand Down
16 changes: 6 additions & 10 deletions extension/src/client/ui/StatusBarController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { AutoWire, Logger } from "@vmware/vrdt-common"
import * as vscode from "vscode"

import { Commands, ProjectArchetypes } from "../constants"
import { Commands } from "../constants"
import { ConfigurationManager, EnvironmentManager } from "../system"
import { Registrable } from "../Registrable"

Expand All @@ -33,7 +33,7 @@ export class StatusBarController implements Registrable, vscode.Disposable {
register(context: vscode.ExtensionContext): void {
context.subscriptions.push(this)

if (this.env.hasRelevantProject(prj => prj.is(ProjectArchetypes.Actions))) {
if (this.env.hasRelevantProject()) {
context.subscriptions.push(
vscode.commands.registerCommand(Commands.EventCollectionStart, this.onCollectionStart.bind(this)),
vscode.commands.registerCommand(Commands.EventCollectionSuccess, this.onCollectionSuccess.bind(this)),
Expand All @@ -56,11 +56,7 @@ export class StatusBarController implements Registrable, vscode.Disposable {
private onConfigurationOrProfilesChanged() {
const currentProfileName = this.config.hasActiveProfile() ? this.config.activeProfile.get("id") : undefined

if (
this.verifyConfiguration() &&
currentProfileName !== this.profileName &&
this.env.hasRelevantProject(prj => prj.is(ProjectArchetypes.Actions))
) {
if (this.verifyConfiguration() && currentProfileName !== this.profileName && this.env.hasRelevantProject()) {
vscode.commands.executeCommand(Commands.TriggerServerCollection)
}
}
Expand All @@ -71,7 +67,7 @@ export class StatusBarController implements Registrable, vscode.Disposable {

const serverConfIsValid = !!this.profileName
if (serverConfIsValid) {
if (this.env.hasRelevantProject(prj => prj.is(ProjectArchetypes.Actions))) {
if (this.env.hasRelevantProject()) {
this.collectionButton.show()

this.collectionButton.text = "$(cloud-download)"
Expand Down Expand Up @@ -102,8 +98,8 @@ export class StatusBarController implements Registrable, vscode.Disposable {

private onCollectionStart() {
this.collectionButton.text = "$(watch) "
this.collectionButton.command = undefined
this.collectionButton.tooltip = undefined
this.collectionButton.command = Commands.TriggerServerCollection
this.collectionButton.tooltip = "Trigger vRO hint collection"
this.collectionButton.color = undefined
}

Expand Down
12 changes: 9 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "vrealize-developer-tools",
"displayName": "vRealize Developer Tools",
"description": "Provides code intelligence features and enables a more developer-friendly experience when creating VMware vRealize Orchestrator and VMware vRealize Automation content.",
"version": "2.4.0",
"version": "2.5.0",
"publisher": "vmware-pscoe",
"license": "MIT",
"homepage": "https://github.com/vmware/vrealize-developer-tools",
Expand Down Expand Up @@ -548,7 +548,9 @@
"@types/vscode": "1.54.0",
"@typescript-eslint/eslint-plugin": "^4.18.0",
"@typescript-eslint/parser": "^4.18.0",
"@vmware/vrdt-common": "^2.4.0",
"codecov": "^3.8.1",
"comment-parser": "^1.3.1",
"eslint": "^7.22.0",
"eslint-config-prettier": "^8.1.0",
"eslint-plugin-header": "3.1.1",
Expand Down Expand Up @@ -583,6 +585,7 @@
"dependencies": {
"adm-zip": "^0.5.4",
"chokidar": "~3.5.1",
"di": "^0.0.1",
"fast-xml-parser": "3.19.0",
"fs-extra": "~9.1.0",
"jsonc-parser": "^3.0.0",
Expand All @@ -591,7 +594,10 @@
"moment": "^2.29.4",
"semver": "^7.3.4",
"tmp": "^0.2.1",
"uuid": "^9.0.0",
"vscode-languageclient": "^6.1.3",
"vscode-languageserver": "^6.1.1",
"vscode-languageserver-textdocument": "^1.0.1",
"vscode-uri": "^3.0.2",
"yaml": "^1.10.2"
},
Expand All @@ -600,7 +606,7 @@
},
"peerDependencies": {
"bufferutil": "^4.0.1",
"canvas": "^2.5.0",
"canvas": "^2.11.0",
"utf-8-validate": "^5.0.2"
},
"overrides": {
Expand All @@ -615,4 +621,4 @@
"preinstall": "node build/preinstall.js",
"vscode:prepublish": "webpack --mode production --config ./extension/webpack.config.js && webpack --mode production --config ./packages/node/vro-language-server/webpack.config.js"
}
}
}
18 changes: 16 additions & 2 deletions packages/node/vrdt-common/src/maven/MavenProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,19 @@ export interface MavenProfile extends Partial<Record<MavenProfileKeys, string>>
}

type MavenProfileKeys = VroProfileKeys | VraProfileKeys
type VroProfileKeys = "vro.host" | "vro.port" | "vro.username" | "vro.password" | "vro.auth" | "vro.tenant"
type VraProfileKeys = "vra.host" | "vra.port" | "vra.username" | "vra.password" | "vra.tenant"
type VroProfileKeys =
| "vro.host"
| "vro.port"
| "vro.username"
| "vro.password"
| "vro.auth"
| "vro.tenant"
| "vro.refresh.token"
| "vro.authHost"
type VraProfileKeys =
| "vrang.host"
| "vrang.port"
| "vrang.username"
| "vrang.password"
| "vrang.tenant"
| "vrang.refresh.token"
3 changes: 2 additions & 1 deletion packages/node/vrdt-common/src/maven/PomFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export class PomFile {
"typescript-project": "com.vmware.pscoe.o11n",
"typescript-project-all": "com.vmware.pscoe.o11n",
"vra-package": "com.vmware.pscoe.vra",
"vra-ng-package": "com.vmware.pscoe.vra-ng"
"vra-ng-package": "com.vmware.pscoe.vra-ng",
"polyglot-project": "com.vmware.pscoe.polyglot"
}

readonly jsonContent: any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { VrealizeSettings } from "../types"

export abstract class BaseConfiguration {
vrdev: VrealizeSettings
allProfiles: MavenProfilesMap | undefined
allProfiles: MavenProfilesMap

hasActiveProfile(): boolean {
try {
Expand Down
16 changes: 16 additions & 0 deletions packages/node/vrdt-common/src/platform/BaseEnvironment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ export abstract class BaseEnvironment {
return this.createAndResolveDir(this.homeDir, ".o11n", "hints")
}

getGlobalProtoDir(): string {
return this.createAndResolveDir(this.homeDir, ".o11n", "proto")
}

getGlobalTokenFile(): string {
const tokensFolder = this.createAndResolveDir(this.homeDir, ".o11n", "tokens")
return path.join(tokensFolder, this.getHostname())
Expand All @@ -69,6 +73,10 @@ export abstract class BaseEnvironment {
return this.createAndResolveDir(workspaceFolder.uri.fsPath, ".o11n", "hints")
}

private getLocalProtoDir(workspaceFolder: WorkspaceFolder): string {
return this.createAndResolveDir(workspaceFolder.uri.fsPath, ".o11n", "proto")
}

getGlobalO11nDir(): string {
return this.createAndResolveDir(this.homeDir, ".o11n")
}
Expand All @@ -93,6 +101,14 @@ export abstract class BaseEnvironment {
return path.join(this.getGlobalHintsDir(), this.getHostname())
}

resolveProtoDir(workspaceFolder?: WorkspaceFolder): string {
if (workspaceFolder) {
return this.getLocalProtoDir(workspaceFolder)
}

return path.join(this.getGlobalProtoDir(), this.getHostname())
}

resolvePluginHintFiles(): string[] {
const workingDir = path.join(this.getGlobalHintsDir(), this.getHostname(), "plugins")
return glob.sync("./*.pb", { cwd: workingDir, absolute: true })
Expand Down
2 changes: 1 addition & 1 deletion packages/node/vrdt-common/src/rest/VraNgRestClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export class VraNgRestClient {
break
}
case "password": {
if (isOnPrem) {
if (await isOnPrem) {
uri = `${baseUrl}/csp/gateway/am/api/login?access_token`
options.body = {
username: grant.username,
Expand Down
Loading